From 616a3ab70681fad02ac1e11b9ff41b5c6c8b8bb2 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Sat, 8 Oct 2022 12:47:48 +0200 Subject: [PATCH] Catch RoutingApp on requestGetMetadata --- meshtastic/node.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meshtastic/node.py b/meshtastic/node.py index 79f0a6e..9e74796 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -516,6 +516,17 @@ class Node: def onRequestGetMetadata(self, p): """Handle the response packet for requesting device metadata getMetadata()""" logging.debug(f'onRequestGetMetadata() p:{p}') + + if p["decoded"]["portnum"] == portnums_pb2.PortNum.Name(portnums_pb2.PortNum.ROUTING_APP): + print('No admin, error reason: ', p["decoded"]["routing"]["errorReason"]) + if p["decoded"]["routing"]["errorReason"] != "NONE": + logging.warning(f'Metadata request failed, error reason: {p["decoded"]["routing"]["errorReason"]}') + self._timeout.expireTime = time.time() # Do not wait any longer + return # Don't try to parse this routing message + logging.debug(f"Retrying metadata request.") + self.getMetadata() + return + c = p["decoded"]["admin"]["raw"].get_device_metadata_response self._timeout.reset() # We made foreward progress logging.debug(f"Received metadata {stripnl(c)}")