Http example lines [API ]

Dear all…,
I do have a nice yeelight bulb [ color ]
I try to make the http api working.
Only i do not understand the api settings.
Is there perhaps some that have a simple http command that i can try, for example on and off.

And then perhaps a example command with different brightnes and different volume.

so i can play with this bulb in my home automation.

I try a lot, only…

This is not working

so help me please…


Hi Dylano,

The API is not HTTP based, which means you can’t just send a http request to the bulb and control it.
Basically, the automation procedure includes two parts:

  1. Dynamic discover.
  2. Control and monitor.

The dynamic discover used a SSDP like protocol. You can send a multi-cast requust to local network and will get response from bulbs. The request and response are encoded in HTTP format but are transferred through UDP.

After discovering the bulb, you can establish a TCP connection to the bulb and control and monitor the bulb through control requests which is encoded in JSON.

This is the search response, the location will tell you the IP and port the bulb is listening, you should establish a TCP socket to this location and then send command through that socket.

HTTP/1.1 200 OK
Cache-Control: max-age=3600
Location: yeelight://
Server: POSIX UPnP/1.0 YGLC/1
id: 0x000000000015243f
model: color
fw_ver: 18
support: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene
cron_add cron_get cron_del set_ct_abx set_rgb a
power: on
bright: 100
color_mode: 2
ct: 4000
rgb: 16711680
hue: 100
sat: 35
name: my_bulb

This is the control request encoded in JSON which is used to turn on the bulb.

{“id”:1,“method”:“set_power”,“params”:[“on”, “smooth”, 500]}


Thanks for the explanation above very useful indeed.

Would it be possible to retrieve the status of my bulbs, via the API, when I am NOT connected to my LAN?

I have built a little dashboard which allows me to contol all bulbs. I currently use IFTTT to control the lights, this works perfect.

However there appears no support to retrieve the status of the bulbs via IFTTT I.e. on/off or color

Is there anyway to GET this information if I am not connected to the LAN?


I don’t quite understand “not connected to the LAN”… However, there is an API that can be used to retrieve the status of the bulb:

{“id”:1, “method”:“get_prop”, “params”:[“power”,“bright”]}

You can add other property name in the parameters array. Please refer to the spec for more information.

Hi I’m trying to get this working. I’ve send exactly this command: {“id”:1,“method”:“set_power”,“params”:[“on”, “smooth”, 500]} via TCP to one of my LED Strips. I’m connected to my Yeelights via TCP but nothing happend. Is there anything I’ve to change in the command? Any Ideas or tips? Is the above command exactly what yeelights need to recieve?