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 ( 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?

1 Like

I got a response here in this request:

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