fix: throw propper exceptions and cleanup code

This commit is contained in:
Sergio Conde
2026-02-01 11:39:09 +01:00
parent bf580c36ae
commit 4d8430d360
3 changed files with 31 additions and 24 deletions

View File

@@ -669,17 +669,17 @@ class Node:
def startOTA(
self,
mode: admin_pb2.OTAMode.ValueType,
hash: bytes,
ota_mode: admin_pb2.OTAMode.ValueType,
ota_file_hash: bytes,
):
"""Tell the node to start OTA mode (firmware >= 2.7.18)."""
if self != self.iface.localNode:
raise Exception("startOTA only possible in local node")
raise ValueError("startOTA only possible in local node")
self.ensureSessionKey()
p = admin_pb2.AdminMessage()
p.ota_request.reboot_ota_mode=mode
p.ota_request.ota_hash=hash
p.ota_request.reboot_ota_mode = ota_mode
p.ota_request.ota_hash = ota_file_hash
return self._sendAdmin(p)