From 9381f187a41c92bc780b7c715bee38fb6e603f9c Mon Sep 17 00:00:00 2001 From: Teemu R Date: Fri, 29 Sep 2017 12:04:22 +0200 Subject: [PATCH] yeelight: allow turn_off transitions, fixes #9602 (#9605) --- homeassistant/components/light/yeelight.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/light/yeelight.py b/homeassistant/components/light/yeelight.py index 82436334072..96d51984568 100644 --- a/homeassistant/components/light/yeelight.py +++ b/homeassistant/components/light/yeelight.py @@ -434,7 +434,10 @@ class YeelightLight(Light): def turn_off(self, **kwargs) -> None: """Turn off.""" import yeelight + duration = int(self.config[CONF_TRANSITION]) # in ms + if ATTR_TRANSITION in kwargs: # passed kwarg overrides config + duration = int(kwargs.get(ATTR_TRANSITION) * 1000) # kwarg in s try: - self._bulb.turn_off() + self._bulb.turn_off(duration=duration) except yeelight.BulbException as ex: _LOGGER.error("Unable to turn the bulb off: %s", ex)