mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-15 00:04:05 +02:00
cancel early
This commit is contained in:
parent
f51c3517b9
commit
e0364b13cb
1 changed files with 9 additions and 6 deletions
|
|
@ -2353,13 +2353,16 @@ class AdaptiveLightingManager:
|
|||
entity_id,
|
||||
event.context.id,
|
||||
)
|
||||
# Skip resetting here because `_service_interceptor_turn_on_handler`
|
||||
# ran *just* before this and already reset the light and populated
|
||||
# `self.last_service_data` with the new data.
|
||||
|
||||
if self.is_proactively_adapting(event.context.id):
|
||||
_LOGGER.debug("We should cancel here?")
|
||||
else:
|
||||
self.reset(entity_id, reset_manual_control=False)
|
||||
_LOGGER.debug(
|
||||
"Skipping reactive adaptation of light %s with context.id='%s'",
|
||||
entity_id,
|
||||
event.context.id,
|
||||
)
|
||||
return
|
||||
|
||||
self.reset(entity_id, reset_manual_control=False)
|
||||
lock = self.turn_off_locks.setdefault(entity_id, asyncio.Lock())
|
||||
async with lock:
|
||||
if await self.just_turned_off(entity_id):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue