Power Outage Monitor - Ring Range Extender - Rules Please

Hello. I'm trying to create the rules required to report a power outage in my home. I have found several references to using a Ring Range Extender V2 for the device, but cannot find any rule examples on how best to implement power outage monitoring and reporting in the Rules Machine.

I've set up rules in Rules Machine as follows:

I have my Hubitat, my router, and my cable modem all on an APC Pro 1500 power backup so I have about 90 minutes to detect the outage and report it via notifications to email, and cell phone. My rules work fine to detect and report/notify me of the initial outage. I'm doing this when my power source for the Ringe Range extender changes from "mains" to "battery". My main question is how do I detect when power is restored and hubitat comes back up. I want to send notifications that my power has been restored (I go on Cruises and may not be at home). Will a rule with a conditional wait command still fire after a Hubitat reboot? I can't believe it would. So I'm looking for a way to determine and report a restart from a power outage?

Would a global variable set by the outage rule, and then checked at boot by another rule (clearing the variable) work? How do I detect a new boot of the Hubitat Hub?

Suggestions and examples will be appreciated. I'd bet this would be a nice application for the Hubitat Application library.

Thanks,

Ron

You can use the systemStart event to capture a reboot. I think it is a "Location" event.

1 Like

Also, are you shutting down the hub if power goes out or will it run for as long as the UPS has power? If you are shutting down the hub, then you have a potential issue in case the hub is shutdown and power is restored before the UPS battery runs out because in this case, the hub will not reboot on its own.

If you are letting the hub run and just want notifications, then you can a) use the systemStart event as suggested above or b) use the Ring Range Extender battery attribute ("mains") to notify when the power comes back on before battery runs out.

Hope this helps.

Ok, you asked, here is my voting rule for my 6 Ring Range Extender V2 devices.

Comments:

  1. You need to use the driver written by Denny Page (@dennypage). At some point within the past year, the Refresh command broke for the built-in driver. The reason Refresh is needed is that, when the hub comes back up after a power fail, the “switch to mains” event from the Ring Extender will be missed because it comes back online before the hub has booted. The workaround is to have a Refresh action in your startup rule (triggered on systemStart location event). However, as noted, the Refresh command for the built-in driver broke within the past year. I sent a couple of PMs to Bryan Copeland, he said he would check on it, but he’s been busy. Switched to Denny Page’s driver, which works. Denny Page subsequently updated his driver to schedule a Refresh when the hub calls the driver’s initialize method on reboot, so the Refresh is no longer needed if you use Denny Page’s driver (installable by HPM). I believe that Jean May’s (@thebearmay’s) Hubitat Information driver has a shutdown command as well. EDIT: It does now, just added.
  1. The design of these rules is subtle. They handle the “flapping” of power up/down on power fail and power recovery as the utility tries to heal the grid, and the rules are retriggered, causing concurrent triggering and execution. If you only have a single Ring Extender, it can be done much more simply. If you want more details of this subtlety, just ask.

  2. There is a voting by the Ring Extenders to handle the cases of internal backup battery failure in one or more of the devices, and to handle the case of someone, accidentally or on purpose, unplugging a Ring Extender from the receptacle (to vacuum, for example, as my wife has been known to do) so that the hub only shuts down when a whole house power fail occurs.

  3. You will need to install and call one of the various shutdown drivers. I use Dominick Meglio’s (@dman2306’s) Hubitat Hub Controller driver (installable by HPM).

Here are the Rules:

First, create a Hub Variable for each Ring Extender to tally whether it is on battery:

Then, create a pair of rules for each Ring Extender to monitor the mains/battery status of each Ring Extender. All Rules are the same, only the device changes.

Then, here is the Rule that does the voting and which triggers the graceful shutdown:


Finally, here is the portion of your SystemStart Rule that initializes everything:

Of course, your hub needs to be on a UPS, and the shutdown timeout in the voting rule needs to be shorter than the UPS uptime.

2 Likes

Interesting approach. However I'm missing something. Perhaps because I'm not familiar with the apps you suggested. I don't see how the hub is rebooted after a shutdown.

I have a UPS. Its a very simple one that is powered by a single 18650 battery.
My plan is to:

A) trigger a rule when the mains power is lost.
B) at about an hour or two of lost power shutdown the hub.

My stumbling block is.... When the hub is in shutdown, the UPS will last a very long time as the load with the hub shutdown is minimal (about 60 ma) The UPS will last a long time at this load.
So the only way to restart the Hub is to remove power to the hub and re-apply power.

I've looked at a number of methods to accomplish this but all are more involved than I wish to undertake. And since 1+ hours of lost mains is very rare in our area my motivation is minimal.
Still I would like to see a simple solution for those who really require it.

I didn’t provide an example of the restart side of the problem, just the shutdown, which is what I understood you to want.

For restart on power return, there are two cases: one, where the UPS drains so that the hub loses power after shutdown and then powers back up when power returns. I don’t have that situation because I shut down the load on the UPS before it dies.

The other case is where you want the hub to reboot after power is restored. To do that, you need a WiFi controlled power strip into which the hub is plugged, with the strip being powered by the UPS, so that the power can be removed from the hub after power is restored, allowing the hub to reboot.

There is a post in the forum this past week or so, describing how to solve that part of the problem. For me, I just have a simple in-line power switch to the hub’s power supply, and I just toggle that switch after power comes back up. Others have used a PoE port on their switch, with a splitter at the hub to the power connector (the hub doesn’t support PoE) and toggle the PoE at the switch.

I copied much of this from someone else on the forum (sorry - can't remember source). It's a Rule in Rule Manager 5.1. It notifies me when the power goes out, and when it is restored. I keep all critical components for communication and automation on UPS devices, and we have a backup generator, so I usually get a notification that the power is back on in about 10 seconds, when the generator fires up. But it really came in handy a few months back when a breaker on the transfer switch tripped during a series of power fluctuations. When I didn't get a "power restored" message, I knew to investigate.

Trigger is:
Power source of Garage Ring Range Extender(mains) reports changed

Actions are:
IF (Power source of Garage Ring Range Extender(mains) is battery(F) [FALSE]) THEN
Notify Pushover: 'Electricity out in Studio-Garage at Meadoasis. Remember to check the GFCI outlet in the front of the garage, and also verify that garage refrigerators are working.'
Repeat every 1:00:00 (stoppable)
Notify Pushover: 'Electricity still out in Studio-Garage at Meadoasis.' --> delayed: 1:00:00(cancelable)
END-REP
ELSE
Cancel Delayed Actions
Stop Repeating Actions
Notify Pushover: 'Electricity restored in Studio-Garage of Meadoasis, but verify that garage refrigerators have power and that no breakers, GFCIs, or AFCIs have been tripped.'
END-IF

My approach is similar to what @672southmain has suggested but I use Node-RED. My HE hub is plugged into a KASA HS-103 wifi plug that is restarted by Node-RED when power is restored.

My trigger for detecting when power goes out and is restored is a ping to 2 Harmony Hubs that are not plugged into any UPS. If one hub does not respond to a ping, Node-RED pings the second Harmony hub. If that also does not respond, Node-RED shuts down Hubitat. It continues to ping the Harmony hubs (Node-RED is plugged into a different UPS than HE) and if the the Harmony hubs come back on line, it checks if HE is already on (in case it restarted because the UPS ran out of power). If not, it flips the power on the Kasa wifi plug and that restarts HE. I recently tried to replace the Harmony hubs with the Ring Range Extender, but since I have a C-5, it would not work.

You could, possibly, adapt the same logic if you could somehow get a notification when power was restored and use that to manually flip power on the wifi plug?