Skip to content

Instantly share code, notes, and snippets.

@mailletf
Created April 18, 2015 16:52
Show Gist options
  • Save mailletf/024e87ccb5d907f45f8a to your computer and use it in GitHub Desktop.
Save mailletf/024e87ccb5d907f45f8a to your computer and use it in GitHub Desktop.
Simple light show using phue
import time
from phue import Bridge
# connect to the hue bridge
b = Bridge(bridge_ip)
b.connect()
# Setup colors
colors = {
"bleu": [0.1393, 0.0813],
"blanc": [0.3062, 0.3151],
"rouge": [0.674, 0.322]
}
colorKeys = colors.keys()
# change each light color 10 times
for cycle in xrange(10):
for light in xrange(5):
# on each cycle, each light goes to the next color, which is
# either bleu, white or red.
next_color = colors[colorKeys[(cycle + light) % 3]]
b.set_light(light, 'xy', next_color, transitiontime=2.5)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment