Skip to content

Commit

Permalink
Migrate abode lights to use Kelvin (#132690)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Dec 9, 2024
1 parent f210b74 commit cd39e4a
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions homeassistant/components/abode/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@

from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_COLOR_TEMP_KELVIN,
ATTR_HS_COLOR,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util.color import (
color_temperature_kelvin_to_mired,
color_temperature_mired_to_kelvin,
)

from . import AbodeSystem
from .const import DOMAIN
Expand All @@ -47,10 +43,8 @@ class AbodeLight(AbodeDevice, LightEntity):

def turn_on(self, **kwargs: Any) -> None:
"""Turn on the light."""
if ATTR_COLOR_TEMP in kwargs and self._device.is_color_capable:
self._device.set_color_temp(
int(color_temperature_mired_to_kelvin(kwargs[ATTR_COLOR_TEMP]))
)
if ATTR_COLOR_TEMP_KELVIN in kwargs and self._device.is_color_capable:
self._device.set_color_temp(kwargs[ATTR_COLOR_TEMP_KELVIN])
return

if ATTR_HS_COLOR in kwargs and self._device.is_color_capable:
Expand Down Expand Up @@ -85,10 +79,10 @@ def brightness(self) -> int | None:
return None

@property
def color_temp(self) -> int | None:
def color_temp_kelvin(self) -> int | None:
"""Return the color temp of the light."""
if self._device.has_color:
return color_temperature_kelvin_to_mired(self._device.color_temp)
return int(self._device.color_temp)
return None

@property
Expand Down

0 comments on commit cd39e4a

Please sign in to comment.