diff --git a/homeassistant/components/yeelight/__init__.py b/homeassistant/components/yeelight/__init__.py index 8a5c1e81a93..7318b088ab4 100644 --- a/homeassistant/components/yeelight/__init__.py +++ b/homeassistant/components/yeelight/__init__.py @@ -259,8 +259,6 @@ class YeelightDevice: _LOGGER.error("Unable to turn the bulb on: %s", ex) return - self.update() - def turn_off(self, duration=DEFAULT_TRANSITION): """Turn off device.""" import yeelight @@ -271,8 +269,6 @@ class YeelightDevice: _LOGGER.error("Unable to turn the bulb on: %s", ex) return - self.update() - def update(self): """Read new properties from the device.""" if not self.bulb: diff --git a/homeassistant/components/yeelight/light.py b/homeassistant/components/yeelight/light.py index d208d1f72b0..22e5d9cc9ce 100644 --- a/homeassistant/components/yeelight/light.py +++ b/homeassistant/components/yeelight/light.py @@ -494,6 +494,7 @@ class YeelightLight(Light): except yeelight.BulbException as ex: _LOGGER.error("Unable to set the defaults: %s", ex) return + self.device.update() def turn_off(self, **kwargs) -> None: """Turn off.""" @@ -502,6 +503,7 @@ class YeelightLight(Light): duration = int(kwargs.get(ATTR_TRANSITION) * 1000) # kwarg in s self.device.turn_off(duration=duration) + self.device.update() def set_mode(self, mode: str): """Set a power mode.""" @@ -509,11 +511,10 @@ class YeelightLight(Light): try: self._bulb.set_power_mode(yeelight.enums.PowerMode[mode.upper()]) + self.device.update() except yeelight.BulbException as ex: _LOGGER.error("Unable to set the power mode: %s", ex) - self.device.update() - def start_flow(self, transitions, count=0, action=ACTION_RECOVER): """Start flow.""" import yeelight