Fix WLED light transition (#30490)
parent
049ced63b1
commit
4ea0754094
|
@ -143,8 +143,13 @@ class WLEDLight(Light, WLEDDeviceEntity):
|
|||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn off the light."""
|
||||
data = {ATTR_ON: False, ATTR_SEGMENT_ID: self._segment}
|
||||
|
||||
if ATTR_TRANSITION in kwargs:
|
||||
data[ATTR_TRANSITION] = kwargs[ATTR_TRANSITION] * 1000
|
||||
|
||||
try:
|
||||
await self.wled.light(on=False)
|
||||
await self.wled.light(**data)
|
||||
self._state = False
|
||||
except WLEDError:
|
||||
_LOGGER.error("An error occurred while turning off WLED light.")
|
||||
|
@ -168,7 +173,7 @@ class WLEDLight(Light, WLEDDeviceEntity):
|
|||
data[ATTR_COLOR_PRIMARY] = color_util.color_hsv_to_RGB(hue, sat, 100)
|
||||
|
||||
if ATTR_TRANSITION in kwargs:
|
||||
data[ATTR_TRANSITION] = kwargs[ATTR_TRANSITION]
|
||||
data[ATTR_TRANSITION] = kwargs[ATTR_TRANSITION] * 1000
|
||||
|
||||
if ATTR_BRIGHTNESS in kwargs:
|
||||
data[ATTR_BRIGHTNESS] = kwargs[ATTR_BRIGHTNESS]
|
||||
|
|
|
@ -90,7 +90,7 @@ async def test_switch_change_state(
|
|||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN,
|
||||
SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: "light.wled_rgb_light"},
|
||||
{ATTR_ENTITY_ID: "light.wled_rgb_light", ATTR_TRANSITION: 5},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
|
Loading…
Reference in New Issue