Skip to main content

Setting Up a Meshtastic MQTT-to-Internet Gateway

An MQTT gateway connects your Meshtastic mesh to the internet, enabling message delivery to non-LoRa clients, integration with home automation, and connection to the global Meshtastic MQTT network.

What the MQTT Gateway Does

A Meshtastic node in "MQTT gateway" mode:

  • Receives all LoRa packets on the configured channel(s)
  • Forwards them to an MQTT broker (local or cloud)
  • Receives messages from the MQTT broker and injects them into the LoRa network
  • Bridges your mesh to the global Meshtastic network (if using the public MQTT server)

Requirements

  • A WiFi-capable Meshtastic node (T-Beam, Heltec V3, T-Beam Supreme — all have WiFi)
  • WiFi network with internet access at the gateway location
  • An MQTT broker: either the public Meshtastic broker (mqtt.meshtastic.org) or a self-hosted one

Configuration Steps

Option A: Using the Meshtastic Public MQTT Server

# Configure via CLI:
meshtastic --set mqtt.enabled true
meshtastic --set mqtt.server mqtt.meshtastic.org
meshtastic --set mqtt.username meshdev
meshtastic --set mqtt.password large4cats

# Configure which channels to bridge (enable MQTT uplink/downlink per channel)
meshtastic --ch-index 0 --ch-set uplink_enabled true
meshtastic --ch-index 0 --ch-set downlink_enabled true

# Configure WiFi (if not already done)
meshtastic --set network.wifi_ssid "YourSSID"
meshtastic --set network.wifi_psk "YourPassword"

Privacy note: The public MQTT server relays messages globally. Only use it for the default (unencrypted) channel unless you want your encrypted channel traffic relayed globally.

Option B: Self-Hosted Mosquitto MQTT Broker

# Install Mosquitto on Raspberry Pi or VPS:
sudo apt install mosquitto mosquitto-clients
sudo systemctl enable --now mosquitto

# Configure anonymous access (for a local network only):
echo "allow_anonymous true" | sudo tee -a /etc/mosquitto/mosquitto.conf
sudo systemctl restart mosquitto

# Configure node to use your local broker:
meshtastic --set mqtt.server 192.168.1.100
meshtastic --set mqtt.enabled true

Verifying the Gateway is Working

# Subscribe to all Meshtastic MQTT topics and watch for packets:
mosquitto_sub -h mqtt.meshtastic.org -u meshdev -P large4cats   -t "msh/US/2/e/#" -v

# Or on your local broker:
mosquitto_sub -h 192.168.1.100 -t "msh/#" -v

You should see base64-encoded packets appearing as mesh traffic is received.

MQTT Packet Decoding

Meshtastic MQTT packets are protobuf-encoded. To decode them for integration with other systems:

pip install meshtastic
# meshtastic library includes MQTT packet decoding

from meshtastic.mqtt import MQTT
# See meshtastic Python API docs for full MQTT integration examples