info/xdrv_57_tasmesh.md
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.
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.
Add #define USE_TASMESH to your file user_config_override.h before compilation.
WARNING: The MAC address used for ESP-NOW on the broker is the Soft AP MAC, not the WiFi MAC.
NOTE: The colons in the mac addresses of the commands are optional.
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 1..13 - 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
MeshInterval 2..200 - changes the interval between mesh messages default set to 50 ms
Rules examples:
rule1 on system#boot do meshbroker endonrule1 on system#init do meshnode FA:KE:AD:DR:ES:S1 endon
system#boot will likely not be ready until after a node attempting to join at system#init.
This will cause the node to fail to mesh and no retrying is implemented at this time.
To account for this, instead of (or in addition to) using a rule on the nodes, assign all nodes to a common group topic (GroupTopic2 tasnodes) and have the broker send a command on that topic after it is ready:</br>rule2 on mesh#broker=1 do publish cmnd/tasnodes/meshnode FA:KE:AD:DR:ES:S1rule3 on mesh#node=1 do meshpeer FA:KE:AD:DR:ES:S1 endonThe following limitations apply: