Power Failure Recovery via RM?

After power failures I tend to have a lot of craziness with various devices including Hue lights. They all default to on and I have lights on everywhere. Any thoughts or ideas on how to use Rule Machine to detect if a power outage occurred and perform some basic actions such as turn off my Hue lights?

I have a rule that will turn lights off after a delay if the Lux value is above a certain number. This will work great during the day but not at night and may be an answer to your problem.
Thinking about it I could define another rule to turn lights off if lux is below a certain level and this is no motion activity from any of my motion sensors for,say, 30 minutes and mode IS NOT away I suppose.
I may do that.

There is an ST app that uses a ‘canary’ bulb.
This works by using a bulb that is always kept off.
If the power goes out and then it comes back on, the canary bulb will go to 100% the same as the rest.
The app knows if that bulb is on then there has been a loss/restore of power.
The app also checks every 5 mins and records the ‘state’ (i.e whether off or on) of each bulb
Once it detects a power loss/restore then it will reset the hulbs to the last state.

Here is the thread about the app, you just need to port it to Hubitat

Andy

3 Likes

Nice! Thanks! I will give that a try. So far I'm about 50% on porting apps. :slight_smile:

That one is not that difficult, just the usual changes

Andy

1 Like

I did something similar when on ST; if the bulb comes on, turn off all others. This was using ge link bulbs. It always worked immediately after an outage. The same logic doesn't work on HE as the canary need a refresh before it's seen as on (tested with both GE and Singled). Does HE handle outages/lights coming on different than ST? Any other suggestions on ways I could instantly (or close to it), turn things off when the power goes out? I thought about chess checking logs for UPS status, monitoring hemv2? Or even some low power device that could run a single http get command to turn things off when powered up after a reboot.

Just to add to this for future discovery.
Hue hubs and bulbs have a "Power on behavior" setting where you can set how you want the bulbs to behave when power is restored.

I keep my Hubitat on an uninterruptible power supply. That way, the system keeps operating even if the power goes out. I don't have any Hue bulbs, but I think that would be a good idea for any Hubitat as a sudden power loss means the hub does not shut down properly.

That wasn't my point, sorry if I was confusing. All my computer gear is on a battery UPS and house on generator, not really the point, but but bulbs will turn on after power comes on after a failure.

As I recall on ST (also on battery UPS) my rule to power all bulbs off if the Canary bulb was on worked instantly. When power came back, Canary came on and my ST rule turned everything off, definitely in less than 10 secs. Just wondering why this worked on ST with GE link bulbs but doesn't work on HE with GE or singled.

Okay. I don't have any "smart" bulbs, just smart dimmers and smart plugs controlled by Hubitat with regular LED bulbs. They must behave differently than the bulbs. I hope you can figure that out.

I think I'll try an ESP8266 + NodeMcu to see if I can make a $5 dongle that does an httpGet on boot to do a refresh on my Canary. I'm more interested on my this worked with ST but not HE. Maybe @patrick has an idea.

I'll report back if my $5 investment works.

1 Like

Here's my solution. It seems to work well as it can join Wifi and refresh a device in about 1 second after a power failure; also it doesn’t take more than a second for the device to discharge the AC adapter. It does 3 refresh calls to your canary bulb. Cost is $5 shipped (in US), assuming you have a spare USB adapter.

EDIT: This doesn't always work for short blips because the capacitors don't fully exhaust and power down the device; it works for longer outages though. If you have a UPS hooked to a Linux system you can edit apcupsd to call your maker API refresh - this will help fix the blips.

3 Likes

Hi, What is the name of this device? I'm looking forward to buy one of this.
Here at home I'm having a problem because some lamps turn on after a power outage

Option #3 in the link. I updated it ESP-01S USB to ESP8266 ESP-01S Wireless Wifi Adapter Module Wi-Fi CH340G 4.5-5.5V, 115200 Baud Rate https://smile.amazon.com/dp/B07KF119YB/ref=cm_sw_r_cp_api_fabt1_XRZQFb0X3WX13

This is only good for big power outages. Little blips don’t run the capacitors down enough to restart the device.

1 Like

hello Brian, I bought the items to do this, could you provide more detailed information on how you did it? I want to use it at my home

I wrote up the process here: hubitat/SmarterBulbs at master · bdwilson/hubitat · GitHub

1 Like

Thank you very much. It worked very well, but I ended up using it in a different way. I created a virtual device in Hubitat and turned it into a trigger for a piston in WebCoRe. So I put this link for the arduino to run when connecting
http://192.168.XX.XX/apps/api/69/devices/681/on?access_token=XXXXXX-XXXX-XXXX-XXXXX
681 is the number of the device ID in my Hubitat
I programmed when this device turns on, update the status of some lamps and have them turned off, and update some sockets and turn them on. Here is the piston

Do you know if this was ever ported?

Ported from ST and modified for Hubitat. Uses a canary bulb to detect the power failure and restores a set of switches to their original state. Triggers every 5 minutes or on hub reboot.