Simple Power Outage Detector

Have you ever wanted a very simple method to monitor is a certain power circuit has lost power? Perhaps a GFCI circuit with a garage freezer on it? Or maybe you're Hubitat Hub is on UPS, and you'd like to know if the power went out in your house so you can safely shut down your hub before the UPS dies? Whatever the reason, I think I have stumbled upon a very simple, low cost solution.

A friend of mine came up with an idea to use a RPi to ping a USB-powered ESP8266 connected to his WiFi network. His idea was to plug the ESP8266 into his garage on the same circuit his refrigerator is on. The RPi, if it could no longer ping the ESP8266, would then send him a notification of some sort. Not a bad idea! :slight_smile:

This got me thinking...:thinking: Why not simply use a Smart WiFi Outlet, like that little wemo mini outlet that's been collecting dust on my desk for a few months. I plugged it in and verified that I could ping it. Now I just needed a way to 'ping it' from Hubitat... Or did I? @jwetzel1492 has a pretty simple little driver that is used to determine if a smartphone is connected to your home WiFi network. Perhaps it would also work with the wemo mini outlet? I tested it and it works perfectly. I named the device "Garage Power" and I now have notifications of "Garage Power is Not Present" and "Garage Power is Present". His driver even allows for a user specified timeout before marking the device as 'not present'. This can be used to avoid false alarms during a home router/access point reboot. Of course, RM could also prevent false alarms using a simple "delay with cancel" in the action.

So, while no new code, I hope this technique is helpful to those looking for a simple solution to detecting a power outage and taking the appropriate action.

NOTE: I am not recommending anyone go out an buy a wemo mini outlet specifically for this. I am not impressed with the wemo mini outlet whatsoever. I am sure there are better, more reliable WiFi outlets on the market that will also work with @jwetzel1492's awesome driver.

14 Likes

Brilliant idea Dan!
Now you got me thinking....

Andy

2 Likes

Neat idea! It seems like it might be easily able to be extended to pretty much any pingable Wi-Fi or other LAN device, or at least one you'd expect to always be on. Now you have me thinking of possibilities: Echo/Google Home devices, always-on Dashboard tablets (definitely not if they sleep), a Hue Bridge, your non-battery ST hub that might as well not be on a UPS since it won't do much anyway, or generally any questionable Wi-Fi "IoT" device that now could actually serve something of a purpose. :slight_smile:

(As usual, I have not tested any of these ideas to see if they actually work.)

1 Like

@bertabcd1234 you can also check out logmor . com for sensors that monitor for power outages

This is another potential solution to know if the power is out. A Ring Range Extender. It has a built in battery, and fires a notification immediately when it switches to battery.

https://www.amazon.com/All-new-Ring-Alarm-Range-Extender/dp/B07ZB2VP4K/ref=sr_1_4?dchild=1&keywords=ring+range+extender&qid=1594668534&sr=8-4

4 Likes

This is what I'm using, as it has it's batter and you can trigger off of it switching power source. I'm on the V1 which I never needed for my Ring Alarm, so paired it directly to HE

1 Like

First gen Ring extender was just reduced on Amazon to $14.99. 7/12. Also works great to inform you when power cut off.
Ring Alarm Range Extender (1st Gen) https://smile.amazon.com/dp/B07FQ6SDKY/ref=cm_sw_r_em_apa_i_rhpdFb12QG0AC

1 Like

So do you plug the Ring extender into the same power source as the Hubitat?

How do you shut down your hub programmatically? Is that a user command somewhere that Rule or Simple can issue?

1 Like

I just plug the Ring extender into one of my electric outlets. You actually want your Hub on a battery backup and know approximately how long the hub will have battery backup. I use Cobra's " Power off shutdown" free app. It senses when Ring losses power and you indicate how many minutes before you want the app to safely shut down the hub. It also notifies you. The thing to remember is to restart the hub you have to be home to unplug and replug the hub. I've attached a Sonoff usb wifi plug directly to the hub. Now from away I can turn the hub off and on to reboot after the app shuts it down and power is restored to use the Sonos usb wifi switch

SONOFF Micro USB Smart WiFi Adaptor 5V, Smart Switch for Type A USB Devices, Compatible with Alexa & Google Home Assistant,APP Remote Control Switch, Voice Control, Timer Function, No Hub Required https://smile.amazon.com/dp/B083BKBKW5/ref=cm_sw_r_em_apa_i_KyWhFbERWGJH5

1 Like

Yeah, per @tony3286 - I have my Hubitat on a UPS which should give it 2-6 hours of life in a power outage if not more.

I'm not using any app to shut down my HE, I'm just using it to try and notify me.
I probably should put it on a 2 hour shut down though...

I use the community (Copeland) developed driver, which exposes a component switch, which is on or off depending on if there is power or not.2

I just purchased a Ring Alarm Range Extender v1 from Amazon for $14.99 which seems to be a good deal. I was able to add this Z-Wave Repeater device to my C7 Hub after a few attempts. Initially, the "powerSource" attribute didn't switch from "mains" to "battery" when I unplugged the Ring device from the AC outlet, but after I let the device's backup battery charge fully to 100% it seemed to be working as expected. When I pull the device from the AC outlet it immediately sets the powerSource attribute to "battery", and vice versa.

Oh, I was using the HE hub's built-in "Ring Alarm Extender" driver on my C7.

2 Likes

Since most US homes have a 240V service (2 - 120V separate phases), it seems a good idea to monitor each separate 120V phase side. It's certainly possible the utility could just have one phase drop and I want to know if either did.

Actually, residential power in the USA is something called Single Split Phase. It would be pretty difficult to lose only half of your home's electrical power. It's all or nothing 99.999% of the time.

6 Likes

I have a similar problem. But, I need to figure out out when the power comes back on. When the power goes out, I drag my generator out and hook up to a legal backfeed circuit with a physical lockout after disabling the main breaker.

But, I want to know immediately when the main thing feed is back online. I have a smart meter that they installed a month ago, but not sure if there is a way to interface with it.

Not that uncommon to lose one leg of your service.

Does anyone know if the Ring Range Ext. 2nd gen will integrate the same?

That’s over-complicating the use of the Ring Extender v2, which natively sends power fail (switch from mains to battery) events. You just set up a power fail routine to trigger on those events.

Now, you do have to refresh the state of the Ring Extender in a systemStart routine, because the “return to mains” event will have been missed while the hub was shutdown or booting.

1 Like

I have a whole home battery backup but it doesn't alert. I just want to know when I'm on backup. I have a couple plugs that aren't on the backup.