Skip to content

Commit 8d248f2

Browse files
authored
Create yeelight2.py
1 parent 3afe6cb commit 8d248f2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

yeelight2.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Make sure you install yeelight
2+
# pip3 install yeelight
3+
4+
# Documentation here: https://yeelight.readthedocs.io/en/latest/
5+
6+
import time
7+
from yeelight import Bulb
8+
bulb1 = Bulb("192.168.0.105")
9+
bulb2 = Bulb("192.168.0.117")
10+
bulb1.turn_on()
11+
bulb2.turn_on()
12+
time.sleep(1)
13+
14+
bulb1.set_rgb(255,0,0)
15+
bulb2.set_rgb(255,0,0)
16+
time.sleep(1)
17+
18+
bulb1.set_rgb(164,168,50)
19+
time.sleep(1)
20+
21+
bulb2.set_rgb(50,90,168)
22+
time.sleep(1)
23+
24+
bulb1.set_rgb(168,50,50)
25+
time.sleep(1)
26+
27+
bulb2.set_rgb(50,168,54)
28+
time.sleep(1)
29+
30+
bulb1.set_rgb(255,0,0)
31+
time.sleep(1)
32+
33+
rgb1 = 50
34+
rgb2 = 10
35+
rgb3 = 50
36+
for i in range(10):
37+
bulb1.set_rgb(rgb1,rgb2,rgb3)
38+
bulb2.set_rgb(rgb1-10,rgb2-10,rgb3-10)
39+
time.sleep(1)
40+
i = i + 1
41+
rgb1 = (i*10.5)
42+
rgb2 = (i*5.5)
43+
rgb3 = (i*9.5)
44+
print(rgb1, rgb2, rgb3)
45+
bulb1.set_rgb(rgb1,rgb2,rgb3)
46+
47+
bulb1.set_rgb(50,64,168)
48+
bulb2.set_rgb(50,64,168)

0 commit comments

Comments
 (0)