RM logic for sensing power outage in order to reset a device by rule?

I have the Ring Z-Wave extenders that report the loss or resumption of mains power.
I have two security cameras that are plugged in to zigbee outlets.
When power to the house drops, these outlets switch off (and do not switch back on when power comes back on).
I would like to have a rule that will sense when power comes back on and then switches those two outlets back on.

Using RM:
Is the approach to use the Power Source changed status on the Ring as the trigger and then wait for the event of the Power Source status as 'mains', then switching the appropriate Zigbee switches on?

Just want to make sure I'm not missing something . . .


Well, almost. That approach might work if the Hubitat hub had a UPS that would keep it up forever during an extended power outage. But consider the situation where you have a Rule, as you should, to cleanly shut your hub down after a few minutes of power outage, before the UPS battery dies.

The problem is, on reboot, the Hubitat hub never sees the “return to mains” event. Why? On power restoration after a power outage, the Hubitat hub begins rebooting. The Ring Extender, however, having internal battery power during the outage, sees the return of mains power and sends the Z-Wave event to the hub (and its driver), but the hub has not yet booted, so the event is lost.

I pointed this out a couple of years ago in this forum, when I also pointed out that Refresh was broken in the built-in Ring Extender driver. My solution was to have a Refresh in my SystemStart Rule to refresh all the Ring Extenders so that the mains/battery state was correct, but this didn’t work with the built-in Ring Extender driver because it’s Refresh was broken.

The Refresh in the built-in driver may have been fixed in the couple of years since, but I haven’t seen any note to that effect in the Release Notes.

So, I switched to the excellent user-contributed Ring Extender driver by Denny Page (@dennypage), which didn’t have a broken Refresh. When Denny Page saw my post about the dropped “return to mains” event, he modified his Ring Extender driver to have a scheduled refresh upon system reboot, so the refresh in a systemStart Rule is no longer necessary.

If you want to see my power fail detect and system restart rules that use a voting algorithm for 6 Ring Extenders to decide whether it’s a real power fail, or a failed single Ring Extender, or, as has happened, one of the Rng Extenders being pulled out of the receptacle when my wife vacuums, just ask.

I don't recall the code but Hubitat has a flag of some sort that can trigger a rule on power up (of the hub). Might this be useful?

Yes. Trigger the Rule on systemStart location event.

My situation is not that complicated. My Hubitat (almost) never loses power. The house is on a full generator system and the Hubitat is on a battery UPS. The problem I am attempting to address is, the devices not on a battery UPS experience an outage of about 10 seconds while the generator spins up and the transfer switch trips. These two outlets that have security cameras plugged into them switch to off when the power goes out. So, when the house switches over to generator power 10 seconds later, those two cameras remain off because their outlets are switched off. I just want to switch them on in this particular situation. The cameras are not located where I could easily put them on a small UPS and they are WiFi so POE is not really an option (again due to location).

Ok, then that will work. Trigger a Rule on systemStart location event, do your plug turn on.

In the scenario I have outlined, a systemStart event is never generated because the hub never goes down. That's why I was suggesting I would use the Power Source changed status on the Ring as the trigger.

I just realized this should be pretty easy to test - I can just unplug the Ring device for a few moments . . . I will test later today and report back.

OK, my rule works as hoped with one issue.

I manually turned off the two outlets the cameras are plugged in to.
I unplugged the Ring Extender to simulate the power outage and then plugged it back in.
The logs showed the unplug event but not the return to mains event.
I unplugged it again, plugged it back in and both the unplug and return to mains event were logged and the rule fired to turn on the outlets.

Is there a problem with the Ring Extender sometimes not catching the return to mains power? Was I just too impatient and should have waited a few minutes (I didn't)?

Did you read my post above in the thread?

Switch to @dennypage’s driver. It works. I have tested it quite thoroughly.


"a scheduled refresh upon system reboot" would be of no use for my use case.

I may try the driver anyway.


1 Like

I'd get different outlets that remember last state.
edit: Oh, outlets vs plugs, I guess. Not so easy then.

They are plug-in type "wall warts" so that may be the best suggestion.

I changed to these (thirdreality) earlier this year because of reports that they made good Zigbee repeaters. I haven't noticed them to be any better than the Centralite devices I replaced. I don't think I ever had the problem with the Centralite units nut it is so infrequent I'm not sure.

I just did a quick test and it looks like the Centralite devices "remember" state when power is removed. That's why I never saw the issue before.

Thanks for that suggestion.

1 Like