Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 1.59 KB

README.md

File metadata and controls

41 lines (32 loc) · 1.59 KB

MQTT gateway for painlessMesh network

Gateway node in mesh network connects to mqtt gateway via serial connection.

Message relay

Messages shall be in JSON format. Only topic and payload are used. Payload is left intact. Topic being changed when relaying.

{ "topic": "....", "payload":"........." }

Mesh ==> MQTT

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()

MQTT ==> Mesh

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

Components

esp-nodes\src\regular-node.cpp

These are regular nodes in mesh. Use as a base for esp8266/esp32 devices.

esp-nodes\src\gateway-node.cpp

This is gateway node in mesh. Only one. Shall be connected to server machine via serial.

mqtt-gateway

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.

build procedure

  1. -- at first install node.js and npm (i tried on node 8.x, npm 5.x)
  2. cd node-painlessmesh-mqtt-gate
  3. edit config.js or export env variables (look inside file)
  4. npm install
  5. npm start