mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Remove old compatibility code (and add new warning) in lifx (#132730)
This commit is contained in:
parent
da0454e24e
commit
07d8778870
@ -16,10 +16,8 @@ from homeassistant.components.light import (
|
||||
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,
|
||||
)
|
||||
@ -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:
|
||||
|
@ -35,7 +35,6 @@ from homeassistant.components.light import (
|
||||
ATTR_COLOR_TEMP_KELVIN,
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_KELVIN,
|
||||
ATTR_RGB_COLOR,
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
ATTR_TRANSITION,
|
||||
@ -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
|
||||
)
|
||||
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user