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



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



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.


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.

Hue Power Loss Memory - Finally