mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Fix KNX light tunable white rounding error (#26364)
* KNX light - tunable white rounding error mitigate rounding errors in kelvin - mired conversion for lights with relative color temperature fixes https://github.com/home-assistant/home-assistant/issues/26357 * typo _min_kelvin <> _max_kelvin * black
This commit is contained in:
parent
48dea59517
commit
a5ccb03e2e
@ -305,7 +305,10 @@ class KNXLight(Light):
|
||||
await self.device.set_color_temperature(kelvin)
|
||||
elif self.device.supports_tunable_white and update_color_temp:
|
||||
# calculate relative_ct from Kelvin to fit typical KNX devices
|
||||
kelvin = int(color_util.color_temperature_mired_to_kelvin(mireds))
|
||||
kelvin = min(
|
||||
self._max_kelvin,
|
||||
int(color_util.color_temperature_mired_to_kelvin(mireds)),
|
||||
)
|
||||
relative_ct = int(
|
||||
255
|
||||
* (kelvin - self._min_kelvin)
|
||||
|
Loading…
x
Reference in New Issue
Block a user