I have serious problem in understanding the openhab guide…please, can you tell me what I have to wrote in the Rule file to make what are you saying to me? Thanks
As far I remember TOGGLE command works only over rest since it is hardcoded there. It is not a valid command in other places. Likely for MQTT. Try ON and OFF to see if config works.
as I said, I am currently using it on openhab on raspberry…
See here, toggle is supported command if you submit request over rest:
I’m not using a TOGGLE command. Infact my command is TOOGLE, but it could be also “switch”. The action is set in the rule files.
//This is the rules file
rule "update pulsante"
when
Item pulsante received command TOOGLE
then
if(Philips_Switch.state == ON) sendCommand(Philips_Switch, OFF)
else sendCommand(Philips_Switch, ON)
end
That’s my point. If your item is a Switch
or Contact
it will never be able to receive a “toggle” command because it is not a valid command to be transmitted by openHAB core. For Switch
you can send only ON
and OFF
commands and for Contact
valid commands are OPEN
and CLOSED
. What your rule is actually looking for is a “state change”.
There was discussion about supporting TOGGLE in the core but it was rejected: https://github.com/openhab/openhab-core/issues/947
Best,
Łukasz
That was my first thought too but it’s on a String Item and if I recall correctly the MQTT binding will use “TOGGLE” so I don’t think that’s a problem in this particular case. It definitely would be a problem for a Switch Item.
logInfo("heating-control.rules", "This is a log entry of type Info!")
Add lines like that which will add entries in openhab.log and show whether or not the rule is running.