Open farbefreak opened 1 month ago
It looks like i misinterpreted the issue.
It seems like HA also somehow tries to mix the selected brightness value into the ww and cw percentages.
Example: comanding a
action: light.turn_on
data:
brightness_pct: 50
kelvin: 3800
Results in the light being set to:
[17:53:18][D][light:051]: Brightness: 50%
[17:53:18][D][light:055]: Color brightness: 0%
[17:53:18][D][light:059]: Red: 100%, Green: 100%, Blue: 100%
[17:53:18][D][light:071]: Cold white: 25%, warm white: 25%
or in raw Percentage / actual output values with gamma correction in esphome:
R: 0%
G: 0%
B: 0%
CW: 12,5% -> 0,3%
WW: 12,5% -> 0,3%
Which equals to a total "perceivable brightness" of 25% and a power output of just 0,6%! Much too low, it looks like this is because the brightness got scaled threetimes by HA, first the actual input bightness value of 50% second the equivalent of esphomes "constant_brightness " trying to keep the total brightness at 100% and third the calculated WW and CW values get multiplied by the 50% input brightness value.
I would expect Home Assistant to command 100%/100% on both WW and CW channels and 50% Brightness on the Brightness channel.
Just changing the Brightness gives me:
action: light.turn_on
data:
brightness_pct: 100
kelvin: 3803
(not sure why 3803K is necesary to get 50/50% - looks like HA ingores the actual color temperature range of the light)
ESPhome:
[17:57:39][D][light:051]: Brightness: 100%
[17:57:39][D][light:055]: Color brightness: 0%
[17:57:39][D][light:059]: Red: 100%, Green: 100%, Blue: 100%
[17:57:39][D][light:071]: Cold white: 50%, warm white: 50%
or in raw Percentage / actual output values with gamma correction in esphome:
R: 0%
G: 0%
B: 0%
CW: 50% -> 14,4%
WW: 50% -> 14,4%
Which equals to a total "perceivable brightness" of 100% and a power output of just 28,8% after the gamma correction. This makes sense as HA is trying to inplement the constant_brightness feature from ESPhome (which it shouldnt imho)
So increasing just the brightness also increased the cw and ww channel values, this should not happen.
Color also seems to be effected. Setting:
action: light.turn_on
data:
brightness_pct: 100
rgb_color:
- 255
- 255
- 255
somehow results in
[18:27:41][D][light:051]: Brightness: 100%
[18:27:41][D][light:055]: Color brightness: 38%
[18:27:41][D][light:059]: Red: 0%, Green: 55%, Blue: 100%
[18:27:41][D][light:071]: Cold white: 100%, warm white: 100%
While it should actually just be:
Brightness: 100%
R: 100%
G: 100%
B: 100%
CW: 0%
WW: 0%
No idea why it sets green to 55% and blue to 100%? But this somehow also results in Homeassistant seeting both CW and WW to 100% which in never does when setting Color temperature alone.
Not sure what i can add to make debugging or finding the issue easier.
The problem
Hello Girls and Guys,
It seems like there is an issue with the current Homeassistant implementation of the Color Temperature setting.
In ESPHome you got the option to configure a light components gamma to make its respone match the human eye. This makes the dim curve non linear resulting in better dimming performance and accurate colors as they match our eyes response.
A CW/WW or a RGBWW component also got the option to keep the brightness constant while using color temperature.
E.g setting 100% on both W channels would result in 50% duty PWM value on both → We get essentially 50% brightness on both channels resulting in the same total brightness as 100% on a single channel. This limits the maximum brightness but is often desired as it keeps the brightness the same.
constant_brightness: true
The problem is with Homeassistant also trying to apply the same logic but before the gamma correction happens.
Lets say i want to set the above configured light to 4000k in HA:
This results in HA sending this:
[15:05:55][D][light:047]: State: ON [15:05:55][D][light:055]: Color brightness: 0% [15:05:55][D][light:059]: Red: 100%, Green: 100%, Blue: 100% [15:05:55][D][light:071]: Cold white: 75%, warm white: 25% [15:05:55][D][light:085]: Transition length: 0.5s
This is wrong and makes no sense?
It should send CW and WW with both 50% as 4000k is exactly between 2000k and 6000k. But worse: as ESPHome applies the Gamma correction ontop of the values, the total brightness would be much less than 100%.
Total brightness would only equal 100% if the Gamma on ESPhome is set to 1. Which makes dimming improper to the eye and colormixing doesnt match the color picker anymore.
Setting constant_brightness: true makes it even worse, as ESPhome applies the interlock ontop of all of that. Resulting in essentially having color interlocked twice, ones in HA which gets scaled by the gamma setting in ESPHome and than the resulting brightness gets kept constant by ESPHome again.
Resulting in much lower brightness than expected.
Is there a way to disable the color interlock in HA? Making it respond properly to the color temperature call of “4000k” resulting in appling 100% on both channels? Or maybe telling HA which gamma the light uses so it can “back calculate” how much brightness on each channel is necessary (say 77% on both or so) to get 50+50 duty PWM value out of ESPHome?
Not sure if it is related but I also found that ?this? causes the color picker to be very jumpy. Brightness slider also does that sometimes but not always. It looks like color picker tries to show the lower brightness color in between. It often changes the color brightness value while clicking opposite colors on the color picker. Doing it quickly reliably causes the color brightness to drop to zero. I was thinking that it might be related to the transition time set inside the ESPHome device but turning that off did nothing. I attached two videos.
https://github.com/user-attachments/assets/b355c55b-4d90-45d4-9b66-fb559b22377b
https://github.com/user-attachments/assets/9781248f-1888-4a67-942f-46c4281ef0c8
Disclaimer: I already posted this inside the forum but I think it might be better suited as a direct issue?
What version of Home Assistant Core has the issue?
2024.10.4
What was the last working version of Home Assistant Core?
2022.x.x (just updated recently from a fully working config)
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Lights
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
I run my HA OS in Virtualbox