Skip to content

Commit

Permalink
Merge pull request #638 from ianmcorvidae/request-telemetry-uptime
Browse files Browse the repository at this point in the history
Include uptime_seconds in sendTelemetry and print upon response
  • Loading branch information
ianmcorvidae authored Jul 11, 2024
2 parents 3c772b5 + fd9b691 commit d996965
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions meshtastic/mesh_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,9 @@ def sendTelemetry(self, destinationId: Union[int,str]=BROADCAST_ADDR, wantRespon
air_util_tx = metrics.get("airUtilTx")
if air_util_tx is not None:
r.device_metrics.air_util_tx = air_util_tx
uptime_seconds = metrics.get("uptimeSeconds")
if uptime_seconds is not None:
r.device_metrics.uptime_seconds = uptime_seconds

if wantResponse:
onResponse = self.onResponseTelemetry
Expand Down Expand Up @@ -591,6 +594,8 @@ def onResponseTelemetry(self, p: dict):
)
if telemetry.device_metrics.air_util_tx is not None:
print(f"Transmit air utilization: {telemetry.device_metrics.air_util_tx:.2f}%")
if telemetry.device_metrics.uptime_seconds is not None:
print(f"Uptime: {telemetry.device_metrics.uptime_seconds} s")

elif p["decoded"]["portnum"] == 'ROUTING_APP':
if p["decoded"]["routing"]["errorReason"] == 'NO_RESPONSE':
Expand Down

0 comments on commit d996965

Please sign in to comment.