Skip to content

feat(cli): add telemetry and sensors CLI commands#2826

Open
drewmccal wants to merge 1 commit into
meshcore-dev:mainfrom
drewmccal:feat/sensor-cli-telemetry
Open

feat(cli): add telemetry and sensors CLI commands#2826
drewmccal wants to merge 1 commit into
meshcore-dev:mainfrom
drewmccal:feat/sensor-cli-telemetry

Conversation

@drewmccal

Copy link
Copy Markdown

Summary

Adds two read-only CLI commands to the shared CommonCLI, so telemetry can be inspected directly over the serial / admin CLI instead of only over the mesh (companion Request Telemetry). Available on any node with a SensorManager (sensor, repeater, etc.).

  • telemetry — queries current telemetry (battery voltage on the SELF channel plus everything querySensors() reports) and prints each channel with its decoded value and unit:

    3 channels
    ch1 Voltage=4.05V
    ch3 Temperature=22.4C
    
  • sensors — lists the active telemetry channels as an inventory, without values:

    2 sensors
    ch1 Voltage
    ch3 Temperature
    

Implementation notes

  • Lives in CommonCLI.cpp alongside the existing sensor get/set/list commands.
  • Decodes the CayenneLPP buffer via the shared LPPReader, and formats floats with StrHelper::ftoa (embedded sprintf("%f") is unreliable).
  • Output mirrors the existing sensor list convention: an N items header, one line per entry, capped to the reply buffer with a ... truncation marker.
  • Decodes the common environmental types with units (temperature, voltage, humidity, pressure, current, power, altitude, GPS); unknown types are listed by channel without a value.
  • telemetry queries querySensors() synchronously, the same as a real telemetry request, so it briefly blocks (e.g. ~750 ms per 1-Wire probe) — expected for a manual command.

Testing

Tested on hardware (RAK4631) and confirmed working: both telemetry and sensors return the expected channels/values over the serial CLI, including battery voltage and a 1-Wire temperature probe. Builds clean for both RAK_4631_sensor and RAK_4631_repeater (the shared-CLI change is verified for non-sensor node types too).

🤖 Generated with Claude Code

Adds two read-only CLI commands to the shared CommonCLI, available on
any node with a SensorManager (sensor, repeater, etc.):

- `telemetry` — queries current telemetry (battery voltage on the SELF
  channel plus everything querySensors() reports) and prints each
  channel with its decoded value and unit, e.g. `ch3 Temperature=22.4C`.
- `sensors` — lists the active telemetry channels as an inventory
  (`ch<N> <Type>`) without values.

Both decode the CayenneLPP buffer via the shared LPPReader and format
floats with StrHelper::ftoa (embedded `%f` is unreliable). Output mirrors
the existing `sensor list` convention: an `N items` header, one line per
entry, capped to the reply buffer with a `...` truncation marker.

This fills the gap where telemetry could previously only be read over
the mesh (companion Request Telemetry); it is now inspectable directly
over the serial/admin CLI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant