Xiaomi yeelight bedside lamp color state

Hi,

I have the xiaomi wifi bed side lamp (wifi ble version).
all is working good but there is something i can’t do with it.

In the yeelight app, there is many possibilities, and one of them is a preconfigured mode named night mode (it’s a kind of warm orange with a low brightness).

I would like to set up exactly the same color with hass, but ???
I’ve check the attributes values when this mode is on and write it on a paper , i’ve try to set up the same attributes values, but the color is not the same.
I have investigate a little and what i’ve discovered is that in the yeelight app, when you choose this night mode, and after you go to the color tab, the color of the lamp is changed and take the same color that if you manually encode the attributes value writed on the paper before.
it’s like the color of the night mode is under the range of attributes value.

it’s not easy to explain, but if someone have the same lamp, it’s easy to test.

  • put the night mode on with yeelight app
  • see the color of your lamp
  • go to home assistant and see the attributes value
  • go to the tab color of yeelight app
    ==> your lamp color have changed, but not you attributes value,
    ==> if you make a script who set up these value, the result is the second color, not the night mode color

anyone have an idea ?

regards

1 Like

Hi Vincent,

I do not own the Xiaomi Yeelight bedside lamp but I guess the approach to getting a specific colour on a light entity should be quite the same across different smart lighting brands.
My LIFX bulbs for example don’t show their current colour state directly in the attributes list (unter the ‘<>’-Tab) next to the entity name, but if I click on the entity name I can see the current brightness and colour of the light in the state area above the entity list. You should be able to find the exact colour value or temperature that the light is currently set to here.
If the values you find there also don’t match the colour you set in the yeelight app, then theres probably a problem with the state feedback to HA.

I attatched a screenshot of what the state area above the entity list looks like if I click on one of my LIFX bulbs.

Hope this helps.

Hello,

yes, i’ve take these attributes values,

first i was thinking like you (a problem with state feedback in HA), but second,… when i see that in the yeelight app when we chose the colour tab, the color change and it seems impossible to configure the same color than the one configured with the night mode, i’m asking me if that it is not a restriction of xiaomi himself.
like they have made their own mode not accessible by an other way than their app,

if it’s not clear i can make pictures to illustrate what i said

I understand what you mean, will try it and let you know.

The previous version I have (bluetooth-only) has a specific mode that is active when the defined “night mode” is active. I’m not sure if it is possible to activate that over the API, but if yes (the ceiling lights support this according to the API), that’d be to way to do it.

I can confirm what you’re seeing and looking at the API night mode is only supported by the ceiling light as @teprrr wrote. It indeed looks like the value for night mode is outside the range which is supported.

Hi,

I have 2 bedside lamp v2 (wifi + bluetooth) and in automations or scripts i have configurated values:

- service: light.turn_on
  data:
    entity_id: light.yeelight_bedside_7811xxxxxxxx
    rgb_color: [255, 153, 0]

This rgb_color is night mode. To know it, i selected by yeelight the mode and after few seconds i checked in HA, which values appear as @sebastian_p said.

imagen

Hope this can help you

That is what you would expect, but as @Vincent wrote it’s not the same color as when you select the nightmode from the Yeelight app.

The moonlight mode should work similarlya also with bedside lamps (see https://forum.yeelight.com/t/topic/7075), so you could try to use https://www.home-assistant.io/components/light.yeelight/#service-lightyeelight_set_mode to set the mode and change the brightness after that, maybe?

There is no “moonlight” mode available in states.attributes values for the bedside lamp.
The only way to set up this mode is the yeelight app.

Maybe we can try to find the rgb code of the color and set up these value even if it seems that values are out of range, … i will test that i think.

Did you try @teprrr suggestion? I did noticed the lamp changed color but as I’m not at home I can not check if it’s simular to nightmode.

I have missunderstood what @teprrr said.

i’m not at home, i will try that tonight

I have tested but something strange.

In my hass I have 2 times yeelight.
The one discovered by bass named yeelight_bedside_macaddress, and the one I have configured named table_basse. (This is physically the same lamp)
Both are available under light.xxx turn_on, color change, etc is working good.
But, if i try the yeelight_set_mode it’s only working on yeelight_bedside_macadress.
(The good news is that yes, the set mode moonlight correspond to the moonlight color in yeelight app)

Have you an idea of why it is not working on both ??

1 Like

That is a bug in the code, more precisely, the bulb initialized the last (the autodiscovered one) will override the entry in hass.data (as they are keyed per host/IP address). So it won’t find the another name when iterating over when looking for matching devices. Could you please create an issue on github for that. The simplest fix is either to disable the auto-discovery or remove the manually configured one for now.

1 Like

I think i will disable auto-discovery.

Are you sure this is an override problem, … because it seems than the manually configured one is working good for all other things (turn_on/off, scene to set states attributes), … it’s just for the yeelight_set_mode that it’s doesn’t work.

Regards

Yes, it should work. Please still create an issue to the issue tracker on that bug, thanks!

issue reported here

additional info:

i’ve try with disabling discover and now my manually declared light is working with yeelight_set_mode

Hi @Vincent , I have exactly the same issue as you post. I have yeelink.light.bslamp2 with xiaomi brand. I went through your conversation, if I understand correctly, using service. YEELIGHT.SET_MODE to ‘moonlight’ can achieve exactly the same as ‘night mode’ from yeelight app?
Now my issue is , currently, xiaomi disabled local control mode for all yeelight product so I can not control my lamp with yeelight integration, but I can use another integration called Xiaomi-Miot-Raw to control the lamp, and still, all the stuff like set brightness, color working like a charm, but I can’t still set nightmode from hass. Do you have any ideas?