Skip to content

Commit

Permalink
Update echonetapiclient.py
Browse files Browse the repository at this point in the history
Probable fix for issue #75
  • Loading branch information
scottyphillips authored Oct 8, 2024
1 parent c361e6d commit 19e56c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pychonet/echonetapiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async def echonetMessage(self, host, deojgc, deojcc, deojci, esv, opc):
# Wait up to 20(0.1*200) seconds depending on the Echonet specifications.
await asyncio.sleep(0.1)
# if tx_tid is not in message list then the message listener has received the message
if self._message_list.get(tx_tid) is None:
if not self._message_list.get(tx_tid):
# Check OPC count in results
if not is_discover and tx_tid in self._opc_counts:
res_opc_count = self._opc_counts[tx_tid]
Expand Down

3 comments on commit 19e56c3

@nao-pon
Copy link
Collaborator

@nao-pon nao-pon commented on 19e56c3 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not in favor of this change.

To determine whether the UDP request was successful, L.211 in echonetMessageReceived() deletes the key TID from self._message_list. Since this is a loop to wait for the deletion, it is necessary to check that the key TID does not exist.

Therefore, I think it should remain as it is: if self._message_list.get(tx_tid) is None:.

@scottyphillips
Copy link
Owner Author

@scottyphillips scottyphillips commented on 19e56c3 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nao-pon there is a problem where the TID for that particular GETC transaction is not being correctly erased, and it is remaining as {} for the full 30 seconds.

Having looked at the code a bit more this morning, I do see how it would be populated with {} during GETC. What I don’t understand is why it is fully timing out.

@scottyphillips
Copy link
Owner Author

@scottyphillips scottyphillips commented on 19e56c3 Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the real issue is possibly in the echonet_received function, it’s not correctly erasing the TID dict, leaving it as {} which is what is applicable for GETC messages. It’s possibly a unique issue to Mitsubishis

There is definitely an issue however with the way it is processing those incoming packets.

Please sign in to comment.