Meshtastic and Home Assistant

I recently read about Meshtastic, a decentralised, off-grid network that lets you send and receive messages using affordable, low-power devices using the LoRa protocol.

I found the whole concept quite interesting, in that it allows you to keep comms in a situation where the grid is unreliable or fails, and broadcast information like GPS coordinates, all in an encrypted manner.

The devices are extremely low powered, and run for multiple days. The range varies considerably by device and environment, varying from ~2 km in an urban setting (with obstacles) to 100+ km with perfect line of sight.

While the mesh functionality depends on other nodes existing within range, you can always use direct communication between your devices.

It can always work as a backup, and as a way to ensure you can communicate with your ā€œgroupā€ while doing activities like hiking.

Hardware Selection

There is a vast selection of hardware available that can be used with Meshtastic, ranging from portable nodes to solar-powered devices that are designed to be mounted up high on houses, trees, or mountains.
If you are curious to just try it out, the XIAO ESP32S3 & Wio-SX1262 Kit for Meshtastic is a tiny ESP32-based, USB-C powered unit, available from Seeedstudio for under 10€. The cost really isn’t a barrier preventing most people from trying this out.

My ā€œHomeā€ node

For use with my Home Assistant, I picked the Rak WisMesh Ethernet MQTT Gateway. I went for the POE version so that I could place it in my attic, or potentially even on the roof, where I wouldn’t have any alternative power source available. Ethernet is also convenient in that it allows connection to my Home Assistant without having to worry about WiFi or Bluetooth range.

The PoE powered Rak WisMesh Ethernet MQTT Gateway
The PoE powered Rak WisMesh Ethernet MQTT Gateway

Mobile nodes

I bought a pair of SenseCAP T1000-E Card Trackers, which have no display but connect to your phone over BLE for messaging. They can otherwise still work as pure trackers, even if not connected to a phone, providing position updates over Meshtastic.

The credit card sized SenseCAP T1000-E
The credit card sized SenseCAP T1000-E

Home Assistant Integration

While the official Meshtastic documentation doesn’t make it obvious, as it only mentions integration via MQTT, there is actually an official Home Assistant Meshtastic Integration which, in my experience, works really well. It allows you to set a node as a gateway, and to interact with the mesh from that node, all via Home Assistant.

You can send and receive messages (via notify. entities), as well as receive telemetry (sensor. entities) and position updates (device_tracker. entities) from connected nodes. The integration exposes a device for each selected node, allowing you to neatly manage all this information within Home Assistant. The integration also exposes the Meshtastic Web client via a bridge, allowing you to interact with it manually, should you want to.

Practical Automations

There are a few examples of how to handle automations on the integration’s GitHub page.
The easiest way is to create an automation that triggers on ā€œManual Eventsā€ and put meshtastic_api_text_message as the ā€œEvent Typeā€. This will cause this automation to be triggered on all incoming channel and direct messages. You can then add conditions to filter out what you need.

You can use the trigger data to pass basically all the information to/on the automation. It includes channel number, sender node id, receiver node id, and the content of the message. You can even use variables to map the channel and node id to a specific name, to make it more user friendly.

Forwarding Meshtastic messages to a notify.entity

I have set up an automation1 to forward any Meshtastic message received on my Home node to my phone (via telegram) and to my computer’s browser.

Receiving a message results in a notification that looks like this:

Telegram notification with the content forwarded from a Meshtastic message.
Telegram notification with the content forwarded from a Meshtastic message.

Code

A flexible person.tracker

One of my potential use cases is to use these as a tracker within Home Assistant. Whereas myself and my partner have our phones tied to our person.entity, automatically setting a home or away state, my daughter doesn’t have a phone, and any relatives that are visiting don’t have their phones tracked for Home Assistant presence. Having a couple of these Meshtastic devices means that I can just grab one from the drawer, press the button to turn it on and assign it to the ā€œGuestā€ person, and… suddenly my smart home knows if they are around. This is especially handy to handle things like alarms or presence-based automations. If/when my daughter eventually gets into a creche/preschool, it may also serve as a handy tracker that can just be placed in her bag.

I have a small card in the Home Assistant dashboard where I can just quickly assign it to someone on the fly.

The card allowing me to assign either tracker to a person.
The card allowing me to assign either tracker to a person.

Requirements
  • Device trackers integrated into Home Assistant (in this case, Meshtastic nodes which expose a device_tracker.entity in Home Assistant).
  • The Spook integration, for the person.add_device_tracker and person.remove_device_tracker actions;
  • A input_select.helper for each tracker device, with a none option plus one entry for each person. I chose to use a ā€œfriendlyā€ name in the helper, and then mapped them to the person.entities in the automation itself.
Code

Conclusion

Meshtastic offers an interesting solution for off-grid communication that integrates surprisingly well with Home Assistant. What began as simple curiosity about decentralised networks and emergency communication capability has proven to be a surprisingly practical addition to my smart home setup, with flexible presence detection being an unexpected bonus.

The ability to maintain some basic communication during power outages or network failures gives me peace of mind, whilst the Home Assistant integration opens up creative automation possibilities. The flexible person tracking system can be particularly useful for guests and family members without tracked devices.

If you’re interested in emergency preparedness or off-grid communication, Meshtastic devices represent excellent value on their own. The learning curve is gentle, the community is helpful, and the potential applications extend well beyond basic messaging. Whether you’re hiking in remote areas, enjoying a festival with friends, or simply want a robust backup communication system, these devices can be relied upon when or where traditional networks fail.

For those already invested in the Home Assistant ecosystem, the integration opens up additional possibilities that make these cool gadgets even more fun to experiment with. The combination creates opportunities for creative automations and presence detection that, whilst not essential for emergency communication, certainly enhance the overall smart home experience.

Footnotes

  1. Personally, I use Node-RED to handle my Home Assistant automations. When I first started using Home Assistant, Node-RED was both easier and more powerful to use than the native Automation functionality. I still prefer it as it makes it easier to organise and reuse parts of the automations. ↩