Power Outage and Zigbee Bulbs

I couldn’t find a simple way to tell that the power has been cycled. There is a field in the hub data that is batteryInUse. You would need to track when this gets set to Yes and then back to No.
The first issue is that getting that value is a pain. The only way I found would be doing an html request and then parsing the results.
The second (and more critical) issue is that when the power goes off, the internet goes off and the smartApp would stop receiving events, since it is not processing locally. This mean you would never get the initial batterInUse flag. This can be overcome with a UPS, but I would need a second one as I have Fios and would need a UPS for the phone switch and the router, since they are in 2 different locations.
I would much rather use an indicator coming from the hub, but until both of the above issues can be addressed, @JDRoberts’s suggestion for a canary bulb really is a brilliant idea. Beside only costing a $15 bulb, it is capturing the exact event that I’m looking for, Smart bulbs turning on due to a power outage.

I’m glad I could help out, I’m sure you will find another project for your first SmartApp.
If you tackle the issue of determining the hub lost and regained power, please share you code, as that may give me enough incentive to get another UPS.

1 Like

Is there a way in CoRE to push/request a healthPoll() on the bulb?

Power Failure - One Solution with CoRE

It looks like the healthPoll() function runs every 5 minutes. It is that which will see the bulb is now on/100 and update things. From the silence on this site, I take it there is nothing in core to run a healthPoll() like function.

Armed with the 5 minute cycle, I wrote a simple script that runs every 5 minutes. It tests if the light level is greater than 99. Why 99? I changed my other scripts to set the light levels to a maximum of 99 so that when there is a power failure, I can detect the bulb is set to 100 and thus a power failure occurred.

Before you begin, turn on Advanced Mode by going into Settings->ExpertFeatures->Expert Mode

FAR from perfect, but a start. It will break if the bulb is connected to a remote. My case is a stationary fixture in the bathroom used as a nightlight triggered by motion sensors. Just wanted to share.

Note since this also depends on the healthPoll() running, it could take 2 cycles or 5-10 minutes for this script to run and your bulb turn off.

Comments and ideas welcome.

1 Like

How do setup. Can you please give an instructions Thanks

I know this is an old thread, but I stumbled onto it and it made me think of my situation. I have (10) Cree bulbs scattered throughout the house. They work fime for me but they do have the issue of turning themselves on at 100% after a power outage. None of my smart switches have this issue. Even though I have a whole home generator, this still occurs during the 15 seconds it takes for the generator to fire up.

So after gathering ideas from @JDRoberts and the rest of you who’ve contributed to this thread, I decided to tackle this for my particular setup. I don’t have any unused Smart Bulbs to use as a ‘canary’ in the specific way that has been discussed here. BUT I do have one that is very rarely set to 100% and never when all (10) of the Cree’s are also on and set to 100%. Using that information and applying it to a webCoRE piston, I came up with the following:

I’ve tested this and it works perfectly! I hope it can be used for some of you as well.

Lee

3 Likes

Thanks for this! I have set it up and will see how it goes. I’ve only got a few zigbee bulbs but only one of them is sometimes triggered to turn on at 100% otherwise it’s at 20%. So I’ve used that as my canary bulb and in the piston which triggers that canary bulb to turn on at 100% I’ve changed it to set it to 99% so it doesn’t cause a false trigger of this power outage piston. With that done, I’ve removed the time condition from your piston as in my case, my bulbs will never be on at 100% unless there has been a power outage.

Great!
In case you’re interested, I’ve updated my piston a few times and this is the result:

This new version runs on a looping timer - I’ve got it set to 10 minutes currently. Looping seems to be more stable. Also, my canary bulb is now an on/off switch and not subject to the same issue as my Cree bulbs staying on at 100% after an outage. I also have the Cree bulbs dimmed to 20% before turning them off so that they don’t turn on at 100% the next time they’re activated.

Good luck!

1 Like