mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +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_FLASH,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
|
DEFAULT_MAX_KELVIN,
|
||||||
|
DEFAULT_MIN_KELVIN,
|
||||||
EFFECT_COLORLOOP,
|
EFFECT_COLORLOOP,
|
||||||
EFFECT_RANDOM,
|
EFFECT_RANDOM,
|
||||||
FLASH_LONG,
|
FLASH_LONG,
|
||||||
@ -447,13 +449,13 @@ class HueLight(CoordinatorEntity, LightEntity):
|
|||||||
def max_color_temp_kelvin(self) -> int:
|
def max_color_temp_kelvin(self) -> int:
|
||||||
"""Return the coldest color_temp_kelvin that this light supports."""
|
"""Return the coldest color_temp_kelvin that this light supports."""
|
||||||
if self.is_group:
|
if self.is_group:
|
||||||
return super().max_color_temp_kelvin
|
return DEFAULT_MAX_KELVIN
|
||||||
|
|
||||||
min_mireds = self.light.controlcapabilities.get("ct", {}).get("min")
|
min_mireds = self.light.controlcapabilities.get("ct", {}).get("min")
|
||||||
|
|
||||||
# We filter out '0' too, which can be incorrectly reported by 3rd party buls
|
# We filter out '0' too, which can be incorrectly reported by 3rd party buls
|
||||||
if not min_mireds:
|
if not min_mireds:
|
||||||
return super().max_color_temp_kelvin
|
return DEFAULT_MAX_KELVIN
|
||||||
|
|
||||||
return color_util.color_temperature_mired_to_kelvin(min_mireds)
|
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:
|
def min_color_temp_kelvin(self) -> int:
|
||||||
"""Return the warmest color_temp_kelvin that this light supports."""
|
"""Return the warmest color_temp_kelvin that this light supports."""
|
||||||
if self.is_group:
|
if self.is_group:
|
||||||
return super().min_color_temp_kelvin
|
return DEFAULT_MIN_KELVIN
|
||||||
if self.is_livarno:
|
if self.is_livarno:
|
||||||
return 500
|
return 2000 # 500 mireds
|
||||||
|
|
||||||
max_mireds = self.light.controlcapabilities.get("ct", {}).get("max")
|
max_mireds = self.light.controlcapabilities.get("ct", {}).get("max")
|
||||||
|
|
||||||
if not max_mireds:
|
if not max_mireds:
|
||||||
return super().min_color_temp_kelvin
|
return DEFAULT_MIN_KELVIN
|
||||||
|
|
||||||
return color_util.color_temperature_mired_to_kelvin(max_mireds)
|
return color_util.color_temperature_mired_to_kelvin(max_mireds)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user