Updates a Philips Hue depending on TeamCity build status.
The machine running this code needs to be on the same network as the Phillips Hue Bridge.
Then simply run ./update_lamp.sh
to update the lamps. The first time you run it, it will ask you to press the button on the Phillips Hue Bridge.
Dependencies
- phue
- mock (only if you want to run tests)
To setup a raspberry pi, just
- Install Rapian as per normal
- Change the default password - Remember to update in 1password as well.
- Update the hostname to
build-lamp
by editing/etc/hostname
(and/etc/hosts
). - Enable ssh server.
- Install git
apt install git
To make it easy to push code to the raspberry use a git bare repo
-
Create a directory
mkdir tc-hue.git
-
Create the bare repo
cd tc-hue.git && git init --bare
-
Put the following in
hooks/post-receive
#!/bin/bash DIR=/home/pi/tc-hue mkdir -p "$DIR" GIT_WORK_TREE="$DIR" git checkout -f master
cd "$DIR/" ./deploy.sh
-
Make it executable
chmod +x hooks/post-receive
-
Create the target directory
mkdir /home/pi/tc-hue
-
Back at your dev machine git remote add build-lamp [email protected].:tc-hue.git
-
Push code
git push build-lamp
To make the update script run e.g. every 5th minute, run crontab -e
and put in an entry like so
/5 * * * * /tc-hue/update_lamp.sh >/dev/null 2>&1
Some old documentation for setting up scheduled execution on windows.
schtasks /create /sc minute /mo 1 /tn "Update Build Lamps" /tr C:\Users\volumental\tc-hue\update_lamp.bat
There is a small flask server to make it easier to trigger the updating
- Copy
build-lamp.service
to/etc/sytemd/system
. chown root:root /etc/sytemd/system/build-lamp.service
sudo systemctl enable build-lamp.service
sudo service build-lamp start
Go to http://build-lamp.local.:5000/