mirror of
https://github.com/meshtastic/python.git
synced 2025-12-30 19:37:52 -05:00
Merge pull request #383 from meshtastic/reboot-ota
add reboot to ota command for testing purposes.
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user