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
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.
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
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.
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.
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 ??
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.
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.
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?