API improvement suggestions

Hi weiwei and other yeelighters, a satisfied customer (and a developer) chiming in with some suggestion for the API!

I wanted to write briefly about a couple of issues some users have been having:

  1. Apparently there is a limit in possible transition times, could you clarify up to what point it should be possible to use that? Related issue report: https://github.com/home-assistant/home-assistant/issues/11371

  2. There is currently no way (besides mDNS or using the discovery protocol) to discover information about the lights. This makes it a bit tricky to support changes in IP addresses, so would it be possible to add some sort of info method to the developer API (returning the MAC address of the bulb, version number, model of the device, …?)? Related to https://github.com/home-assistant/home-assistant/issues/12337

  3. Related to previous request, it would be nice if the devices could report supported features (e.g. similar to that of discovery process, but also information like the range of supported color temperatures, see https://github.com/home-assistant/home-assistant/issues/13785) over the developer API.

  4. I’m unsure if this is already possible, but it would be great to allow activating the night mode also on the bedlight lamp (the API says this is available for the ceiling lights). See https://community.home-assistant.io/t/xiaomi-yeelight-bedside-lamp-color-state/71617/2

Do you think such changes could be possible at some point in the future? :slight_smile:

Thanks for supporting Yeelight and also thank you for your advices.

Regarding the 4 issue/suggestions you listed, following are our answers.

  1. We need to take a look at this issue. There is an internal 10ms timer to handle the transition (if total transition time is 1s, then it takes 100 loops to finish the transition, every loop change a little bit hardware output). However, when the transition time is very long, we did some optimization in order to avoid excessive calculation (MCU usage). The strategy may need to be improved.

  2. The discovery response contains two headers: model & id. (page 4 of the spec). The user should use the “id” field as a unique identifier of the device.

  3. This is a good idea, we will consider adding such meta info in discovery response in next update.

  4. Night mode feature should also be applicable for bedside lamp.

1 Like

Thanks for the information (especially about the points 1 & 4) and your prompt response! I just wanted to add a bit to the points 2 and 3 – what I meant that it would be nice if that information (id, model) could also be queried with get_prop. This would allow skipping the discovery process completely when the IP address is known (e.g. when it is set statically) and thereby simplify the process in those cases. This would also allow recognizing those duplicates (where a device is being discovered and the ID is known) from those lights that are manually configured by their IP address (in case of homeassistant).

I see, we will consider this.


This would be great.