master
***This Project lives @ https://gitlab.rickelobe.com/Rich/OffWith-Hue ***
Prerequisits
- *nix machine
- Phue python library. Install using pip
pip install phue
- A CyberPower UPS device connected to your machine OR Network UPS Tools configured device
CyberPower's pwrstatd daemon (PowerPanel) can be downloaded here: http://www.cyberpower-eu.com/products/software/pp_linux.htm
# Description This program will turn off lights that are controlled through your Philips Hue bridge after a power outage. To determine whether a power outage has occurred, it can use CyberPower's pwrstatd daemon or monitor your system log for messages from NUT (Network UPS Tools) for status changes.
The program routinely query's your Hue bridge for a list of lights, storing the ones that are currently off. When the power goes out, it will wait for the power to return, then turn off all lights that were off prior to the power outage.
Usage
Example #1: Show help
# hue_off.py -h
Options Usage:
-b, --bridge | IP address of your Hue Bridge
-c, --createuser | Create a new user on your Hue Bridge
-i, --interval | Set how often (in seconds) to check the pwrstatd log.
Defaults to 60, only used for CyberPower monitoring
-m, --mode | Set the mode for checking power status
Options are 'cyberpower' or 'nut'
-l, --logfile | Specify the logfile to watch for NUT messages
This only applies when mode is set to "nut"
Typically "/var/log/syslog"
Example #2: Start and connect to Hue Bridge at IP 192.168.1.101, set mode to parse NUT log, and specify log file to monitor
# hue_off.py -b 192.168.1.101 -m nut --logfile /var/log/messages.log
Description
This script will monitor the pwrstatd.log for mains power failures. When power is restored, it will turn off Hue lights since their default action is to power on after an outage.
Readme
MIT
81 KiB
0 Stars
1 Watchers
0 Forks
Languages
Python
100%