-
Notifications
You must be signed in to change notification settings - Fork 3
/
print-nodedb.py
49 lines (44 loc) · 2.1 KB
/
print-nodedb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import meshtastic.serial_interface
iface = meshtastic.serial_interface.SerialInterface()
if iface.nodes:
for node in iface.nodes.values():
# print (node)
print("Node Num:", node["num"])
print("Node ID:", node["user"]["id"])
print("Long Name:", node["user"]["longName"])
print("Short Name:", node["user"]["shortName"])
print("Hardware Model:", node["user"]["hwModel"])
if "role" in node["user"]:
print("Role:", node["user"]["role"])
if "macaddr" in node["user"]:
print("MAC Address:", node["user"]["macaddr"])
if "publicKey" in node["user"]:
print("Public Key: ", node["user"]["publicKey"])
if "snr" in node:
print("SNR:", node["snr"])
if "lastHeard" in node:
print("Last Heard:", node["lastHeard"])
if "hopsAway" in node:
print("Hops Away:", node["hopsAway"])
if "position" in node:
if "latitude" in node["position"]:
print("Latitude:", node["position"]["latitude"])
if "longitude" in node["position"]:
print("Longitude:", node["position"]["longitude"])
if "altitude" in node["position"]:
print("Altitude:", node["position"]["altitude"])
if "time" in node["position"]:
print("Time:", node["position"]["time"])
if "deviceMetrics" in node:
if "batteryLevel" in node["deviceMetrics"]:
print("Battery Level:", node["deviceMetrics"]["batteryLevel"])
if "voltage" in node["deviceMetrics"]:
print("Voltage:", node["deviceMetrics"]["voltage"])
if "channelUtilization" in node["deviceMetrics"]:
print("Channel Utilization:", node["deviceMetrics"]["channelUtilization"])
if "airUtilTx" in node["deviceMetrics"]:
print("Air Util Tx:", node["deviceMetrics"]["airUtilTx"])
if "uptimeSeconds" in node["deviceMetrics"]:
print("Uptime Seconds: ", node["deviceMetrics"]["uptimeSeconds"])
print("\n")
iface.close()