From 8acf0b849ab626cca19612b646f7951235d54981 Mon Sep 17 00:00:00 2001 From: GUVWAF Date: Thu, 29 Dec 2022 17:00:35 +0100 Subject: [PATCH] --nodes displays battery, channel and Tx air util. --- meshtastic/mesh_interface.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index c9ee602..6c6a67b 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -137,7 +137,20 @@ class MeshInterface: "Latitude": formatFloat(pos.get("latitude"), 4, "°"), "Longitude": formatFloat(pos.get("longitude"), 4, "°"), "Altitude": formatFloat(pos.get("altitude"), 0, " m"), - "Battery": formatFloat(pos.get("batteryLevel"), 2, "%"), + }) + + metrics = node.get('deviceMetrics') + if metrics: + batteryLevel = metrics.get('batteryLevel') + if batteryLevel is not None: + if batteryLevel == 0: + batteryString = "Powered" + else: + batteryString = str(batteryLevel)+"%" + row.update({"Battery": batteryString}) + row.update({ + "Channel util.": formatFloat(metrics.get('channelUtilization'), 2, "%"), + "Tx air util.": formatFloat(metrics.get('airUtilTx'), 2, "%"), }) row.update({