Gateway node in mesh network connects to mqtt gateway via serial connection.
Messages shall be in JSON format. Only topic and payload are used. Payload is left intact. Topic being changed when relaying.
{ "topic": "....", "payload":"........." }
All messages inside mesh network which sent to esp-mesh-gateway will be relayed to MQTT broker.
topic in mesh | published to MQTT topic | comment |
---|---|---|
"abc" | "mesh-out/XXXX/abc" | where XXXX is mesh.nodeId() |
Only MQTT messages sent to "mesh_in/XXXX/blahblah" topics are being relayed to mesh.
topic in MQTT | relayed to mesh as | comment |
---|---|---|
"mesh-in/0/abc" | "abc" | broadcast message to all nodes in mesh |
"mesh-in/XXXX/abc" | "abc" | direct message to node with mesh.nodeId()=XXXX |
These are regular nodes in mesh. Use as a base for esp8266/esp32 devices.
This is gateway node in mesh. Only one. Shall be connected to server machine via serial.
This is node.js based gateway which listens to messages from serial port, relays them to MQTT and back. Can be run on any windows or linux machine which supports node.js.
- -- at first install node.js and npm (i tried on node 8.x, npm 5.x)
- cd node-painlessmesh-mqtt-gate
- edit config.js or export env variables (look inside file)
- npm install
- npm start