How to keep the SONOFF ZBMINI switch state during power outage?

I have 4 SONOFF ZBMINI switches that control the heating in my home. They expose On/Off state only (no Keep, Default, etc…).

Power outages happen often during winter where I live. After a power outage, when the power resumes - the switches always go into Off state.

I have lots of automations in place that control the state of those switches and ideally I would like to have a way to tell the switch to resume to whatever state it was in after a power outage.

Is there a smart way to do that? Obviously, the switch itself does not support this as a built-in function so I’m looking for alternatives.

1 Like

Perhaps use an input boolean to track the state of the switch ?
When HA restarts, use an automation to check the the state of the switches matches the states of the booleans ?

Same here. Not sure how to retain the state.
I have an aquarium light connected to zbmini. It is turned on at sun.above and off at sun.below.
When the power goes out, the zbmini forgets the state.
HA runs on UPS, so it’s not affected on power outages.

Ok, so thats a different use case. In this case, the entity has changed state (its been powered off and on again) but Home Assistant has been running the whole time.

I don’t think HA gets any kind of notification if a device is simply power cycled. (I just tested it with a smart bulb). In this case, all i can think of its that your use a time pattern based automation to set the device to either or on off.

1 Like

I was thinking on setting last state sensor based on sun trigger and then periodically(e. g. 5 mins) checking what was the last state. If the current state is different than last state, then align.