@alteriom/painlessmesh 1.6.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +380 -143
- package/LICENSE +674 -674
- package/README.md +477 -434
- package/RELEASE_GUIDE.md +504 -418
- package/docs/DOCUMENTATION_MIGRATION_PLAN.md +175 -175
- package/docs/IMPLEMENTATION_PLAN_MESH_TOPOLOGY.md +1062 -0
- package/docs/MESH_TOPOLOGY_GUIDE.md +992 -0
- package/docs/MESH_TOPOLOGY_PROGRESS.md +422 -0
- package/docs/MQTT_BRIDGE_COMMANDS.md +894 -0
- package/docs/MQTT_BRIDGE_IMPLEMENTATION_SUMMARY.md +324 -0
- package/docs/MQTT_COMMAND_SCHEMA_PROPOSAL.md +576 -0
- package/docs/MQTT_SCHEMA_COMPLIANCE.md +285 -0
- package/docs/MQTT_SCHEMA_PROPOSALS.md +446 -0
- package/docs/MQTT_SCHEMA_REVIEW.md +690 -0
- package/docs/OTA_COMMANDS_REFERENCE.md +554 -0
- package/docs/PHASE1_GUIDE.md +349 -0
- package/docs/PHASE2_GUIDE.md +543 -0
- package/docs/README.md +77 -70
- package/docs/SCHEMA_VALIDATION_CHECKLIST.md +222 -0
- package/docs/alteriom/overview.md +507 -507
- package/docs/api/core-api.md +606 -606
- package/docs/architecture/mesh-architecture.md +378 -378
- package/docs/architecture/plugin-system.md +516 -516
- package/docs/getting-started/first-mesh.md +409 -409
- package/docs/getting-started/installation.md +274 -274
- package/docs/getting-started/quickstart.md +157 -157
- package/docs/improvements/FEATURE_PROPOSALS.md +337 -0
- package/docs/improvements/PHASE1_IMPLEMENTATION.md +325 -0
- package/docs/improvements/PHASE2_IMPLEMENTATION.md +567 -0
- package/docs/improvements/README.md +86 -68
- package/docs/improvements/ota-and-status-enhancements.md +911 -0
- package/docs/improvements/ota-status-architecture-diagrams.md +658 -0
- package/docs/improvements/ota-status-quick-reference.md +284 -0
- package/docs/platformio-publishing.md +255 -0
- package/docs/platformio-setup-summary.md +121 -0
- package/docs/troubleshooting/common-issues.md +520 -520
- package/docs/troubleshooting/faq.md +472 -472
- package/docs/tutorials/basic-examples.md +717 -717
- package/docs/wiki/API-Reference.md +245 -245
- package/docs/wiki/Complete-Documentation.md +122 -122
- package/examples/alteriom/README.md +139 -81
- package/examples/alteriom/alteriom.ino +186 -185
- package/examples/alteriom/alteriom_sensor_package.hpp +240 -127
- package/examples/alteriom/platformio.ini +24 -24
- package/examples/alteriomImproved/alteriom_sensor_package.hpp +224 -0
- package/examples/{alteriom → alteriomImproved}/improved_sensor_node.ino +245 -245
- package/examples/alteriomImproved/platformio.ini +25 -0
- package/examples/alteriomPhase1/alteriom_sensor_package.hpp +224 -0
- package/examples/alteriomPhase1/phase1_features.ino +242 -0
- package/examples/alteriomPhase1/platformio.ini +25 -0
- package/examples/alteriomPhase2/alteriom_sensor_package.hpp +224 -0
- package/examples/alteriomPhase2/phase2_features.ino +186 -0
- package/examples/alteriomPhase2/platformio.ini +25 -0
- package/examples/{alteriom → alteriomSensorNode}/alteriom_sensor_node.ino +183 -183
- package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +224 -0
- package/examples/alteriomSensorNode/platformio.ini +25 -0
- package/examples/basic/basic.ino +66 -66
- package/examples/basic/platformio.ini +25 -25
- package/examples/bridge/bridge.ino +51 -51
- package/examples/bridge/mesh_event_publisher.hpp +253 -0
- package/examples/bridge/mesh_topology_reporter.hpp +303 -0
- package/examples/bridge/mqtt_command_bridge.hpp +459 -0
- package/examples/bridge/mqtt_status_bridge.hpp +519 -0
- package/examples/bridge/platformio.ini +25 -25
- package/examples/echoNode/echoNode.ino +33 -33
- package/examples/echoNode/platformio.ini +25 -25
- package/examples/logClient/logClient.ino +109 -109
- package/examples/logClient/platformio.ini +25 -25
- package/examples/logServer/logServer.ino +81 -81
- package/examples/logServer/platformio.ini +25 -25
- package/examples/meshCommandNode/alteriom_sensor_package.hpp +235 -0
- package/examples/meshCommandNode/meshCommandNode.ino +263 -0
- package/examples/meshCommandNode/platformio.ini +25 -0
- package/examples/mqttBridge/mqttBridge.ino +118 -118
- package/examples/mqttBridge/platformio.ini +26 -26
- package/examples/mqttCommandBridge/alteriom_sensor_package.hpp +235 -0
- package/examples/mqttCommandBridge/mesh_event_publisher.hpp +253 -0
- package/examples/mqttCommandBridge/mesh_topology_reporter.hpp +303 -0
- package/examples/mqttCommandBridge/mqttCommandBridge.ino +252 -0
- package/examples/mqttCommandBridge/mqtt_command_bridge.hpp +459 -0
- package/examples/mqttCommandBridge/platformio.ini +26 -0
- package/examples/mqttStatusBridge/mqttStatusBridge.ino +216 -0
- package/examples/mqttStatusBridge/mqtt_status_bridge.hpp +522 -0
- package/examples/mqttStatusBridge/platformio.ini +26 -0
- package/examples/mqttTopologyTest/README.md +467 -0
- package/examples/mqttTopologyTest/mqttTopologyTest.ino +748 -0
- package/examples/mqttTopologyTest/platformio.ini +26 -0
- package/examples/namedMesh/namedMesh.ino +97 -97
- package/examples/namedMesh/platformio.ini +25 -25
- package/examples/otaReceiver/otaReceiver.ino +79 -79
- package/examples/otaReceiver/platformio.ini +25 -25
- package/examples/otaSender/otaSender.ino +160 -151
- package/examples/otaSender/platformio.ini +25 -25
- package/examples/startHere/platformio.ini +25 -25
- package/examples/startHere/startHere.ino +159 -159
- package/examples/webServer/platformio.ini +27 -27
- package/examples/webServer/webServer.ino +89 -89
- package/keywords.txt +48 -48
- package/library.json +55 -34
- package/library.properties +10 -10
- package/package.json +86 -78
- package/src/AlteriomPainlessMesh.h +97 -97
- package/src/arduino/wifi.hpp +365 -365
- package/src/boost/asynctcp.hpp +279 -279
- package/src/painlessMesh.h +70 -70
- package/src/painlessMeshSTA.cpp +236 -236
- package/src/painlessMeshSTA.h +58 -58
- package/src/painlessTaskOptions.h +4 -4
- package/src/painlessmesh/base64.hpp +111 -111
- package/src/painlessmesh/buffer.hpp +229 -229
- package/src/painlessmesh/callback.hpp +91 -91
- package/src/painlessmesh/configuration.hpp +77 -77
- package/src/painlessmesh/connection.hpp +192 -192
- package/src/painlessmesh/layout.hpp +188 -188
- package/src/painlessmesh/logger.hpp +158 -158
- package/src/painlessmesh/memory.hpp +119 -119
- package/src/painlessmesh/mesh.hpp +761 -560
- package/src/painlessmesh/metrics.hpp +322 -322
- package/src/painlessmesh/ntp.hpp +263 -263
- package/src/painlessmesh/ota.hpp +582 -553
- package/src/painlessmesh/plugin.hpp +188 -188
- package/src/painlessmesh/protocol.hpp +813 -813
- package/src/painlessmesh/router.hpp +322 -322
- package/src/painlessmesh/tcp.hpp +71 -71
- package/src/painlessmesh/validation.hpp +238 -238
- package/src/plugin/performance.hpp +214 -214
- package/src/plugin/remote.hpp +64 -64
- package/src/scheduler.cpp +10 -10
- package/src/wifi.cpp +2 -2
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
# Quick Start Guide
|
|
2
|
-
|
|
3
|
-
Get your first painlessMesh network running in just a few minutes! This guide will walk you through creating a simple mesh network with two ESP8266 or ESP32 devices.
|
|
4
|
-
|
|
5
|
-
## What You'll Need
|
|
6
|
-
|
|
7
|
-
- 2 or more ESP8266 or ESP32 development boards
|
|
8
|
-
- Arduino IDE or PlatformIO
|
|
9
|
-
- USB cables for programming
|
|
10
|
-
|
|
11
|
-
## Step 1: Install painlessMesh
|
|
12
|
-
|
|
13
|
-
### Arduino IDE
|
|
14
|
-
1. Open Arduino IDE
|
|
15
|
-
2. Go to **Sketch → Include Library → Manage Libraries**
|
|
16
|
-
3. Search for "painlessMesh"
|
|
17
|
-
4. Install the latest version by "Coopdis"
|
|
18
|
-
|
|
19
|
-
### PlatformIO
|
|
20
|
-
Add to your `platformio.ini`:
|
|
21
|
-
```ini
|
|
22
|
-
lib_deps =
|
|
23
|
-
painlessMesh
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Step 2: Basic Mesh Example
|
|
27
|
-
|
|
28
|
-
Copy this code to your Arduino IDE or create a new PlatformIO project:
|
|
29
|
-
|
|
30
|
-
```cpp
|
|
31
|
-
#include "painlessMesh.h"
|
|
32
|
-
|
|
33
|
-
#define MESH_PREFIX "MyMeshNetwork"
|
|
34
|
-
#define MESH_PASSWORD "somethingSneaky"
|
|
35
|
-
#define MESH_PORT 5555
|
|
36
|
-
|
|
37
|
-
Scheduler userScheduler; // to control your personal task
|
|
38
|
-
painlessMesh mesh;
|
|
39
|
-
|
|
40
|
-
// User stub
|
|
41
|
-
void sendMessage(); // Prototype so PlatformIO doesn't complain
|
|
42
|
-
|
|
43
|
-
Task taskSendMessage(TASK_SECOND * 1, TASK_FOREVER, &sendMessage);
|
|
44
|
-
|
|
45
|
-
void sendMessage() {
|
|
46
|
-
String msg = "Hello from node ";
|
|
47
|
-
msg += mesh.getNodeId();
|
|
48
|
-
mesh.sendBroadcast(msg);
|
|
49
|
-
taskSendMessage.setInterval(random(TASK_SECOND * 1, TASK_SECOND * 5));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Needed for painless library
|
|
53
|
-
void receivedCallback(uint32_t from, String &msg) {
|
|
54
|
-
Serial.printf("startHere: Received from %u msg=%s\n", from, msg.c_str());
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
void newConnectionCallback(uint32_t nodeId) {
|
|
58
|
-
Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void changedConnectionCallback() {
|
|
62
|
-
Serial.printf("Changed connections\n");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
void nodeTimeAdjustedCallback(int32_t offset) {
|
|
66
|
-
Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(),offset);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
void setup() {
|
|
70
|
-
Serial.begin(115200);
|
|
71
|
-
|
|
72
|
-
// Set debug messages before init()
|
|
73
|
-
mesh.setDebugMsgTypes(ERROR | STARTUP);
|
|
74
|
-
|
|
75
|
-
// Initialize mesh
|
|
76
|
-
mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
|
|
77
|
-
mesh.onReceive(&receivedCallback);
|
|
78
|
-
mesh.onNewConnection(&newConnectionCallback);
|
|
79
|
-
mesh.onChangedConnections(&changedConnectionCallback);
|
|
80
|
-
mesh.onNodeTimeAdjusted(&nodeTimeAdjustedCallback);
|
|
81
|
-
|
|
82
|
-
// Add task to scheduler
|
|
83
|
-
userScheduler.addTask(taskSendMessage);
|
|
84
|
-
taskSendMessage.enable();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
void loop() {
|
|
88
|
-
// it will run the user scheduler as well
|
|
89
|
-
mesh.update();
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Step 3: Upload and Test
|
|
94
|
-
|
|
95
|
-
1. **Upload the code** to your first ESP8266/ESP32 device
|
|
96
|
-
2. **Open Serial Monitor** (115200 baud) to see debug messages
|
|
97
|
-
3. **Upload the same code** to your second device
|
|
98
|
-
4. Watch them automatically discover each other and start exchanging messages!
|
|
99
|
-
|
|
100
|
-
## What You Should See
|
|
101
|
-
|
|
102
|
-
In the Serial Monitor, you'll see output like:
|
|
103
|
-
```
|
|
104
|
-
startHere: New Connection, nodeId = 123456789
|
|
105
|
-
startHere: Received from 123456789 msg=Hello from node 123456789
|
|
106
|
-
Changed connections
|
|
107
|
-
Adjusted time 1234567. Offset = 12
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Key Concepts
|
|
111
|
-
|
|
112
|
-
- **Mesh Network**: All nodes automatically discover and connect to each other
|
|
113
|
-
- **Broadcasting**: Messages sent to all nodes in the network
|
|
114
|
-
- **Node ID**: Each device gets a unique identifier
|
|
115
|
-
- **Time Sync**: All nodes automatically synchronize their clocks
|
|
116
|
-
- **Self-Healing**: If nodes disconnect, the mesh automatically reorganizes
|
|
117
|
-
|
|
118
|
-
## Next Steps
|
|
119
|
-
|
|
120
|
-
Now that you have a basic mesh working:
|
|
121
|
-
|
|
122
|
-
1. **Add more nodes** - Upload the same code to additional devices
|
|
123
|
-
2. **Try different message types** - See [Custom Packages Tutorial](../tutorials/custom-packages.md)
|
|
124
|
-
3. **Add sensors** - Check out the [Sensor Networks Tutorial](../tutorials/sensor-networks.md)
|
|
125
|
-
4. **Explore Alteriom features** - Learn about [Alteriom Extensions](../alteriom/overview.md)
|
|
126
|
-
|
|
127
|
-
## Troubleshooting
|
|
128
|
-
|
|
129
|
-
**Nodes not connecting?**
|
|
130
|
-
- Make sure MESH_PREFIX and MESH_PASSWORD are identical on all devices
|
|
131
|
-
- Check that devices are within WiFi range
|
|
132
|
-
- Verify MESH_PORT is the same on all devices
|
|
133
|
-
|
|
134
|
-
**Serial output not showing?**
|
|
135
|
-
- Check baud rate is set to 115200
|
|
136
|
-
- Ensure USB cable supports data transfer
|
|
137
|
-
- Try pressing the reset button after upload
|
|
138
|
-
|
|
139
|
-
For more help, see our [Troubleshooting Guide](../troubleshooting/common-issues.md).
|
|
140
|
-
|
|
141
|
-
## Configuration Options
|
|
142
|
-
|
|
143
|
-
You can customize your mesh network by changing these parameters:
|
|
144
|
-
|
|
145
|
-
```cpp
|
|
146
|
-
// Network credentials
|
|
147
|
-
#define MESH_PREFIX "YourNetworkName" // Network name (SSID)
|
|
148
|
-
#define MESH_PASSWORD "YourPassword" // Network password
|
|
149
|
-
#define MESH_PORT 5555 // TCP port for mesh communication
|
|
150
|
-
|
|
151
|
-
// Debug levels - combine with | operator
|
|
152
|
-
mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
|
|
153
|
-
|
|
154
|
-
// Available debug types:
|
|
155
|
-
// ERROR, STARTUP, CONNECTION, SYNC, COMMUNICATION, GENERAL, MSG_TYPES, REMOTE
|
|
156
|
-
```
|
|
157
|
-
|
|
1
|
+
# Quick Start Guide
|
|
2
|
+
|
|
3
|
+
Get your first painlessMesh network running in just a few minutes! This guide will walk you through creating a simple mesh network with two ESP8266 or ESP32 devices.
|
|
4
|
+
|
|
5
|
+
## What You'll Need
|
|
6
|
+
|
|
7
|
+
- 2 or more ESP8266 or ESP32 development boards
|
|
8
|
+
- Arduino IDE or PlatformIO
|
|
9
|
+
- USB cables for programming
|
|
10
|
+
|
|
11
|
+
## Step 1: Install painlessMesh
|
|
12
|
+
|
|
13
|
+
### Arduino IDE
|
|
14
|
+
1. Open Arduino IDE
|
|
15
|
+
2. Go to **Sketch → Include Library → Manage Libraries**
|
|
16
|
+
3. Search for "painlessMesh"
|
|
17
|
+
4. Install the latest version by "Coopdis"
|
|
18
|
+
|
|
19
|
+
### PlatformIO
|
|
20
|
+
Add to your `platformio.ini`:
|
|
21
|
+
```ini
|
|
22
|
+
lib_deps =
|
|
23
|
+
painlessMesh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Step 2: Basic Mesh Example
|
|
27
|
+
|
|
28
|
+
Copy this code to your Arduino IDE or create a new PlatformIO project:
|
|
29
|
+
|
|
30
|
+
```cpp
|
|
31
|
+
#include "painlessMesh.h"
|
|
32
|
+
|
|
33
|
+
#define MESH_PREFIX "MyMeshNetwork"
|
|
34
|
+
#define MESH_PASSWORD "somethingSneaky"
|
|
35
|
+
#define MESH_PORT 5555
|
|
36
|
+
|
|
37
|
+
Scheduler userScheduler; // to control your personal task
|
|
38
|
+
painlessMesh mesh;
|
|
39
|
+
|
|
40
|
+
// User stub
|
|
41
|
+
void sendMessage(); // Prototype so PlatformIO doesn't complain
|
|
42
|
+
|
|
43
|
+
Task taskSendMessage(TASK_SECOND * 1, TASK_FOREVER, &sendMessage);
|
|
44
|
+
|
|
45
|
+
void sendMessage() {
|
|
46
|
+
String msg = "Hello from node ";
|
|
47
|
+
msg += mesh.getNodeId();
|
|
48
|
+
mesh.sendBroadcast(msg);
|
|
49
|
+
taskSendMessage.setInterval(random(TASK_SECOND * 1, TASK_SECOND * 5));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Needed for painless library
|
|
53
|
+
void receivedCallback(uint32_t from, String &msg) {
|
|
54
|
+
Serial.printf("startHere: Received from %u msg=%s\n", from, msg.c_str());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void newConnectionCallback(uint32_t nodeId) {
|
|
58
|
+
Serial.printf("--> startHere: New Connection, nodeId = %u\n", nodeId);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void changedConnectionCallback() {
|
|
62
|
+
Serial.printf("Changed connections\n");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
void nodeTimeAdjustedCallback(int32_t offset) {
|
|
66
|
+
Serial.printf("Adjusted time %u. Offset = %d\n", mesh.getNodeTime(),offset);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
void setup() {
|
|
70
|
+
Serial.begin(115200);
|
|
71
|
+
|
|
72
|
+
// Set debug messages before init()
|
|
73
|
+
mesh.setDebugMsgTypes(ERROR | STARTUP);
|
|
74
|
+
|
|
75
|
+
// Initialize mesh
|
|
76
|
+
mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
|
|
77
|
+
mesh.onReceive(&receivedCallback);
|
|
78
|
+
mesh.onNewConnection(&newConnectionCallback);
|
|
79
|
+
mesh.onChangedConnections(&changedConnectionCallback);
|
|
80
|
+
mesh.onNodeTimeAdjusted(&nodeTimeAdjustedCallback);
|
|
81
|
+
|
|
82
|
+
// Add task to scheduler
|
|
83
|
+
userScheduler.addTask(taskSendMessage);
|
|
84
|
+
taskSendMessage.enable();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void loop() {
|
|
88
|
+
// it will run the user scheduler as well
|
|
89
|
+
mesh.update();
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Step 3: Upload and Test
|
|
94
|
+
|
|
95
|
+
1. **Upload the code** to your first ESP8266/ESP32 device
|
|
96
|
+
2. **Open Serial Monitor** (115200 baud) to see debug messages
|
|
97
|
+
3. **Upload the same code** to your second device
|
|
98
|
+
4. Watch them automatically discover each other and start exchanging messages!
|
|
99
|
+
|
|
100
|
+
## What You Should See
|
|
101
|
+
|
|
102
|
+
In the Serial Monitor, you'll see output like:
|
|
103
|
+
```
|
|
104
|
+
startHere: New Connection, nodeId = 123456789
|
|
105
|
+
startHere: Received from 123456789 msg=Hello from node 123456789
|
|
106
|
+
Changed connections
|
|
107
|
+
Adjusted time 1234567. Offset = 12
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Key Concepts
|
|
111
|
+
|
|
112
|
+
- **Mesh Network**: All nodes automatically discover and connect to each other
|
|
113
|
+
- **Broadcasting**: Messages sent to all nodes in the network
|
|
114
|
+
- **Node ID**: Each device gets a unique identifier
|
|
115
|
+
- **Time Sync**: All nodes automatically synchronize their clocks
|
|
116
|
+
- **Self-Healing**: If nodes disconnect, the mesh automatically reorganizes
|
|
117
|
+
|
|
118
|
+
## Next Steps
|
|
119
|
+
|
|
120
|
+
Now that you have a basic mesh working:
|
|
121
|
+
|
|
122
|
+
1. **Add more nodes** - Upload the same code to additional devices
|
|
123
|
+
2. **Try different message types** - See [Custom Packages Tutorial](../tutorials/custom-packages.md)
|
|
124
|
+
3. **Add sensors** - Check out the [Sensor Networks Tutorial](../tutorials/sensor-networks.md)
|
|
125
|
+
4. **Explore Alteriom features** - Learn about [Alteriom Extensions](../alteriom/overview.md)
|
|
126
|
+
|
|
127
|
+
## Troubleshooting
|
|
128
|
+
|
|
129
|
+
**Nodes not connecting?**
|
|
130
|
+
- Make sure MESH_PREFIX and MESH_PASSWORD are identical on all devices
|
|
131
|
+
- Check that devices are within WiFi range
|
|
132
|
+
- Verify MESH_PORT is the same on all devices
|
|
133
|
+
|
|
134
|
+
**Serial output not showing?**
|
|
135
|
+
- Check baud rate is set to 115200
|
|
136
|
+
- Ensure USB cable supports data transfer
|
|
137
|
+
- Try pressing the reset button after upload
|
|
138
|
+
|
|
139
|
+
For more help, see our [Troubleshooting Guide](../troubleshooting/common-issues.md).
|
|
140
|
+
|
|
141
|
+
## Configuration Options
|
|
142
|
+
|
|
143
|
+
You can customize your mesh network by changing these parameters:
|
|
144
|
+
|
|
145
|
+
```cpp
|
|
146
|
+
// Network credentials
|
|
147
|
+
#define MESH_PREFIX "YourNetworkName" // Network name (SSID)
|
|
148
|
+
#define MESH_PASSWORD "YourPassword" // Network password
|
|
149
|
+
#define MESH_PORT 5555 // TCP port for mesh communication
|
|
150
|
+
|
|
151
|
+
// Debug levels - combine with | operator
|
|
152
|
+
mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
|
|
153
|
+
|
|
154
|
+
// Available debug types:
|
|
155
|
+
// ERROR, STARTUP, CONNECTION, SYNC, COMMUNICATION, GENERAL, MSG_TYPES, REMOTE
|
|
156
|
+
```
|
|
157
|
+
|
|
158
158
|
Ready to dive deeper? Check out our [Installation Guide](installation.md) for more advanced setup options!
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# Feature Proposals: OTA and Status Enhancements
|
|
2
|
+
|
|
3
|
+
**Status:** 📋 Proposal - Awaiting Review
|
|
4
|
+
**Type:** Enhancement
|
|
5
|
+
**Impact:** High
|
|
6
|
+
**Effort:** Medium-High
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 🎯 Overview
|
|
11
|
+
|
|
12
|
+
This proposal explores comprehensive enhancements to painlessMesh for production IoT deployments, focusing on two critical areas:
|
|
13
|
+
|
|
14
|
+
1. **Enhanced OTA Distribution** - More efficient, reliable, and scalable firmware updates across mesh networks
|
|
15
|
+
2. **Mesh Network Status Monitoring** - Comprehensive health monitoring and diagnostic capabilities
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📚 Documentation Index
|
|
20
|
+
|
|
21
|
+
### Quick Start
|
|
22
|
+
- **[Quick Reference Guide](ota-status-quick-reference.md)** ⚡ - Start here for TL;DR with decision matrices
|
|
23
|
+
- **[Architecture Diagrams](ota-status-architecture-diagrams.md)** 📊 - Visual understanding of each option
|
|
24
|
+
|
|
25
|
+
### Complete Analysis
|
|
26
|
+
- **[Full Proposal](ota-and-status-enhancements.md)** 📖 - Comprehensive 50+ page analysis with:
|
|
27
|
+
- Detailed examination of current implementation
|
|
28
|
+
- 5 OTA enhancement options with pros/cons
|
|
29
|
+
- 5 status monitoring options with pros/cons
|
|
30
|
+
- Implementation details and code examples
|
|
31
|
+
- Risk assessment and mitigation strategies
|
|
32
|
+
- Phased rollout recommendations
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 🚀 At a Glance
|
|
37
|
+
|
|
38
|
+
### OTA Enhancement Options
|
|
39
|
+
|
|
40
|
+
| Option | Description | Speed | Memory | Best For |
|
|
41
|
+
|--------|-------------|-------|--------|----------|
|
|
42
|
+
| **1E: Compression** ⭐⭐⭐⭐⭐ | Gzip firmware transfers | ⭐⭐⭐⭐ | +4-8KB | Everyone (start here) |
|
|
43
|
+
| **1A: Broadcast** ⭐⭐⭐⭐ | Mesh-wide simultaneous distribution | ⭐⭐⭐⭐⭐ | +2-5KB | Medium-large meshes |
|
|
44
|
+
| **1B: Progressive** ⭐⭐⭐⭐ | Phased rollout with safety checks | ⭐⭐ | +3-7KB | Production safety |
|
|
45
|
+
| 1C: Peer-to-Peer | Viral propagation via updated nodes | ⭐⭐⭐⭐⭐ | +200KB | Very large meshes |
|
|
46
|
+
| 1D: MQTT Bridge | Cloud-managed OTA via MQTT | ⭐⭐⭐ | +5-10KB | MQTT infrastructure |
|
|
47
|
+
|
|
48
|
+
### Status Monitoring Options
|
|
49
|
+
|
|
50
|
+
| Option | Description | Real-time | Overhead | Best For |
|
|
51
|
+
|--------|-------------|-----------|----------|----------|
|
|
52
|
+
| **2A: Enhanced Package** ⭐⭐⭐⭐⭐ | Extended Alteriom StatusPackage | ⭐⭐⭐ | Low | Simple integration |
|
|
53
|
+
| **2E: MQTT Bridge** ⭐⭐⭐⭐⭐ | Publish status to MQTT topics | ⭐⭐⭐ | Low | Cloud integration |
|
|
54
|
+
| **2B: Status Service** ⭐⭐⭐⭐ | Query-based status collection | ⭐⭐⭐ | Medium | Centralized control |
|
|
55
|
+
| 2C: Telemetry Stream | Continuous low-bandwidth updates | ⭐⭐⭐⭐⭐ | Very Low | Real-time critical |
|
|
56
|
+
| 2D: Health Dashboard | Complete web-based monitoring | ⭐⭐⭐⭐⭐ | Medium | User-facing apps |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 🎯 Recommended Path
|
|
61
|
+
|
|
62
|
+
### ✅ Phase 1: Quick Wins (Weeks 3-4)
|
|
63
|
+
**Implement:** Options 1E + 2A
|
|
64
|
+
**Effort:** 3-4 weeks
|
|
65
|
+
**Value:** Immediate 40-60% OTA speed improvement + standardized status
|
|
66
|
+
|
|
67
|
+
```cpp
|
|
68
|
+
// Compressed OTA
|
|
69
|
+
mesh.offerOTA("sensor", "ESP32", md5, parts, false, false, true);
|
|
70
|
+
|
|
71
|
+
// Enhanced Status
|
|
72
|
+
alteriom::EnhancedStatusPackage status;
|
|
73
|
+
status.uptime = millis() / 1000;
|
|
74
|
+
status.freeMemory = ESP.getFreeHeap() / 1024;
|
|
75
|
+
mesh.sendBroadcast(status.toJsonString());
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Benefits:**
|
|
79
|
+
- ✅ Faster OTA distribution
|
|
80
|
+
- ✅ Lower network bandwidth usage
|
|
81
|
+
- ✅ Standardized status reporting
|
|
82
|
+
- ✅ Minimal risk, high reward
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### ✅ Phase 2: Production Ready (Weeks 6-8)
|
|
87
|
+
**Implement:** Options 1A + 2E
|
|
88
|
+
**Effort:** 6-8 weeks
|
|
89
|
+
**Value:** Scalable OTA + professional monitoring
|
|
90
|
+
|
|
91
|
+
```cpp
|
|
92
|
+
// Broadcast OTA
|
|
93
|
+
mesh.offerOTA("sensor", "ESP32", md5, parts, false, true);
|
|
94
|
+
|
|
95
|
+
// MQTT Status
|
|
96
|
+
MqttStatusBridge bridge(mesh, mqttClient);
|
|
97
|
+
bridge.setPublishInterval(30000);
|
|
98
|
+
bridge.begin();
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Benefits:**
|
|
102
|
+
- ✅ Scales to large meshes (50+ nodes)
|
|
103
|
+
- ✅ Cloud integration via MQTT
|
|
104
|
+
- ✅ Professional monitoring tools (Grafana, InfluxDB)
|
|
105
|
+
- ✅ Enterprise-ready features
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### ✅ Phase 3: Advanced (Months 3-4)
|
|
110
|
+
**Implement:** Options 1B + 2C
|
|
111
|
+
**Effort:** 3-4 months
|
|
112
|
+
**Value:** Production-safe updates + real-time monitoring
|
|
113
|
+
|
|
114
|
+
```cpp
|
|
115
|
+
// Progressive Rollout
|
|
116
|
+
ProgressiveOTA ota(mesh);
|
|
117
|
+
ota.setPhases({0.05, 0.20, 1.0}); // 5%, 20%, 100%
|
|
118
|
+
ota.setHealthCheck(checkNodeHealth);
|
|
119
|
+
ota.begin("sensor", "ESP32", md5);
|
|
120
|
+
|
|
121
|
+
// Telemetry Stream
|
|
122
|
+
TelemetryStream telemetry(mesh);
|
|
123
|
+
telemetry.setInterval(60000); // 60s
|
|
124
|
+
telemetry.begin();
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Benefits:**
|
|
128
|
+
- ✅ Zero-downtime updates
|
|
129
|
+
- ✅ Early failure detection
|
|
130
|
+
- ✅ Real-time anomaly detection
|
|
131
|
+
- ✅ Proactive alerting
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 📊 Expected Results
|
|
136
|
+
|
|
137
|
+
### OTA Improvements
|
|
138
|
+
|
|
139
|
+
**Current State:**
|
|
140
|
+
- Update time: 60-120s for 10 nodes
|
|
141
|
+
- Network usage: N × Firmware_Size
|
|
142
|
+
- Success rate: ~85%
|
|
143
|
+
|
|
144
|
+
**After Phase 1 (Compression):**
|
|
145
|
+
- Update time: 35-70s (40% faster)
|
|
146
|
+
- Network usage: 0.5 × N × Firmware_Size
|
|
147
|
+
- Success rate: ~90%
|
|
148
|
+
|
|
149
|
+
**After Phase 2 (Broadcast + Compression):**
|
|
150
|
+
- Update time: 15-30s (75% faster)
|
|
151
|
+
- Network usage: 1 × Firmware_Size (regardless of node count)
|
|
152
|
+
- Success rate: ~95%
|
|
153
|
+
|
|
154
|
+
### Status Monitoring
|
|
155
|
+
|
|
156
|
+
**Current State:**
|
|
157
|
+
- Manual status collection
|
|
158
|
+
- No standardization
|
|
159
|
+
- Application-specific implementation
|
|
160
|
+
|
|
161
|
+
**After Phase 1 (Enhanced Package):**
|
|
162
|
+
- Standardized status format
|
|
163
|
+
- Integration with metrics system
|
|
164
|
+
- 500 bytes overhead per update
|
|
165
|
+
|
|
166
|
+
**After Phase 2 (MQTT Bridge):**
|
|
167
|
+
- Cloud integration
|
|
168
|
+
- Integration with standard tools
|
|
169
|
+
- Historical data tracking
|
|
170
|
+
- Alert management
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 🎓 Decision Guide
|
|
175
|
+
|
|
176
|
+
### "Which OTA option should I choose?"
|
|
177
|
+
|
|
178
|
+
**Start with:** 1E (Compression)
|
|
179
|
+
- Universal benefit (40-60% faster)
|
|
180
|
+
- Low complexity
|
|
181
|
+
- Works with existing infrastructure
|
|
182
|
+
|
|
183
|
+
**Add 1A (Broadcast) if:**
|
|
184
|
+
- Mesh has 10+ nodes
|
|
185
|
+
- Frequent OTA updates
|
|
186
|
+
- Network congestion is an issue
|
|
187
|
+
|
|
188
|
+
**Add 1B (Progressive) if:**
|
|
189
|
+
- Production deployment
|
|
190
|
+
- Cannot afford downtime
|
|
191
|
+
- Need safety guarantees
|
|
192
|
+
|
|
193
|
+
**Consider 1C (P2P) if:**
|
|
194
|
+
- Very large mesh (50+ nodes)
|
|
195
|
+
- Nodes have sufficient flash (ESP32)
|
|
196
|
+
- Need fastest possible distribution
|
|
197
|
+
|
|
198
|
+
**Use 1D (MQTT) if:**
|
|
199
|
+
- Already using MQTT infrastructure
|
|
200
|
+
- Need cloud-based management
|
|
201
|
+
- External OTA tools required
|
|
202
|
+
|
|
203
|
+
### "Which status option should I choose?"
|
|
204
|
+
|
|
205
|
+
**Start with:** 2A (Enhanced StatusPackage)
|
|
206
|
+
- Easiest integration
|
|
207
|
+
- Builds on existing Alteriom packages
|
|
208
|
+
- Minimal changes required
|
|
209
|
+
|
|
210
|
+
**Add 2E (MQTT Bridge) if:**
|
|
211
|
+
- Need cloud monitoring
|
|
212
|
+
- Using monitoring tools (Grafana, etc.)
|
|
213
|
+
- Want historical data
|
|
214
|
+
|
|
215
|
+
**Use 2B (Status Service) if:**
|
|
216
|
+
- Need centralized aggregation
|
|
217
|
+
- On-demand queries preferred
|
|
218
|
+
- RESTful API required
|
|
219
|
+
|
|
220
|
+
**Use 2C (Telemetry) if:**
|
|
221
|
+
- Real-time monitoring critical
|
|
222
|
+
- Large-scale deployment (50+ nodes)
|
|
223
|
+
- Proactive alerting needed
|
|
224
|
+
|
|
225
|
+
**Use 2D (Dashboard) if:**
|
|
226
|
+
- User-facing application
|
|
227
|
+
- Need visual interface
|
|
228
|
+
- Web-based monitoring required
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## ⚠️ Important Notes
|
|
233
|
+
|
|
234
|
+
### For OTA Implementation
|
|
235
|
+
|
|
236
|
+
**Always remember:**
|
|
237
|
+
- ✅ Include OTA support in updated firmware (prevents bricking)
|
|
238
|
+
- ✅ Test on single node before mesh-wide deployment
|
|
239
|
+
- ✅ Implement rollback mechanism for failures
|
|
240
|
+
- ✅ Use MD5 validation for firmware integrity
|
|
241
|
+
- ✅ Consider progressive rollout for production
|
|
242
|
+
|
|
243
|
+
**Common pitfalls:**
|
|
244
|
+
- ❌ Updating all nodes simultaneously without testing
|
|
245
|
+
- ❌ Forgetting OTA support in new firmware
|
|
246
|
+
- ❌ Skipping MD5 validation
|
|
247
|
+
- ❌ No rollback plan
|
|
248
|
+
|
|
249
|
+
### For Status Monitoring
|
|
250
|
+
|
|
251
|
+
**Always remember:**
|
|
252
|
+
- ✅ Choose appropriate update intervals (30-60s typical)
|
|
253
|
+
- ✅ Implement timeout handling for non-responsive nodes
|
|
254
|
+
- ✅ Monitor memory usage to prevent exhaustion
|
|
255
|
+
- ✅ Set up alerts for critical conditions
|
|
256
|
+
|
|
257
|
+
**Common pitfalls:**
|
|
258
|
+
- ❌ Polling status too frequently (causes congestion)
|
|
259
|
+
- ❌ Ignoring memory warnings (causes crashes)
|
|
260
|
+
- ❌ Assuming all nodes respond (timeouts happen)
|
|
261
|
+
- ❌ No historical data retention
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 🔄 Current Status
|
|
266
|
+
|
|
267
|
+
### Completed
|
|
268
|
+
- ✅ Analysis of current implementation
|
|
269
|
+
- ✅ Research of enhancement options
|
|
270
|
+
- ✅ Detailed proposal documentation
|
|
271
|
+
- ✅ Architecture diagrams
|
|
272
|
+
- ✅ Quick reference guide
|
|
273
|
+
|
|
274
|
+
### Next Steps
|
|
275
|
+
1. ⏳ Review proposal with team
|
|
276
|
+
2. ⏳ Approve Phase 1 features
|
|
277
|
+
3. ⏳ Create detailed design documents
|
|
278
|
+
4. ⏳ Set up test infrastructure
|
|
279
|
+
5. ⏳ Begin Phase 1 implementation
|
|
280
|
+
|
|
281
|
+
### Timeline
|
|
282
|
+
- **Weeks 1-2:** Review and approval
|
|
283
|
+
- **Weeks 3-6:** Phase 1 implementation
|
|
284
|
+
- **Weeks 7-12:** Phase 2 implementation
|
|
285
|
+
- **Months 4-6:** Phase 3 implementation
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 🤝 Contributing
|
|
290
|
+
|
|
291
|
+
Interested in implementing these features?
|
|
292
|
+
|
|
293
|
+
1. Read the full proposal: [ota-and-status-enhancements.md](ota-and-status-enhancements.md)
|
|
294
|
+
2. Review architecture: [ota-status-architecture-diagrams.md](ota-status-architecture-diagrams.md)
|
|
295
|
+
3. Check quick reference: [ota-status-quick-reference.md](ota-status-quick-reference.md)
|
|
296
|
+
4. Open a GitHub issue to discuss
|
|
297
|
+
5. Submit a pull request with implementation
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## 📖 Related Resources
|
|
302
|
+
|
|
303
|
+
### In This Repository
|
|
304
|
+
- [Library Improvements Overview](README.md)
|
|
305
|
+
- [Metrics System](../../src/painlessmesh/metrics.hpp)
|
|
306
|
+
- [Alteriom Packages](../../examples/alteriom/alteriom_sensor_package.hpp)
|
|
307
|
+
- [OTA Sender Example](../../examples/otaSender/otaSender.ino)
|
|
308
|
+
- [OTA Receiver Example](../../examples/otaReceiver/otaReceiver.ino)
|
|
309
|
+
- [MQTT Bridge Example](../../examples/mqttBridge/mqttBridge.ino)
|
|
310
|
+
|
|
311
|
+
### Documentation
|
|
312
|
+
- [painlessMesh Architecture](../architecture/mesh-architecture.md)
|
|
313
|
+
- [Plugin System](../architecture/plugin-system.md)
|
|
314
|
+
- [API Reference](../api/core-api.md)
|
|
315
|
+
- [Troubleshooting](../troubleshooting/common-issues.md)
|
|
316
|
+
|
|
317
|
+
### External References
|
|
318
|
+
- ESP-IDF OTA Documentation
|
|
319
|
+
- ArduinoOTA Library
|
|
320
|
+
- MQTT Protocol Specification
|
|
321
|
+
- InfluxDB/Grafana Integration
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## 📞 Contact
|
|
326
|
+
|
|
327
|
+
Questions or feedback?
|
|
328
|
+
|
|
329
|
+
- **GitHub Issues:** https://github.com/Alteriom/painlessMesh/issues
|
|
330
|
+
- **Discussions:** https://github.com/Alteriom/painlessMesh/discussions
|
|
331
|
+
- **Email:** See CONTRIBUTING.md
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
**Last Updated:** December 2024
|
|
336
|
+
**Proposal Version:** 1.0
|
|
337
|
+
**Status:** Ready for Review
|