MQTT Upload
The Meshcore Home Assistant integration can publish Meshcore packet data to MQTT brokers directly from the integration.
Overview
MQTT upload supports:
- Up to 4 brokers
- Dynamic broker management (add/edit/remove)
- Custom MQTT brokers (username/password or no auth)
- LetsMesh brokers using MeshCore auth-token mode
- Per-broker topic templates and auth settings
- Per-broker payload mode (
packetorraw) - Per-broker connection binary sensors under the main node device
Configure in Home Assistant
- Go to Settings -> Devices & Services
- Open your Meshcore integration
- Click Configure
- Open Manage MQTT Brokers
- Use Add Broker, Edit Broker, or Remove Broker
Broker Settings
Per broker, configure:
- Enabled
- Server
- Port
- Transport (
tcporwebsockets) - Use TLS
- TLS Verify
- Username / Password (not needed when using auth token)
- Use MeshCore Auth Token
- Token Audience (usually broker hostname for token-based setups)
- Owner Public Key (optional JWT
ownerclaim; sent only with TLS + TLS Verify) - Owner Email (optional JWT
emailclaim; sent only with TLS + TLS Verify) - Auth Token TTL (seconds)
- Payload Mode:
packet= normalized packet payloads (LetsMesh-compatible behavior)raw= raw MeshCore event payloads
- Status Topic
- Packets Topic
- IATA (per-broker topic region code)
- Client ID Prefix
LetsMesh Setup
Typical LetsMesh settings:
Server:mqtt-us-v1.letsmesh.net(or regional LetsMesh endpoint)Port:443Transport:websocketsUse TLS: enabledUse MeshCore Auth Token: enabledToken Audience: same as broker hostnamePayload Mode:packetPackets Topic:meshcore/{IATA}/{PUBLIC_KEY}/packets
When uploading to LetsMesh, you do not need to provide a username or password. Authentication is handled automatically when Use MeshCore Auth Token is enabled.
If a LetsMesh broker is configured with an /events packets topic, the integration auto-corrects it to /packets.
Auth Token Behavior
Auth-token mode works as follows:
- Integration requests private key from the connected node via
export_private_key() - It tries
meshcore-decoderfirst if available - If
meshcore-decoderis missing/unavailable, it falls back to in-process Python signing (PyNaCl) - If the broker rejects auth (for example after token expiry), the integration refreshes token credentials and attempts reconnect automatically
Optional owner claims for LetsMesh:
Owner Public Keyis sent as JWT claimowneronly when Use TLS and TLS Verify are both enabledOwner Emailis sent as JWT claimemailonly when Use TLS and TLS Verify are both enabledOwner Public Keymust be 64 hex charactersOwner Emailmust be a valid email format- Invalid owner values are ignored with warning logs
- Owner-claim behavior is the same for both
meshcore-decoderand Python fallback token generation paths
meshcore-decoder is optional for normal installs.
If the node cannot export its private key (firmware/export disabled), auth-token upload cannot start.
Published Payload Behavior
MQTT publishing behavior depends on broker Payload Mode.
packet mode
- Publishes packet-style payloads only (RX/RF/PACKET path)
- Uses topic shape
meshcore/{IATA}/{PUBLIC_KEY}/packetsby default - Normalizes RX/RF packet data into legacy packet JSON fields (
type=PACKET,direction,route,packet_type,hash, etc.) - Applies duplicate suppression to reduce duplicate callback publishes
raw mode
- Publishes raw event payloads without packet normalization
- Payload includes:
event_typepayload(sanitized MeshCore event payload)timestamporigin/origin_id
Packet publishes are non-retained. Status publishes (online / offline / LWT) are retained.
MQTT Connection Sensors
For each configured broker, the integration exposes a connection binary sensor under the main MeshCore device:
binary_sensor.meshcore_*_mqtt_broker_1_connectionbinary_sensor.meshcore_*_mqtt_broker_2_connection- etc.
Troubleshooting
If MQTT upload is not working:
- Confirm broker is Enabled
- Check Home Assistant logs for
[MQTT1],[MQTT2], etc. - Verify auth-token broker has valid
Token AudienceandAuth Token TTL - Verify private key export works on the connected node
- Check broker connection diagnostic sensors in Home Assistant
Common log examples:
meshcore-decoder not found ... will try Python fallback signerPrivate key export command failedAuth token requested but token generation failedRefreshed auth token; attempting reconnect