kopia lustrzana https://github.com/mate-dev/meshtastic-matrix-relay
nodes_plugin response in md
rodzic
f22a5966da
commit
fbbfcae645
|
@ -47,27 +47,29 @@ $shortname $longname / $devicemodel / $battery $voltage / $snr / $lastseen
|
|||
|
||||
meshtastic_client = connect_meshtastic()
|
||||
|
||||
response = f"Nodes: {len(meshtastic_client.nodes)}\n"
|
||||
response = f">Nodes: {len(meshtastic_client.nodes)}\n"
|
||||
|
||||
for node, info in meshtastic_client.nodes.items():
|
||||
snr = ""
|
||||
if "snr" in info:
|
||||
snr = f"{info['snr']} dB"
|
||||
else:
|
||||
snr = ""
|
||||
if info['snr'] is not None:
|
||||
snr = f"{info['snr']} dB "
|
||||
|
||||
last_heard = None
|
||||
if "lastHeard" in info:
|
||||
last_heard = get_relative_time(info["lastHeard"])
|
||||
|
||||
voltage = "?V"
|
||||
battery = "?%"
|
||||
voltage = ""
|
||||
battery = ""
|
||||
if "deviceMetrics" in info:
|
||||
if "voltage" in info["deviceMetrics"]:
|
||||
voltage = f"{info['deviceMetrics']['voltage']}V"
|
||||
voltage = f"{info['deviceMetrics']['voltage']}V "
|
||||
if "batteryLevel" in info["deviceMetrics"]:
|
||||
battery = f"{info['deviceMetrics']['batteryLevel']}%"
|
||||
battery = f"{info['deviceMetrics']['batteryLevel']}% "
|
||||
|
||||
response += f"{info['user']['shortName']} {info['user']['longName']} / {info['user']['hwModel']} / {battery} {voltage} / {snr} / {last_heard}\n"
|
||||
response += f">**{info['user']['shortName']}** {info['user']['longName']}\n"\
|
||||
f">{info['user']['hwModel']} {battery}{voltage}\n"\
|
||||
f">{snr}{last_heard}\n\n"
|
||||
|
||||
return response
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ Pillow==9.5.0
|
|||
py-staticmaps==0.4.0
|
||||
matrix-nio==0.20.2
|
||||
matplotlib==3.7.1
|
||||
requests==2.30.0
|
||||
requests==2.31.0
|
||||
markdown==3.4.3
|
||||
haversine==2.8.0
|
||||
schedule==1.2.0
|
||||
schedule==1.2.0
|
||||
|
|
Ładowanie…
Reference in New Issue