Skip to content

feat: environmental telemetry charts and resend failed message (#88)#133

Merged
rinchen merged 1 commit intomainfrom
ian
Mar 14, 2026
Merged

feat: environmental telemetry charts and resend failed message (#88)#133
rinchen merged 1 commit intomainfrom
ian

Conversation

@rinchen
Copy link
Member

@rinchen rinchen commented Mar 14, 2026

Summary

Implements two feature-parity items from issue #88 (matching Ian's meshtastic-cli):

  • Environmental telemetry — capture, store, and visualize EnvironmentMetrics packets (BME280/BME680/weather stations) with per-node latest readings and time-series charts
  • Resend failed message — one-click retry for messages that failed RF/device delivery

Changes

src/renderer/lib/types.ts

  • New EnvironmentTelemetryPoint interface with all protobuf env fields: temperature, relativeHumidity, barometricPressure, gasResistance, iaq, lux, windSpeed, windDirection, windGust, windLull, weight, rainfall1h, rainfall24h
  • Seven new optional env_* fields on MeshNode (session-only, not persisted to DB — no schema change required)

src/renderer/hooks/useDevice.ts

  • Extended onTelemetryPacket type cast to include all env metric fields
  • New environmentMetrics variant handler: records time-series into environmentTelemetry state (capped at MAX_TELEMETRY_POINTS), and patches per-node env_* fields on MeshNode via updateNodes
  • New environmentTelemetry: EnvironmentTelemetryPoint[] exported from the hook

src/renderer/components/TelemetryPanel.tsx

  • New props: environmentTelemetry, useFahrenheit, onToggleFahrenheit
  • toF() helper for Celsius → Fahrenheit conversion
  • °C/°F toggle button in the panel header — only visible when temperature data is present; state persists to localStorage['mesh-client:useFahrenheit']
  • Three new charts (rendered only when the relevant data exists):
    1. Temperature & Humidity — dual Y-axis (°C or °F left, % right)
    2. Barometric Pressure — single Y-axis (hPa)
    3. Air Quality (IAQ) — single Y-axis 0–500
  • CSV export extended with env_temperature_c, env_humidity_pct, env_pressure_hpa, env_iaq columns
  • Empty-state check and point counter include env data

src/renderer/components/NodeInfoBody.tsx

  • iaqLabel() helper maps IAQ score (0–500) to human-readable category (Excellent → Severely Polluted)
  • New useFahrenheit?: boolean prop
  • Environment section rendered below route info when any env field is set on the node; shows temperature (°C/°F), humidity, pressure, IAQ with label, lux, and wind (speed + direction if available)
  • Works in both NodeDetailModal and MapPanel Leaflet popups automatically

src/renderer/components/NodeDetailModal.tsx

  • New useFahrenheit?: boolean prop threaded through to NodeInfoBody

src/renderer/components/ChatPanel.tsx

  • New onResend: (msg: ChatMessage) => void prop
  • Resend button (circular-arrow SVG) appears inline with the status badge when msg.status === 'failed' (device/RF transport failure only — not triggered by MQTT-only failure). Clicking calls onResend(msg) with stopPropagation.

src/renderer/App.tsx

  • useFahrenheit state with localStorage persistence
  • toggleFahrenheit callback (stable via useCallback)
  • handleResend callback — calls device.sendMessage with original payload, channel, and to (DM destination if set)
  • All new props wired: TelemetryPanel, NodeDetailModal, ChatPanel

src/renderer/components/ChatPanel.test.tsx

  • Added onResend: vi.fn() to the default test props to satisfy the new required prop

Test plan

  • Connect to a network with a BME280/BME680/weather-station node; open Telemetry tab — new charts appear once env packets arrive
  • Open Node Detail for an env-equipped node — Environment section shows latest temp/humidity/pressure/IAQ/lux/wind
  • Toggle °C/°F button in Telemetry header — charts and node detail update; preference survives reload
  • Send a message, disconnect mid-send to force failure — circular-arrow icon appears left of the ✗ badge; click it — a new pending message is queued
  • npm run build:renderer — no TypeScript or lint errors
  • npm test — all 66 tests pass

Fixes #88

- Capture environmentMetrics packets in useDevice (temp, humidity,
  pressure, IAQ, lux, wind) as time-series and per-node latest values
- TelemetryPanel: three new charts (Temp/Humidity, Pressure, IAQ)
  with °C/°F toggle persisted to localStorage
- NodeInfoBody: Environment section shows latest sensor readings for
  any node with env data; respects useFahrenheit prop
- NodeDetailModal: passes useFahrenheit through to NodeInfoBody
- ChatPanel: circular-arrow resend button on failed own messages

Fixes #88
@rinchen rinchen merged commit ca87723 into main Mar 14, 2026
6 checks passed
@rinchen rinchen deleted the ian branch March 14, 2026 21:45
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.

Feature parity with Ian

1 participant