Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions homeassistant/components/lifx/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
ATTR_BRIGHTNESS,
ATTR_BRIGHTNESS_PCT,
ATTR_COLOR_NAME,
ATTR_COLOR_TEMP,
ATTR_COLOR_TEMP_KELVIN,
ATTR_HS_COLOR,
ATTR_KELVIN,
ATTR_RGB_COLOR,
ATTR_XY_COLOR,
)
Expand Down Expand Up @@ -114,18 +112,13 @@ def find_hsbk(hass: HomeAssistant, **kwargs: Any) -> list[float | int | None] |
saturation = int(saturation / 100 * 65535)
kelvin = 3500

if ATTR_KELVIN in kwargs:
if "color_temp" in kwargs: # old ATTR_COLOR_TEMP
# added in 2025.1, can be removed in 2026.1
_LOGGER.warning(
"The 'kelvin' parameter is deprecated. Please use 'color_temp_kelvin' for"
"The 'color_temp' parameter is deprecated. Please use 'color_temp_kelvin' for"
" all service calls"
)
kelvin = kwargs.pop(ATTR_KELVIN)
saturation = 0

if ATTR_COLOR_TEMP in kwargs:
kelvin = color_util.color_temperature_mired_to_kelvin(
kwargs.pop(ATTR_COLOR_TEMP)
)
kelvin = color_util.color_temperature_mired_to_kelvin(kwargs.pop("color_temp"))
saturation = 0

if ATTR_COLOR_TEMP_KELVIN in kwargs:
Expand Down
12 changes: 1 addition & 11 deletions tests/components/lifx/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
ATTR_COLOR_TEMP_KELVIN,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_KELVIN,
ATTR_RGB_COLOR,
ATTR_SUPPORTED_COLOR_MODES,
ATTR_TRANSITION,
Expand Down Expand Up @@ -1719,7 +1718,7 @@ async def test_lifx_set_state_color(hass: HomeAssistant) -> None:


async def test_lifx_set_state_kelvin(hass: HomeAssistant) -> None:
"""Test set_state works with old and new kelvin parameter names."""
"""Test set_state works with kelvin parameter names."""
already_migrated_config_entry = MockConfigEntry(
domain=DOMAIN, data={CONF_HOST: "127.0.0.1"}, unique_id=SERIAL
)
Expand Down Expand Up @@ -1748,15 +1747,6 @@ async def test_lifx_set_state_kelvin(hass: HomeAssistant) -> None:
assert bulb.set_power.calls[0][0][0] is False
bulb.set_power.reset_mock()

await hass.services.async_call(
DOMAIN,
"set_state",
{ATTR_ENTITY_ID: entity_id, ATTR_BRIGHTNESS: 255, ATTR_KELVIN: 3500},
blocking=True,
)
assert bulb.set_color.calls[0][0][0] == [32000, 0, 65535, 3500]
bulb.set_color.reset_mock()

await hass.services.async_call(
DOMAIN,
"set_state",
Expand Down