meshtastic-map

liamcottleMIT更新放缓

把通过 MQTT 收到的 Meshtastic LoRa 网状网络节点实时画在地图上,方便查看节点分布和覆盖范围。

A map of all Meshtastic nodes heard via MQTT.

暂无版本318star87fork同步于 2026-11-07 07:29 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/liamcottle/meshtastic-map && cd meshtastic-map
npm install
# 在 .env 写入 DATABASE_URL="mysql://root@localhost:3306/meshtastic-map?connection_limit=100"
npx prisma migrate dev
node src/mqtt.js
node src/index.js
硬件要求按 README 说明

README 未说明,仅需能跑 Node.js 与 MySQL/MariaDB 的机器;用 Docker Compose 可一并启动数据库、采集器和地图

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 MQTT 上听到的 Meshtastic 节点实时画到地图上,自建节点监控面板

把通过 MQTT 收到的 Meshtastic LoRa 网状网络节点实时画在地图上,方便查看节点分布和覆盖范围。

核心能力

  • 常驻订阅 mqtt.meshtastic.org 的 msh/# 主题收集节点
  • 解码 ServiceEnvelope 并用默认 AQ== 密钥解加密包
  • 按 NODEINFO/POSITION/TELEMETRY 等类型分别入库
  • 提供节点搜索、位置历史、遥测图表与路由追踪侧栏
  • Neighbours 图层用蓝线展示节点间互相听到的关系

容易踩的坑

Meshtastic protobuf schema 因 GPLv3 未随项目提供,需自行获取才能运行 MQTT Collector;数据库查询含 MySQL 专有语法,其他数据库未测试;默认监听 8080 端口,可用 --port 修改;Neighbours 图层在固件低于 v2.3.2 时会把 MQTT 节点误报为邻居

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    A map of all Meshtastic nodes heard via MQTT.

    My version of the map is available at https://meshtastic.liamcottle.net

    Check out my new Meshtastic Web Client: MeshTXT

    How does it work?

    • An mqtt client is persistently connected to mqtt.meshtastic.org and subscribed to the msh/# topic.
    • All messages received are attempted to be decoded as ServiceEnvelope packets.
    • If a packet is encrypted, it attempts to decrypt it with the default AQ== key.
    • If a packet can't be decoded as a ServiceEnvelope, it is ignored.
    • NODEINFO_APP packets add a node to the database.
    • POSITION_APP packets update the position of a node in the database.
    • NEIGHBORINFO_APP packets log neighbours heard by a node to the database.
    • TELEMETRY_APP packets update battery and voltage metrics for a node in the database.
    • TRACEROUTE_APP packets log all trace routes performed by a node to the database.
    • MAP_REPORT_APP packets are stored in the database, but are not widely adopted, so are not used yet.
    • The database is a MySQL server, and a nodejs express server is running an API to serve data to the map interface.

    Features

    • Connects to mqtt.meshtastic.org to collect nodes and metrics.
    • Shows nodes on the map if they have reported a valid position.
    • Search bar to find nodes by ID, Hex ID, Short Name and Long Name.
    • Hover over nodes on the map to see basic information and a preview image.
    • Click nodes on the map to show a sidebar with more info such as telemetry graphs and traceroutes.
    • Ability to share a direct link to a node. The map will auto navigate to it.
    • Device list. To see which hardware models are most popular.
    • Mobile optimised layout.
    • Settings available to hide nodes from the map if they haven't been updated in a while.
    • Real-Time message UI to view TEXT_MESSAGE_APP packets as they come in.
    • View position history of a node between a selectable time range.
    • "Neighbours" map layer. Shows blue connection lines between nodes that heard the other node.
      • This information is taken from the NEIGHBORINFO_APP.
      • Some neighbour lines are clearly wrong.
      • Meshtastic firmware older than v2.3.2 reports MQTT nodes as Neighbours.
      • This was fixed in meshtastic/firmware/#3457, but adoption will likely be slow...

    TODO

    • use vuejs build process to make managing code easier
    • don't use cdn hosted javascript deps so we can run fully offline
      • offline map tiles?
    • dedupe packets to prevent spamming database

    Install

    Clone the project repo.

    git clone https://github.com/liamcottle/meshtastic-map
    cd meshtastic-map
    

    Install NodeJS dependencies

    npm install
    

    Create a .env environment file.

    touch .env
    

    Add a database connection string for prisma to .env file.

    DATABASE_URL="mysql://root@localhost:3306/meshtastic-map?connection_limit=100"
    

    Note: Some queries are MySQL specific. Other db providers have not been tested.

    Migrate the database.

    npx prisma migrate dev
    

    Run the MQTT listener, to save packets to database.

    node src/mqtt.js
    

    Run the Express Server, to serve the /api and Map UI.

    node src/index.js
    # Server running at http://127.0.0.1:8080
    

    Note: You can also use a custom port with --port 8123

    Upgrading

    Run the following commands from inside the meshtastic-map repo.

    # update repo
    git fetch && git pull
    
    # migrate database
    npx prisma migrate dev
    

    You will now need to restart the index.js and mqtt.js scripts.

    MQTT Collector

    Please note, due to the Meshtastic protobuf schema files being locked under a GPLv3 license, these are not provided in this MIT licensed project. You will need to obtain these files yourself to be able to use the MQTT Collector.

    By default, the MQTT Collector connects to the public Meshtastic MQTT server. Alternatively, you may provide the relevant options shown in the help section below to connect to your own MQTT server along with your own decryption keys.

    node src/mqtt.js --help
    
    Meshtastic MQTT Collector
    
      Collects and processes service envelopes from a Meshtastic MQTT server.
    
    Options
    
      -h, --help                                    Display this usage guide.
      --mqtt-broker-url string                      MQTT Broker URL (e.g: mqtt://mqtt.meshtastic.org)
      --mqtt-username string                        MQTT Username (e.g: meshdev)
      --mqtt-password string                        MQTT Password (e.g: large4cats)
      --mqtt-topic                                  MQTT Topic to subscribe to (e.g: msh/#)
      --collect-service-envelopes                   This option will save all received service envelopes to the database.
      --collect-text-messages                       This option will save all received text messages to the database.
      --collect-waypoints                           This option will save all received waypoints to the database.
      --collect-neighbour-info                      This option will save all received neighbour infos to the database.
      --collect-map-reports                         This option will save all received map reports to the database.
      --decryption-keys <base64DecryptionKey> ...   Decryption keys encoded in base64 to use when decrypting service envelopes.
      --purge-interval-seconds number               How long to wait between each automatic database purge.
      --purge-nodes-unheard-for-seconds number      Nodes that haven't been heard from in this many seconds will be purged from the database.
    

    To connect to your own MQTT server, you could do something like the following;

    node src/mqtt.js --mqtt-broker-url mqtt://mqtt.example.com --mqtt-username username --mqtt-password password --decryption-keys 1PG7OiApB1nwvP+rz05pAQ==
    

    MQTT Connection Status

    TODO: update this section as this info is now outdated. MQTT status is determined based on a timestamp we update when a packet is gated to MQTT by that node.

    The map shows a different coloured icon for nodes based on their connection state to MQTT.

    • Green: Online (connected to MQTT)
    • Blue: Offline (disconnected from MQTT)

    This works by listening to /stat/!ID topics on the MQTT server.

    When a node connects to MQTT it publishes online to the topic, and when the MQTT server detects the client has disconnected (via an LWT) it publishes offline to the topic.

    The Meshtastic firmware configures an LWT (Last Will and Testament), which the MQTT server publishes upon client disconnect.

    After a node boots up, there is a ~30 second delay before the online state is published. After a node disconnects from MQTT, there is a ~30 second delay before the offline state is published.

    This works well when your node connects to MQTT over WiFi, however, when using the MQTT Client Proxy feature, your node sends/receives packets to/from your Android/iOS device, and then your device connects to MQTT and proxies the messages.

    Meshtastic Node <-> Android/iOS <-> MQTT
    

    Unfortunately, when using that feature your online / offline states will not work as expected.

    As of the time of writing these docs, the mobile devices do not correctly configure the LWT for the node being proxied, and thus do not publish the offline state for the node, so you can't detect if your node disconnected from MQTT.

    Your node will stay "stuck" in the online state in the MQTT server.

    Docker Compose

    A docker-compose.yml is available. You can run the following command to launch everything;

    docker compose up
    

    This will:

    • Start a MariaDB database server.
    • Run the database migrations.
    • Start the MQTT collector.
    • Start the Map UI.
    • Expose the map on port 8080.

    Testing

    To execute unit tests, run the following;

    npm run test
    

    Contributing

    If you have a feature request, or find a bug, please open an issue here on GitHub.

    License

    MIT

    Legal

    This project is not affiliated with or endorsed by the Meshtastic project.

    The Meshtastic logo is the trademark of Meshtastic LLC.

    References