mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Set default min/max color temperature in hue lights (#133548)
This commit is contained in:
parent
681863f80e
commit
ddd2ba6c4a
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user