Skip to main content

MQTT Overview & Setup

Meshtastic MQTT Gateway Overview

MQTT allows Meshtastic nodes to bridge the local LoRa mesh to the internet, enabling mesh messages to travel between physically separated mesh islands and feeding data into monitoring dashboards.

Hardware Requirements

A device can gateway to MQTT in several ways:

  • Onboard Wi-Fi (ESP32 only) - the device connects to a Wi-Fi network directly. ESP32 boards with Wi-Fi include:
    • Heltec V3 / V4
    • T-Beam
    • T-Deck
    • Station G2
  • Ethernet - the nRF52-based RAK4631 with the RAK13800 Ethernet module.
  • MQTT Client Proxy - the node uses the connected phone app's internet connection, so it needs no onboard internet hardware at all. This works on any node, including nRF52 boards.

nRF52-based devices (most RAK Wireless WisBlock cores, e.g. the RAK4631, and some Lilygo variants) lack onboard Wi-Fi, so they cannot gateway over their own Wi-Fi. They can still use MQTT via Ethernet (RAK4631 + RAK13800) or via MQTT Client Proxy. The one caveat is that nRF52 platforms cannot emit JSON over MQTT - JSON output requires an ESP32 gateway.

Public MQTT Broker

The Meshtastic project operates a free public broker:

mqtt.meshtastic.org

The public broker is not anonymous. It requires credentials - the built-in defaults are username meshdev / password large4cats. The firmware auto-fills these when the fields are left blank, but external clients (MQTT Explorer, mosquitto_sub, Node-RED, Home Assistant) must supply them explicitly. The public broker also enforces restrictions (e.g., zero-hop, no broad # subscriptions, location-precision limits).

Topic Structure

msh/REGION/2/e/CHANNELNAME/USERID

The 2 segment is a fixed value in the Meshtastic MQTT protocol and does not change per channel. The encoding segment is the literal value e for encrypted protobuf (the default) or json for human-readable JSON. (Firmware before 2.3.0 used /c/ instead of /e/.) The final segment is the gateway node's USERID. For example, a US node publishing JSON on the LongFast channel:

msh/US/2/json/LongFast/!a1b2c3d4

Configuration via Meshtastic CLI

Enable JSON encoding (human-readable messages on the broker):

meshtastic --set mqtt.json_enabled true
meshtastic --ch-index 0 --ch-set uplink_enabled true
meshtastic --ch-index 0 --ch-set downlink_enabled true

Best practice: Enable downlink on only ONE node on your local mesh. Because multiple gateway nodes can be connected to a single mesh, the same MQTT message can be injected into the mesh multiple times if several nodes have downlink enabled, causing duplicate messages and unnecessary channel congestion.

App Configuration Path

In the Meshtastic app: Settings > MQTT (Android) or Settings > Module Configuration > MQTT (Apple)

  • Enable MQTT: on
  • Address: mqtt.meshtastic.org
  • Root topic: msh/US (replace US with your region code)
  • Username / Password: for the public broker, leave blank to use the built-in defaults (meshdev / large4cats), or set them explicitly. The public broker is not anonymous.
  • TLS: enabled recommended