in s1e1-totally-lit/hue-python/danceparty.py [0:0]
def main():
# First, get all lights and groups of lights
room_data = get_rooms(LOCAL_HUE, USER_NAME)
light_data = get_lights(LOCAL_HUE, USER_NAME)
# Loop through each light and force it to be on if necessary. No lights can be off during dance party mode!
lights_included = []
if LIGHT_GROUP:
for room in IDS:
lights_included.append(room_data[room]['lights'])
else:
for bulb in IDS:
lights_included.append(light_data[bulb]['id'])
for light in lights_included:
light_stat = get_light_status(light)
if light_stat['state']['on'] == False:
turn_light_on(light)
# Loop forever. Dance parties must not end!
while True:
dance_party_mode(lights_included)