Skip to content

feat(mqtt): publish native MapReports for the official Meshtastic map - #116

Closed
Meyblaubaer wants to merge 2 commits into
KMX415:mainfrom
Meyblaubaer:feat/native-map-report
Closed

feat(mqtt): publish native MapReports for the official Meshtastic map#116
Meyblaubaer wants to merge 2 commits into
KMX415:mainfrom
Meyblaubaer:feat/native-map-report

Conversation

@Meyblaubaer

Copy link
Copy Markdown

What changed

  • Add opt-in native Meshtastic MAP_REPORT_APP publishing on <topic_root>/<region>/2/map/.
  • Use the configured transmit.node_id for both the packet source and ServiceEnvelope gateway ID, keeping it separate from the capture gateway identity.
  • Match Meshtastic firmware privacy constraints: public and unencrypted, MQTT-only, minimum 3600-second interval, and 12-15 position precision bits.
  • Publish the configured name, static position, PORTDUINO hardware model, firmware version, region, modem preset, primary channel metadata, and locally heard Meshtastic node count.
  • Add Configuration -> MQTT dashboard controls, API persistence/validation, defaults, runtime status, docs, and tests.

Closes #115

Why

The existing MQTT publisher forwards captured traffic with a separate gateway identity. It does not publish a native map report for the configured Meshpoint transmit identity, so the Meshpoint node may not appear on the official Meshtastic map.

Safety and compatibility

  • Disabled by default.
  • Requires MQTT plus configured device.latitude, device.longitude, and transmit.node_id.
  • Does not use LoRa airtime or change radio behavior.
  • Retries after connection/config readiness, then publishes no more than once per configured interval.
  • Uses the official ServiceEnvelope and MapReport protobufs and /2/map/ topic shape.

Testing

  • 27 passed: MapReport formatter/publisher/coordinator, MQTT API, and node repository targeted tests.
  • 938 passed, 68 subtests passed: broad suite excluding hardware/update tests that require sudo and /opt/meshpoint on the host.
  • Full local run reached 957 passes; eight update/rollback tests failed only because this sandbox cannot execute sudo or write /opt/meshpoint.
  • node --check frontend/js/configuration/mqtt_card.js
  • Import/unused checks and git diff --check passed for changed files.

Hardware and region

  • Protocol output validated by decoding the generated ServiceEnvelope with the official Meshtastic Python protobufs.
  • EU_868 / LongFast configuration covered by tests.
  • No live Pi/concentrator deployment was performed for this branch. No RF path is changed.

Risks

The report intentionally shares public node identity and approximate location data. The feature is explicit opt-in, clearly labeled in the dashboard and documentation, and bounded to the Meshtastic-supported privacy range and cadence.

AI assistance

This focused change was developed with Codex assistance and reviewed through targeted protocol tests plus the broader project test suite.

Copilot AI review requested due to automatic review settings July 26, 2026 15:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in, MQTT-only Meshtastic MapReport publisher so a Meshpoint can appear on the official Meshtastic map using the configured transmit identity (transmit.node_id) rather than the separate MQTT gateway identity.

Changes:

  • Adds MapReport protobuf construction and a new MQTT publish path targeting <topic_root>/<region>/2/map/.
  • Introduces a coordinator loop to publish MapReports on a bounded cadence (min 3600s) and tracks runtime status (last_map_report_at).
  • Extends config/API/dashboard/docs/tests to support enabling MapReports plus interval and position-precision controls.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_mqtt_config_routes.py Extends MQTT config route tests to cover MapReport fields and min-interval validation.
tests/test_map_report.py Adds unit tests for MapReport formatting, MQTT publishing behavior, and coordinator integration.
src/storage/node_repository.py Adds optional protocol filter to get_active_count for MapReport “heard nodes” counts.
src/relay/mqtt_publisher.py Adds publish_map_report() and runtime status tracking for MapReport publishing.
src/relay/map_report.py Introduces MapReport + ServiceEnvelope builder and coordinate rounding logic.
src/coordinator.py Adds background task/loop to periodically publish MapReports based on config.
src/config.py Adds MQTT MapReport configuration defaults.
src/api/routes/mqtt_config_routes.py Surfaces MapReport config in dashboard status and persists/validates via API.
frontend/js/configuration/mqtt_card.js Adds dashboard controls for MapReport enable/interval/precision.
docs/MQTT-AND-MESHRADAR.md Documents how to enable native MapReport publishing and its privacy constraints.
docs/CONFIGURATION.md Documents new MQTT configuration keys for MapReport support.
docs/CHANGELOG.md Adds unreleased changelog entry for native MQTT MapReport.
config/default.yaml Adds defaults for MapReport-related MQTT settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/routes/mqtt_config_routes.py
Comment thread src/coordinator.py
Comment thread docs/CHANGELOG.md
Comment thread src/relay/map_report.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@KMX415

KMX415 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Thanks for this, @Meyblaubaer. Merged into feat/v0.7.8 with your authorship preserved so it lands in the contributor graph:

  • 12008bf feat(mqtt): publish native Meshtastic map reports (Author: Meyblaubaer)
  • 56f383b Potential fix for pull request finding (your Copilot Autofix trailer kept)

Follow-up on our side (not attributed to you): require mqtt.enabled=true when MapReport is on, plus a small publish RC hardening for the test suite.

Closing this PR against main because the sprint branch is the merge target for v0.7.8. It will ride to main with that release. Closes #115 via the sprint branch.

Hardware bake still welcome when you can: enable MapReport against mqtt.meshtastic.org and confirm the node shows on the official map.

@KMX415

KMX415 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Landed on feat/v0.7.8 rather than main; see comment above.

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.

Add native Meshtastic MAP_REPORT support for official community maps

3 participants