diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index d08a9fd..dc46a86 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -285,6 +285,10 @@ def onConnected(interface): closeNow = True interface.getNode(args.dest).factoryReset() + if args.reset_nodedb: + closeNow = True + interface.getNode(args.dest).resetNodeDb() + if args.sendtext: closeNow = True channelIndex = 0 @@ -876,6 +880,9 @@ def initParser(): parser.add_argument( "--factory-reset", help="Tell the destination node to install the default config", action="store_true") + + parser.add_argument( + "--reset-nodedb", help="Tell the destination node clear its list of nodes", action="store_true") parser.add_argument( "--reply", help="Reply to received messages", diff --git a/meshtastic/node.py b/meshtastic/node.py index d48e572..ba06eb0 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -482,6 +482,14 @@ class Node: return self._sendAdmin(p) + def resetNodeDb(self): + """Tell the node to reset its list of nodes.""" + p = admin_pb2.AdminMessage() + p.nodedb_reset = True + logging.info(f"Telling node to reset the NodeDB") + + return self._sendAdmin(p) + def _fixupChannels(self): """Fixup indexes and add disabled channels as needed"""