Created
May 11, 2019 13:04
-
-
Save colinfwren/ce4b6187666cc1fec611ab0f0f47aa89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import pyhue | |
HUE_IP = 'XXX.XXX.XXX.XXX' | |
HUE_USERNAME = 'replace_with_username' | |
HUE_ROOMS = ['Office'] | |
# Get the pyhue.Bridge instance | |
bridge = pyhue.Bridge(HUE_IP, HUE_USERNAME) | |
# Find the room in the list of rooms set up by the user | |
rooms = [room for room in bridge.groups if room.name in HUE_ROOMS] | |
# Iterate over rooms | |
for room in rooms: | |
# Iterate over lights in room | |
for light_id in room.lights: | |
# Use the light_id to find the light | |
light = bridge.get_light(light_id) | |
# Turn it off | |
light.on = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment