mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
parent
445b0f6f94
commit
9381f187a4
@ -434,7 +434,10 @@ class YeelightLight(Light):
|
|||||||
def turn_off(self, **kwargs) -> None:
|
def turn_off(self, **kwargs) -> None:
|
||||||
"""Turn off."""
|
"""Turn off."""
|
||||||
import yeelight
|
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:
|
try:
|
||||||
self._bulb.turn_off()
|
self._bulb.turn_off(duration=duration)
|
||||||
except yeelight.BulbException as ex:
|
except yeelight.BulbException as ex:
|
||||||
_LOGGER.error("Unable to turn the bulb off: %s", ex)
|
_LOGGER.error("Unable to turn the bulb off: %s", ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user