@alteriom/painlessmesh 1.8.14 → 1.9.0

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 (208) hide show
  1. package/BRIDGE_TO_INTERNET.md +229 -0
  2. package/CHANGELOG.md +89 -1
  3. package/CONTRIBUTING.md +79 -0
  4. package/README.md +70 -143
  5. package/docs/README.md +1 -0
  6. package/docs/api/shared-gateway.md +1207 -0
  7. package/docs/troubleshooting/common-issues.md +28 -0
  8. package/docs/troubleshooting/faq.md +113 -12
  9. package/examples/basic/test/simulator/CMakeLists.txt +40 -0
  10. package/examples/basic/test/simulator/README.md +149 -0
  11. package/examples/basic/test/simulator/firmware/basic_firmware.hpp +117 -0
  12. package/examples/basic/test/simulator/scenarios/basic_mesh_test.yaml +81 -0
  13. package/examples/bridge/bridge.ino +17 -4
  14. package/examples/bridge_failover/README.md +81 -0
  15. package/examples/bridge_failover/bridge_failover.ino +51 -6
  16. package/examples/sharedGateway/README.md +235 -0
  17. package/examples/{meshCommandNode → sharedGateway}/platformio.ini +3 -2
  18. package/examples/sharedGateway/sharedGateway.ino +303 -0
  19. package/library.json +3 -22
  20. package/library.properties +1 -1
  21. package/package.json +3 -3
  22. package/src/arduino/wifi.hpp +380 -13
  23. package/src/painlessmesh/gateway.hpp +2120 -0
  24. package/src/painlessmesh/mesh.hpp +1034 -6
  25. package/src/painlessmesh/message_tracker.hpp +311 -0
  26. package/src/painlessmesh/protocol.hpp +6 -0
  27. package/DOCUMENTATION_INDEX.md +0 -146
  28. package/docs/API_DESIGN_GUIDELINES.md +0 -414
  29. package/docs/ARDUINO_LIBRARY_MANAGER_SUBMISSION.md +0 -331
  30. package/docs/BOOLEAN_NAMING_CONVENTION.md +0 -235
  31. package/docs/BRIDGE_FAILOVER.md +0 -512
  32. package/docs/BRIDGE_HEALTH_MONITORING.md +0 -293
  33. package/docs/CHANNEL_SYNCHRONIZATION.md +0 -209
  34. package/docs/CREATE_MISSING_RELEASES.md +0 -321
  35. package/docs/DOCUMENTATION_MIGRATION_PLAN.md +0 -176
  36. package/docs/FAQ_VERSION_NUMBERS.md +0 -152
  37. package/docs/IMPLEMENTATION_PLAN_MESH_TOPOLOGY.md +0 -1062
  38. package/docs/MESH_TOPOLOGY_GUIDE.md +0 -992
  39. package/docs/MESH_TOPOLOGY_PROGRESS.md +0 -422
  40. package/docs/MQTT_BRIDGE_COMMANDS.md +0 -894
  41. package/docs/MQTT_BRIDGE_IMPLEMENTATION_SUMMARY.md +0 -324
  42. package/docs/MQTT_COMMAND_SCHEMA_PROPOSAL.md +0 -576
  43. package/docs/MQTT_SCHEMA_COMPLIANCE.md +0 -340
  44. package/docs/MQTT_SCHEMA_PROPOSALS.md +0 -446
  45. package/docs/MQTT_SCHEMA_REVIEW.md +0 -690
  46. package/docs/OTA_COMMANDS_REFERENCE.md +0 -554
  47. package/docs/PHASE1_GUIDE.md +0 -349
  48. package/docs/PHASE2_GUIDE.md +0 -543
  49. package/docs/QUICK_REFERENCE_VERSIONING.md +0 -127
  50. package/docs/RELEASE_AGENT_SUMMARY.md +0 -386
  51. package/docs/SCHEMA_VALIDATION_CHECKLIST.md +0 -222
  52. package/docs/VERSION_MANAGEMENT.md +0 -213
  53. package/docs/archive/DOCUSAURUS_DEPLOYMENT.md +0 -166
  54. package/docs/archive/FEATURE_PROPOSALS.md +0 -337
  55. package/docs/archive/LIBRARY_JSON_FIX.md +0 -98
  56. package/docs/archive/LIBRARY_STRUCTURE_FIX.md +0 -215
  57. package/docs/archive/PHASE1_IMPLEMENTATION.md +0 -325
  58. package/docs/archive/PHASE2_IMPLEMENTATION.md +0 -567
  59. package/docs/archive/RELEASE_SUMMARY.md +0 -173
  60. package/docs/archive/SCONS_BUILD_FIX.md +0 -313
  61. package/docs/archive/TRIGGER_RELEASE.md +0 -280
  62. package/docs/archive/VECTOR_INCLUDE_FIX.md +0 -129
  63. package/docs/archive/ota-and-status-enhancements.md +0 -911
  64. package/docs/archive/ota-status-architecture-diagrams.md +0 -658
  65. package/docs/archive/ota-status-quick-reference.md +0 -284
  66. package/docs/design/.gitkeep +0 -1
  67. package/docs/design/STATION_CREDENTIALS_DESIGN.md +0 -182
  68. package/docs/development/ARDUINO_COMPLIANCE_SUMMARY.md +0 -71
  69. package/docs/development/CODE_REFACTORING_RECOMMENDATIONS.md +0 -1011
  70. package/docs/development/DOCKER_TESTING.md +0 -196
  71. package/docs/development/PLATFORMIO_USAGE.md +0 -180
  72. package/docs/development/TESTING_SUMMARY.md +0 -126
  73. package/docs/development/contributing.md +0 -301
  74. package/docs/development/documentation.md +0 -583
  75. package/docs/features/DIAGNOSTICS_API.md +0 -534
  76. package/docs/implementation/BRIDGE_ARCHITECTURE_IMPLEMENTATION.md +0 -340
  77. package/docs/implementation/BRIDGE_HEALTH_MONITORING_IMPLEMENTATION.md +0 -213
  78. package/docs/implementation/BRIDGE_STATUS_FEATURE.md +0 -635
  79. package/docs/implementation/DIAGNOSTICS_API_IMPLEMENTATION.md +0 -232
  80. package/docs/implementation/IMPLEMENTATION_COMPLETE.md +0 -228
  81. package/docs/implementation/IMPLEMENTATION_NTP_TIME_SYNC.md +0 -325
  82. package/docs/implementation/IMPLEMENTATION_SUMMARY.md +0 -316
  83. package/docs/implementation/MESSAGE_QUEUE_IMPLEMENTATION.md +0 -405
  84. package/docs/implementation/MULTI_BRIDGE_IMPLEMENTATION.md +0 -520
  85. package/docs/implementation/NTP_TIME_SYNC_FEATURE.md +0 -392
  86. package/docs/improvements/FUTURE_PROPOSALS.md +0 -1016
  87. package/docs/improvements/IMPLEMENTATION_HISTORY.md +0 -1091
  88. package/docs/improvements/OTA_STATUS_ENHANCEMENTS.md +0 -709
  89. package/docs/improvements/README.md +0 -212
  90. package/docs/internal/CUSTOM_AGENT_ANALYSIS.md +0 -391
  91. package/docs/internal/ISSUE_65_VERIFICATION.md +0 -947
  92. package/docs/internal/ISSUE_66_CLOSURE.md +0 -249
  93. package/docs/internal/ISSUE_66_STATUS.md +0 -316
  94. package/docs/internal/PR_SUMMARY.md +0 -315
  95. package/docs/internal/REVIEW_SUMMARY.md +0 -332
  96. package/docs/multi-bridge-setup.md +0 -1025
  97. package/docs/platformio-publishing.md +0 -255
  98. package/docs/platformio-setup-summary.md +0 -121
  99. package/docs/releases/ANNOUNCEMENT_v1.8.6.md +0 -63
  100. package/docs/releases/ANNOUNCEMENT_v1.8.7.md +0 -113
  101. package/docs/releases/BRIDGE_STATUS_SELF_REGISTRATION_FIX.md +0 -221
  102. package/docs/releases/FEATURE_HISTORY.md +0 -543
  103. package/docs/releases/GITHUB_RELEASE_v1.8.6.md +0 -71
  104. package/docs/releases/GITHUB_RELEASE_v1.8.7.md +0 -90
  105. package/docs/releases/PATCH_v1.7.2.md +0 -262
  106. package/docs/releases/PATCH_v1.7.3.md +0 -262
  107. package/docs/releases/PATCH_v1.7.4.md +0 -219
  108. package/docs/releases/PHASE1_SUMMARY.md +0 -246
  109. package/docs/releases/PHASE2_SUMMARY.md +0 -499
  110. package/docs/releases/PUBLISH_v1.8.0_INSTRUCTIONS.md +0 -163
  111. package/docs/releases/QUICK_START_RELEASES.md +0 -113
  112. package/docs/releases/RELEASE_CHECKLIST_1.8.10.md +0 -331
  113. package/docs/releases/RELEASE_CHECKLIST_1.8.9.md +0 -207
  114. package/docs/releases/RELEASE_CHECKLIST_v1.7.4.md +0 -253
  115. package/docs/releases/RELEASE_CHECKLIST_v1.7.5.md +0 -315
  116. package/docs/releases/RELEASE_CHECKLIST_v1.7.6.md +0 -389
  117. package/docs/releases/RELEASE_CHECKLIST_v1.8.0.md +0 -331
  118. package/docs/releases/RELEASE_CHECKLIST_v1.8.2.md +0 -309
  119. package/docs/releases/RELEASE_NOTES_1.7.0.md +0 -539
  120. package/docs/releases/RELEASE_NOTES_1.8.10.md +0 -239
  121. package/docs/releases/RELEASE_NOTES_1.8.9.md +0 -213
  122. package/docs/releases/RELEASE_NOTES_v1.8.0.md +0 -685
  123. package/docs/releases/RELEASE_NOTES_v1.8.1.md +0 -221
  124. package/docs/releases/RELEASE_NOTES_v1.8.2.md +0 -421
  125. package/docs/releases/RELEASE_NOTES_v1.8.3.md +0 -292
  126. package/docs/releases/RELEASE_NOTES_v1.8.4.md +0 -277
  127. package/docs/releases/RELEASE_NOTES_v1.8.6.md +0 -205
  128. package/docs/releases/RELEASE_NOTES_v1.8.7.md +0 -184
  129. package/docs/releases/RELEASE_PLAN_v1.7.6.md +0 -816
  130. package/docs/releases/RELEASE_SUMMARY_1.8.10.md +0 -193
  131. package/docs/releases/RELEASE_SUMMARY_v1.7.4.md +0 -276
  132. package/docs/releases/RELEASE_SUMMARY_v1.7.5.md +0 -322
  133. package/docs/releases/RELEASE_SUMMARY_v1.7.6.md +0 -436
  134. package/docs/releases/RELEASE_SUMMARY_v1.7.7.md +0 -391
  135. package/docs/releases/RELEASE_SUMMARY_v1.7.8.md +0 -523
  136. package/docs/releases/RELEASE_SUMMARY_v1.7.9.md +0 -542
  137. package/docs/troubleshooting/ARDUINO_IDE_VERSION_FIX_SUMMARY.md +0 -229
  138. package/docs/troubleshooting/ARDUINO_LIBRARY_NAME_FIX.md +0 -197
  139. package/docs/troubleshooting/CRASH_QUICK_REF.md +0 -93
  140. package/docs/troubleshooting/ESP32_C6_COMPATIBILITY.md +0 -157
  141. package/docs/troubleshooting/FREERTOS_ASSERTION_FAILURE.md +0 -288
  142. package/docs/troubleshooting/FREERTOS_FIX_IMPLEMENTATION.md +0 -267
  143. package/docs/troubleshooting/NPM_PUBLISHING_ISSUE_SUMMARY.md +0 -110
  144. package/docs/troubleshooting/PAINLESSMESH_V1.7.4_COMPILATION_ISSUES.md +0 -547
  145. package/docs/troubleshooting/QUICK_FIX_FREERTOS.md +0 -164
  146. package/docs/troubleshooting/SENSOR_NODE_CONNECTION_CRASH.md +0 -264
  147. package/docs/troubleshooting/station-reconnection-issues.md +0 -172
  148. package/docs/v1.7.7_MQTT_IMPROVEMENTS.md +0 -794
  149. package/docs/wiki/API-Reference.md +0 -246
  150. package/docs/wiki/Complete-Documentation.md +0 -123
  151. package/examples/alteriomImproved/alteriom_sensor_package.hpp +0 -224
  152. package/examples/alteriomImproved/improved_sensor_node.ino +0 -248
  153. package/examples/alteriomImproved/platformio.ini +0 -32
  154. package/examples/alteriomMetricsHealth/alteriom_sensor_package.hpp +0 -796
  155. package/examples/alteriomMetricsHealth/metrics_health_node.ino +0 -429
  156. package/examples/alteriomMetricsHealth/platformio.ini +0 -26
  157. package/examples/alteriomPhase1/alteriom_sensor_package.hpp +0 -224
  158. package/examples/alteriomPhase1/phase1_features.ino +0 -242
  159. package/examples/alteriomPhase1/platformio.ini +0 -26
  160. package/examples/alteriomPhase2/alteriom_sensor_package.hpp +0 -224
  161. package/examples/alteriomPhase2/phase2_features.ino +0 -186
  162. package/examples/alteriomPhase2/platformio.ini +0 -26
  163. package/examples/alteriomSensorNode/alteriom_sensor_node.ino +0 -186
  164. package/examples/alteriomSensorNode/alteriom_sensor_package.hpp +0 -1227
  165. package/examples/alteriomSensorNode/platformio.ini +0 -26
  166. package/examples/bridge/alteriom_sensor_package.hpp +0 -1170
  167. package/examples/bridge/bridge_health_monitoring_example.ino +0 -188
  168. package/examples/bridge/enhanced_mqtt_bridge.hpp +0 -610
  169. package/examples/bridge/enhanced_mqtt_bridge_example.ino +0 -226
  170. package/examples/bridge/mesh_event_publisher.hpp +0 -253
  171. package/examples/bridge/mesh_topology_reporter.hpp +0 -303
  172. package/examples/bridge/mqtt_command_bridge.hpp +0 -459
  173. package/examples/bridge/mqtt_status_bridge.hpp +0 -519
  174. package/examples/bridgeAwareSensorNode/alteriom_sensor_package.hpp +0 -1227
  175. package/examples/bridgeAwareSensorNode/bridgeAwareSensorNode.ino +0 -342
  176. package/examples/bridgeAwareSensorNode/platformio.ini +0 -26
  177. package/examples/diagnosticsExample/diagnosticsExample.ino +0 -171
  178. package/examples/diagnosticsExample/platformio.ini +0 -26
  179. package/examples/echoNode/echoNode.ino +0 -33
  180. package/examples/echoNode/platformio.ini +0 -26
  181. package/examples/meshCommandNode/alteriom_sensor_package.hpp +0 -235
  182. package/examples/meshCommandNode/meshCommandNode.ino +0 -265
  183. package/examples/mqttCommandBridge/alteriom_sensor_package.hpp +0 -235
  184. package/examples/mqttCommandBridge/mesh_event_publisher.hpp +0 -253
  185. package/examples/mqttCommandBridge/mesh_topology_reporter.hpp +0 -303
  186. package/examples/mqttCommandBridge/mqttCommandBridge.ino +0 -254
  187. package/examples/mqttCommandBridge/mqtt_command_bridge.hpp +0 -462
  188. package/examples/mqttCommandBridge/platformio.ini +0 -27
  189. package/examples/mqttStatusBridge/mqttStatusBridge.ino +0 -218
  190. package/examples/mqttStatusBridge/mqtt_status_bridge.hpp +0 -522
  191. package/examples/mqttStatusBridge/platformio.ini +0 -27
  192. package/examples/mqttTopologyTest/README.md +0 -467
  193. package/examples/mqttTopologyTest/mqttTopologyTest.ino +0 -754
  194. package/examples/mqttTopologyTest/platformio.ini +0 -27
  195. package/examples/multi_bridge/README.md +0 -346
  196. package/examples/multi_bridge/primary_bridge.ino +0 -96
  197. package/examples/multi_bridge/regular_node.ino +0 -141
  198. package/examples/multi_bridge/secondary_bridge.ino +0 -111
  199. package/examples/ntpTimeSyncBridge/alteriom_sensor_package.hpp +0 -1383
  200. package/examples/ntpTimeSyncBridge/ntpTimeSyncBridge.ino +0 -86
  201. package/examples/ntpTimeSyncNode/alteriom_sensor_package.hpp +0 -1383
  202. package/examples/ntpTimeSyncNode/ntpTimeSyncNode.ino +0 -109
  203. package/examples/queued_alarms/README.md +0 -390
  204. package/examples/queued_alarms/queued_alarms.ino +0 -265
  205. package/examples/routing_demo/README.md +0 -172
  206. package/examples/routing_demo/routing_demo.ino +0 -102
  207. package/examples/rtcIntegration/README.md +0 -294
  208. package/examples/rtcIntegration/rtcIntegration.ino +0 -210
@@ -1,690 +0,0 @@
1
- # MQTT Command Schema Review & Mesh Reporting Analysis
2
-
3
- **Date:** October 12, 2025
4
- **Reviewer:** Alteriom Development Team
5
- **Document:** MQTT_COMMAND_SCHEMA_PROPOSAL.md Analysis
6
- **Status:** ✅ APPROVED with RECOMMENDED ADDITIONS
7
-
8
- ---
9
-
10
- ## Executive Summary
11
-
12
- ### Overall Assessment
13
-
14
- The MQTT command schema proposal is **comprehensive and production-ready** for device control operations. However, analysis reveals a **critical gap in mesh network topology reporting** that should be addressed in the same release (v0.5.0).
15
-
16
- ### Key Findings
17
-
18
- | Area | Status | Details |
19
- |------|--------|---------|
20
- | Command Schema | ✅ **Excellent** | Complete, well-documented, ready to implement |
21
- | Response Tracking | ✅ **Excellent** | Correlation IDs, latency metrics, error codes |
22
- | Migration Path | ✅ **Excellent** | Clear upgrade from v0.4.0 control_response |
23
- | Standard Commands | ✅ **Excellent** | 30+ documented commands across 6 categories |
24
- | **Mesh Topology** | ⚠️ **MISSING** | No schema for network structure reporting |
25
- | **Mesh Events** | ⚠️ **MISSING** | No schema for real-time mesh notifications |
26
-
27
- ---
28
-
29
- ## Part 1: Command Schema Review
30
-
31
- ### ✅ Strengths
32
-
33
- #### 1. Complete Command Lifecycle
34
- ```json
35
- // Command → Response with correlation
36
- {
37
- "command": "read_sensors",
38
- "correlation_id": "cmd-1728745800-001",
39
- "parameters": {"immediate": true}
40
- }
41
- // ↓
42
- {
43
- "success": true,
44
- "correlation_id": "cmd-1728745800-001",
45
- "latency_ms": 1250
46
- }
47
- ```
48
-
49
- #### 2. Comprehensive Error Handling
50
- - 12 standard error codes (TIMEOUT, INVALID_PARAMS, SENSOR_NOT_AVAILABLE, etc.)
51
- - Human-readable messages
52
- - Machine-readable error_code field
53
- - Gateway-generated errors for timeouts
54
-
55
- #### 3. Well-Organized Command Categories
56
- - **Device Control (1-99):** RESET, SLEEP, LED_CONTROL, RELAY_SWITCH, PWM_SET
57
- - **Configuration (100-199):** GET_CONFIG, SET_CONFIG, SAVE_CONFIG, SET_SAMPLE_RATE
58
- - **Status (200-255):** GET_STATUS, GET_METRICS, GET_DIAGNOSTICS, START_MONITORING
59
-
60
- #### 4. Production-Ready Features
61
- - Priority queuing (low, normal, high, urgent)
62
- - Configurable timeouts (1000-300000ms)
63
- - Command parameter validation
64
- - Custom command support with `custom_` prefix
65
-
66
- #### 5. Excellent Documentation
67
- - 4 complete examples (success, error, timeout)
68
- - JavaScript and Python client code
69
- - Migration path from v0.4.0
70
- - Implementation checklist
71
-
72
- ### 📋 Minor Suggestions
73
-
74
- 1. **Add Batch Command Support**
75
- ```json
76
- {
77
- "event": "command_batch",
78
- "commands": [
79
- {"command": "led_control", "parameters": {...}},
80
- {"command": "set_interval", "parameters": {...}}
81
- ],
82
- "correlation_id": "batch-001"
83
- }
84
- ```
85
-
86
- 2. **Add Scheduled Command Support**
87
- ```json
88
- {
89
- "command": "read_sensors",
90
- "schedule": {
91
- "execute_at": "2025-10-12T16:00:00Z",
92
- "repeat": "hourly"
93
- }
94
- }
95
- ```
96
-
97
- ---
98
-
99
- ## Part 2: Mesh Reporting Gap Analysis
100
-
101
- ### ⚠️ Critical Missing Feature: Topology Reporting
102
-
103
- #### The Problem
104
-
105
- **Current State:**
106
- - MQTT topic exists: `mesh/topology` (in implementation docs)
107
- - Gateway publishes topology updates
108
- - **NO STANDARDIZED SCHEMA** ❌
109
-
110
- **Impact:**
111
- ```
112
- ❌ Web dashboards can't reliably parse topology
113
- ❌ DevOps lacks standardized monitoring format
114
- ❌ Third-party tools can't visualize mesh
115
- ❌ Historical topology analysis impossible
116
- ```
117
-
118
- #### Use Cases Not Addressed
119
-
120
- **1. Network Visualization**
121
- ```
122
- Dashboard needs to display:
123
- ├── Which nodes are online?
124
- ├── How are they connected?
125
- ├── What's the signal quality?
126
- ├── Where are the bottlenecks?
127
- └── Which paths are redundant?
128
- ```
129
-
130
- **2. Performance Monitoring**
131
- ```
132
- Monitoring system needs:
133
- ├── Average hop count to each node
134
- ├── Connection quality metrics
135
- ├── Network diameter changes
136
- ├── Node churn rate (joins/leaves per hour)
137
- └── Message routing efficiency
138
- ```
139
-
140
- **3. Debugging & Troubleshooting**
141
- ```
142
- When "Node X is unreachable":
143
- ├── What path should messages take?
144
- ├── Which intermediate nodes?
145
- ├── Are there alternative routes?
146
- ├── Is the network partitioned?
147
- └── What's the RSSI at each hop?
148
- ```
149
-
150
- ---
151
-
152
- ## Part 3: Proposed Mesh Topology Schema
153
-
154
- ### New Schema: mesh_topology.schema.json
155
-
156
- #### High-Level Structure
157
- ```json
158
- {
159
- "event": "mesh_topology",
160
- "mesh_id": "MESH-001",
161
- "gateway_node_id": "ALT-6825DD341CA4",
162
- "nodes": [...], // Array of node objects
163
- "connections": [...], // Array of connection/edge objects
164
- "metrics": {...}, // Network-wide aggregates
165
- "update_type": "full" // "full" or "incremental"
166
- }
167
- ```
168
-
169
- #### Node Object Schema
170
- ```json
171
- {
172
- "node_id": "ALT-441D64F804A0",
173
- "role": "sensor", // gateway|sensor|repeater|bridge
174
- "status": "online", // online|offline|unknown
175
- "last_seen": "2025-10-12T14:59:58Z",
176
- "firmware_version": "SN 2.3.4",
177
- "uptime_seconds": 72000,
178
- "free_memory_kb": 42,
179
- "connection_count": 2
180
- }
181
- ```
182
-
183
- #### Connection Object Schema
184
- ```json
185
- {
186
- "from_node": "ALT-6825DD341CA4",
187
- "to_node": "ALT-441D64F804A0",
188
- "quality": 95, // 0-100 percentage
189
- "latency_ms": 12, // Round-trip time
190
- "rssi": -42, // WiFi signal strength (dBm)
191
- "hop_count": 1 // Hops from gateway
192
- }
193
- ```
194
-
195
- #### Network Metrics Object
196
- ```json
197
- {
198
- "total_nodes": 4,
199
- "online_nodes": 4,
200
- "network_diameter": 2, // Max hop count
201
- "avg_connection_quality": 85,
202
- "messages_per_second": 12.4
203
- }
204
- ```
205
-
206
- ### Complete Example: 4-Node Mesh
207
-
208
- **MQTT Topic:** `alteriom/mesh/MESH-001/topology`
209
-
210
- ```json
211
- {
212
- "schema_version": 1,
213
- "device_id": "ALT-6825DD341CA4",
214
- "device_type": "gateway",
215
- "timestamp": "2025-10-12T15:00:00Z",
216
- "firmware_version": "GW 2.3.4",
217
- "event": "mesh_topology",
218
- "mesh_id": "MESH-001",
219
- "gateway_node_id": "ALT-6825DD341CA4",
220
- "nodes": [
221
- {
222
- "node_id": "ALT-6825DD341CA4",
223
- "role": "gateway",
224
- "status": "online",
225
- "last_seen": "2025-10-12T15:00:00Z",
226
- "firmware_version": "GW 2.3.4",
227
- "uptime_seconds": 86400,
228
- "free_memory_kb": 128,
229
- "connection_count": 3
230
- },
231
- {
232
- "node_id": "ALT-441D64F804A0",
233
- "role": "sensor",
234
- "status": "online",
235
- "last_seen": "2025-10-12T14:59:58Z",
236
- "firmware_version": "SN 2.3.4",
237
- "uptime_seconds": 72000,
238
- "free_memory_kb": 42,
239
- "connection_count": 2
240
- },
241
- {
242
- "node_id": "ALT-9A3B2C1D0E5F",
243
- "role": "sensor",
244
- "status": "online",
245
- "last_seen": "2025-10-12T14:59:55Z",
246
- "firmware_version": "SN 2.3.4",
247
- "uptime_seconds": 64800,
248
- "free_memory_kb": 38,
249
- "connection_count": 1
250
- },
251
- {
252
- "node_id": "ALT-7F8E9D0A1B2C",
253
- "role": "repeater",
254
- "status": "online",
255
- "last_seen": "2025-10-12T14:59:59Z",
256
- "firmware_version": "RP 2.3.4",
257
- "uptime_seconds": 43200,
258
- "free_memory_kb": 96,
259
- "connection_count": 3
260
- }
261
- ],
262
- "connections": [
263
- {
264
- "from_node": "ALT-6825DD341CA4",
265
- "to_node": "ALT-441D64F804A0",
266
- "quality": 95,
267
- "latency_ms": 12,
268
- "rssi": -42,
269
- "hop_count": 1
270
- },
271
- {
272
- "from_node": "ALT-6825DD341CA4",
273
- "to_node": "ALT-7F8E9D0A1B2C",
274
- "quality": 88,
275
- "latency_ms": 18,
276
- "rssi": -55,
277
- "hop_count": 1
278
- },
279
- {
280
- "from_node": "ALT-441D64F804A0",
281
- "to_node": "ALT-7F8E9D0A1B2C",
282
- "quality": 82,
283
- "latency_ms": 24,
284
- "rssi": -62,
285
- "hop_count": 2
286
- },
287
- {
288
- "from_node": "ALT-7F8E9D0A1B2C",
289
- "to_node": "ALT-9A3B2C1D0E5F",
290
- "quality": 75,
291
- "latency_ms": 32,
292
- "rssi": -68,
293
- "hop_count": 2
294
- }
295
- ],
296
- "metrics": {
297
- "total_nodes": 4,
298
- "online_nodes": 4,
299
- "network_diameter": 2,
300
- "avg_connection_quality": 85,
301
- "messages_per_second": 12.4
302
- },
303
- "update_type": "full"
304
- }
305
- ```
306
-
307
- ### Incremental Updates
308
-
309
- **When a node joins:**
310
- ```json
311
- {
312
- "event": "mesh_topology",
313
- "mesh_id": "MESH-001",
314
- "nodes": [
315
- {
316
- "node_id": "ALT-NEW12345678",
317
- "role": "sensor",
318
- "status": "online"
319
- }
320
- ],
321
- "connections": [
322
- {
323
- "from_node": "ALT-7F8E9D0A1B2C",
324
- "to_node": "ALT-NEW12345678",
325
- "quality": 78
326
- }
327
- ],
328
- "update_type": "incremental"
329
- }
330
- ```
331
-
332
- ---
333
-
334
- ## Part 4: Additional Mesh Schemas
335
-
336
- ### Schema 2: mesh_event.schema.json
337
-
338
- **Purpose:** Real-time notifications of mesh state changes
339
-
340
- ```json
341
- {
342
- "event": "mesh_event",
343
- "event_type": "node_leave",
344
- "affected_nodes": ["ALT-441D64F804A0"],
345
- "timestamp": "2025-10-12T15:10:00Z",
346
- "details": {
347
- "reason": "timeout",
348
- "last_seen": "2025-10-12T15:08:45Z",
349
- "connections_lost": 2
350
- }
351
- }
352
- ```
353
-
354
- **Event Types:**
355
- - `node_join` - New node entered mesh
356
- - `node_leave` - Node left mesh (clean disconnect)
357
- - `node_timeout` - Node lost due to timeout
358
- - `connection_lost` - Direct connection failed
359
- - `connection_restored` - Connection recovered
360
- - `network_split` - Mesh partitioned
361
- - `network_merged` - Partitions rejoined
362
- - `route_changed` - Routing table updated
363
-
364
- ### Schema 3: mesh_diagnostics.schema.json
365
-
366
- **Purpose:** Detailed mesh health information
367
-
368
- ```json
369
- {
370
- "event": "mesh_diagnostics",
371
- "diagnostic_type": "full_report",
372
- "routing_table": [
373
- {
374
- "destination": "ALT-441D64F804A0",
375
- "next_hop": "ALT-441D64F804A0",
376
- "hop_count": 1,
377
- "path_quality": 95
378
- }
379
- ],
380
- "message_statistics": {
381
- "total_sent": 15432,
382
- "total_received": 14987,
383
- "total_dropped": 45,
384
- "retransmissions": 123
385
- },
386
- "connection_history": [
387
- {
388
- "node_id": "ALT-441D64F804A0",
389
- "connects": 1,
390
- "disconnects": 0,
391
- "avg_uptime_seconds": 72000
392
- }
393
- ]
394
- }
395
- ```
396
-
397
- ---
398
-
399
- ## Part 5: Mesh Command Extensions
400
-
401
- ### Add Mesh-Specific Commands (300-399)
402
-
403
- Extend the standard command list with mesh operations:
404
-
405
- ```json
406
- // Topology management
407
- "get_topology" // Request current mesh topology
408
- "scan_neighbors" // Scan for nearby mesh nodes
409
- "force_reconnect" // Force reconnection to mesh
410
- "optimize_routes" // Trigger routing optimization
411
-
412
- // Diagnostics
413
- "mesh_diagnostics" // Run mesh health check
414
- "connection_test" // Test connection to specific node
415
- "trace_route" // Trace message path to node
416
-
417
- // Network management
418
- "set_tx_power" // Adjust WiFi transmit power
419
- "change_channel" // Switch WiFi channel
420
- "isolate_node" // Temporarily isolate node for testing
421
- ```
422
-
423
- **Example: Get Topology Command**
424
- ```json
425
- {
426
- "event": "command",
427
- "command": "get_topology",
428
- "correlation_id": "cmd-topology-001",
429
- "parameters": {
430
- "format": "full", // "full" or "summary"
431
- "include_metrics": true,
432
- "include_history": false
433
- }
434
- }
435
- ```
436
-
437
- **Response:**
438
- ```json
439
- {
440
- "event": "command_response",
441
- "command": "get_topology",
442
- "correlation_id": "cmd-topology-001",
443
- "success": true,
444
- "result": {
445
- // Full topology object as per mesh_topology.schema.json
446
- },
447
- "latency_ms": 850
448
- }
449
- ```
450
-
451
- ---
452
-
453
- ## Part 6: Implementation Roadmap
454
-
455
- ### v0.5.0 Scope (RECOMMENDED)
456
-
457
- #### High Priority - Include Now ✅
458
-
459
- 1. **command.schema.json** (from proposal) ✅
460
- 2. **command_response.schema.json** (from proposal) ✅
461
- 3. **mesh_topology.schema.json** (NEW) ⚠️
462
- 4. **mesh_event.schema.json** (NEW) ⚠️
463
-
464
- **Rationale:** Topology reporting is essential for mesh monitoring. Without it, users can't visualize or debug their networks effectively.
465
-
466
- #### Medium Priority - Consider for v0.5.0 📋
467
-
468
- 5. **mesh_diagnostics.schema.json** (NEW)
469
- 6. **Mesh command extensions** (300-399 command IDs)
470
-
471
- **Rationale:** Nice-to-have for advanced debugging, but not blocking.
472
-
473
- #### Low Priority - Defer to v0.6.0 ⏳
474
-
475
- 7. **node_discovery.schema.json** (auto-configuration)
476
- 8. **route_metrics.schema.json** (per-message tracking)
477
- 9. **Batch command schema** (send multiple commands)
478
- 10. **Scheduled command schema** (future execution)
479
-
480
- ---
481
-
482
- ## Part 7: Schema Comparison Matrix
483
-
484
- | Feature | Command Proposal | Mesh Addition | Current painlessMesh | Gap |
485
- |---------|-----------------|---------------|---------------------|-----|
486
- | Device control | ✅ Covered | N/A | ✅ Implemented | ✅ None |
487
- | Command tracking | ✅ correlation_id | N/A | ✅ commandId field | ✅ None |
488
- | Error handling | ✅ 12 error codes | N/A | ✅ StatusPackage | ✅ None |
489
- | Network topology | ❌ Not covered | ✅ Proposed | ⚠️ Ad-hoc format | ⚠️ **Critical** |
490
- | Node list | ❌ Not covered | ✅ Proposed | ✅ getNodeList() | ⚠️ Schema needed |
491
- | Connection graph | ❌ Not covered | ✅ Proposed | ⚠️ Not exposed | ⚠️ **Critical** |
492
- | Signal quality | ❌ Not covered | ✅ Proposed (RSSI) | ⚠️ Not exposed | ⚠️ Important |
493
- | Network events | ❌ Not covered | ✅ Proposed | ⚠️ Callbacks only | ⚠️ Important |
494
- | Routing table | ❌ Not covered | ✅ Proposed | ⚠️ Internal only | 📋 Future |
495
- | Hop counts | ❌ Not covered | ✅ Proposed | ⚠️ Not tracked | 📋 Future |
496
-
497
- ---
498
-
499
- ## Part 8: Benefits Analysis
500
-
501
- ### With Command Schema Only (Proposal)
502
-
503
- ✅ Control devices remotely
504
- ✅ Track command execution
505
- ✅ Handle errors gracefully
506
- ❌ Can't visualize network
507
- ❌ Can't debug connectivity issues
508
- ❌ Can't monitor mesh health
509
-
510
- ### With Command + Topology Schemas (Recommended)
511
-
512
- ✅ Control devices remotely
513
- ✅ Track command execution
514
- ✅ Handle errors gracefully
515
- ✅ **Visualize network graph** (D3.js/Cytoscape.js)
516
- ✅ **Debug connectivity issues** (trace paths)
517
- ✅ **Monitor mesh health** (quality metrics)
518
- ✅ **Detect network problems** (partitions, bottlenecks)
519
- ✅ **Historical analysis** (topology over time)
520
- ✅ **Automated alerts** (node offline, poor quality)
521
-
522
- ---
523
-
524
- ## Part 9: Example Web Dashboard Integration
525
-
526
- ### Topology Visualization with D3.js
527
-
528
- ```javascript
529
- import mqtt from 'mqtt';
530
- import * as d3 from 'd3';
531
-
532
- const client = mqtt.connect('mqtt://broker.local:1883');
533
- client.subscribe('alteriom/mesh/+/topology');
534
-
535
- client.on('message', (topic, message) => {
536
- const topology = JSON.parse(message.toString());
537
-
538
- if (topology.event === 'mesh_topology') {
539
- renderMeshGraph(topology);
540
- }
541
- });
542
-
543
- function renderMeshGraph(topology) {
544
- const nodes = topology.nodes.map(n => ({
545
- id: n.node_id,
546
- role: n.role,
547
- status: n.status,
548
- memory: n.free_memory_kb
549
- }));
550
-
551
- const links = topology.connections.map(c => ({
552
- source: c.from_node,
553
- target: c.to_node,
554
- quality: c.quality,
555
- latency: c.latency_ms
556
- }));
557
-
558
- // D3.js force-directed graph
559
- const simulation = d3.forceSimulation(nodes)
560
- .force('link', d3.forceLink(links).id(d => d.id))
561
- .force('charge', d3.forceManyBody())
562
- .force('center', d3.forceCenter(width / 2, height / 2));
563
-
564
- // Render nodes with color based on status
565
- svg.selectAll('circle')
566
- .data(nodes)
567
- .enter().append('circle')
568
- .attr('r', 20)
569
- .attr('fill', d => d.status === 'online' ? 'green' : 'red');
570
-
571
- // Render links with thickness based on quality
572
- svg.selectAll('line')
573
- .data(links)
574
- .enter().append('line')
575
- .attr('stroke-width', d => d.quality / 10)
576
- .attr('stroke', d => d.quality > 80 ? 'green' : d.quality > 50 ? 'orange' : 'red');
577
- }
578
- ```
579
-
580
- ### Real-Time Event Monitoring
581
-
582
- ```javascript
583
- client.subscribe('alteriom/mesh/+/events');
584
-
585
- client.on('message', (topic, message) => {
586
- const event = JSON.parse(message.toString());
587
-
588
- if (event.event === 'mesh_event') {
589
- switch (event.event_type) {
590
- case 'node_leave':
591
- showNotification('⚠️ Node Offline',
592
- `Node ${event.affected_nodes[0]} disconnected`);
593
- updateTopology(); // Refresh graph
594
- break;
595
-
596
- case 'node_join':
597
- showNotification('✅ New Node',
598
- `Node ${event.affected_nodes[0]} joined mesh`);
599
- updateTopology();
600
- break;
601
-
602
- case 'network_split':
603
- showAlert('🚨 Network Partition Detected!',
604
- 'Mesh has split into multiple segments');
605
- break;
606
- }
607
- }
608
- });
609
- ```
610
-
611
- ---
612
-
613
- ## Part 10: Recommendations
614
-
615
- ### For @alteriom/mqtt-schema Maintainers
616
-
617
- #### Immediate Actions (v0.5.0)
618
-
619
- 1. ✅ **Approve command schemas** from proposal (ready as-is)
620
- 2. ⚠️ **Add mesh_topology.schema.json** (critical for monitoring)
621
- 3. ⚠️ **Add mesh_event.schema.json** (important for alerts)
622
- 4. 📝 **Update TypeScript types** to include mesh schemas
623
- 5. 🧪 **Add validation tests** for topology messages
624
-
625
- #### Future Considerations (v0.6.0)
626
-
627
- 6. 📋 **Add mesh_diagnostics.schema.json** (advanced debugging)
628
- 7. 📋 **Add node_discovery.schema.json** (auto-configuration)
629
- 8. ⏳ **Add batch_command.schema.json** (efficiency)
630
- 9. ⏳ **Add scheduled_command.schema.json** (automation)
631
-
632
- ### For alteriom-firmware Team
633
-
634
- #### Immediate Actions
635
-
636
- 1. ✅ **Implement command bridge** (already done!)
637
- 2. ⚠️ **Add topology reporter** in gateway
638
- - Export `mesh.getNodeList()` as topology message
639
- - Publish full topology every 60 seconds
640
- - Publish incremental updates on node join/leave
641
- 3. ⚠️ **Add mesh event publisher**
642
- - Hook into painlessMesh callbacks
643
- - Publish `mesh_event` on topology changes
644
- 4. 🧪 **Test with web dashboard** (D3.js visualization)
645
-
646
- #### Future Work
647
-
648
- 5. 📋 **Add `get_topology` command handler**
649
- 6. 📋 **Implement mesh diagnostics command**
650
- 7. 📋 **Add connection quality tracking** (RSSI, latency)
651
-
652
- ---
653
-
654
- ## Conclusion
655
-
656
- ### Summary
657
-
658
- The MQTT command schema proposal is **excellent and ready for implementation**. However, to provide a **complete mesh management solution**, we strongly recommend adding **mesh topology and event schemas** in the same release (v0.5.0).
659
-
660
- ### Final Verdict
661
-
662
- | Component | Status | Action |
663
- |-----------|--------|--------|
664
- | Command Schema | ✅ **APPROVED** | Implement as proposed |
665
- | Response Schema | ✅ **APPROVED** | Implement as proposed |
666
- | Topology Schema | ⚠️ **MISSING** | **Add to v0.5.0** |
667
- | Event Schema | ⚠️ **MISSING** | **Add to v0.5.0** |
668
-
669
- ### Proposed v0.5.0 Release Scope
670
-
671
- **Include:**
672
- 1. command.schema.json ✅
673
- 2. command_response.schema.json ✅
674
- 3. mesh_topology.schema.json ⚠️ **NEW**
675
- 4. mesh_event.schema.json ⚠️ **NEW**
676
-
677
- **Benefits:**
678
- - Complete bidirectional control (commands + responses)
679
- - Complete mesh visibility (topology + events)
680
- - Production-ready monitoring solution
681
- - Enables web dashboard visualization
682
- - Supports automated alerting
683
-
684
- ---
685
-
686
- **Reviewed By:** Alteriom Development Team
687
- **Date:** October 12, 2025
688
- **Status:** ✅ APPROVED WITH ADDITIONS RECOMMENDED
689
- **Next Step:** Submit mesh schemas to @alteriom/mqtt-schema maintainers
690
-