Set default min/max color temperature in hue lights (#133548)

This commit is contained in:
epenet 2024-12-19 08:36:29 +01:00 committed by GitHub
parent 681863f80e
commit ddd2ba6c4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,6 +17,8 @@ from homeassistant.components.light import (
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
DEFAULT_MAX_KELVIN,
DEFAULT_MIN_KELVIN,
EFFECT_COLORLOOP,
EFFECT_RANDOM,
FLASH_LONG,
@ -447,13 +449,13 @@ class HueLight(CoordinatorEntity, LightEntity):
def max_color_temp_kelvin(self) -> int:
"""Return the coldest color_temp_kelvin that this light supports."""
if self.is_group:
return super().max_color_temp_kelvin
return DEFAULT_MAX_KELVIN
min_mireds = self.light.controlcapabilities.get("ct", {}).get("min")
# We filter out '0' too, which can be incorrectly reported by 3rd party buls
if not min_mireds:
return super().max_color_temp_kelvin
return DEFAULT_MAX_KELVIN
return color_util.color_temperature_mired_to_kelvin(min_mireds)
@ -461,14 +463,14 @@ class HueLight(CoordinatorEntity, LightEntity):
def min_color_temp_kelvin(self) -> int:
"""Return the warmest color_temp_kelvin that this light supports."""
if self.is_group:
return super().min_color_temp_kelvin
return DEFAULT_MIN_KELVIN
if self.is_livarno:
return 500
return 2000 # 500 mireds
max_mireds = self.light.controlcapabilities.get("ct", {}).get("max")
if not max_mireds:
return super().min_color_temp_kelvin
return DEFAULT_MIN_KELVIN
return color_util.color_temperature_mired_to_kelvin(max_mireds)