Telemetry stream: GET /api/telemetry + MCP get_telemetry #16

Merged
kamilkrzywda merged 1 commits from feat/telemetry into main 2026-09-24 23:56:11 +02:00
Owner

What

New GET /api/telemetry (+ MCP tool get_telemetry) — the mesh's telemetry stream, newest first, last 100 records:

{ "from": 67731772, "at": 1790281651000, "kind": "environmentMetrics",
  "data": { "temperature": 4.099999904632568, "relativeHumidity": 81.5 } }

Details

  • Captures TELEMETRY_APP (portnum 67) packets in the existing packet handler; record = { from, at /* epoch ms */, kind, data } where kind is the Telemetry oneof case name and data that variant's payload
  • All eight variants pass through: deviceMetrics / environmentMetrics / airQualityMetrics / powerMetrics / localStats / healthMetrics / hostMetrics / trafficManagementStats (verified against installed @meshtastic/protobufs 2.8.0); bare time-only packets are ignored
  • uint64 fields serialize as decimal strings via the existing jsonSafe choke point (no BigInt 500s — same class of bug fixed in v0.7.1)
  • Bounded at 100 like message history, in-memory only, reset on reconnect — noted in Swagger
  • Bonus fix at the same choke point: protobuf-es internal $typeName keys no longer leak into decoded proto output (also cleaned up /api/device metadata/config sections)

Verification

  • npm run build ✓
  • npm test — 37/37 passed (was 34, +3: device+environment variants → from/kind/data; cap at 100 dropping oldest; reset on reconnect)
  • v0.8.0, CHANGELOG entry added
## What New `GET /api/telemetry` (+ MCP tool `get_telemetry`) — the mesh's telemetry stream, newest first, last 100 records: ```json { "from": 67731772, "at": 1790281651000, "kind": "environmentMetrics", "data": { "temperature": 4.099999904632568, "relativeHumidity": 81.5 } } ``` ## Details - Captures TELEMETRY_APP (portnum 67) packets in the existing packet handler; record = `{ from, at /* epoch ms */, kind, data }` where `kind` is the Telemetry oneof case name and `data` that variant's payload - All eight variants pass through: deviceMetrics / environmentMetrics / airQualityMetrics / powerMetrics / localStats / healthMetrics / hostMetrics / trafficManagementStats (verified against installed @meshtastic/protobufs 2.8.0); bare time-only packets are ignored - uint64 fields serialize as decimal strings via the existing `jsonSafe` choke point (no BigInt 500s — same class of bug fixed in v0.7.1) - Bounded at 100 like message history, in-memory only, reset on reconnect — noted in Swagger - Bonus fix at the same choke point: protobuf-es internal `$typeName` keys no longer leak into decoded proto output (also cleaned up /api/device metadata/config sections) ## Verification - `npm run build` ✓ - `npm test` — 37/37 passed (was 34, +3: device+environment variants → from/kind/data; cap at 100 dropping oldest; reset on reconnect) - v0.8.0, CHANGELOG entry added
kamilkrzywda added 1 commit 2026-09-24 23:55:10 +02:00
kamilkrzywda merged commit 0571c7095e into main 2026-09-24 23:56:11 +02:00
kamilkrzywda deleted branch feat/telemetry 2026-09-24 23:56:11 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/MeshBot#16