-
-
Save ethanrusz/2080e595ffb616ad181aec1b5ef3b175 to your computer and use it in GitHub Desktop.
Causes Philips Hue lights to flicker
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 qhue import Bridge | |
import time | |
import random | |
import sys | |
bridge_ip = "<hue_ip_address>" | |
username = "<username>" | |
my_lights = [light_id_1, light_id_2] | |
def flicker(bridge, elapsed_time, lights_list = [], transition = 10): | |
start_time= time.time() | |
while (time.time() - start_time < elapsed_time): | |
for light in lights_list: | |
bridge.lights[light].state(bri=random.randint(50,130),on=True) | |
time.sleep(random.uniform(0,0.5)) | |
for light in lights_list: | |
bridge.lights[light].state(transitiontime=random.randint(0, transiti | |
on), on=False) | |
time.sleep(random.uniform(0,0.5)) | |
b = Bridge(bridge_ip_address, username) | |
flicker(b, float(sys.argv[1]), my_lights, transition = 1) | |
for light in light_list: | |
b.lights[light].state(bri=255,on=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment