-
Notifications
You must be signed in to change notification settings - Fork 0
/
lightsdemo.py
43 lines (39 loc) · 1.29 KB
/
lightsdemo.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
#!/usr/bin/env python3
import lifx
from time import time
program = [ [ [ 0xb693, 0xffff, 0x0000, 3500, 0 ],
[ 0x105a, 0xffff, 0x0000, 3500, 0 ],
'...',
0 ],
[ [ 0xb693, 0xffff, 0x19c6, 3500, 20000 ],
[ 0x105a, 0xffff, 0x7bed, 3500, 15000 ],
'Welcome to the LIFX-python demo program.',
15 ],
[ [ 0x2666, 0xbc36, 0xffff, 3500, 30000 ],
[ 0xa5af, 0xe835, 0xffff, 3500, 30000 ],
'We can switch from scene to scene.',
30 ],
[ [ 0x0000, 0x0000, 0xffff, 6500, 10000 ],
[ 0x0000, 0x0000, 0xffff, 6500, 10000 ],
"And we'll leave with 6500K white.",
15 ] ]
lights = lifx.get_lights()
if len(lights):
lights[0].set_power(True)
if len(lights) > 1:
lights[1].set_power(True)
for step in program:
if len(lights):
lights[0].set_color(*step[0])
if len(lights) > 1:
lights[1].set_color(*step[1])
print(step[2])
start = time()
while time() - start < step[3]:
lifx.pause(3)
if len(lights):
lights[0].get_state()
print(lights[0])
if len(lights) > 1:
lights[1].get_state()
print(lights[1])