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

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.