Restore entities state after a power outage

Is there a way to restore the state of the entities (e.g. lights or switches) after a power outage?

It isn’t very confortable to have all lights on in the middle of the night after a power outage. After the power comes back, I want the lights and switches/relays to remain the same state before the power outage. Something like the Power loss recovery from Philips Hue (“hue_power_on_behavior”: “recover”) but done from HA.

I’ve found this helper (https://github.com/home-assistant/core/blob/27c3ce16c36c74a0aeaccb7f50d2fe326b6e3a48/homeassistant/helpers/restore_state.py) but I guess it restores the internal state when rebooting HA, but it doesn’t change the devices states.

How do you manage this problem?

did you figure out how to manage this issue?
Thanks!

1 Like

I got a response here in this request:

But I haven’t found a good solution yet :frowning: