Display MoreEDIT: For me it is not working well. the color change is not reliable
is it a timing problem? or a hardware limitation?
Original Post:
i ve got some Exception errors. i fixed it. dont know if this is a clean solution. but it works :p
PythonDisplay More#!/usr/bin/python import socket import time from yeelight import * #UDP SERVER port = 19446 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(("", port)) print("waiting on port:", port) #YEELIGHT bulb = Bulb("192.168.2.105") bulb.turn_on() bulb.effect = "sudden" #Stop/Start music mode, bypasses lamp rate limits, ensures that previous sockets close before starting while True: try: bulb.stop_music() break except BulbException: break time.sleep(1) while True: try: bulb.start_music() break except BulbException: break time.sleep(1) try: while True: d = s.recvfrom(3) bulb.set_rgb(*bytearray(d[0])) except KeyboardInterrupt: print "Exit ..."
Hello Squizzy,
You can probe if is a hardware limitation if you add this line into a loop:
echo -ne '{"id":1,"method":"set_rgb","params":[255, "sudden", 0]}\r\n' |nc -w1 192.168.168.100 112233
With this you send directly a command to yeelight, and changin the "255" you can change the color.
I doesn't have yeelight bulb, but if anyone probe that is possible the rate of color change's, I buy one.