Yeelight lan control with packetsender

Tags: #<Tag:0x00007fc41208a178>

Hi guys.

I want to share some knowalage about control yeelight lamps and strips over the lan by sending commands to those devices. I have a lot of those lamps at home and from time to time HA which controls them became crazy with 100% cpu because one of them start to refuse the network connection. Anyway, that info can help someone debug their problems.

  1. We have manual with detail https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf
  2. We need install tool https://packetsender.com/
  3. First you should send “discovery” package - it is udp on 239.255.255.250 port 1982 and all yeelight devices will replay to you with their location, status and available settings

response looks like that

Cache-Control: max-age=3600
Date:
Ext:
Location: yeelight://192.168.1.120:55443
Server: POSIX UPnP/1.0 YGLC/1
id: 0x0000000010e0de00
model: ceiling20
fw_ver: 27
support: get_prop set_default set_power toggle set_bright set_scene cron_add cron_get cron_del start_cf stop_cf set_adjust adjust_bright set_name set_ct_abx adjust_ct bg_set_rgb bg_set_hsv bg_set_ct_abx bg_start_cf bg_stop_cf set_scene_bundle bg_set_default bg_set_power bg_set_bright bg_set_adjust bg_adjust_bright bg_adjust_color bg_adjust_ct bg_toggle dev_toggle
power: off
bright: 98
color_mode: 2
ct: 3773
rgb: 0
hue: 0
sat: 0
name:

Like you can see there are Location, power status and features that device have. More info in manual.

Next you can control each of them - simple case turn on/off the power. For that you should send TCP package to device address with command you want run - in our case it is (please make sure it have \r\n in the end!)

{ “id”: 1, “method”: “set_power”, “params”:[“on”]}\r\n

Also it works if you use telnet telnet 192.168.1.120 55443 and run the same command { “id”: 1, “method”: “set_power”, “params”:[“on”]} \r\n

That’s it!

Duke

Did you integrated in HA somehow ?