Dear community,
Most of smart bulbs goes to On state when power restored after outage. In my region it happens from time to time. It’s not great when light turns on in the middle of night especially in kids room.
How do you handle this situations?
Depends on bulb used. Many will restore last state in this case.
Might be far fetched idea but something to work with.
Input boolean at least can restore a state.
- create input_boolean per light
- Create automations to change input boolean state with ~3-5 minutes time delay. Other vise the input_boolean would get the same value as the light on startup. with this light turns on but boolean is still off.
- Run a script based on homeassistant start event and set all light states according to corresponding input_booleans.
Could be good idea to run raspberry with a small ups to avoid shutdowns. Most often you can detect the blackout if the ups is feeding from grid or from battery.
it might also be possible to change the default behavior of the bulps. To not turn on when power is applied. That would be the best in your case I think. As long as you have an convinient way to turn lights on without a power cycle.
I have the same problem. I’m thinking about using this script:
to save the state of lights every x minutes and some sort of outage detection (perhaps pinging, or better yet looking for a device uptime) to trigger a restore state. The lights will still go on, but hopefully turn off in a minute or two.
One of the many reasons I don’t use smart bulbs but in a few places. Definitely never in a bedroom unless it’s a WiFi bulb have custom firmware flashed to.
My LiFX bulbs remember their previous brightness, and when they lose power they turn on to what they were at before (you have to switch them off and on again twice to reset them to full brightness).
If your bulbs do that as well, it might be worth creating an off script that sets them to a very low brightness before switching off. That way when they turn on after a power outage they’ll at least be easier to ignore.
One could also keep a boolean for each of the bulbs (I know…) to remember the state the bulbs have been set, and then have an automation check each X minutes if the state doesn’t matches with the current bulb state.
If there’s a power outage and the bulbs turn on by themselves, the two states will not match and Hass will be able to restore the correct state.