@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
package/CHANGELOG.md CHANGED
@@ -19,6 +19,183 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
 
20
20
  - TBD
21
21
 
22
+ ## [1.7.8] - 2025-11-04
23
+
24
+ ### Added
25
+
26
+ - **BRIDGE_TO_INTERNET.md** - Comprehensive documentation for bridging mesh networks to the Internet via WiFi router
27
+ - Complete code examples with AP+STA mode configuration
28
+ - WiFi channel matching requirements and best practices
29
+ - Links to working bridge examples (basic, MQTT, web server, enhanced MQTT)
30
+ - Architecture diagrams and forwarding patterns
31
+ - Troubleshooting and additional resources
32
+
33
+ - **Enhanced StatusPackage** - New organization and sensor configuration fields
34
+ - Organization fields: `organizationId`, `organizationName`, `organizationDomain`
35
+ - Sensor configuration: `sensorTypes` array, `sensorConfig` JSON, `sensorInventory` array
36
+ - Separate JSON serialization keys for sensors data vs configuration
37
+ - CamelCase field naming convention for consistency
38
+
39
+ - **API Design Guidelines** - `docs/API_DESIGN_GUIDELINES.md`
40
+ - Field naming conventions (camelCase, units in field names)
41
+ - Boolean naming patterns (`is`, `has`, `should`, `can`)
42
+ - Time field naming with units (`_ms`, `_s`, `_us` suffixes)
43
+ - Serialization patterns and consistency rules
44
+ - Comprehensive validation tests
45
+
46
+ - **Manual Publishing Workflow** - `.github/workflows/manual-publish.yml`
47
+ - On-demand NPM and GitHub Packages publishing
48
+ - Fixes cases where automated release doesn't trigger package publication
49
+ - Configurable options for selective publishing
50
+
51
+ ### Changed
52
+
53
+ - **Time Field Naming Convention** - Consistent unit suffixes across all packages
54
+ - `collectionTimestamp` → `collectionTimestamp_ms`
55
+ - `avgResponseTime` → `avgResponseTime_us`
56
+ - `estimatedTimeToFailure` → `estimatedTimeToFailure_s`
57
+ - All time fields now include explicit units in field names
58
+ - Documentation: `docs/architecture/TIME_FIELD_NAMING.md`
59
+
60
+ - **StatusPackage JSON Structure** - Improved field organization
61
+ - Sensor data uses `sensors` key (array of readings)
62
+ - Sensor configuration uses separate keys (`sensorTypes`, `sensorConfig`, `sensorInventory`)
63
+ - No key collisions between runtime data and configuration
64
+ - Unconditional serialization for predictable JSON structure
65
+
66
+ - **MQTT Retry Logic** - Fixed serialization to include all retry fields
67
+ - Proper condition for including retry configuration
68
+ - Epsilon comparison for floating-point backoff multiplier
69
+
70
+ ### Fixed
71
+
72
+ - **CI Pipeline** - Made validate-release depend on CI completion
73
+ - Prevents release validation from running before tests complete
74
+ - Ensures all tests pass before release can proceed
75
+
76
+ - **ArduinoJson API** - Updated deprecated API usage
77
+ - Fixed deprecated JsonVariant::is<JsonObject>() calls
78
+ - Updated to ArduinoJson 7.x compatible patterns
79
+ - Code formatting improvements
80
+
81
+ - **ESP8266 Compatibility** - Fixed `getDeviceId()` function
82
+ - Added proper ESP8266 implementation in mqttTopologyTest
83
+ - Platform-specific device ID retrieval
84
+
85
+ - **Documentation** - Multiple improvements
86
+ - Fixed v1.7.7 release date in documentation
87
+ - Added comprehensive mqtt-schema v0.7.2+ message type codes table
88
+ - Corrected CommandPackage type number (400, not 201)
89
+ - Enhanced Alteriom Extensions section in README
90
+ - Added GitHub Packages authentication for npm install
91
+
92
+ ## [1.7.7] - 2025-11-05
93
+
94
+ ### Added
95
+
96
+ - **MQTT Schema v0.7.2 Compliance** - Updated to @alteriom/mqtt-schema v0.7.2
97
+ - Added `message_type` field to all packages for 90% faster classification
98
+ - MetricsPackage (204) now aligns with schema SENSOR_METRICS (v0.7.2+)
99
+ - CommandPackage moved from type 201 → 400 (COMMAND per schema, resolves conflict with SENSOR_HEARTBEAT)
100
+ - HealthCheckPackage uses 605 (MESH_METRICS per mqtt-schema v0.7.2+)
101
+ - EnhancedStatusPackage uses 604 (MESH_STATUS per mqtt-schema v0.7.2+)
102
+ - Compatible with mesh bridge schema (type 603) for future integration
103
+
104
+ - **MetricsPackage (Type 204)** - Comprehensive performance metrics for real-time monitoring and dashboards
105
+ - CPU and processing metrics (cpuUsage, loopIterations, taskQueueSize)
106
+ - Memory metrics (freeHeap, minFreeHeap, heapFragmentation, maxAllocHeap)
107
+ - Network performance (bytesReceived, bytesSent, packetsDropped, currentThroughput)
108
+ - Timing and latency metrics (avgResponseTime, maxResponseTime, avgMeshLatency)
109
+ - Connection quality indicators (connectionQuality, wifiRSSI)
110
+ - Collection metadata for tracking
111
+
112
+ - **MeshNodeListPackage (Type 600)** - List of all nodes in mesh network (MESH_NODE_LIST per mqtt-schema v0.7.2+)
113
+ - Array of node information (nodeId, status, lastSeen, signalStrength)
114
+ - Total node count and mesh identifier
115
+ - Enables node discovery and monitoring
116
+
117
+ - **MeshTopologyPackage (Type 601)** - Mesh network topology with connections (MESH_TOPOLOGY per mqtt-schema v0.7.2+)
118
+ - Array of connections between nodes (fromNode, toNode, linkQuality, latencyMs, hopCount)
119
+ - Root/gateway node identification
120
+ - Enables topology visualization and network analysis
121
+
122
+ - **MeshAlertPackage (Type 602)** - Mesh network alerts and warnings (MESH_ALERT per mqtt-schema v0.7.2+)
123
+ - Array of alerts with type, severity, and message
124
+ - Node-specific and network-wide alerts
125
+ - Threshold-based alerting with metric values
126
+
127
+ - **MeshBridgePackage (Type 603)** - Bridge for native mesh protocol messages (MESH_BRIDGE per mqtt-schema v0.7.2+)
128
+ - Encapsulates native painlessMesh protocol messages
129
+ - Supports multiple mesh protocols (painlessMesh, esp-now, ble-mesh, etc.)
130
+ - Includes RSSI, hop count, and timing information
131
+ - Enables mesh-to-MQTT bridging
132
+
133
+ - **HealthCheckPackage (Type 605)** - Proactive health monitoring with problem detection (MESH_METRICS per mqtt-schema v0.7.2+)
134
+ - Overall health status (0=critical, 1=warning, 2=healthy)
135
+ - Problem flags for 10+ specific issue types (low memory, high CPU, network issues, etc.)
136
+ - Component health scores (memoryHealth, networkHealth, performanceHealth)
137
+ - Memory leak detection with trend analysis (bytes/hour)
138
+ - Predictive maintenance indicators (estimatedTimeToFailure)
139
+ - Actionable recommendations for operators
140
+ - Environmental monitoring (temperature, temperatureHealth)
141
+
142
+ - **Example Implementation** - `examples/alteriom/metrics_health_node.ino`
143
+ - Demonstrates complete metrics collection and health monitoring
144
+ - Configurable collection intervals
145
+ - CPU usage calculation
146
+ - Memory leak detection
147
+ - Network quality assessment
148
+ - Problem flag detection and alerting
149
+
150
+ - **Comprehensive Testing** - `test/catch/catch_metrics_health_packages.cpp`
151
+ - 64 test assertions validating both new packages
152
+ - Edge case handling (min/max values)
153
+ - Problem flag testing
154
+ - Health status level validation
155
+ - Serialization/deserialization verification
156
+
157
+ - **Documentation** - `docs/v1.7.7_MQTT_IMPROVEMENTS.md`
158
+ - Complete implementation guide
159
+ - MQTT bridge integration examples
160
+ - Dashboard integration (Grafana, InfluxDB, Home Assistant)
161
+ - Performance considerations and optimization tips
162
+ - Alert configuration examples
163
+ - Best practices and troubleshooting
164
+
165
+ ### Improved
166
+
167
+ - **MQTT Communication Efficiency** - Optimized metric collection for large meshes
168
+ - Minimal network overhead (~109 bytes/sec for 10 nodes)
169
+ - Configurable collection intervals based on health status
170
+ - Selective reporting of changed metrics
171
+
172
+ - **Problem Detection** - Early warning system for common issues
173
+ - Memory leak detection with trend analysis
174
+ - Network instability detection
175
+ - Performance degradation alerts
176
+ - Thermal warnings
177
+ - Mesh partition detection
178
+
179
+ - **Predictive Maintenance** - Proactive failure prevention
180
+ - Estimated time to failure calculations
181
+ - Memory exhaustion prediction
182
+ - Automated recommendations
183
+ - Health-based interval adjustment
184
+
185
+ ### Performance
186
+
187
+ - **Memory Impact**: <1KB overhead for both packages with reasonable collection intervals
188
+ - **Network Bandwidth**: Minimal impact (~109 bytes/sec for 10 nodes with 30s/60s intervals)
189
+ - **CPU Overhead**: <1% additional CPU usage for metric collection
190
+
191
+ ### Compatibility
192
+
193
+ - **100% Backward Compatible** with v1.7.6
194
+ - All existing packages (200-203) work unchanged
195
+ - New packages (204, 604, 605) are optional additions
196
+ - No breaking changes to existing code
197
+ - Can be adopted incrementally
198
+
22
199
  ## [1.7.6] - 2025-10-19
23
200
 
24
201
  ### Fixed
package/README.md CHANGED
@@ -24,12 +24,80 @@ This fork includes specialized packages for structured IoT communication:
24
24
 
25
25
  #### Custom Package Types
26
26
 
27
- - **`SensorPackage`** (Type 200) - Environmental data collection (temperature, humidity, pressure, battery levels)
28
- - **`CommandPackage`** (Type 201) - Device control and automation commands
29
- - **`StatusPackage`** (Type 202) - Health monitoring and system status reporting
30
- - **`EnhancedStatusPackage`** (Type 203) - Detailed performance metrics and mesh statistics
31
-
32
- All packages provide type-safe serialization, automatic JSON conversion, and mesh-wide broadcasting or targeted messaging.
27
+ **Core IoT Packages:**
28
+
29
+ - **`SensorPackage`** (Type 200) - Environmental data collection
30
+ - Temperature, humidity, pressure monitoring
31
+ - Battery level tracking
32
+ - Sensor ID and timestamp fields
33
+ - Ideal for environmental monitoring and smart agriculture
34
+
35
+ - **`StatusPackage`** (Type 202) - Basic health monitoring
36
+ - Device status flags and uptime
37
+ - Free memory and WiFi strength
38
+ - Firmware version tracking
39
+ - Command response capability for MQTT bridge
40
+
41
+ - **`CommandPackage`** (Type 400) - Device control and automation (COMMAND per mqtt-schema v0.7.2+)
42
+ - Targeted command execution
43
+ - JSON parameter support
44
+ - Command tracking with unique IDs
45
+ - Perfect for remote device control
46
+
47
+ **Advanced Monitoring Packages (Phase 2):**
48
+
49
+ - **`MetricsPackage`** (Type 204) - Comprehensive performance metrics (SENSOR_METRICS per mqtt-schema v0.7.2+)
50
+ - CPU usage and processing metrics
51
+ - Memory health (heap, fragmentation, max allocation)
52
+ - Network throughput and packet statistics
53
+ - Response time and latency tracking
54
+ - Connection quality and WiFi RSSI
55
+ - Dashboard-ready data collection
56
+
57
+ - **`HealthCheckPackage`** (Type 605) - Proactive problem detection (MESH_METRICS per mqtt-schema v0.7.2+)
58
+ - Overall health scoring (0-100 for memory, network, performance)
59
+ - Problem flag indicators (16-bit flags for specific issues)
60
+ - Memory leak detection with trend analysis
61
+ - Predictive maintenance (estimated time to failure)
62
+ - Crash tracking and reboot reason codes
63
+ - Actionable recommendations
64
+
65
+ **Mesh Topology & Management (Phase 2):**
66
+
67
+ - **`EnhancedStatusPackage`** (Type 604) - Detailed mesh status (MESH_STATUS per mqtt-schema v0.7.2+)
68
+ - Complete mesh statistics (node count, connections, messages)
69
+ - Performance metrics (latency, packet loss, throughput)
70
+ - Alert flags and error reporting
71
+ - Firmware verification with MD5 hash
72
+
73
+ - **`MeshNodeListPackage`** (Type 600) - Node discovery and inventory (MESH_NODE_LIST per mqtt-schema v0.7.2+)
74
+ - List of all mesh nodes with status (offline/online/unreachable)
75
+ - Signal strength (RSSI) for each node
76
+ - Last seen timestamps
77
+ - Supports up to 50 nodes per message
78
+
79
+ - **`MeshTopologyPackage`** (Type 601) - Network topology visualization (MESH_TOPOLOGY per mqtt-schema v0.7.2+)
80
+ - Connection graph with link quality
81
+ - Latency measurements per connection
82
+ - Hop count tracking
83
+ - Root/gateway node identification
84
+ - Supports up to 100 connections per message
85
+
86
+ - **`MeshAlertPackage`** (Type 602) - Network event notifications (MESH_ALERT per mqtt-schema v0.7.2+)
87
+ - Configurable alert types (low memory, node offline, connection lost)
88
+ - Severity levels (info, warning, critical)
89
+ - Metric-based threshold triggering
90
+ - Human-readable alert messages
91
+ - Supports up to 20 alerts per message
92
+
93
+ - **`MeshBridgePackage`** (Type 603) - Protocol bridging (MESH_BRIDGE per mqtt-schema v0.7.2+)
94
+ - Encapsulates native mesh protocol messages
95
+ - Multi-protocol support (painlessMesh, ESP-NOW, BLE-Mesh)
96
+ - Raw payload with signal strength
97
+ - Gateway node identification
98
+ - Enables heterogeneous mesh networks
99
+
100
+ All packages provide type-safe serialization, automatic JSON conversion, and mesh-wide broadcasting or targeted messaging. They align with mqtt-schema v0.7.2+ for enterprise IoT integration.
33
101
 
34
102
  #### 🚀 Phase 2 Features (v1.7.0+)
35
103
 
@@ -177,8 +245,15 @@ void receivedCallback(uint32_t from, String& msg) {
177
245
  | Type | Class | Purpose | Fields |
178
246
  |------|-------|---------|--------|
179
247
  | 200 | `SensorPackage` | Environmental data | `temperature`, `humidity`, `pressure`, `sensorId`, `timestamp`, `batteryLevel` |
180
- | 201 | `CommandPackage` | Device control | `command`, `targetDevice`, `parameters`, `commandId` |
181
248
  | 202 | `StatusPackage` | Health monitoring | `deviceStatus`, `uptime`, `freeMemory`, `wifiStrength`, `firmwareVersion` |
249
+ | 204 | `MetricsPackage` | Sensor metrics (v1.7.7+, aligns with schema v0.7.2+) | `cpuUsage`, `freeHeap`, `bytesReceived`, `currentThroughput`, `connectionQuality`, `wifiRSSI` |
250
+ | 400 | `CommandPackage` | Device control (v1.7.7+, moved from 201) | `command`, `targetDevice`, `parameters`, `commandId` |
251
+ | 600 | `MeshNodeListPackage` | Mesh node list (v1.7.7+, MESH_NODE_LIST) | `nodes[]` (nodeId, status, lastSeen, signalStrength), `nodeCount`, `meshId` |
252
+ | 601 | `MeshTopologyPackage` | Mesh topology (v1.7.7+, MESH_TOPOLOGY) | `connections[]` (fromNode, toNode, linkQuality, latencyMs), `rootNode` |
253
+ | 602 | `MeshAlertPackage` | Mesh alerts (v1.7.7+, MESH_ALERT) | `alerts[]` (alertType, severity, message, nodeId), `alertCount` |
254
+ | 603 | `MeshBridgePackage` | Mesh bridge (v1.7.7+, MESH_BRIDGE) | `meshProtocol`, `fromNodeId`, `toNodeId`, `meshType`, `rawPayload`, `rssi`, `hopCount` |
255
+ | 604 | `EnhancedStatusPackage` | Mesh status (MESH_STATUS per schema v0.7.2+) | `nodeCount`, `connectionCount`, `messagesReceived`, `messagesSent`, `avgLatency`, `packetLossRate` |
256
+ | 605 | `HealthCheckPackage` | Mesh metrics (v1.7.7+, MESH_METRICS per schema v0.7.2+) | `healthStatus`, `problemFlags`, `memoryHealth`, `networkHealth`, `performanceHealth`, `recommendations` |
182
257
 
183
258
  ## Key Features
184
259
 
@@ -207,16 +282,23 @@ void receivedCallback(uint32_t from, String& msg) {
207
282
  - **Event Coordination** - Synchronized displays, distributed processing
208
283
  - **Bridge Networks** - Connect mesh to WiFi/Internet/MQTT
209
284
 
210
- ## Latest Release: v1.7.6 (October 19, 2025)
285
+ ## Development Version: v1.7.8
286
+
287
+ **In Development** - Next release after v1.7.7
288
+
289
+ See [CHANGELOG](CHANGELOG.md) for upcoming changes.
290
+
291
+ ## Latest Release: v1.7.7 (November 5, 2025)
211
292
 
212
- **Critical emergency fix** for compilation failures in v1.7.4 and v1.7.5:
293
+ **MQTT Schema v0.7.2 Compliance with Enhanced Monitoring**:
213
294
 
214
- - ✅ **Compilation Fixed** - Resolved "_task_request_t was not declared" error
215
- - ✅ **ESP32 & ESP8266** - All platforms now compile successfully
216
- - ✅ **FreeRTOS Stability** - Maintained ~85% crash reduction on ESP32
217
- - 🚨 **v1.7.4/v1.7.5 Users** - Upgrade immediately (those versions don't compile)
295
+ - ✅ **MetricsPackage (Type 204)** - Comprehensive performance metrics for real-time monitoring
296
+ - ✅ **HealthCheckPackage (Type 605)** - Proactive health monitoring with problem detection
297
+ - ✅ **Mesh Topology Packages** - Complete network visualization (Types 600-603)
298
+ - **Enhanced MQTT Bridge** - On-demand metrics, health checks, and aggregated statistics
299
+ - ✅ **100% Backward Compatible** - All existing code continues to work
218
300
 
219
- **[📋 Full Release Notes](docs/releases/RELEASE_SUMMARY_v1.7.6.md)** | **[🔖 CHANGELOG](CHANGELOG.md)**
301
+ **[📋 Full Release Notes](docs/releases/RELEASE_SUMMARY_v1.7.7.md)** | **[🔖 CHANGELOG](CHANGELOG.md)**
220
302
 
221
303
  ## Getting Help
222
304
 
package/RELEASE_GUIDE.md CHANGED
@@ -344,6 +344,42 @@ npm whoami
344
344
  # Create any page to initialize, then re-run release
345
345
  ```
346
346
 
347
+ **NPM/GitHub Packages Not Published Automatically**
348
+
349
+ If the automated release ran but NPM and GitHub Packages weren't published, it's likely due to the commit message not matching the required pattern.
350
+
351
+ The automated workflow requires the commit message to start with `release:` (lowercase with colon):
352
+ ```bash
353
+ # ✅ Correct - Will trigger NPM/GitHub Packages publishing
354
+ git commit -m "release: v1.7.7 - Complete mqtt-schema implementation"
355
+
356
+ # ❌ Wrong - Will create tag/release but skip NPM publishing
357
+ git commit -m "Release v1.7.7 - Complete mqtt-schema implementation"
358
+ ```
359
+
360
+ **Solution: Use Manual Publishing Workflow**
361
+
362
+ If this happens, you can manually publish packages:
363
+
364
+ 1. Go to **Actions** → **Manual Package Publishing**
365
+ 2. Click **Run workflow**
366
+ 3. Select options:
367
+ - ✅ Publish to NPM Registry
368
+ - ✅ Publish to GitHub Packages
369
+ 4. Click **Run workflow**
370
+
371
+ The manual workflow will:
372
+ - Read the current version from `library.properties`
373
+ - Publish to NPM (if selected)
374
+ - Publish to GitHub Packages (if selected)
375
+ - Show success/failure status for each
376
+
377
+ Alternatively, from command line:
378
+ ```bash
379
+ # Trigger via GitHub CLI
380
+ gh workflow run manual-publish.yml
381
+ ```
382
+
347
383
  ### Manual Override
348
384
 
349
385
  If automation fails, you can manually perform any step: