mirror of
https://github.com/meshtastic/python.git
synced 2026-01-29 01:51:11 -05:00
Add get device metadata admin message
This commit is contained in:
@@ -502,6 +502,14 @@ class Node:
|
||||
|
||||
return self._sendAdmin(p)
|
||||
|
||||
def getMetadata(self, secs: int = 10):
|
||||
"""Tell the node to shutdown."""
|
||||
p = admin_pb2.AdminMessage()
|
||||
p.get_device_metadata_request = True
|
||||
logging.info(f"Requesting device metadata")
|
||||
|
||||
return self._sendAdmin(p, wantResponse=True, onResponse=self.onRequestGetMetadata)
|
||||
|
||||
def _fixupChannels(self):
|
||||
"""Fixup indexes and add disabled channels as needed"""
|
||||
|
||||
@@ -525,6 +533,15 @@ class Node:
|
||||
index += 1
|
||||
|
||||
|
||||
def onRequestGetMetadata(self, p):
|
||||
"""Handle the response packet for requesting device metadata getMetadata()"""
|
||||
logging.debug(f'onRequestGetMetadata() p:{p}')
|
||||
c = p["decoded"]["admin"]["raw"].get_device_metadata_response
|
||||
self._timeout.reset() # We made foreward progress
|
||||
logging.debug(f"Received metadata {stripnl(c)}")
|
||||
print(f"\nfirmware_version: {c.firmware_version}")
|
||||
print(f"device_state_version: {c.device_state_version}")
|
||||
|
||||
def onResponseRequestChannel(self, p):
|
||||
"""Handle the response packet for requesting a channel _requestChannel()"""
|
||||
logging.debug(f'onResponseRequestChannel() p:{p}')
|
||||
|
||||
Reference in New Issue
Block a user