From cfb87697466c88e4cd1cc2b01f0d81b853fc52fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 10 Oct 2022 16:59:01 +0200 Subject: [PATCH] add reeboot to ota command for testing purposes. This is a developer only command for now :-) --- meshtastic/__main__.py | 7 +++++++ meshtastic/node.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 6c2b107..135f166 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -273,6 +273,10 @@ def onConnected(interface): closeNow = True interface.getNode(args.dest).reboot() + if args.reboot_ota: + closeNow = True + interface.getNode(args.dest).rebootOTA(); + if args.shutdown: closeNow = True interface.getNode(args.dest).shutdown() @@ -886,6 +890,9 @@ def initParser(): parser.add_argument( "--reboot", help="Tell the destination node to reboot", action="store_true") + parser.add_argument( + "--reboot-ota", help="Tell the destination node to reboot into factory firmware", action="store_true") + parser.add_argument( "--shutdown", help="Tell the destination node to shutdown", action="store_true") diff --git a/meshtastic/node.py b/meshtastic/node.py index 6f719c5..c73d7a4 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -458,6 +458,14 @@ class Node: return self._sendAdmin(p) + def rebootOTA(self, secs: int = 10): + """Tell the node to reboot into factory firmware.""" + p = admin_pb2.AdminMessage() + p.reboot_ota_seconds = secs + logging.info(f"Telling node to reboot to OTA in {secs} seconds") + + return self._sendAdmin(p) + def shutdown(self, secs: int = 10): """Tell the node to shutdown.""" p = admin_pb2.AdminMessage()