meshmonitor icon indicating copy to clipboard operation
meshmonitor copied to clipboard

[FEAT] add Node List export for mesh upgrade process

Open kokoshell opened this issue 5 months ago • 2 comments

Hi Yeraze,

Is it possible to add CSV / HTML export for all current seen nodes in order to use for mesh upgrade process ? Table head would be like: Node Long Name, Node Short Name, Hardware Type, Role, Node ID, Avg. Hops away, Avg. SNR/RSSI etc.

Thank you ! Kokoshell

kokoshell avatar Jun 16 '26 20:06 kokoshell

Hi @kokoshell — great use case, and this aligns well with MeshMonitor's role as a mesh management tool. Exporting node inventory for upgrade planning is a natural fit. Here's the implementation plan I'm proposing.


Implementation Plan: Node List Export (CSV / HTML)

What Gets Exported

All fields the Meshtastic firmware provides, mapped to the columns you requested plus a few extras useful for upgrade planning:

Export Column Source Field Notes
Node ID nodeId Hex string (e.g. !ab12cd34)
Long Name longName
Short Name shortName
Hardware hwModel Integer → model name string (e.g. TBEAM, HELTEC_V3)
Role role Integer → human-readable (e.g. Router, Client, Router_Client)
Hops Away hopsAway Last-known; labeled "Last Hops" in export header to be accurate
SNR snr Last-known value (dB); labeled "Last SNR" — not a running average, as the DB stores the most-recent reading
RSSI rssi Last-known value (dBm); labeled "Last RSSI" — same caveat
Firmware firmwareVersion Useful for identifying nodes that need upgrades
Last Heard lastHeard ISO timestamp
Battery batteryLevel % (if reported)
Via MQTT viaMqtt Boolean
Latitude latitude / latitudeOverride
Longitude longitude / longitudeOverride

Note on "Avg." SNR/RSSI: The nodes table stores the most-recent packet's SNR/RSSI, not a rolling average. True per-node averages would require aggregating the packet_log table, which adds complexity and is opt-in (packet logging must be enabled). For this first pass I'll export the last-known values with clear column headers. If averaged values are important for your workflow, let me know and I can scope that as a follow-up.


Backend Changes

New route — GET /api/sources/:sourceId/nodes/export

Query param: ?format=csv (default) or ?format=html

  • Auth: nodes:read permission (same gate as the existing node list endpoint)
  • Per-source scoped via sourceManagerRegistry + sourceId from the URL (mandatory per MeshMonitor architecture)
  • CSV: RFC 4180 compliant, UTF-8 BOM so Excel opens it correctly, fields properly quoted/escaped
  • HTML: a self-contained <table> inside a minimal HTML document with light styling — usable in a browser or paste-able into docs

Files touched:

  • src/server/routes/sourceRoutes.ts — add the export route
  • src/db/repositories/nodes.ts — re-use existing getAllNodes(sourceId); no new DB query needed
  • src/server/constants/meshtastic.ts — add HW_MODEL_NAMES and ROLE_NAMES maps if not already present (maps integer → string for export)

Frontend Changes

Export button in the node list / Nodes tab UI (likely src/components/NodesTab.tsx):

  • A small "Export ▾" dropdown button with "CSV" and "HTML" options
  • Triggers a download via window.location or a hidden <a download> pointing at /api/sources/:sourceId/nodes/export?format=…
  • Respects the active source from SourceContext (useSource())
  • No new permissions UI needed — if the user can see the node list, they can export it

What This Does NOT Cover (out of scope for this issue)

  • Filtering before export (export is always all nodes for the source — filtered export can be a follow-up)
  • Packet-log-averaged SNR/RSSI (opt-in feature, see note above)
  • Scheduled/automated exports

Plan ready — awaiting maintainer approval before starting implementation.


Generated by Claude Code

Yeraze avatar Jun 16 '26 20:06 Yeraze

Yes, packet logging is always enabled and rolling average is needed. Thank you !

kokoshell avatar Jun 16 '26 20:06 kokoshell