Skip to content

Conversation

@michaelhart
Copy link
Contributor

@michaelhart michaelhart commented Oct 7, 2025

Adds serial commands to get stats

  • Added formatStatsReply, formatRadioStatsReply, and formatPacketStatsReply methods in MyMesh for simple_repeater, simple_room_server, and simple_sensor.
  • Updated CommonCLI to handle new stats commands.

The 3 new serial-only commands are stats-core, stats-radio, and stats-packets.

  -> {"battery_mv":0,"uptime_secs":17,"errors":0,"queue_len":2}
  -> {"noise_floor":-103,"last_rssi":-17,"last_snr":12.25,"tx_air_secs":1,"rx_air_secs":3}
  -> {"recv":6,"sent":3,"flood_tx":3,"direct_tx":0,"flood_rx":6,"direct_rx":0}

@Cisien
Copy link

Cisien commented Oct 19, 2025

@ripplebiz @recrof We would love this change. It will let us free up air time by moving repeater stats telemetry to other systems

@michaelhart michaelhart force-pushed the dev branch 4 times, most recently from 472e388 to faa097d Compare October 21, 2025 11:00
@Cisien
Copy link

Cisien commented Oct 27, 2025

@ripplebiz Are there any concerns with this change? It would be good to get it merged so we can get these metrics in an automation fashon without having to spend air time.

@recrof
Copy link
Collaborator

recrof commented Oct 27, 2025

sorry guys, can't merge PRs, I guess @liamcottle and @fdlamotte can review and decide if @ripplebiz is busy

@fdlamotte
Copy link
Collaborator

fdlamotte commented Oct 27, 2025

I don't have issue with this PR (did not see it before, sorry).

But I would be interested to know why it hasn't been merged yet by @ripplebiz before doing it (sorry, I don't really make things go forward). If it's just for review time, I can do it ... (already overlooked and seems fine)

If I understand well, you want to read the STATUS_REQ from serial cli (it took me time because I usually use cli over lora but I now see why you couldn't access these ;) )

@michaelhart
Copy link
Contributor Author

michaelhart commented Oct 28, 2025

If I understand well, you want to read the STATUS_REQ from serial cli (it took me time because I usually use cli over lora but I now see why you couldn't access these ;) )

Yup. A bit more context: It's an increasingly popular idea to use the HA plugin to poll these stats over LoRa/MeshCore, but the downside is that it is imo a very, very poor utilization of precious airtime to have so many people polling so many repeaters to paint a private line on a private chart that they will also probably go months at a time without looking at and potentially even totally forget that it even exists.

From my stats, already these REQ/RES packets at times account for around 50% of all mesh traffic globally - though it has improved a little recently, and it's my understanding too that this is only a handful of people. The ratio of mesh traffic being used this way is even worse if you look at specific regions, like SEA. Why so many packets can come from as few as 1-2 people's HA is an open and separate issue, but my hope is to provide a substantially better alternative (more granular, publicly available charts on packet analyzer, and even deeper analysis potential in w0z's Grafana when Alex has time to update his ingestor).

My hope with this change is to funnel these stats over the internet, so that we don't kill the usability of our mesh just so a few people can make a personal HA dashboard, and so that we all can still benefit and improve the reliability of the mesh from the insights from this data.

@fdlamotte
Copy link
Collaborator

fdlamotte commented Oct 28, 2025

There is no big blocker with this PR, seems we all got overwhelmed recently ;)

There is one small issue whith the stats command, as the length is not checked. If other stats commands are added later, there is a risk that an older firmware responds to stats instead of the newer command ...

So the suggestion is either to check the lenth or use another name for stats, Scott suggests stats-core

- Added formatStatsReply, formatRadioStatsReply, and formatPacketStatsReply methods in MyMesh for both simple_repeater, simple_room_server, and simple_sensor.
- Updated CommonCLI to handle new stats commands.
@michaelhart
Copy link
Contributor Author

michaelhart commented Oct 29, 2025

That is a great catch about the fact the stats stuff would have caught future stats-x commands. I've both checked length on all to ensure it always behaves as intended and changed stats to stats-core.

@fdlamotte
Copy link
Collaborator

fdlamotte commented Oct 29, 2025

great, I'll just run it on my techo before merging (a last check)

edit: just great, let's merge

thank you for the contribution, and sorry for the delay ... you were right to ping us ;)

@fdlamotte fdlamotte merged commit 1d2a115 into meshcore-dev:dev Oct 29, 2025
@michaelhart
Copy link
Contributor Author

No worries, I completely understand :) Thank you @fdlamotte!

@michaelhart
Copy link
Contributor Author

Followup for where the stats are going: https://analyzer.letsme.sh/node/C79F318AC9063B31C374C7B4476CC32D12F19DF37C2440555DB81FDE34E56442

agessaman pushed a commit to agessaman/MeshCore that referenced this pull request Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants