mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix tplink color temp conversion (#68484)
This commit is contained in:
parent
574f4710aa
commit
16655c4ccc
@ -87,7 +87,10 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
|||||||
|
|
||||||
# Handle turning to temp mode
|
# Handle turning to temp mode
|
||||||
if ATTR_COLOR_TEMP in kwargs:
|
if ATTR_COLOR_TEMP in kwargs:
|
||||||
color_tmp = mired_to_kelvin(int(kwargs[ATTR_COLOR_TEMP]))
|
# Handle temp conversion mireds -> kelvin being slightly outside of valid range
|
||||||
|
kelvin = mired_to_kelvin(int(kwargs[ATTR_COLOR_TEMP]))
|
||||||
|
kelvin_range = self.device.valid_temperature_range
|
||||||
|
color_tmp = max(kelvin_range.min, min(kelvin_range.max, kelvin))
|
||||||
_LOGGER.debug("Changing color temp to %s", color_tmp)
|
_LOGGER.debug("Changing color temp to %s", color_tmp)
|
||||||
await self.device.set_color_temp(
|
await self.device.set_color_temp(
|
||||||
color_tmp, brightness=brightness, transition=transition
|
color_tmp, brightness=brightness, transition=transition
|
||||||
|
Loading…
x
Reference in New Issue
Block a user