mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Restore color_temp handling for lifx.set_state (#82067)
fixes undefined
This commit is contained in:
parent
48f6c9a486
commit
42652872f6
@ -16,6 +16,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_BRIGHTNESS_PCT,
|
ATTR_BRIGHTNESS_PCT,
|
||||||
ATTR_COLOR_NAME,
|
ATTR_COLOR_NAME,
|
||||||
|
ATTR_COLOR_TEMP,
|
||||||
ATTR_COLOR_TEMP_KELVIN,
|
ATTR_COLOR_TEMP_KELVIN,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_KELVIN,
|
ATTR_KELVIN,
|
||||||
@ -114,6 +115,12 @@ def find_hsbk(hass: HomeAssistant, **kwargs: Any) -> list[float | int | None] |
|
|||||||
kelvin = kwargs.pop(ATTR_KELVIN)
|
kelvin = kwargs.pop(ATTR_KELVIN)
|
||||||
saturation = 0
|
saturation = 0
|
||||||
|
|
||||||
|
if ATTR_COLOR_TEMP in kwargs:
|
||||||
|
kelvin = color_util.color_temperature_mired_to_kelvin(
|
||||||
|
kwargs.pop(ATTR_COLOR_TEMP)
|
||||||
|
)
|
||||||
|
saturation = 0
|
||||||
|
|
||||||
if ATTR_COLOR_TEMP_KELVIN in kwargs:
|
if ATTR_COLOR_TEMP_KELVIN in kwargs:
|
||||||
kelvin = kwargs.pop(ATTR_COLOR_TEMP_KELVIN)
|
kelvin = kwargs.pop(ATTR_COLOR_TEMP_KELVIN)
|
||||||
saturation = 0
|
saturation = 0
|
||||||
|
@ -1539,6 +1539,15 @@ async def test_lifx_set_state_kelvin(hass: HomeAssistant) -> None:
|
|||||||
assert bulb.set_color.calls[0][0][0] == [32000, 0, 25700, 2700]
|
assert bulb.set_color.calls[0][0][0] == [32000, 0, 25700, 2700]
|
||||||
bulb.set_color.reset_mock()
|
bulb.set_color.reset_mock()
|
||||||
|
|
||||||
|
await hass.services.async_call(
|
||||||
|
DOMAIN,
|
||||||
|
"set_state",
|
||||||
|
{ATTR_ENTITY_ID: entity_id, ATTR_BRIGHTNESS: 255, ATTR_COLOR_TEMP: 400},
|
||||||
|
blocking=True,
|
||||||
|
)
|
||||||
|
assert bulb.set_color.calls[0][0][0] == [32000, 0, 65535, 2500]
|
||||||
|
bulb.set_color.reset_mock()
|
||||||
|
|
||||||
|
|
||||||
async def test_infrared_color_bulb(hass: HomeAssistant) -> None:
|
async def test_infrared_color_bulb(hass: HomeAssistant) -> None:
|
||||||
"""Test setting infrared with a color bulb."""
|
"""Test setting infrared with a color bulb."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user