Skip to content

Commit 8d2315d

Browse files
authored
Register the command response listener before sending (#248)
1 parent 8c64072 commit 8d2315d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

zigpy_deconz/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,16 +576,15 @@ async def _command(self, cmd, **kwargs):
576576

577577
async with self._command_lock(priority=self._get_command_priority(command)):
578578
seq = self._seq
579-
580-
LOGGER.debug("Sending %s%s (seq=%s)", cmd, kwargs, seq)
581-
self._uart.send(command.replace(seq=seq).serialize())
582-
583579
self._seq = (self._seq % 255) + 1
584580

585581
fut = asyncio.Future()
586582
self._awaiting[seq][cmd].append(fut)
587583

588584
try:
585+
LOGGER.debug("Sending %s%s (seq=%s)", cmd, kwargs, seq)
586+
self._uart.send(command.replace(seq=seq).serialize())
587+
589588
async with asyncio_timeout(COMMAND_TIMEOUT):
590589
return await fut
591590
except asyncio.TimeoutError:

0 commit comments

Comments
 (0)