mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Fix tplink bug changing color temp on bulbs with light effects (#121696)
This commit is contained in:
parent
c40a9ac4b5
commit
2148cfc899
@ -392,11 +392,11 @@ class TPLinkLightEffectEntity(TPLinkLightEntity):
|
|||||||
kwargs[ATTR_EFFECT], brightness=brightness, transition=transition
|
kwargs[ATTR_EFFECT], brightness=brightness, transition=transition
|
||||||
)
|
)
|
||||||
elif ATTR_COLOR_TEMP_KELVIN in kwargs:
|
elif ATTR_COLOR_TEMP_KELVIN in kwargs:
|
||||||
if self.effect:
|
if self.effect and self.effect != EFFECT_OFF:
|
||||||
# If there is an effect in progress
|
# If there is an effect in progress
|
||||||
# we have to clear the effect
|
# we have to clear the effect
|
||||||
# before we can set a color temp
|
# before we can set a color temp
|
||||||
await self._light_module.set_hsv(0, 0, brightness)
|
await self._effect_module.set_effect(LightEffect.LIGHT_EFFECTS_OFF)
|
||||||
await self._async_set_color_temp(
|
await self._async_set_color_temp(
|
||||||
kwargs[ATTR_COLOR_TEMP_KELVIN], brightness, transition
|
kwargs[ATTR_COLOR_TEMP_KELVIN], brightness, transition
|
||||||
)
|
)
|
||||||
|
@ -533,16 +533,16 @@ async def test_smart_strip_effects(hass: HomeAssistant) -> None:
|
|||||||
assert state.attributes[ATTR_EFFECT_LIST] == ["Off", "Effect1", "Effect2"]
|
assert state.attributes[ATTR_EFFECT_LIST] == ["Off", "Effect1", "Effect2"]
|
||||||
|
|
||||||
# Ensure setting color temp when an effect
|
# Ensure setting color temp when an effect
|
||||||
# is in progress calls set_hsv to clear the effect
|
# is in progress calls set_effect to clear the effect
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
"turn_on",
|
"turn_on",
|
||||||
{ATTR_ENTITY_ID: entity_id, ATTR_COLOR_TEMP_KELVIN: 4000},
|
{ATTR_ENTITY_ID: entity_id, ATTR_COLOR_TEMP_KELVIN: 4000},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
light.set_hsv.assert_called_once_with(0, 0, None)
|
light_effect.set_effect.assert_called_once_with(LightEffect.LIGHT_EFFECTS_OFF)
|
||||||
light.set_color_temp.assert_called_once_with(4000, brightness=None, transition=None)
|
light.set_color_temp.assert_called_once_with(4000, brightness=None, transition=None)
|
||||||
light.set_hsv.reset_mock()
|
light_effect.set_effect.reset_mock()
|
||||||
light.set_color_temp.reset_mock()
|
light.set_color_temp.reset_mock()
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user