@alteriom/painlessmesh 1.7.6 → 1.7.8

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +177 -0
  2. package/README.md +96 -14
  3. package/RELEASE_GUIDE.md +36 -0
  4. package/docs/API_DESIGN_GUIDELINES.md +414 -0
  5. package/docs/BOOLEAN_NAMING_CONVENTION.md +235 -0
  6. package/docs/MQTT_BRIDGE_COMMANDS.md +10 -10
  7. package/docs/MQTT_BRIDGE_IMPLEMENTATION_SUMMARY.md +1 -1
  8. package/docs/MQTT_SCHEMA_COMPLIANCE.md +57 -2
  9. package/docs/PHASE1_GUIDE.md +1 -1
  10. package/docs/alteriom/overview.md +25 -2
  11. package/docs/architecture/plugin-system.md +1 -1
  12. package/docs/archive/RELEASE_SUMMARY.md +1 -1
  13. package/docs/releases/RELEASE_CHECKLIST_v1.7.6.md +389 -0
  14. package/docs/releases/RELEASE_SUMMARY_v1.7.7.md +391 -0
  15. package/docs/v1.7.7_MQTT_IMPROVEMENTS.md +794 -0
  16. package/docs/wiki/API-Reference.md +2 -2
  17. package/docs/wiki/Complete-Documentation.md +1 -1
  18. package/examples/alteriom/README.md +150 -4
  19. package/examples/alteriom/alteriom.ino +1 -1
  20. package/examples/alteriom/alteriom_sensor_package.hpp +914 -4
  21. package/examples/alteriomImproved/alteriom_sensor_package.hpp +1 -1
  22. package/examples/alteriomImproved/improved_sensor_node.ino +1 -1
  23. package/examples/alteriomMetricsHealth/alteriom_sensor_package.hpp +796 -0
  24. package/examples/alteriomMetricsHealth/metrics_health_node.ino +418 -0
  25. package/examples/alteriomMetricsHealth/platformio.ini +26 -0
  26. package/examples/alteriomPhase1/alteriom_sensor_package.hpp +1 -1
  27. package/examples/alteriomPhase1/phase1_features.ino +2 -2
  28. package/examples/alteriomPhase2/alteriom_sensor_package.hpp +1 -1
  29. package/examples/alteriomSensorNode/alteriom_sensor_node.ino +1 -1
  30. package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +1 -1
  31. package/examples/bridge/enhanced_mqtt_bridge.hpp +610 -0
  32. package/examples/bridge/enhanced_mqtt_bridge_example.ino +226 -0
  33. package/examples/meshCommandNode/alteriom_sensor_package.hpp +1 -1
  34. package/examples/mqttCommandBridge/alteriom_sensor_package.hpp +1 -1
  35. package/examples/mqttTopologyTest/mqttTopologyTest.ino +5 -1
  36. package/library.json +1 -1
  37. package/library.properties +1 -1
  38. package/package.json +2 -2
@@ -84,7 +84,7 @@ variant.printTo(message);
84
84
  mesh.sendBroadcast(message);
85
85
  ```
86
86
 
87
- ### CommandPackage (Type 201)
87
+ ### CommandPackage (Type 400)
88
88
 
89
89
  Device control and automation commands for remote node management.
90
90
 
@@ -176,7 +176,7 @@ void receivedCallback(uint32_t from, String& msg) {
176
176
  case 200: // SensorPackage
177
177
  handleSensorData(alteriom::SensorPackage(obj), from);
178
178
  break;
179
- case 201: // CommandPackage
179
+ case 400: // CommandPackage
180
180
  handleCommand(alteriom::CommandPackage(obj), from);
181
181
  break;
182
182
  case 202: // StatusPackage
@@ -77,7 +77,7 @@ For environmental sensor data collection:
77
77
  - Battery level monitoring
78
78
  - Timestamp synchronization
79
79
 
80
- ### CommandPackage (Type 201)
80
+ ### CommandPackage (Type 400)
81
81
  For device control and automation:
82
82
  - Remote device commands
83
83
  - Parameter passing via JSON
@@ -15,8 +15,8 @@ Broadcast package for sharing environmental sensor data across the mesh.
15
15
  - `timestamp` - Unix timestamp of measurement
16
16
  - `batteryLevel` - Battery level percentage (0-100)
17
17
 
18
- ### CommandPackage (Type 201)
19
- Single-destination package for sending commands to specific nodes.
18
+ ### CommandPackage (Type 400)
19
+ Single-destination package for sending commands to specific nodes. Uses COMMAND code (400) per mqtt-schema v0.7.2+ for full compliance.
20
20
 
21
21
  **Fields:**
22
22
  - `command` - Command type identifier
@@ -44,6 +44,129 @@ Extended status package with comprehensive health metrics (18 fields).
44
44
  - `avgLatency`, `packetLossRate`, `throughput` - Performance metrics
45
45
  - `alertFlags`, `lastError` - Alert system
46
46
 
47
+ ### MetricsPackage (Type 204) - NEW in v1.7.7
48
+ Comprehensive performance metrics for detailed monitoring and dashboards.
49
+
50
+ **Key Fields:**
51
+ - `cpuUsage`, `loopIterations`, `taskQueueSize` - CPU and processing metrics
52
+ - `freeHeap`, `minFreeHeap`, `heapFragmentation`, `maxAllocHeap` - Memory metrics
53
+ - `bytesReceived`, `bytesSent`, `packetsReceived`, `packetsSent` - Network performance
54
+ - `avgResponseTime`, `maxResponseTime`, `avgMeshLatency` - Timing metrics
55
+ - `connectionQuality`, `wifiRSSI` - Connection quality indicators
56
+ - `collectionTimestamp`, `collectionInterval` - Collection metadata
57
+
58
+ **Use Cases:**
59
+ - Real-time performance dashboards
60
+ - Capacity planning and optimization
61
+ - Network throughput analysis
62
+ - Latency monitoring
63
+
64
+ ### HealthCheckPackage (Type 605) - NEW in v1.7.7
65
+ Proactive health monitoring with problem detection and recommendations.
66
+
67
+ **Key Fields:**
68
+ - `healthStatus` - Overall health: 0=critical, 1=warning, 2=healthy
69
+ - `problemFlags` - Bit flags for specific problems (16 types)
70
+ - `memoryHealth`, `networkHealth`, `performanceHealth` - Component health scores (0-100)
71
+ - `memoryTrend` - Memory leak detection (bytes/hour)
72
+ - `packetLossPercent`, `reconnectionCount` - Network stability
73
+ - `missedDeadlines`, `maxLoopTime` - Performance indicators
74
+ - `temperature`, `temperatureHealth` - Environmental monitoring
75
+ - `estimatedTimeToFailure` - Predictive maintenance indicator
76
+ - `recommendations` - Actionable guidance for operators
77
+
78
+ **Problem Flags:**
79
+ - 0x0001 - Low memory warning
80
+ - 0x0002 - High CPU usage
81
+ - 0x0004 - Connection instability
82
+ - 0x0008 - High packet loss
83
+ - 0x0010 - Network congestion
84
+ - 0x0020 - Low battery
85
+ - 0x0040 - Thermal warning
86
+ - 0x0080 - Mesh partition detected
87
+ - 0x0100 - OTA in progress
88
+ - 0x0200 - Configuration error
89
+
90
+ **Use Cases:**
91
+ - Proactive problem detection
92
+ - Predictive maintenance
93
+ - Automated alerting
94
+ - Memory leak detection
95
+
96
+ ### MeshNodeListPackage (Type 600) - NEW in v1.7.7
97
+ List of all nodes in the mesh network with their status.
98
+
99
+ **Fields:**
100
+ - `nodes[]` - Array of node information (max 50)
101
+ - `nodeId` - Node identifier
102
+ - `status` - 0=offline, 1=online, 2=unreachable
103
+ - `lastSeen` - Unix timestamp of last communication
104
+ - `signalStrength` - RSSI in dBm
105
+ - `nodeCount` - Total number of nodes
106
+ - `meshId` - Mesh network identifier
107
+
108
+ **Use Cases:**
109
+ - Node discovery and monitoring
110
+ - Network health visualization
111
+ - Device inventory management
112
+
113
+ ### MeshTopologyPackage (Type 601) - NEW in v1.7.7
114
+ Mesh network topology with all connections between nodes.
115
+
116
+ **Fields:**
117
+ - `connections[]` - Array of connections (max 100)
118
+ - `fromNode` - Source node ID
119
+ - `toNode` - Destination node ID
120
+ - `linkQuality` - Link quality 0.0-1.0
121
+ - `latencyMs` - Latency in milliseconds
122
+ - `hopCount` - Number of hops
123
+ - `connectionCount` - Total number of connections
124
+ - `rootNode` - Root/gateway node ID
125
+
126
+ **Use Cases:**
127
+ - Topology visualization
128
+ - Network optimization
129
+ - Path analysis
130
+
131
+ ### MeshAlertPackage (Type 602) - NEW in v1.7.7
132
+ Mesh network alerts for critical events and warnings.
133
+
134
+ **Fields:**
135
+ - `alerts[]` - Array of alerts (max 20)
136
+ - `alertType` - Alert type (0-8: low_memory, node_offline, connection_lost, etc.)
137
+ - `severity` - 0=info, 1=warning, 2=critical
138
+ - `message` - Human-readable alert message
139
+ - `nodeId` - Related node ID
140
+ - `metricValue` - Related metric value
141
+ - `threshold` - Threshold that triggered alert
142
+ - `alertId` - Unique alert identifier
143
+ - `alertCount` - Total number of alerts
144
+
145
+ **Use Cases:**
146
+ - Automated alerting
147
+ - Problem notification
148
+ - Event logging
149
+
150
+ ### MeshBridgePackage (Type 603) - NEW in v1.7.7
151
+ Bridge package for encapsulating native mesh protocol messages.
152
+
153
+ **Fields:**
154
+ - `meshProtocol` - 0=painlessMesh, 1=esp-now, 2=ble-mesh, etc.
155
+ - `fromNodeId` - Source node ID
156
+ - `toNodeId` - Destination node ID (0=broadcast)
157
+ - `meshType` - Mesh protocol-specific message type
158
+ - `rawPayload` - Raw payload (hex/base64 encoded)
159
+ - `rssi` - Signal strength in dBm
160
+ - `hopCount` - Number of hops
161
+ - `meshTimestamp` - Mesh protocol timestamp
162
+ - `gatewayNodeId` - Gateway's node ID
163
+ - `meshNetworkId` - Mesh network identifier
164
+
165
+ **Use Cases:**
166
+ - Mesh-to-MQTT bridging
167
+ - Multi-protocol support
168
+ - Protocol translation
169
+
47
170
  ## Examples
48
171
 
49
172
  ### `alteriom_sensor_node.ino`
@@ -61,6 +184,17 @@ Phase 1 OTA enhancement example demonstrating:
61
184
  - Alert system implementation
62
185
  - Usage patterns for Phase 1 features
63
186
 
187
+ ### `metrics_health_node.ino` (NEW in v1.7.7)
188
+ Comprehensive monitoring node example demonstrating:
189
+ - MetricsPackage (Type 204) collection and broadcasting
190
+ - HealthCheckPackage (Type 605) proactive monitoring (MESH_METRICS)
191
+ - CPU usage calculation and tracking
192
+ - Memory leak detection with trend analysis
193
+ - Network quality assessment
194
+ - Problem flag detection and alerting
195
+ - Predictive maintenance indicators
196
+ - Configurable collection intervals
197
+
64
198
  ## Usage
65
199
 
66
200
  ```cpp
@@ -77,7 +211,7 @@ mesh.sendBroadcast(sensor.toJsonString());
77
211
  // Handle incoming commands
78
212
  void handleMessage(String& msg) {
79
213
  auto doc = parseJson(msg);
80
- if (doc["type"] == 201) {
214
+ if (doc["type"] == 400) {
81
215
  CommandPackage cmd(doc.as<JsonObject>());
82
216
  processCommand(cmd);
83
217
  }
@@ -137,4 +271,16 @@ This validates:
137
271
  - Package type consistency
138
272
  - Field preservation
139
273
  - Edge case handling
140
- - Integration with painlessMesh plugin system
274
+ - Integration with painlessMesh plugin system
275
+ - JSON structure consistency (nested vs flat)
276
+
277
+ ## Documentation
278
+
279
+ For developers adding new configuration fields to Alteriom packages:
280
+
281
+ - **[API Design Guidelines](../../docs/API_DESIGN_GUIDELINES.md)** - Comprehensive guide on when to use nested vs flat JSON structures
282
+ - **[Time Field Naming Convention](alteriom_sensor_package.hpp#L10-L55)** - How to handle time-based fields (ms/s variants)
283
+ - **[Boolean Naming Convention](../../docs/BOOLEAN_NAMING_CONVENTION.md)** - Consistent patterns for boolean fields (*Set, *Enabled, is*)
284
+ - **[JSON Structure Guidelines](alteriom_sensor_package.hpp#L57-L121)** - Quick reference for nesting patterns
285
+
286
+ These guidelines ensure consistency and maintainability across all Alteriom packages.
@@ -126,7 +126,7 @@ void handleIncomingPackage(uint32_t from, String& msg) {
126
126
  // Process sensor data (store, forward, analyze, etc.)
127
127
  } break;
128
128
 
129
- case 201: // CommandPackage
129
+ case 400: // CommandPackage
130
130
  {
131
131
  CommandPackage receivedCmd(obj);
132
132
  if (receivedCmd.dest == mesh.getNodeId()) {