Fix lifx service call interference (#77770)
* Fix #77735 by restoring the wait to let state settle Signed-off-by: Avi Miller <me@dje.li> * Skip the asyncio.sleep during testing Signed-off-by: Avi Miller <me@dje.li> * Patch out asyncio.sleep for lifx tests Signed-off-by: Avi Miller <me@dje.li> * Patch out a constant instead of overriding asyncio.sleep directly Signed-off-by: Avi Miller <me@dje.li> Signed-off-by: Avi Miller <me@dje.li>
This commit is contained in:
parent
a9c19e2ffb
commit
0e63a4c091
5 changed files with 25 additions and 5 deletions
|
@ -39,7 +39,7 @@ from .manager import (
|
|||
)
|
||||
from .util import convert_8_to_16, convert_16_to_8, find_hsbk, lifx_features, merge_hsbk
|
||||
|
||||
COLOR_ZONE_POPULATE_DELAY = 0.3
|
||||
LIFX_STATE_SETTLE_DELAY = 0.3
|
||||
|
||||
SERVICE_LIFX_SET_STATE = "set_state"
|
||||
|
||||
|
@ -231,6 +231,9 @@ class LIFXLight(LIFXEntity, LightEntity):
|
|||
if power_off:
|
||||
await self.set_power(False, duration=fade)
|
||||
|
||||
# Avoid state ping-pong by holding off updates as the state settles
|
||||
await asyncio.sleep(LIFX_STATE_SETTLE_DELAY)
|
||||
|
||||
# Update when the transition starts and ends
|
||||
await self.update_during_transition(fade)
|
||||
|
||||
|
@ -338,7 +341,7 @@ class LIFXStrip(LIFXColor):
|
|||
# Zone brightness is not reported when powered off
|
||||
if not self.is_on and hsbk[HSBK_BRIGHTNESS] is None:
|
||||
await self.set_power(True)
|
||||
await asyncio.sleep(COLOR_ZONE_POPULATE_DELAY)
|
||||
await asyncio.sleep(LIFX_STATE_SETTLE_DELAY)
|
||||
await self.update_color_zones()
|
||||
await self.set_power(False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue