-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathcontrol.py
53 lines (34 loc) · 1023 Bytes
/
control.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
author: @endormi
Automated philips hue light controller using Phue
"""
from phue import Bridge
ip = ''
b = Bridge(ip)
# If the app is not registered and the button is not pressed, press the button and call connect() (this only needs to be run a single time)
b.connect()
lights = b.get_light_objects('name')
dict = {}
# for light in ['Kitchen']
# lights[light].on = True
# lights[light].hue = 15000
# lights[light].saturation = 120
# Change the hue and saturation to change color
def movie():
for light in lights:
lights[light].on = True
lights[light].hue = 5000
lights[light].saturation = 100
def turn_off():
for light in lights:
lights[light].on = False
def main():
print('Commands to use: movie & turn_off')
choose_command = input("Type in the command you want to use: ").lower()
dict = {
'movie': movie,
'turn_off': turn_off,
}
dict.get(choose_command, lambda: 'Invalid')()
if __name__ == '__main__':
main()