Workaround brightness transition delay from off in older yeelight models (#58774)

This commit is contained in:
J. Nick Koston 2021-10-31 10:11:07 -05:00 committed by GitHub
parent f94bbf351d
commit faecc90b38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 1 deletions

View file

@ -63,6 +63,7 @@ from . import (
DATA_DEVICE,
DATA_UPDATED,
DOMAIN,
MODELS_WITH_DELAYED_ON_TRANSITION,
POWER_STATE_CHANGE_TIME,
YEELIGHT_FLOW_TRANSITION_SCHEMA,
YeelightEntity,
@ -614,7 +615,10 @@ class YeelightGenericLight(YeelightEntity, LightEntity):
"""Set bulb brightness."""
if not brightness:
return
if math.floor(self.brightness) == math.floor(brightness):
if (
math.floor(self.brightness) == math.floor(brightness)
and self._bulb.model not in MODELS_WITH_DELAYED_ON_TRANSITION
):
_LOGGER.debug("brightness already set to: %s", brightness)
# Already set, and since we get pushed updates
# we avoid setting it again to ensure we do not