Skip to content

Instantly share code, notes, and snippets.

@kocsenc
Last active November 7, 2017 04:30
Show Gist options
  • Save kocsenc/c2ff0762f41569dd012d5b2741a571bb to your computer and use it in GitHub Desktop.
Save kocsenc/c2ff0762f41569dd012d5b2741a571bb to your computer and use it in GitHub Desktop.
Cycle some creepy colors on your hue lights for halloween!
#!/usr/bin/env python3
import random
import time
from phue import Bridge
BRIGHTNESS = 255 # Max is 255
TRANSITION_TIME = 100 # Deciseconds for transition
bridge_ip = "192.168.1.172"
b = Bridge(bridge_ip)
all_lights = b.get_light_objects()
to_cycle = [all_lights[0]] # Set the lights you want to cycle.
ORANGE = (0.6, 0.4)
RED = (0.67, 0.32)
GREEN = (0.15, 0.8)
PURPLE = (0.25, 0.1)
PINK = (0.5, 0.25)
print("Ctrl + C to stop cycling.")
colors = [ORANGE, GREEN, RED, PURPLE, PINK]
color_i = 0
while True:
print("Cycling lights to: {}".format(colors[color_i]))
for light in to_cycle:
# Set the transition time of all lights to TRANSITION_TIME
light.transitiontime = TRANSITION_TIME
light.brightness = BRIGHTNESS
light.xy = colors[color_i]
time.sleep(TRANSITION_TIME / 10)
color_i = (color_i + 1) % len(colors)
@kocsenc
Copy link
Author

kocsenc commented Nov 7, 2017

@craigcabrey I think it's fair to assume most folks wouldn't have that set up :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment