-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lights turn on after restart of zigbee2mqtt - workaround? #992
Comments
Probably a duplicate of #959 |
I don't know if this really is the same issue. As my problem is pushing the states (probably saved in state.json) at the start of zigbee2mqtt causes this. I also have the same issue with my ikea tradfri dimmer. If I turn of my light with alexa, the dimmer value will still be let's say "150". After a restart this will turn on the light. This only would be a workarround but I could imagine two solutions:
Mind that this also could be a security issue. EDIT: |
Stop when home assistant is not running, do you also experience this? |
I don't understand. When home assistant does not run, there is no automation to be triggered, so in this case no lights will turn on. |
When using the automation format from the wiki, does this also happen (https://koenkk.github.io/zigbee2mqtt/integration/home_assistant.html - Responding to button clicks) |
Looks like this works. The reason is that those three values are reportet at the start up:
click is not included, so the automation is not triggered. So restarting zigbee doesn't trigger that anymore. To be totaly sure I still have to test if a ha or a mosquitto restart will trigger this. EDIT: I just found out the following: So responding to button clicks will work for the aqara buttons (click is not reportet in the mqtt message at start up of zigbee2mqtt).
This might be an issue for other devices too. It depends on wch data they report at startup. I guess the coord pings those devices at startup??? and than gets those values, right? The device "decides" which information it sends. |
No that shouldn't be the case. Let me know if this can be closed. |
I edited my comment above. This will still be an issue for devices like the ikea dimmer. |
The What is the problem that this will be triggered? |
Because this trigger will turn on lights with the reported brightness value. If you turn off a light (not with the dimmer) and than restart zigbee2mqtt the brightness value will trun on that light again. Edit: Also I jsut found out that a restart of home assistant triggers that automation? do I have to change something at the retain setting? this automation is triggered at start up, don't know why. There is another mqtt message after the restart, but it doesn't contain "click", so I can't explain my self why this gets triggers. And even more weird, the "right" side doesn't get triggered (even if I press the right button before, so it has that state saved).
|
@h4nc I see, can you try adding |
So there is no issue with the dimmer, if you only use the dimmer to control a light. If you use other ways too: voice control, ha UI However could you explain a little more what I should do in that code? Edit: I don’t think I can change that code as I don’t know how to this in the hassio addon. But if you change that I can pull the update and try it out. Also I tried restarting home assistant and mosquito. The left button gets triggered. I think it has something to do with the retain state. But it looks like the left one is the to retain true and the right one to false (as this one doesn’t get triggered). |
I don’t know why but it looks like the retain flag was set to true, so mosquito published the information at the restart. To get rid of this I deleted my mosquito addon and reinstalled it. |
@h4nc retain flag is set manually in |
Thanks for clearing that. To still it will be easier to delete and reinstall to clear the database, as finding the right topic and publish. I still don’t get why my left button was retain: true. I‘m thinking about using one of those Aqara sensors to trigger a security sensitive automation. |
I have a xiaomi double switch that turns on my lights.
After a restart zigbee2mqqt publishes all the states again and so my automation in homeassistant gets triggered and turns on my lights.
Is there a way to bypass this? May turning of publishing the events at restart for certain devices?
My automation looks like this:
My config in zigbee looks like this:
The text was updated successfully, but these errors were encountered: