-
Notifications
You must be signed in to change notification settings - Fork 1
/
hue_alert.py
executable file
·64 lines (53 loc) · 1.5 KB
/
hue_alert.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
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
"""Makes the Hue Lamp(s) ping or blink."""
from hue_class import HueLamp
from hue_config import lamp_dict
for a, n in lamp_dict.items():
globals()[n] = HueLamp(a, n)
print("\n###### Makes the Hue Lamp(s) ping or blink. ######\n")
while True:
x = input("You can make the lamps (p)ing once or (b)link 15 times and (s)top blinking while blinking : ")
print()
if x == 'p':
state = 1
break
elif x == 'b':
state = 2
break
elif x == 's':
state = 0
break
else:
print("Please just input (p)ing, (b)link or (s)top.\n")
s = "Where to send ? "
for name in lamp_dict.values():
y = name[5:]
s = s + "%s " % y.replace(y[0], "(%s)" % y[0], 1)
if len(lamp_dict) > 1:
s = s + "or (a)ll : "
else:
s = s + " : "
while True:
kbd_inp = input(s)
print()
first_letter_list = [y[5] for y in lamp_dict.values()]
if kbd_inp in first_letter_list:
k = [y for y in lamp_dict.values() if kbd_inp == y[5]]
globals()[k[0]].alert_set(state)
break
elif kbd_inp == "a":
for lamp in lamp_dict.values():
globals()[lamp].alert_set(state)
break
else:
s = "Please just input "
for name in lamp_dict.values():
s = s + "(%s) " % name[5]
if len(lamp_dict) > 1:
s = s + "or (a) : "
else:
s = s + " : "
for lamp in lamp_dict.values():
hl_obj = globals()[lamp]
hl_obj.prop_chg_notify.kill()
print()