Created
October 13, 2018 07:40
-
-
Save bazwilliams/59566ae19d7222713b24afcd14dfc2db to your computer and use it in GitHub Desktop.
The Williams' Family Disco!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from phue import Bridge | |
from rgbxy import Converter | |
import random | |
import time | |
b = Bridge('philips-hue') | |
b.connect() | |
light_names = b.get_light_objects('name') | |
converter = Converter() | |
lights = [ light_names['Lounge Lamp'], light_names['Lounge Main'] ] | |
colours = [ 'FF0000', '00FF00', '0000FF', 'FF00FF' ] | |
while(True): | |
for colour in colours: | |
for light in lights: | |
light.on = True | |
light.transitiontime = 1 | |
light.xy = converter.hex_to_xy(colour) | |
time.sleep(0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.6 | |
RUN pip3 install phue rgbxy | |
ADD app.py /app/ | |
CMD python3 /app/app.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build
Rename the lights as appropriate for your house.
docker build -t disco .
Run
Press the button on your Hue bridge
Dance
Improve
[ ] Use MQTT to turn disco mode on or off
[ ] Configurable lights
[ ] Configurable bridge or auto discovery
[ ] Use Spotify Web API to start music; or
[ ] Hook into HomeAssistant