1
mirror of https://github.com/home-assistant/core synced 2024-08-31 05:57:13 +02:00

TP Link: Don't report HS when in CT mode (#49704)

* TP Link: Don't report HS when in CT mode

* Update tests
This commit is contained in:
Bram Kragten 2021-04-27 11:19:21 +02:00 committed by GitHub
parent 0d410209d2
commit b00ccf98f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -354,7 +354,7 @@ class TPLinkSmartBulb(LightEntity):
):
color_temp = kelvin_to_mired(light_state_params[LIGHT_STATE_COLOR_TEMP])
if light_features.supported_features & SUPPORT_COLOR:
if color_temp is None and light_features.supported_features & SUPPORT_COLOR:
hue_saturation = (
light_state_params[LIGHT_STATE_HUE],
light_state_params[LIGHT_STATE_SATURATION],

View File

@ -524,8 +524,8 @@ async def test_light(hass: HomeAssistant, light_mock_data: LightMockData) -> Non
state = hass.states.get("light.light1")
assert state.state == "on"
assert state.attributes["brightness"] == 51
assert state.attributes["hs_color"] == (110, 90)
assert state.attributes["color_temp"] == 222
assert "hs_color" not in state.attributes
assert light_state["on_off"] == 1
await hass.services.async_call(
@ -541,6 +541,7 @@ async def test_light(hass: HomeAssistant, light_mock_data: LightMockData) -> Non
assert state.state == "on"
assert state.attributes["brightness"] == 56
assert state.attributes["hs_color"] == (23, 27)
assert "color_temp" not in state.attributes
assert light_state["brightness"] == 22
assert light_state["hue"] == 23
assert light_state["saturation"] == 27
@ -580,8 +581,8 @@ async def test_light(hass: HomeAssistant, light_mock_data: LightMockData) -> Non
state = hass.states.get("light.light1")
assert state.state == "on"
assert state.attributes["brightness"] == 168
assert state.attributes["hs_color"] == (77, 78)
assert state.attributes["color_temp"] == 156
assert "hs_color" not in state.attributes
assert light_state["brightness"] == 66
assert light_state["hue"] == 77
assert light_state["saturation"] == 78