use locks

This commit is contained in:
Bas Nijholt 2020-09-29 14:21:39 +02:00
commit 37f110f5d1

View file

@ -569,7 +569,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
)
lock = self._locks.get(entity_id)
if lock is None:
lock = asyncio.Lock()
lock = self._locks[entity_id] = asyncio.Lock()
async with lock:
if await self.turn_on_off_listener.maybe_cancel_adjusting(
entity_id,