Skip to content

Instantly share code, notes, and snippets.

@Staars
Last active March 3, 2025 12:22
Show Gist options
  • Save Staars/42f8b41ddc593d25db868b30b8c28721 to your computer and use it in GitHub Desktop.
Save Staars/42f8b41ddc593d25db868b30b8c28721 to your computer and use it in GitHub Desktop.
WIP driver TASMESH

TAS-MESH

This driver provides the ability to move TASMOTA-devices out of the WLAN by using ESP-NOW to communicate bidirectional with an internal protocol.
Thus the workload for the WLAN-router is reduced and with the reduced overhead the local 2,4-GHz-band will be freed of some traffic. Power consumption of the nodes will be reduced significantly allowing better battery powered projects with TASMOTA. Automatic payload encryption is applied using the WiFi-password1 as the key. A maximum of 32 bytes of this password is used for the ChaCha20Poly1305 authenticated encryption as the key. As ACK/NACK messages seem to be not reliable on both ESP-platforms, the method "send-and-pray" is used.

Working priciple

An ESP32 is needed as gateway/broker to connect the nodes (typically an ESP8266) to the WLAN. The ESP32 will receive the MQTT-topic of every node and subscribe to it as a proxy.
If a MQTT-message in the form of 'cmnd/node_topic/...' is received, the broker will automatically send this to the referring node via ESP-NOW.
The broker will automatically send time messages to all nodes.

The nodes will send their MQTT-messages back to the broker via ESP-NOW.

Commands

MESHBROKER - starts the broker on the ESP32, printing out the MAC and used WiFi-channel to the log. Must be called after WiFi is initialized!! Example 'Rule1 on system#boot do meshbroker endon'

MESHCHANNEL n - changes the WiFi-channel (on the node) to n (1-13) according to the channel of the (ESP32-)broker.

MESHNODE AA:BB:CC:DD:EE:FF - starts a node and connects the the broker with the given MAC-address, will automatically send MQTT-topic to the broker

MESHPEER AA:BB:CC:DD:EE:FF - usable to add a known node to another node to be able to send data via the mesh to the broker, that may be out of reach

RULES examples:
rule3 on mesh#node=1 do meshpeer 2cf4323cdb33 endon

  • add a known peer (another node in the mesh) after the node has initialized

rule1 on system#boot do meshbroker endon

  • the broker must be started after wifi is up!!

ToDo:

  • handle persisitence, for now RULES can be used
  • error handling, fall-back mechanisms

Known issues:

  • cmnd/node_topic/something can not be launched on the broker
@SensorsIot
Copy link

I want to use this functionality in my Smartmeter interface. But I do not find how to enable it or which Firmware version I need

@Staars
Copy link
Author

Staars commented Mar 3, 2025

An updated version of this document can be found here:
https://github.com/arendst/Tasmota/blob/development/info/xdrv_57_tasmesh.md

The driver is still a work in progress and that's why there is no documentation in the official docs.

To use it a self compiled build is needed, which is described in the linked document.

(I will probably delete this GIST in the not so distant future as it is outdated and more confusing than helpful.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment