Zwave2Mqtt icon indicating copy to clipboard operation
Zwave2Mqtt copied to clipboard

Turning off switch briefly reports it as back on in homeassistant, before showing off [question]

Open vvuk opened this issue 5 years ago • 4 comments

I've got a Zooz ZEN15 power switch for a high-wattage device. When I turn the device off via homeassistant, the device's state flicks back to on.. and only some seconds later goes back off. If I look at the zwave2mqtt logs I see this:

z2m:Mqtt Message received on zwave2mqtt/5/37/1/0/set +1m
z2m:Zwave zwave node 5: changed: 50-1-2:Electric - W:4.692 -> 0 +2s
z2m:Zwave zwave node 5: changed: 50-1-256:Exporting:false -> false +1ms
z2m:Zwave zwave node 5: changed: 50-1-2:Electric - W:0 -> 0 +23ms
z2m:Zwave zwave node 5: changed: 50-1-256:Exporting:false -> false +4ms
z2m:Zwave Notification from node 5: Notification - TimeOut (1) +9s
z2m:Zwave zwave node 5: changed: 37-1-0:Switch:true -> false +692ms
z2m:Zwave zwave node 5: changed: 37-1-0:Switch:false -> false +23ms

I'm guessing what's happening is hass sends the mqtt message to set the device to off. Homeassistant then refreshes the state of the device, and sees that it's still on -- or that the persistent state is still on (I need to go actually look at the physical switch to see how quickly the device responds). Some seconds later, there's a zwave timeout, and then the switch finally responds with the new state. Note that the power draw went to 0 watts within 2 seconds, so I think the switch actually responds fairly quickly; just the state doesn't get communicated.

I'm fairly new to doing zwave through mqtt -- I'm not even quite sure where to begin here. Any suggestions would be appreciated. Thanks!

vvuk avatar Nov 22 '20 20:11 vvuk

Have you set the qos in z2m?

I saw similar behavior in hass with my aeotec dual nanos, they all started behaving a lot better after setting z2m config for mqtt to retain and qos 2.

https://assetwolf.com/learn/mqtt-qos-understanding-quality-of-service#:~:text=Quality%20of%20Service%20%28QoS%29%20in%20MQTT%20messaging%20is,at%20these%20in%20more%20detail%20in%20a%20moment.

idlezombie avatar Nov 23 '20 03:11 idlezombie

I would suggest to set the qos to 0 and enable retain flag

robertsLando avatar Nov 23 '20 09:11 robertsLando

QoS is set to 0 and retain is enabled. I saw in the z-wave log that there are some timeouts from this device; will dig into that too.

vvuk avatar Dec 04 '20 04:12 vvuk

@vvuk Also keep an eye to: https://github.com/zwave-js/zwavejs2mqtt. It's very close to a first release

robertsLando avatar Dec 04 '20 08:12 robertsLando