Note! This script is now deprecated, as all Hue bulbs can be configured to restore their previous settings on power on.
Perl script for automatically handling/restoring Philips Hue bulbs after returning from a power failure.
Easy setup (on unix):
- Edit the
BRIDGE
constant near the top of the script, and change the IP address to point at your own bridge. - Edit the
MAGIC_NUMBER
constant near the top of the script, specifying how many "Extended color light" bulbs need to be in the default power on state for the script to start restoring the state of all the lights. 3-4 seem like good numbers, but it depends entirely on your situation. - Press the link button on your Hue Bridge, and run
huebro.pl -v reg
, and the script should now have access to your bridge. - Run
huebro.pl -v check
to grab an initial snapshot of your lights. You should see some action on screen. - Set up a cron job that runs
huebro.pl check
periodically (once every minute seems ok). - Make some changes to your lights, and keep an eye on the
~/.huebro/huebro.log
file to see what's happening.
If you run into problems, use the -v
and -d
options, and try the huebro.pl current
command to see what's going on. If you still can't figure it out, it's time to start reading the code.
The following perl modules are needed by huebro:
- DBI
- DBD::SQLite
- LWP::UserAgent
- JSON
If you're on Debian (or Ubuntu, or Raspbian) you can install these by running the following command:
sudo apt-get install libwww-perl libjson-perl libdbi-perl libdbd-sqlite3-perl