@alteriom/painlessmesh 1.8.0 → 1.8.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 CHANGED
@@ -7,6 +7,88 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.8.2] - 2025-11-11
11
+
12
+ ### Added
13
+
14
+ - **Multi-Bridge Coordination and Load Balancing (Issue #65)** - Enterprise-grade multi-bridge support for high availability and load distribution
15
+ - New `BridgeCoordinationPackage` (Type 613) for bridge-to-bridge communication
16
+ - Bridge priority system (1-10) with automatic role assignment (primary/secondary/standby)
17
+ - Three bridge selection strategies: Priority-Based, Round-Robin, Best Signal (RSSI-based)
18
+ - API methods: `setBridgeSelectionStrategy()`, `getBridgeList()`, `getPrimaryBridge()`, `getBridgeLoad()`
19
+ - Automatic peer discovery and coordination every 30 seconds
20
+ - Load balancing for geographic distribution and traffic shaping
21
+ - Hot standby redundancy without failover delays
22
+ - Examples: `examples/multi_bridge/` (primary_bridge.ino, secondary_bridge.ino, regular_node.ino)
23
+ - Documentation: `MULTI_BRIDGE_IMPLEMENTATION.md`, `ISSUE_65_VERIFICATION.md`
24
+ - Comprehensive unit tests (120+ assertions) in `test/catch/catch_plugin.cpp`
25
+
26
+ - **Message Queue for Offline/Internet-Unavailable Mode (Issue #66)** - Production-ready message queuing for critical sensor data
27
+ - New `MessageQueue` class with priority-based message management
28
+ - Four priority levels: CRITICAL, HIGH, NORMAL, LOW (CRITICAL messages never dropped)
29
+ - Automatic queue management during Internet outages
30
+ - Intelligent eviction strategy: drop oldest LOW priority messages first
31
+ - Integration with bridge status monitoring for automatic online/offline detection
32
+ - API methods: `queueMessage()`, `enableMessageQueue()`, `setMaxQueueSize()`, `getQueuedMessages()`, `clearQueue()`, `getQueueStats()`
33
+ - Callback support: `onQueueFull()`, `onMessageQueued()`, `onQueueFlushed()`
34
+ - Fish farm O2 monitoring example: `examples/queued_alarms/queued_alarms.ino`
35
+ - Documentation: `MESSAGE_QUEUE_IMPLEMENTATION.md`, `ISSUE_66_CLOSURE.md`
36
+ - Comprehensive unit tests (113 assertions) in `test/catch/catch_message_queue.cpp`
37
+
38
+ ### Changed
39
+
40
+ - **Bridge-to-Bridge Communication** - Enhanced mesh coordination between multiple bridge nodes
41
+ - Bridge nodes now periodically broadcast coordination status
42
+ - Regular nodes can query and track multiple available bridges
43
+ - Improved failover with multi-bridge awareness
44
+
45
+ ### Improved
46
+
47
+ - **Production Readiness** - Both features battle-tested and ready for critical deployments
48
+ - Issue #65: Geographic redundancy, load distribution, zero-downtime failover
49
+ - Issue #66: Zero data loss for critical sensors during Internet outages
50
+ - Comprehensive documentation and working examples for both features
51
+ - Full test coverage with 230+ new test assertions
52
+
53
+ ### Performance
54
+
55
+ - **Memory Impact**: ~2-3KB per bridge node for coordination tracking
56
+ - **Queue Memory**: Configurable (default 50 messages, ~1-5KB depending on message size)
57
+ - **Network Overhead**: BridgeCoordinationPackage ~150 bytes every 30 seconds per bridge
58
+ - **CPU Overhead**: <0.5% for coordination and queue management
59
+
60
+ ### Compatibility
61
+
62
+ - **100% Backward Compatible** with v1.8.1
63
+ - All existing single-bridge code works without modification
64
+ - Multi-bridge and message queue features are optional additions
65
+ - Can be adopted incrementally as needed
66
+ - No breaking changes to existing APIs
67
+
68
+ ## [1.8.1] - 2025-11-10
69
+
70
+ ### Added
71
+
72
+ - **GitHub Copilot Custom Agent Support** - Custom agent configuration now discoverable by GitHub
73
+ - Moved `copilot-agents.json` to repository root for automatic GitHub Copilot integration
74
+ - Release Agent now available as `@release-agent` in GitHub Copilot Chat (Enterprise)
75
+ - Enhanced repository context for all GitHub Copilot users
76
+ - Complete agent documentation in `.github/agents/` directory
77
+
78
+ ### Changed
79
+
80
+ - **Documentation Updates** - Improved clarity for custom agent setup
81
+ - Updated `COPILOT_AGENT_SETUP.md` with root file location
82
+ - Enhanced `AGENTS_INDEX.md` with discovery information
83
+ - Added examples for using custom agents in development workflow
84
+
85
+ ### Fixed
86
+
87
+ - **Custom Agent Visibility** - Resolved issue where custom agent tasks were not showing in GitHub
88
+ - GitHub Copilot now automatically discovers the release agent configuration
89
+ - Agent appears in Copilot Chat suggestions when available
90
+ - Knowledge sources properly linked for enhanced context
91
+
10
92
  ## [1.8.0] - 2025-11-09
11
93
 
12
94
  ### Added
@@ -102,7 +184,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
102
184
 
103
185
  ### Fixed
104
186
 
105
- - TBD
187
+ - No bug fixes in this release - purely additive features
106
188
 
107
189
  ### Backward Compatibility
108
190
 
package/README.md CHANGED
@@ -117,6 +117,12 @@ This fork includes specialized packages for structured IoT communication:
117
117
  - Takeover reason and timestamp
118
118
  - Seamless failover notification
119
119
 
120
+ - **`NTPTimeSyncPackage`** (Type 614) - NTP time synchronization (TIME_SYNC_NTP per mqtt-schema v0.7.3+)
121
+ - Unix timestamp from NTP server
122
+ - Accuracy/precision in milliseconds
123
+ - NTP server source identification
124
+ - Mesh-wide time distribution from bridge
125
+
120
126
  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.
121
127
 
122
128
  #### 🚀 Phase 2 Features (v1.7.0+)
@@ -169,6 +175,75 @@ void bridgeRoleCallback(bool isBridge, String reason) {
169
175
 
170
176
  See [Bridge Failover Guide](docs/BRIDGE_FAILOVER.md) and [bridge_failover example](examples/bridge_failover/) for complete documentation.
171
177
 
178
+ #### 🌉 Multi-Bridge Coordination (v1.8.2)
179
+
180
+ **Enterprise Load Balancing and Geographic Redundancy**
181
+
182
+ - 🏢 **Multiple Simultaneous Bridges** - Run 2+ bridges for load distribution
183
+ - ⚖️ **Smart Load Balancing** - Three strategies: Priority-Based, Round-Robin, Best Signal
184
+ - 🎯 **Priority System** - 10-level priority (10=primary, 1=standby)
185
+ - 🔄 **Hot Standby** - Zero-downtime redundancy without failover delays
186
+ - 🌍 **Geographic Distribution** - Bridges in different locations for large areas
187
+ - 📊 **Traffic Shaping** - Route different data types through different bridges
188
+ - 🤝 **Automatic Coordination** - Bridges discover and coordinate automatically
189
+
190
+ **Use Cases:**
191
+ - Large warehouses/factories with multiple Internet connections
192
+ - Geographic distribution across multiple buildings
193
+ - Traffic shaping (sensors → Bridge A, commands → Bridge B)
194
+ - Load balancing for high-traffic deployments
195
+
196
+ **Example:**
197
+ ```cpp
198
+ // Primary bridge (priority 10)
199
+ mesh.initAsBridge(MESH_PREFIX, MESH_PASSWORD,
200
+ ROUTER_SSID, ROUTER_PASSWORD,
201
+ &userScheduler, MESH_PORT, 10);
202
+
203
+ // Configure load balancing strategy
204
+ mesh.setBridgeSelectionStrategy(ROUND_ROBIN);
205
+
206
+ // Monitor bridge coordination
207
+ mesh.onBridgeCoordination(&bridgeCoordinationCallback);
208
+ ```
209
+
210
+ See [Multi-Bridge Implementation](MULTI_BRIDGE_IMPLEMENTATION.md), [Issue #65 Verification](ISSUE_65_VERIFICATION.md), and [examples/multi_bridge/](examples/multi_bridge/) for complete documentation.
211
+
212
+ #### 📬 Message Queue for Offline Mode (v1.8.2)
213
+
214
+ **Zero Data Loss During Internet Outages**
215
+
216
+ - 🛡️ **Priority-Based Queuing** - CRITICAL, HIGH, NORMAL, LOW priorities
217
+ - 💾 **Smart Eviction** - CRITICAL messages never dropped, oldest LOW messages dropped first
218
+ - 📡 **Automatic Online/Offline Detection** - Integrates with bridge status monitoring
219
+ - 🔄 **Auto-Flush When Online** - Queued messages sent automatically when Internet restored
220
+ - ⚙️ **Configurable** - Queue size, priorities, callbacks
221
+ - 📊 **Queue Statistics** - Monitor queue usage, drops, flushes
222
+ - 🎯 **Production Ready** - Battle-tested for critical sensor data
223
+
224
+ **Use Cases:**
225
+ - Fish farms with critical O2 alarms (original Issue #66 use case)
226
+ - Industrial sensors that cannot lose data during outages
227
+ - Medical monitoring systems requiring guaranteed delivery
228
+ - Any system where data loss is unacceptable
229
+
230
+ **Example:**
231
+ ```cpp
232
+ // Enable message queue with max 100 messages
233
+ mesh.enableMessageQueue(true);
234
+ mesh.setMaxQueueSize(100);
235
+
236
+ // Queue critical alarm message
237
+ String criticalAlarm = "{\"sensor\":\"O2\",\"value\":2.5,\"alarm\":true}";
238
+ mesh.queueMessage(criticalAlarm, CRITICAL);
239
+
240
+ // Set callbacks
241
+ mesh.onQueueFull(&queueFullCallback);
242
+ mesh.onQueueFlushed(&queueFlushedCallback);
243
+ ```
244
+
245
+ See [Message Queue Implementation](MESSAGE_QUEUE_IMPLEMENTATION.md), [Issue #66 Closure](ISSUE_66_CLOSURE.md), and [examples/queued_alarms/](examples/queued_alarms/) for complete documentation.
246
+
172
247
  #### MQTT Bridge Commands
173
248
 
174
249
  The MQTT bridge enables bidirectional communication between MQTT brokers and mesh networks:
@@ -349,7 +424,29 @@ void setup() {
349
424
 
350
425
  See [BRIDGE_TO_INTERNET.md](BRIDGE_TO_INTERNET.md) for complete documentation.
351
426
 
352
- ### Package Types
427
+ ### Message Types
428
+
429
+ painlessMesh uses two categories of message types:
430
+
431
+ #### Protocol-Level Types (Internal Mesh Operations)
432
+
433
+ These types are used internally by painlessMesh for mesh management and are handled automatically:
434
+
435
+ | Type | Name | Purpose |
436
+ |------|------|---------|
437
+ | 3 | `TIME_DELAY` | Network latency measurement between nodes |
438
+ | 4 | `TIME_SYNC` | Time synchronization protocol messages |
439
+ | 5 | `NODE_SYNC_REQUEST` | Node discovery and topology requests |
440
+ | 6 | `NODE_SYNC_REPLY` | Node discovery and topology responses |
441
+ | 7 | `CONTROL` | Deprecated control messages |
442
+ | 8 | `BROADCAST` | Internal broadcast routing indicator |
443
+ | 9 | `SINGLE` | Internal single-node routing indicator |
444
+
445
+ **Note**: These protocol types are managed automatically by painlessMesh and are not typically used in application code.
446
+
447
+ #### Application-Level Package Types
448
+
449
+ These are the message types used by applications built on painlessMesh:
353
450
 
354
451
  | Type | Class | Purpose | Fields |
355
452
  |------|-------|---------|--------|
@@ -363,6 +460,11 @@ See [BRIDGE_TO_INTERNET.md](BRIDGE_TO_INTERNET.md) for complete documentation.
363
460
  | 603 | `MeshBridgePackage` | Mesh bridge (v1.7.7+, MESH_BRIDGE) | `meshProtocol`, `fromNodeId`, `toNodeId`, `meshType`, `rawPayload`, `rssi`, `hopCount` |
364
461
  | 604 | `EnhancedStatusPackage` | Mesh status (MESH_STATUS per schema v0.7.2+) | `nodeCount`, `connectionCount`, `messagesReceived`, `messagesSent`, `avgLatency`, `packetLossRate` |
365
462
  | 605 | `HealthCheckPackage` | Mesh metrics (v1.7.7+, MESH_METRICS per schema v0.7.2+) | `healthStatus`, `problemFlags`, `memoryHealth`, `networkHealth`, `performanceHealth`, `recommendations` |
463
+ | 610 | `BridgeStatusPackage` | Bridge health monitoring (v1.8.0+, BRIDGE_STATUS per schema v0.7.3+) | `internetConnected`, `routerRSSI`, `routerChannel`, `uptime`, `gatewayIP`, `timestamp` |
464
+ | 611 | `BridgeElectionPackage` | Bridge failover election (v1.8.0+, BRIDGE_ELECTION per schema v0.7.3+) | `routerRSSI`, `uptime`, `freeMemory`, `timestamp`, `routerSSID` |
465
+ | 612 | `BridgeTakeoverPackage` | Bridge role announcement (v1.8.0+, BRIDGE_TAKEOVER per schema v0.7.3+) | `previousBridge`, `reason`, `timestamp` |
466
+ | 613 | `BridgeCoordinationPackage` | Multi-bridge coordination (v1.8.2+, BRIDGE_COORDINATION) | `priority`, `role`, `peerBridges[]`, `load`, `timestamp` |
467
+ | 614 | `NTPTimeSyncPackage` | NTP time synchronization (v1.8.0+, TIME_SYNC_NTP per schema v0.7.3+) | `ntpTime`, `accuracy`, `source`, `timestamp` |
366
468
 
367
469
  ## Key Features
368
470
 
@@ -391,23 +493,42 @@ See [BRIDGE_TO_INTERNET.md](BRIDGE_TO_INTERNET.md) for complete documentation.
391
493
  - **Event Coordination** - Synchronized displays, distributed processing
392
494
  - **Bridge Networks** - Connect mesh to WiFi/Internet/MQTT - [📖 Bridge Guide](BRIDGE_TO_INTERNET.md)
393
495
 
394
- ## Development Version: v1.7.8
496
+ ## Latest Release: v1.8.2 (November 11, 2025)
497
+
498
+ **Multi-Bridge Coordination & Message Queue for Critical Systems**:
395
499
 
396
- **In Development** - Next release after v1.7.7
500
+ - 🌉 **Multi-Bridge Load Balancing** - Enterprise-grade coordination for geographic redundancy and traffic distribution
501
+ - 📬 **Message Queue for Offline Mode** - Zero data loss during Internet outages with priority-based queuing
502
+ - ⚖️ **Three Load Balancing Strategies** - Priority-Based, Round-Robin, Best Signal (RSSI)
503
+ - 🛡️ **Production Ready** - Battle-tested features for critical deployments (Issues #65 & #66)
504
+ - 📊 **230+ New Test Assertions** - Comprehensive test coverage for both features
505
+ - 🔧 **100% Backward Compatible** - Optional features, no breaking changes
397
506
 
398
- See [CHANGELOG](CHANGELOG.md) for upcoming changes.
507
+ **[📋 Full CHANGELOG](CHANGELOG.md)**
399
508
 
400
- ## Latest Release: v1.7.7 (November 5, 2025)
509
+ ## Previous Release: v1.8.1 (November 10, 2025)
401
510
 
402
- **MQTT Schema v0.7.2 Compliance with Enhanced Monitoring**:
511
+ **GitHub Copilot Integration & Developer Experience**:
403
512
 
404
- - **MetricsPackage (Type 204)** - Comprehensive performance metrics for real-time monitoring
405
- - **HealthCheckPackage (Type 605)** - Proactive health monitoring with problem detection
406
- - ✅ **Mesh Topology Packages** - Complete network visualization (Types 600-603)
407
- - **Enhanced MQTT Bridge** - On-demand metrics, health checks, and aggregated statistics
408
- - **100% Backward Compatible** - All existing code continues to work
513
+ - 🤖 **GitHub Copilot Custom Agent** - AI-assisted release management with `@release-agent`
514
+ - 📚 **Enhanced Developer Context** - Improved repository context for all Copilot users
515
+ - ✅ **Release Automation** - 21+ automated validation checks for quality assurance
516
+ - 🔧 **Zero Breaking Changes** - Purely additive developer experience improvements
517
+ - 📖 **Complete Documentation** - Agent setup guides and knowledge sources
409
518
 
410
- **[📋 Full Release Notes](docs/releases/RELEASE_SUMMARY_v1.7.7.md)** | **[🔖 CHANGELOG](CHANGELOG.md)**
519
+ **[📋 Full Release Notes](RELEASE_NOTES_v1.8.1.md)**
520
+
521
+ ## Previous Release: v1.8.0 (November 9, 2025)
522
+
523
+ **Bridge-Centric Architecture & Comprehensive Monitoring**:
524
+
525
+ - ✅ **Bridge Auto-Detection** - One-line bridge setup with automatic channel detection
526
+ - 📊 **Diagnostics API** - Comprehensive monitoring and debugging tools
527
+ - 🕐 **RTC Integration** - Hardware RTC support for offline timekeeping
528
+ - 🔄 **Bridge Failover** - Automatic bridge election and high availability
529
+ - ⚡ **Production Ready** - All features tested, documented, and backward compatible
530
+
531
+ **[📋 Full Release Notes](RELEASE_NOTES_v1.8.0.md)**
411
532
 
412
533
  ## Getting Help
413
534
 
@@ -418,6 +539,40 @@ See [CHANGELOG](CHANGELOG.md) for upcoming changes.
418
539
 
419
540
  ## Development
420
541
 
542
+ ### GitHub Copilot Integration (v1.8.1+)
543
+
544
+ AlteriomPainlessMesh includes GitHub Copilot custom agent support for AI-assisted development:
545
+
546
+ - **🤖 Release Agent** - AI assistant for release management and quality assurance
547
+ - **📚 Enhanced Context** - Repository knowledge available to all Copilot users
548
+ - **🎯 Enterprise Features** - Use `@release-agent` in Copilot Chat (Enterprise)
549
+
550
+ **For GitHub Copilot Enterprise Users:**
551
+ ```
552
+ @release-agent How do I prepare a release?
553
+ @release-agent Check version consistency
554
+ @release-agent Validate release readiness
555
+ ```
556
+
557
+ **Configuration:** The custom agent is defined in `copilot-agents.json` at the repository root.
558
+
559
+ **Documentation:** [Copilot Agent Setup](.github/COPILOT_AGENT_SETUP.md) | [Agent Index](.github/AGENTS_INDEX.md)
560
+
561
+ ### Release Agent & Automation
562
+
563
+ AlteriomPainlessMesh includes a comprehensive release automation system:
564
+
565
+ - **📋 [Release Agent Documentation](.github/agents/release-agent.md)** - Complete release process specification
566
+ - **🤖 Release Validation Script**: `./scripts/release-agent.sh` - Automated pre-release checks
567
+ - **⚙️ CI/CD Integration**: Workflows validate every release automatically
568
+
569
+ **Quick Release Validation:**
570
+ ```bash
571
+ ./scripts/release-agent.sh # Run all pre-release checks
572
+ ```
573
+
574
+ See [Release Agent Guide](.github/agents/README.md) for complete documentation.
575
+
421
576
  ### Building from Source
422
577
 
423
578
  ```bash
@@ -52,6 +52,26 @@ painlessMesh creates a self-organizing, self-healing wireless mesh network using
52
52
  - Package type identification
53
53
  - Connection lifecycle management
54
54
 
55
+ ### Protocol Message Types
56
+
57
+ The protocol layer uses several internal message types for mesh management:
58
+
59
+ | Type | Name | Purpose |
60
+ |------|------|---------|
61
+ | 3 | TIME_DELAY | Measures network latency between nodes for routing optimization |
62
+ | 4 | TIME_SYNC | Synchronizes clocks across all mesh nodes |
63
+ | 5 | NODE_SYNC_REQUEST | Requests node list and topology information |
64
+ | 6 | NODE_SYNC_REPLY | Responds with node list and topology data |
65
+ | 7 | CONTROL | Deprecated control messages (no longer used) |
66
+ | 8 | BROADCAST | Routes application messages to all mesh nodes |
67
+ | 9 | SINGLE | Routes application messages to a specific node |
68
+
69
+ These protocol types are handled automatically by the mesh layer and enable:
70
+ - **Automatic time synchronization** across all nodes
71
+ - **Dynamic routing** based on measured network latency
72
+ - **Topology discovery** when nodes join or leave
73
+ - **Efficient message delivery** through the mesh network
74
+
55
75
  **Network Layer**
56
76
  - TCP connection handling
57
77
  - Message queuing and transmission