@alteriom/painlessmesh 1.7.9 → 1.8.1

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 (42) hide show
  1. package/CHANGELOG.md +118 -2
  2. package/README.md +159 -12
  3. package/docs/BRIDGE_FAILOVER.md +512 -0
  4. package/docs/BRIDGE_HEALTH_MONITORING.md +293 -0
  5. package/docs/CREATE_MISSING_RELEASES.md +321 -0
  6. package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +523 -0
  7. package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +542 -0
  8. package/examples/alteriom/alteriom_sensor_package.hpp +213 -0
  9. package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +1014 -11
  10. package/examples/basic/basic.ino +6 -2
  11. package/examples/bridge/bridge.ino +44 -23
  12. package/examples/bridge/bridge_health_monitoring_example.ino +188 -0
  13. package/examples/bridgeAwareSensorNode/alteriom_sensor_package.hpp +1227 -0
  14. package/examples/bridgeAwareSensorNode/bridgeAwareSensorNode.ino +343 -0
  15. package/examples/bridgeAwareSensorNode/platformio.ini +26 -0
  16. package/examples/bridge_failover/README.md +358 -0
  17. package/examples/bridge_failover/bridge_failover.ino +180 -0
  18. package/examples/bridge_failover/platformio.ini +27 -0
  19. package/examples/diagnosticsExample/diagnosticsExample.ino +171 -0
  20. package/examples/diagnosticsExample/platformio.ini +26 -0
  21. package/examples/multi_bridge/README.md +346 -0
  22. package/examples/multi_bridge/primary_bridge.ino +96 -0
  23. package/examples/multi_bridge/regular_node.ino +141 -0
  24. package/examples/multi_bridge/secondary_bridge.ino +111 -0
  25. package/examples/ntpTimeSyncBridge/alteriom_sensor_package.hpp +1383 -0
  26. package/examples/ntpTimeSyncBridge/ntpTimeSyncBridge.ino +81 -0
  27. package/examples/ntpTimeSyncNode/alteriom_sensor_package.hpp +1383 -0
  28. package/examples/ntpTimeSyncNode/ntpTimeSyncNode.ino +109 -0
  29. package/examples/queued_alarms/README.md +390 -0
  30. package/examples/queued_alarms/queued_alarms.ino +265 -0
  31. package/examples/rtcIntegration/README.md +235 -0
  32. package/examples/rtcIntegration/rtcIntegration.ino +196 -0
  33. package/library.json +1 -1
  34. package/library.properties +1 -1
  35. package/package.json +1 -1
  36. package/src/arduino/wifi.hpp +888 -0
  37. package/src/painlessMeshSTA.cpp +63 -0
  38. package/src/painlessMeshSTA.h +3 -0
  39. package/src/painlessmesh/mesh.hpp +1327 -4
  40. package/src/painlessmesh/message_queue.hpp +368 -0
  41. package/src/painlessmesh/plugin.hpp +69 -0
  42. package/src/painlessmesh/rtc.hpp +203 -0
package/CHANGELOG.md CHANGED
@@ -7,18 +7,134 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.8.1] - 2025-11-10
11
+
10
12
  ### Added
11
13
 
12
- - TBD
14
+ - **GitHub Copilot Custom Agent Support** - Custom agent configuration now discoverable by GitHub
15
+ - Moved `copilot-agents.json` to repository root for automatic GitHub Copilot integration
16
+ - Release Agent now available as `@release-agent` in GitHub Copilot Chat (Enterprise)
17
+ - Enhanced repository context for all GitHub Copilot users
18
+ - Complete agent documentation in `.github/agents/` directory
13
19
 
14
20
  ### Changed
15
21
 
16
- - TBD
22
+ - **Documentation Updates** - Improved clarity for custom agent setup
23
+ - Updated `COPILOT_AGENT_SETUP.md` with root file location
24
+ - Enhanced `AGENTS_INDEX.md` with discovery information
25
+ - Added examples for using custom agents in development workflow
26
+
27
+ ### Fixed
28
+
29
+ - **Custom Agent Visibility** - Resolved issue where custom agent tasks were not showing in GitHub
30
+ - GitHub Copilot now automatically discovers the release agent configuration
31
+ - Agent appears in Copilot Chat suggestions when available
32
+ - Knowledge sources properly linked for enhanced context
33
+
34
+ ## [1.8.0] - 2025-11-09
35
+
36
+ ### Added
37
+
38
+ - **Diagnostics API for Bridge Operations** - Comprehensive monitoring and debugging tools
39
+ - New diagnostic methods for bridge state, topology, and connectivity
40
+ - Election history tracking with detailed event logging
41
+ - Network topology visualization with neighbor information
42
+ - Connectivity testing and validation tools
43
+ - Comprehensive diagnostic report generation
44
+ - Minimal overhead when diagnostics enabled
45
+ - Examples: `examples/diagnostics/` directory
46
+ - Documentation: `DIAGNOSTICS_API.md`
47
+
48
+ - **Bridge Health Monitoring & Metrics Collection** - Real-time bridge performance metrics
49
+ - New `BridgeHealthMetrics` struct with connectivity, signal, traffic, and performance data
50
+ - Four API methods: `getBridgeHealthMetrics()`, `resetHealthMetrics()`, `getHealthMetricsJSON()`, `onHealthMetricsUpdate()`
51
+ - Automatic tracking of uptime, disconnects, RSSI, traffic bytes, latency, and packet loss
52
+ - JSON export for integration with MQTT, Prometheus, Grafana, CloudWatch
53
+ - Periodic callback support for automated monitoring
54
+ - Zero overhead when not used
55
+ - Comprehensive unit tests (63 assertions)
56
+ - Example: `examples/bridge/bridge_health_monitoring_example.ino`
57
+ - Documentation: `docs/BRIDGE_HEALTH_MONITORING.md`
58
+
59
+ - **RTC (Real-Time Clock) Integration** - Hardware RTC support for offline timekeeping
60
+ - Support for DS3231, DS1307, and PCF8523 RTC modules
61
+ - Automatic time persistence across reboots and power failures
62
+ - Seamless integration with NTP time sync
63
+ - Comprehensive unit tests for RTC functionality
64
+ - Example sketches demonstrating RTC usage
65
+
66
+ - **Bridge Status Broadcast & Callback (Type 610)** - Real-time Internet connectivity monitoring
67
+ - Bridge nodes automatically broadcast connectivity status every 30 seconds
68
+ - New `onBridgeStatusChanged()` callback for connectivity state changes
69
+ - API methods: `hasInternetConnection()`, `getPrimaryBridge()`, `getBridges()`, `isBridge()`
70
+ - Status includes Internet connectivity, router RSSI, channel, uptime, gateway IP
71
+ - Enable offline mode and message queueing when Internet unavailable
72
+ - Support for bridge failover scenarios
73
+ - Documentation: `BRIDGE_STATUS_FEATURE.md`
74
+
75
+ - **Automatic Bridge Failover with RSSI-Based Election (Types 611, 612)** - High-availability bridge management
76
+ - Distributed bridge election protocol when primary bridge fails
77
+ - RSSI-based node selection for optimal bridge placement
78
+ - New `BridgeElectionPackage` (Type 611) for election coordination
79
+ - New `BridgeTakeoverPackage` (Type 612) for bridge transition announcements
80
+ - API methods: `enableBridgeFailover()`, `setRouterCredentials()`, `onBridgeRoleChanged()`
81
+ - Automatic promotion of best-positioned node to bridge role
82
+ - Tiebreaker rules: uptime, free memory, node ID
83
+ - Split-brain prevention and oscillation protection
84
+ - Graceful handling of multiple sequential failures
85
+ - Critical for production high-availability systems (Issue #64)
86
+
87
+ - **NTP Time Synchronization (Type 614)** - Bridge-to-mesh NTP time distribution
88
+ - New `NTPTimeSyncPackage` for broadcasting NTP time from bridge nodes
89
+ - Bridge nodes with Internet distribute authoritative time to entire mesh
90
+ - Eliminates per-node NTP queries (saves bandwidth and power)
91
+ - Supports RTC synchronization for offline operation
92
+ - Includes accuracy field for time uncertainty tracking
93
+ - Comprehensive unit tests (5 scenarios, 38 assertions)
94
+ - Example sketches: `ntpTimeSyncBridge.ino` and `ntpTimeSyncNode.ino`
95
+ - Documentation: `NTP_TIME_SYNC_FEATURE.md`
96
+
97
+ - **Bridge-Centric Architecture** - New `initAsBridge()` method for automatic channel detection
98
+ - Bridge nodes now connect to router first and auto-detect its channel
99
+ - Mesh network automatically configured on router's channel
100
+ - Eliminates need for manual channel configuration
101
+ - Automatically sets root node flags
102
+ - Graceful fallback to channel 1 if router connection fails
103
+
104
+ - **Auto Channel Detection for Regular Nodes** - Support for `channel=0` in `init()`
105
+ - Regular nodes can now auto-detect mesh channel by scanning all channels
106
+ - Falls back to channel 1 if mesh not found
107
+ - Simplifies multi-node deployments
108
+
109
+ - **Helper Function** - New `scanForMeshChannel()` static method
110
+ - Scans all 13 WiFi channels to find mesh SSID
111
+ - Supports hidden networks
112
+ - Returns detected channel or 0 if not found
113
+ - Detailed logging for troubleshooting
114
+
115
+ ### Changed
116
+
117
+ - **Enhanced Documentation** - Updated bridge and basic examples
118
+ - `examples/bridge/bridge.ino` now uses `initAsBridge()` API
119
+ - `examples/basic/basic.ino` demonstrates auto channel detection
120
+ - `BRIDGE_TO_INTERNET.md` rewritten with bridge-centric approach
121
+ - `README.md` includes bridge quick start guide
122
+
123
+ - **StationScan Enhancement** - Modified `stationScan()` to support all-channel scanning
124
+ - When `channel=0`, automatically scans all channels before connecting
125
+ - Auto-updates mesh channel based on detected network
17
126
 
18
127
  ### Fixed
19
128
 
20
129
  - TBD
21
130
 
131
+ ### Backward Compatibility
132
+
133
+ - All existing code continues to work without changes
134
+ - Manual channel configuration (`mesh.init(..., channel)`) still supported
135
+ - Legacy `stationManual()` approach still available
136
+ - No breaking API changes
137
+
22
138
  ## [1.7.9] - 2025-11-08
23
139
 
24
140
  ### Fixed
package/README.md CHANGED
@@ -97,7 +97,27 @@ This fork includes specialized packages for structured IoT communication:
97
97
  - Gateway node identification
98
98
  - Enables heterogeneous mesh networks
99
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.
100
+ **Bridge Failover & High Availability (v1.8.0):**
101
+
102
+ - **`BridgeStatusPackage`** (Type 610) - Bridge health monitoring (BRIDGE_STATUS per mqtt-schema v0.7.3+)
103
+ - Internet connectivity status
104
+ - Router signal strength (RSSI)
105
+ - Gateway IP and router channel
106
+ - Heartbeat for failure detection
107
+
108
+ - **`BridgeElectionPackage`** (Type 611) - Automatic failover election (BRIDGE_ELECTION per mqtt-schema v0.7.3+)
109
+ - Router RSSI measurement
110
+ - Node uptime and free memory
111
+ - Distributed consensus protocol
112
+ - RSSI-based winner selection
113
+
114
+ - **`BridgeTakeoverPackage`** (Type 612) - Bridge role announcement (BRIDGE_TAKEOVER per mqtt-schema v0.7.3+)
115
+ - New bridge identification
116
+ - Previous bridge tracking
117
+ - Takeover reason and timestamp
118
+ - Seamless failover notification
119
+
120
+ All packages provide type-safe serialization, automatic JSON conversion, and mesh-wide broadcasting or targeted messaging. They align with mqtt-schema v0.7.3+ for enterprise IoT integration.
101
121
 
102
122
  #### 🚀 Phase 2 Features (v1.7.0+)
103
123
 
@@ -117,6 +137,38 @@ All packages provide type-safe serialization, automatic JSON conversion, and mes
117
137
 
118
138
  See [Phase 2 Guide](docs/PHASE2_GUIDE.md) for complete documentation.
119
139
 
140
+ #### 🔄 Automatic Bridge Failover (v1.8.0)
141
+
142
+ **High Availability for Critical Systems**
143
+
144
+ - 🎯 **RSSI-Based Election** - Best signal strength wins bridge role
145
+ - 🔍 **Automatic Detection** - 60-second failure detection via heartbeats
146
+ - ⚡ **Fast Failover** - 60-70 second typical recovery time
147
+ - 🌐 **Distributed Consensus** - No single coordinator, deterministic winner selection
148
+ - 🛡️ **Split-Brain Prevention** - State machine prevents concurrent elections
149
+ - 📊 **Tiebreaker Rules** - RSSI → Uptime → Memory → Node ID
150
+
151
+ **Use Cases:**
152
+ - Fish farm alarm systems requiring 24/7 Internet connectivity
153
+ - Industrial IoT networks with critical sensor monitoring
154
+ - Smart building systems needing continuous cloud connectivity
155
+
156
+ **Example:**
157
+ ```cpp
158
+ // Enable automatic bridge failover
159
+ mesh.setRouterCredentials(ROUTER_SSID, ROUTER_PASSWORD);
160
+ mesh.enableBridgeFailover(true);
161
+ mesh.onBridgeRoleChanged(&bridgeRoleCallback);
162
+
163
+ void bridgeRoleCallback(bool isBridge, String reason) {
164
+ if (isBridge) {
165
+ Serial.printf("🎯 Promoted to bridge: %s\n", reason.c_str());
166
+ }
167
+ }
168
+ ```
169
+
170
+ See [Bridge Failover Guide](docs/BRIDGE_FAILOVER.md) and [bridge_failover example](examples/bridge_failover/) for complete documentation.
171
+
120
172
  #### MQTT Bridge Commands
121
173
 
122
174
  The MQTT bridge enables bidirectional communication between MQTT brokers and mesh networks:
@@ -242,6 +294,61 @@ void receivedCallback(uint32_t from, String& msg) {
242
294
  }
243
295
  ```
244
296
 
297
+ ### Bridge to Internet (Auto Channel Detection)
298
+
299
+ The new bridge-centric architecture makes it easy to connect your mesh to the Internet via a router. The bridge node automatically detects the router's channel and configures the mesh accordingly.
300
+
301
+ #### Bridge Node
302
+
303
+ ```cpp
304
+ #include "painlessMesh.h"
305
+
306
+ #define MESH_PREFIX "MyMeshNetwork"
307
+ #define MESH_PASSWORD "somethingSneaky"
308
+ #define ROUTER_SSID "YourRouterSSID"
309
+ #define ROUTER_PASSWORD "YourRouterPassword"
310
+
311
+ Scheduler userScheduler;
312
+ painlessMesh mesh;
313
+
314
+ void setup() {
315
+ Serial.begin(115200);
316
+ mesh.setDebugMsgTypes(ERROR | STARTUP | CONNECTION);
317
+
318
+ // Single call does everything:
319
+ // 1. Connects to router and detects its channel
320
+ // 2. Initializes mesh on detected channel
321
+ // 3. Sets node as root/bridge
322
+ mesh.initAsBridge(MESH_PREFIX, MESH_PASSWORD,
323
+ ROUTER_SSID, ROUTER_PASSWORD,
324
+ &userScheduler, 5555);
325
+
326
+ mesh.onReceive(&receivedCallback);
327
+ }
328
+
329
+ void loop() { mesh.update(); }
330
+
331
+ void receivedCallback(uint32_t from, String& msg) {
332
+ // Forward mesh data to Internet services (MQTT, HTTP, etc.)
333
+ }
334
+ ```
335
+
336
+ #### Regular Nodes (Auto Channel Detection)
337
+
338
+ ```cpp
339
+ void setup() {
340
+ Serial.begin(115200);
341
+
342
+ // channel=0 means auto-detect the mesh channel
343
+ mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, 5555,
344
+ WIFI_AP_STA, 0);
345
+
346
+ mesh.onReceive(&receivedCallback);
347
+ }
348
+ ```
349
+
350
+ See [BRIDGE_TO_INTERNET.md](BRIDGE_TO_INTERNET.md) for complete documentation.
351
+
245
352
  ### Package Types
246
353
 
247
354
  | Type | Class | Purpose | Fields |
@@ -284,23 +391,29 @@ void receivedCallback(uint32_t from, String& msg) {
284
391
  - **Event Coordination** - Synchronized displays, distributed processing
285
392
  - **Bridge Networks** - Connect mesh to WiFi/Internet/MQTT - [📖 Bridge Guide](BRIDGE_TO_INTERNET.md)
286
393
 
287
- ## Development Version: v1.7.8
394
+ ## Latest Release: v1.8.1 (November 10, 2025)
288
395
 
289
- **In Development** - Next release after v1.7.7
396
+ **GitHub Copilot Integration & Developer Experience**:
290
397
 
291
- See [CHANGELOG](CHANGELOG.md) for upcoming changes.
398
+ - 🤖 **GitHub Copilot Custom Agent** - AI-assisted release management with `@release-agent`
399
+ - 📚 **Enhanced Developer Context** - Improved repository context for all Copilot users
400
+ - ✅ **Release Automation** - 21+ automated validation checks for quality assurance
401
+ - 🔧 **Zero Breaking Changes** - Purely additive developer experience improvements
402
+ - 📖 **Complete Documentation** - Agent setup guides and knowledge sources
292
403
 
293
- ## Latest Release: v1.7.7 (November 5, 2025)
404
+ **[📋 Full Release Notes](RELEASE_NOTES_v1.8.1.md)** | **[🔖 CHANGELOG](CHANGELOG.md)**
294
405
 
295
- **MQTT Schema v0.7.2 Compliance with Enhanced Monitoring**:
406
+ ## Previous Release: v1.8.0 (November 9, 2025)
296
407
 
297
- - **MetricsPackage (Type 204)** - Comprehensive performance metrics for real-time monitoring
298
- - ✅ **HealthCheckPackage (Type 605)** - Proactive health monitoring with problem detection
299
- - ✅ **Mesh Topology Packages** - Complete network visualization (Types 600-603)
300
- - ✅ **Enhanced MQTT Bridge** - On-demand metrics, health checks, and aggregated statistics
301
- - ✅ **100% Backward Compatible** - All existing code continues to work
408
+ **Bridge-Centric Architecture & Comprehensive Monitoring**:
302
409
 
303
- **[📋 Full Release Notes](docs/releases/RELEASE_SUMMARY_v1.7.7.md)** | **[🔖 CHANGELOG](CHANGELOG.md)**
410
+ - **Bridge Auto-Detection** - One-line bridge setup with automatic channel detection
411
+ - 📊 **Diagnostics API** - Comprehensive monitoring and debugging tools
412
+ - 🕐 **RTC Integration** - Hardware RTC support for offline timekeeping
413
+ - 🔄 **Bridge Failover** - Automatic bridge election and high availability
414
+ - ⚡ **Production Ready** - All features tested, documented, and backward compatible
415
+
416
+ **[📋 Full Release Notes](RELEASE_NOTES_v1.8.0.md)**
304
417
 
305
418
  ## Getting Help
306
419
 
@@ -311,6 +424,40 @@ See [CHANGELOG](CHANGELOG.md) for upcoming changes.
311
424
 
312
425
  ## Development
313
426
 
427
+ ### GitHub Copilot Integration (v1.8.1+)
428
+
429
+ AlteriomPainlessMesh includes GitHub Copilot custom agent support for AI-assisted development:
430
+
431
+ - **🤖 Release Agent** - AI assistant for release management and quality assurance
432
+ - **📚 Enhanced Context** - Repository knowledge available to all Copilot users
433
+ - **🎯 Enterprise Features** - Use `@release-agent` in Copilot Chat (Enterprise)
434
+
435
+ **For GitHub Copilot Enterprise Users:**
436
+ ```
437
+ @release-agent How do I prepare a release?
438
+ @release-agent Check version consistency
439
+ @release-agent Validate release readiness
440
+ ```
441
+
442
+ **Configuration:** The custom agent is defined in `copilot-agents.json` at the repository root.
443
+
444
+ **Documentation:** [Copilot Agent Setup](.github/COPILOT_AGENT_SETUP.md) | [Agent Index](.github/AGENTS_INDEX.md)
445
+
446
+ ### Release Agent & Automation
447
+
448
+ AlteriomPainlessMesh includes a comprehensive release automation system:
449
+
450
+ - **📋 [Release Agent Documentation](.github/agents/release-agent.md)** - Complete release process specification
451
+ - **🤖 Release Validation Script**: `./scripts/release-agent.sh` - Automated pre-release checks
452
+ - **⚙️ CI/CD Integration**: Workflows validate every release automatically
453
+
454
+ **Quick Release Validation:**
455
+ ```bash
456
+ ./scripts/release-agent.sh # Run all pre-release checks
457
+ ```
458
+
459
+ See [Release Agent Guide](.github/agents/README.md) for complete documentation.
460
+
314
461
  ### Building from Source
315
462
 
316
463
  ```bash