From 3187874c481b88edc7d126fe44457bcf34510f47 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Fri, 5 Mar 2021 10:18:49 +0800 Subject: [PATCH] properly ignore messages we sent --- meshtastic/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index 2dffb06..90641c0 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -521,7 +521,7 @@ class MeshInterface: asDict = google.protobuf.json_format.MessageToDict(fromRadio) if fromRadio.HasField("my_info"): self.myInfo = fromRadio.my_info - logging.debug(f"Received myinfo: {fromRadio.my_info}") + logging.debug(f"Received myinfo: {stripnl(fromRadio.my_info)}") failmsg = None # Check for app too old @@ -622,6 +622,14 @@ class MeshInterface: # want the raw protobuf, so we provide it in "raw" asDict["raw"] = meshPacket + # from might be missing if the nodenum was zero. + if not "from" in asDict: + asDict["from"] = 0 + logging.error(f"Device returned a packet we sent, ignoring: {stripnl(asDict)}") + return + if not "to" in asDict: + asDict["to"] = 0 + # /add fromId and toId fields based on the node ID asDict["fromId"] = self._nodeNumToId(asDict["from"]) asDict["toId"] = self._nodeNumToId(asDict["to"])