Skip to content

Commit

Permalink
fix: add MessageType.MSP_TELEMETRY_UPDATE to _wait_for_ack to prevent…
Browse files Browse the repository at this point in the history
… deathloops (#16)
  • Loading branch information
cryptk committed May 27, 2023
1 parent 123e1d0 commit 8a65727
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyomnilogic_local/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ async def _wait_for_ack(self, ack_id: int) -> None:
_LOGGER.debug("We received a message that is not our ACK, it appears the ACK was dropped")
# If the message that we received was either a LEADMESSAGE or a BLOCK MESSAGE, lets put it back and return,
# The Omni is continuing on with life, lets not be clingy for an ACK that was dropped and will never come
# We will put this new message back into the queue and stop waiting for our ACK
if message.type in {MessageType.MSP_LEADMESSAGE, MessageType.MSP_BLOCKMESSAGE}:
# We will put this new message back into the queue and stop waiting for our ACK.
# The set below should include any message types that may be sent immediately after the Omni sends us an ACK.
# Example is:
# Us > Omni: MessageType.REQUEST_CONFIGURATION
# Omni > Us: MessageType.ACK
# Omni > Us: MessageType.MSP_LEADMESSAGE <--- Sent immediately after an ACK
if message.type in {MessageType.MSP_LEADMESSAGE, MessageType.MSP_TELEMETRY_UPDATE}:
_LOGGER.debug("Omni has sent a new message, continuing on with the communication")
await self.data_queue.put(message)
break
Expand Down

0 comments on commit 8a65727

Please sign in to comment.