diff --git a/pyvlx/api/api_event.py b/pyvlx/api/api_event.py index ea45b857..c21a36c1 100644 --- a/pyvlx/api/api_event.py +++ b/pyvlx/api/api_event.py @@ -22,12 +22,12 @@ def __init__(self, pyvlx: "PyVLX", timeout_in_seconds: int = 10): self.timeout_handle: Optional[asyncio.TimerHandle] = None async def do_api_call(self) -> None: - """Start. Sending and waiting for answer.""" + """Start. Sending and waiting for answer.""" # We check for connection before entering the semaphore section # because otherwise we might try to connect, which calls this, and we get stuck on # the semaphore. await self.pyvlx.check_connected() - + async with self.pyvlx.sem: self.pyvlx.connection.register_frame_received_cb(self.response_rec_callback) await self.send_frame() diff --git a/pyvlx/pyvlx.py b/pyvlx/pyvlx.py index ad293ba0..1a17b9ae 100644 --- a/pyvlx/pyvlx.py +++ b/pyvlx/pyvlx.py @@ -41,7 +41,7 @@ def __init__(self, self.version = None self.protocol_version = None self.klf200 = Klf200Gateway(pyvlx=self) - self.sem = asyncio.Semaphore(1) # Limit parallel commands + self.sem = asyncio.Semaphore(1) # Limit parallel commands async def connect(self) -> None: """Connect to KLF 200."""