mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Use ATTR_COLOR_TEMP_KELVIN in baf light (#132692)
This commit is contained in:
parent
b1791aae63
commit
549afbc27e
@ -8,16 +8,13 @@ from aiobafi6 import Device, OffOnAuto
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
ColorMode,
|
ColorMode,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.util.color import (
|
from homeassistant.util.color import color_temperature_kelvin_to_mired
|
||||||
color_temperature_kelvin_to_mired,
|
|
||||||
color_temperature_mired_to_kelvin,
|
|
||||||
)
|
|
||||||
|
|
||||||
from . import BAFConfigEntry
|
from . import BAFConfigEntry
|
||||||
from .entity import BAFEntity
|
from .entity import BAFEntity
|
||||||
@ -94,8 +91,6 @@ class BAFStandaloneLight(BAFLight):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn on the light."""
|
"""Turn on the light."""
|
||||||
if (color_temp := kwargs.get(ATTR_COLOR_TEMP)) is not None:
|
if (color_temp := kwargs.get(ATTR_COLOR_TEMP_KELVIN)) is not None:
|
||||||
self._device.light_color_temperature = color_temperature_mired_to_kelvin(
|
self._device.light_color_temperature = color_temp
|
||||||
color_temp
|
|
||||||
)
|
|
||||||
await super().async_turn_on(**kwargs)
|
await super().async_turn_on(**kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user