Fix tplink bug changing color temp on bulbs with light effects (#121696)
This commit is contained in:
parent
c40a9ac4b5
commit
2148cfc899
2 changed files with 5 additions and 5 deletions
|
@ -392,11 +392,11 @@ class TPLinkLightEffectEntity(TPLinkLightEntity):
|
|||
kwargs[ATTR_EFFECT], brightness=brightness, transition=transition
|
||||
)
|
||||
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
|
||||
# we have to clear the effect
|
||||
# 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(
|
||||
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"]
|
||||
|
||||
# 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(
|
||||
LIGHT_DOMAIN,
|
||||
"turn_on",
|
||||
{ATTR_ENTITY_ID: entity_id, ATTR_COLOR_TEMP_KELVIN: 4000},
|
||||
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_hsv.reset_mock()
|
||||
light_effect.set_effect.reset_mock()
|
||||
light.set_color_temp.reset_mock()
|
||||
|
||||
await hass.services.async_call(
|
||||
|
|
Loading…
Add table
Reference in a new issue