Skip to content

Commit

Permalink
Set default min/max color temperature in hue lights (#133548)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Dec 19, 2024
1 parent 681863f commit ddd2ba6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions homeassistant/components/hue/v1/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_TRANSITION,
DEFAULT_MAX_KELVIN,
DEFAULT_MIN_KELVIN,
EFFECT_COLORLOOP,
EFFECT_RANDOM,
FLASH_LONG,
Expand Down Expand Up @@ -447,28 +449,28 @@ def color_temp_kelvin(self) -> int | None:
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)

@property
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)

Expand Down

0 comments on commit ddd2ba6

Please sign in to comment.