#Sync States

1 messages · Page 1 of 1 (latest)

wanton jackal
#

I'm wondering what the best practices are to keep states as expected.

For example, I have a set of 3 smart lights bulbs and I also have a switch to toggle them. So I set up the button to toggle all three in an HA automation. However on the first time I tried it the lights ended up out of sync were 2 of the 3 were off. Every time I toggled them they stayed out of sync so I fixed it manually by changing the state to match.

This got me thinking what is the best way to handle this? I would guess binds but either I don't know enough or it would seem that my device doesn't support it.

One way of doing this might be to set a timer that runs every X number of seconds to check if the state matches a helper variable and if it does not to then make it match. I could then send the normal device changes but also toggle the state of that helper variable.

still dew
wanton jackal
#

Thanks for the reply!
Ok looking at this now but when I toggle what happens to an out of sync light? Ideally it would not be out of sync but lets say that for some reason it's already out of sync, perhaps the power was off because someone turned the physical switch on the lamp as opposed to my smart button. How would you handle that other than admonishing the person who caused the bulb to lose power then bring it back out of sync.

stark chasm
#

No matter what, whenever you tell the group to either turn on or turn off, it will issue that command to each entity regardless of the current state. But you can also choose the behavior of how the light group is displayed. By default, when any light in the group is ON, the group will be considered ON. And so then all you can do is turn it off. If one light is IN and you want the rest ON, you’ll have to toggle the group OFF and then ON.

Alternatively, if you choose the “all entities” option, the behavior will be that all lights have to be ON before the groups shows ON.

wanton jackal
#

Thanks again, and I do like that all entities option!