core: light_profiles.csv stopped working
The problem
I have been using a light_profiles.csv file for a long time to set default turn on values for my zigbee lights.
Since a recent update, they no longer apply when turning lights on.
What version of Home Assistant Core has the issue?
core-2024.1.1
What was the last working version of Home Assistant Core?
core-2023.12.1
What type of installation are you running?
Home Assistant Container
Integration causing the issue
light
Link to integration documentation on our website
https://www.home-assistant.io/integrations/light/
Diagnostics information
There is no logging in the home-assistant.log file relating to light_profiles.csv or any events relating to light entities which are in the csv file for information.
Example YAML snippet
id,x,y,brightness,transition
light.lounge_floor_lightbulb_osram.default,0.526,0.387,128,3
light.hall_lightbulb_osram.default,0.526,0.387,156,3
light.chillout_floor_lightbulb_ikea.default,0.463,0.376,152,3
light.bedroom_floor_lightbulb_ikea.default,0.421,0.364,200,3
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: open
- Created 6 months ago
- Reactions: 2
- Comments: 24 (7 by maintainers)
Hi @nmaggioni adding the
relax
andenergize
presets tolight_profiles.csv
and using them in a service call to a group of lights works for me in2024.1.2
too.I have tried downgrading to
2023.12.0
as well as2023.12.4
and found that everything works as expected in these versions. As soon as I use any version>=2024.1.0
it breaks as described in this issue.I then proceeded to analyze the git diff between
2023.12.4
and2024.1.0
. I have found that when I run homeassistant2024.1.0
or2024.1.2
, remove all the changes made tohomeassistant/components/light/__init__.py
in #86026 and restart homeassistant, the light temperature works as expected.Here is the patch resulting from this testing. I couldn’t upload it as a file so I’m adding it as a collapsable section.
Unfortunately I’m not familiar enough with the homeassistant codebase to draw meaningful conclusions from this just yet but hope it’ll help understanding the underlying issue. 😃
Since
color_util.color_hs_to_xy
was not modified in2024.1.x
andcolor_util.color_xy_to_temperature
was newly added I assume there is an issue with it or with the logic in which it’s invoked.Click to expand patch
@RandomUser99 Glad to hear that, conversions and transitions are working as expected then. Unless somebody chimes in with other results, I’d say that the issue only concerns the default profiles and its cause should be investigated elsewhere along the turn-on process.
I could try to dig into this over the course of the next week(s), but I haven’t delved in that part of the code before so it’ll take a bit - if nobody else gets there in the meantime 😉
Thanks for finding that PR. I believe my cold/warm lights did in fact respond to changing xy in the profile, but I am not sure. It was probably undefined behavior anyway 😃 I would have expected to be able to set the color temperature of a bulb as desired, and then look up the xy-values in the bulb’s state attributes. However, all values I came up with produced all-red light.
Thanks to @nmaggioni for providing some well-defined behavior here. Maybe you can help with the remaining question: Given a desired color temperature in Kelvin, what xy-values should I set, i.e. what is the inverse of the
color_xy_to_temperature
conversion?EDIT: an addition to the light_profiles.csv documentation would be even better (I am happy to contribute if I find out how).
EDIT2: Ah, I guess there would be multiple xy solutions for a given CT… Would all of them work equally? In any case, I think it would be helpful to have some sort of clue about how to set these values to achieve some desired effect. In the meantime I will play around with this converter to find some suitable values 😃
I don’t see any how of my changes that would affect light profiles.
There is color temp related change recently #86026
After some more testing it looks like the light_profiles.csv file is being read and processed as the brightness and transition are being applied (proven by changing the values), but the xy_color is not being applied.