Hi Guys, I have a question about how switches are updated in openhab.
Case No.1 a switch which simply triggers a Rule
Switch Power_Plug_Socket_1
I will have to use
Power_Plug_Socket_1.postUpdate(ON)
somewhere in my rule in order to visualise it in my Sitemap
But even without that it would turn on.
Switch Test1 "Just a test"
2018-07-19 22:43:02.776 [ome.event.ItemCommandEvent] - Item 'Test1' received command OFF
2018-07-19 22:43:02.788 [vent.ItemStateChangedEvent] - Test1 changed from ON to OFF
Why?
Case No. 2 is a zwave Switch:
Switch wz_switch2_switch1 "Gartenlicht" <light> (WZ_switch2, Garten) {channel="zwave:device:zwave_usb:node7:switch_binary1"}
I guess in this case the binding is responsible (thus the zwave USB Dongle gets the update)
I have noticed though, that sometimes even if a zwave device is not connected, it still shows turned on (therefore I have no feedback if the light/pump/whatever actually received the command and was turned on.
No. 3:
How does that work with MQTT Switches?
Switch Relay1 "MQTT 1" { mqtt=">[MQTT:mqtt/irrigation/relay1/switch:command:ON:1], >[MQTT:mqtt/irrigation/relay1/switch:command:OFF:0], <[MQTT:mqtt/irrigation/relay1/state:state:default]"}
In my case the Switch was not configured properly, so it returned the state āNULLā but still the switch was turned on in my sitemap - so even if the mqtt subscriber was offline, I would still get the (wrong) feedback
also see my logfile here:
018-07-19 22:38:44.653 [ome.event.ItemCommandEvent] - Item 'Relay1' received command OFF
2018-07-19 22:38:44.670 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn't post update for 'Relay1'
2018-07-19 22:38:44.672 [vent.ItemStateChangedEvent] - Relay1 changed from ON to OFF
How do I prevent this from happening? Or am I just confused?