feat: include radio stats in MQTT status messages#169
feat: include radio stats in MQTT status messages#169Kpa-clawbot wants to merge 1 commit intorightup:devfrom
Conversation
|
@Kpa-clawbot if you can target this on the dev branch, i can work on this. |
@yellowcooln have I not already done this in dev? |
|
Commenting because this is something I was looking at as well. The letsmesh_handler does include a publish status call. I wonder if it makes sense to continue having two separate MQTT implementations with the minor drift between the two. The The issue with the current The issues with the current mqtt implementation is that it doesn't include the status publish and only supports 1 client instance. The configuration could be expanded:
Example: https://github.com/Rigear/pyMC_Repeater/tree/feat/mqtt_merge I can make an official PR once I fix up the API endpoint |
Adds noise_floor, tx_air_secs, rx_air_secs, recv_errors, and battery_mv to the MQTT status message under a 'stats' key. This enables downstream tools like CoreScope to display RF health metrics (noise floor charts, airtime monitoring, jammer detection) for observers running pyMC_Repeater. The stats format matches meshcoretomqtt's output for compatibility. Changes: - MQTTHandler: add LWT (Last Will) for offline detection, add publish_status() for retained status messages - StorageCollector: add get_device_stats() to gather radio metrics, add publish_status() convenience method - RepeaterHandler (engine.py): publish status periodically (default every 5 minutes, configurable via mqtt.status_interval)
b0cd4f5 to
80d2e40
Compare
|
@rightup @Rigear — chiming in on Rigear's note above. Agree the duplication between this Happy to defer to whichever order makes the owner's life easier:
Either way works for us — owner's call. Just rebased on |
Summary
Adds periodic MQTT status messages that include radio and device statistics, enabling downstream monitoring tools to track repeater health in real time.
What
<base_topic>/<node_name>/statusevery 5 minutes (configurable viamqtt.status_interval)."offline"status when the repeater disconnects unexpectedly.Message Format
{ "status": "online", "origin": "<node_name>", "origin_id": "<node_id>", "stats": { "uptime_secs": 3600, "noise_floor": -95, "tx_air_secs": 42, "rx_air_secs": 0, "recv_errors": 0 } }The format is compatible with meshcoretomqtt status messages, so tools like CoreScope can consume pyMC_Repeater status alongside other MeshCore nodes without any changes.
Configuration
Notes
rx_air_secsandrecv_errorsare currently hardcoded to0since pyMC_Repeater doesn't track those metrics yet. They're included so consumers can distinguish "not tracked" from "field missing".battery_mvis omitted (only relevant on embedded boards).