Add rnode battery state to rnstatus output

This commit is contained in:
Mark Qvist 2024-10-11 10:14:10 +02:00
parent 60d8da843c
commit 7417cf5947
2 changed files with 3 additions and 2 deletions

View File

@ -1328,7 +1328,7 @@ class Reticulum:
if hasattr(interface, "r_battery_state"): if hasattr(interface, "r_battery_state"):
if interface.r_battery_state != 0x00: if interface.r_battery_state != 0x00:
ifstats["battery_state"] = interface.r_battery_state ifstats["battery_state"] = interface.get_battery_state_string()
if hasattr(interface, "r_battery_percent"): if hasattr(interface, "r_battery_percent"):
ifstats["battery_percent"] = interface.r_battery_percent ifstats["battery_percent"] = interface.r_battery_percent

View File

@ -295,7 +295,8 @@ def program_setup(configdir, dispall=False, verbosity=0, name_filter=None, json=
if "battery_percent" in ifstat and ifstat["battery_percent"] != None: if "battery_percent" in ifstat and ifstat["battery_percent"] != None:
try: try:
bpi = int(ifstat["battery_percent"]) bpi = int(ifstat["battery_percent"])
print(" Battery : {bp}%".format(bp=bpi)) bss = ifstat["battery_state"]
print(f" Battery : {bpi}% ({bss})")
except: except:
pass pass