Skip to main content

Home Assistant and Node-RED Integration

Integration Architecture

The standard integration path from a Meshtastic mesh to Home Assistant or Node-RED is:

  1. Meshtastic MQTT gateway — a mesh node with WiFi (or a dedicated gateway device) publishes all received mesh packets to an MQTT broker as JSON
  2. MQTT broker (Mosquitto) — runs on the local network (often on the same machine as Home Assistant); receives all packets from the gateway
  3. Home Assistant or Node-RED — subscribes to the MQTT topics and processes the incoming data

Home Assistant Setup via HACS

The Meshtastic integration for Home Assistant is available through HACS (Home Assistant Community Store):

  1. Install HACS in Home Assistant if not already present
  2. Search for "Meshtastic" in HACS integrations and install
  3. Add the integration in Home Assistant Settings → Integrations → Add Integration → Meshtastic
  4. Configure with your MQTT broker address, port, and topic prefix (default: msh)
  5. Nodes appear as Home Assistant devices with individual sensors for position, battery level, and telemetry values

What You Can Do in Home Assistant

  • Geofencing automations: trigger actions when a node's GPS position enters or leaves a defined zone — useful for "person arriving home" automations using a mesh device as a low-cost tracker
  • Telemetry alerts: send a notification when a remote temperature sensor exceeds a threshold (e.g., greenhouse overheating, freezer failure)
  • Battery low notifications: alert when a field node's battery level drops below a set percentage
  • Dashboard visualization: display node positions on a map card alongside other Home Assistant entities

Node-RED Alternative

Node-RED provides more flexibility for complex processing pipelines than the Home Assistant integration:

  • Use the node-red-contrib-meshtastic node for direct serial/TCP connection to a Meshtastic device, or process raw MQTT JSON from the broker with standard MQTT nodes
  • Build custom routing logic: filter messages by node ID, apply transformations, forward to multiple destinations simultaneously
  • Suitable for multi-destination forwarding — e.g., send alerts to both Home Assistant and a Telegram bot at the same time

Example Node-RED Flow

A typical data logging flow:

  1. MQTT In node — subscribes to the Meshtastic MQTT topic
  2. JSON parse node — parses the raw MQTT payload
  3. Switch node — filters for a specific node ID (e.g., only process packets from your sensor node)
  4. Function node — extracts the desired telemetry fields and formats a row
  5. Google Sheets node — appends the row to a Google Sheet for long-term logging

MeshCore and Home Assistant

MeshCore does not have a native MQTT gateway equivalent to Meshtastic's built-in WiFi gateway. Integration options include:

  • Serial/USB bridge script: connect a MeshCore node to a Raspberry Pi or other Linux machine via USB, use the MeshCore Python library to read incoming data, and publish it to an MQTT broker with a custom script
  • Custom Home Assistant integration: a community-developed integration using the Python library can expose MeshCore nodes as HA devices
  • This approach requires more custom development compared to the plug-and-play Meshtastic HACS integration

Privacy Considerations

Position and telemetry data from your nodes is visible to anyone who has access to your mesh channel. By default, Meshtastic devices transmit on the public LongFast channel, meaning nearby nodes operated by others can receive your telemetry.

  • Configure a private channel with a unique name and PSK for nodes you don't want public network participants to observe
  • Consider whether you want GPS position data from home-based sensor nodes to be visible on public MQTT bridges (e.g., MQTT.meshdev.in)
  • Disable MQTT uplink on nodes with sensitive data if you use the public broker