Description of problem:
I have a RaZberry Z-Wave controller mounted on a RPI 2 Model B and a Wenzhou TKB Control System TZ68 On/Off Switch Socket. It works fine most of the times except when i power it off and then i power it on in the next 1,2 or 3 seconds, the switch and power LED turns on for 1 second then it turns off by itself. This happens from the web ui and from the psychical button on the socket.
I could not reproduce this when the socket is connected to the open-zwave-control-panel, when using that, it works fine from the ozcp web ui and from the psychical button.
I think it has something to do with the fact that i am not pulling the z-wave socket nor the z-wave controller, so after hass sends the command via the z-wave controller, it takes a second or two before the socket reports back to the z-wave controller its state and hass processes that.
Expected:
Turn socket on, wait a second or two, turn socket off, wait one second, turn socket on again, socket remains on until turned off again.
I’ve got the same setup (well, I’m using a Pi3, but I’m also using the Razberry controller and a TZ68 units), and I don’t (quite) see that happen.
What I do see is that the change in switch state isn’t always immediately reflected in the UI. That’s because the response from the socket isn’t always received (or the command isn’t) and it needs to retransmit. That’s just the nature of wireless communications however. Sometimes running a Heal or Test on the Z-Wave network solves that.
Certainly, using the button on the switch always behaves as expected. If you’re not seeing that then the chances are you’ve got a faulty unit.
I am not polling the devices, so yes, there is a delay in the UI, i understand how it works and that the device has to report the new state back to the controller and only then the UI gets updated. But that is not the issue.
At first i thought that myself, but the device works as expected with the ozwcp, i only get this strange behaviour with home assistant, so i guess that rules out a faulty switch.
Maybe you can tell me more about your configuration, do you also have as i have notifications when it turns on and off ? I also have a timer that switches it off after a couple of minutes after the on event, maybe there is something there, i will dig further and post back if i get to the bottom of it.
It could be that you’re seeing a side effect of your turning it off automatically. If you disable that automation (and potentially other automations) does the problem go away? None of my automations turn the lights off at a fixed time after they’re turned on.
I turned off the automation that triggers on power on and poweres the switch off after a couple of minutes and the problem went away. I am guessing i have to find i way to also cancel that automation if for some reason i power the switch off earlier and manually.
Thanks for the input, i will come back with the solution or workaround maybe somebody has the same issues and would like to hear about it.
Ah, I don’t use notifications to tell me about automations working. For things like lights going on and off, it’s pretty obvious
If you’re using a delay, then instead try using a second automation that turns off the lights if they’ve been on for a given length of time:
alias: 'Light left on'
initial_state: 'on'
trigger:
platform: state
entity_id: switch.yourlight
to: 'on'
for:
minutes: 5
action:
- service: switch.turn_off
data:
entity_id: switch.yourlight
That will then turn it off when it’s been on for 5 minutes. If you want that to only happen when the automation turned it on, then you’ll need to add an input_boolean, that you turn on in the initial automation, and then off with this one. Add this to your on automation’s actions:
I use it for a switch which has a UV steriliser plugged in, i put things in it that i want to sterilise every 2 days, and it turns on automatically, then turns off after 40 minutes (sufficient time for a UV sterilisation session and keeping the lamp last longer) so i get notified when it turns on and off, and if by any chance it does not turn off (it’s a bit far from the z-wave controller, rarely it happens to miss a command) i do it manually (because i got notified when it turned on and can tell if it has been on for too long) because i don’t want to waste my UV lamp.