darth-hp / yeelight-shell-scripts

Control Xiaomi Mi Yeelight (RGB) with bash scripts
Apache License 2.0
130 stars 23 forks source link

Yeelight Smart LED Bulb W3 doesnot work #20

Open evanchurov opened 4 days ago

evanchurov commented 4 days ago

While Yeelight s1 works OK, the new W3 does not.

The reason is it needs to send an answer to the host saying something like {"method":"props","params":{"power":"on"}} while printf "something" > /dev/tcp/xxx/yyy does not imply answers.

The solution is to change from printf "{\"id\":1,$2}\r\n" >/dev/tcp/$ip/55443 to printf "{\"id\":1,$2}\r\n" | nc -w 1 $ip 55443 &

It means netcat gets an answer and closes the connection after 1 second working in background. Works OK after that.

darth-hp commented 4 days ago

I haven't used this for a very long time. Do you mind to create a PR and I will merge?