@alteriom/painlessmesh 1.9.16 → 1.9.18

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
@@ -13,6 +13,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Fixed
15
15
 
16
+ ## [1.9.18] - 2025-12-21
17
+
18
+ ### Added
19
+
20
+ - **Internet Connectivity Check Enhancement** - Bridge nodes now verify actual internet access before processing HTTP requests
21
+ - Added `hasActualInternetAccess()` function that performs DNS resolution to detect router internet issues
22
+ - Gateway checks both WiFi association AND DNS resolution before attempting HTTP requests
23
+ - Provides early failure detection when router has no WAN connection
24
+ - Clear, actionable error messages help users troubleshoot connectivity problems:
25
+ - "Gateway WiFi not connected" - ESP not associated with WiFi network
26
+ - "Router has no internet access - check WAN connection" - WiFi OK but router offline
27
+ - Minimal performance impact: ~100ms DNS check vs 30+ second HTTP timeout
28
+ - New test suite with 22 assertions covering connectivity scenarios
29
+ - Documentation: ISSUE_INTERNET_CONNECTIVITY_CHECK.md
30
+ - Backward compatible: No API changes required
31
+
32
+ ## [1.9.17] - 2025-12-21
33
+
34
+ ### Changed
35
+
36
+ - **Documentation Enhancement** - Professional-grade documentation improvements
37
+ - Removed all phase terminology (Phase 1, Phase 2) for clearer product positioning
38
+ - Reorganized package types in proper numerical order (200-614) for better discoverability
39
+ - Enhanced package type descriptions with clearer use cases and benefits
40
+ - Improved Advanced Features section with comprehensive feature list
41
+ - Updated README to production-level quality suitable for enterprise adoption
42
+ - Clarified message type taxonomy (Protocol-Level vs Application-Level)
43
+
44
+ ### Documentation
45
+
46
+ - **Package Type Organization** - All 19 application-level package types now listed in numerical order
47
+ - Core IoT Packages (200, 202, 400)
48
+ - Advanced Monitoring (204, 605)
49
+ - Mesh Topology & Management (600-604)
50
+ - Bridge Failover & High Availability (610-614)
51
+ - **Feature Clarity** - Advanced features now prominently displayed including:
52
+ - Broadcast OTA distribution
53
+ - MQTT bridge integration
54
+ - Automatic bridge failover
55
+ - Multi-bridge coordination
56
+ - Message queueing for offline resilience
57
+
16
58
  ## [1.9.16] - 2025-12-20
17
59
 
18
60
  ### Changed
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div align="center">
6
6
 
7
- **Version 1.9.16** - Maintenance release with documentation improvements and code refinements
7
+ **Version 1.9.18** - Internet connectivity check enhancement with DNS resolution verification
8
8
 
9
9
  [![CI/CD Pipeline](https://github.com/Alteriom/painlessMesh/actions/workflows/ci.yml/badge.svg)](https://github.com/Alteriom/painlessMesh/actions/workflows/ci.yml)
10
10
  [![Documentation](https://github.com/Alteriom/painlessMesh/actions/workflows/docs.yml/badge.svg)](https://github.com/Alteriom/painlessMesh/actions/workflows/docs.yml)
@@ -46,7 +46,7 @@ This fork includes specialized packages for structured IoT communication:
46
46
  - Command tracking with unique IDs
47
47
  - Perfect for remote device control
48
48
 
49
- **Advanced Monitoring Packages (Phase 2):**
49
+ **Advanced Monitoring Packages:**
50
50
 
51
51
  - **`MetricsPackage`** (Type 204) - Comprehensive performance metrics (SENSOR_METRICS per mqtt-schema v0.7.2+)
52
52
  - CPU usage and processing metrics
@@ -64,13 +64,7 @@ This fork includes specialized packages for structured IoT communication:
64
64
  - Crash tracking and reboot reason codes
65
65
  - Actionable recommendations
66
66
 
67
- **Mesh Topology & Management (Phase 2):**
68
-
69
- - **`EnhancedStatusPackage`** (Type 604) - Detailed mesh status (MESH_STATUS per mqtt-schema v0.7.2+)
70
- - Complete mesh statistics (node count, connections, messages)
71
- - Performance metrics (latency, packet loss, throughput)
72
- - Alert flags and error reporting
73
- - Firmware verification with MD5 hash
67
+ **Mesh Topology & Management:**
74
68
 
75
69
  - **`MeshNodeListPackage`** (Type 600) - Node discovery and inventory (MESH_NODE_LIST per mqtt-schema v0.7.2+)
76
70
  - List of all mesh nodes with status (offline/online/unreachable)
@@ -99,7 +93,13 @@ This fork includes specialized packages for structured IoT communication:
99
93
  - Gateway node identification
100
94
  - Enables heterogeneous mesh networks
101
95
 
102
- **Bridge Failover & High Availability (v1.8.0):**
96
+ - **`EnhancedStatusPackage`** (Type 604) - Detailed mesh status (MESH_STATUS per mqtt-schema v0.7.2+)
97
+ - Complete mesh statistics (node count, connections, messages)
98
+ - Performance metrics (latency, packet loss, throughput)
99
+ - Alert flags and error reporting
100
+ - Firmware verification with MD5 hash
101
+
102
+ **Bridge Failover & High Availability:**
103
103
 
104
104
  - **`BridgeStatusPackage`** (Type 610) - Bridge health monitoring (BRIDGE_STATUS per mqtt-schema v0.7.3+)
105
105
  - Internet connectivity status
@@ -119,6 +119,13 @@ This fork includes specialized packages for structured IoT communication:
119
119
  - Takeover reason and timestamp
120
120
  - Seamless failover notification
121
121
 
122
+ - **`BridgeCoordinationPackage`** (Type 613) - Multi-bridge coordination (BRIDGE_COORDINATION per mqtt-schema v0.7.3+)
123
+ - Bridge priority levels (1-10)
124
+ - Role assignment (primary/secondary/standby)
125
+ - Peer bridge discovery
126
+ - Load balancing metrics
127
+ - Hot standby redundancy
128
+
122
129
  - **`NTPTimeSyncPackage`** (Type 614) - NTP time synchronization (TIME_SYNC_NTP per mqtt-schema v0.7.3+)
123
130
  - Unix timestamp from NTP server
124
131
  - Accuracy/precision in milliseconds
@@ -127,7 +134,7 @@ This fork includes specialized packages for structured IoT communication:
127
134
 
128
135
  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.
129
136
 
130
- #### 🚀 Phase 2 Features (v1.7.0+)
137
+ #### 🚀 Advanced Features
131
138
 
132
139
  **Broadcast OTA Distribution**
133
140
 
@@ -145,7 +152,7 @@ All packages provide type-safe serialization, automatic JSON conversion, and mes
145
152
 
146
153
  See [BRIDGE_TO_INTERNET.md](BRIDGE_TO_INTERNET.md) for complete documentation.
147
154
 
148
- #### 🔄 Automatic Bridge Failover (v1.8.0)
155
+ #### 🔄 Automatic Bridge Failover
149
156
 
150
157
  **High Availability for Critical Systems**
151
158
 
@@ -538,12 +545,15 @@ These are the message types used by applications built on painlessMesh:
538
545
  - **📱 ESP32 & ESP8266** - Full support for both platforms
539
546
  - **🛡️ Memory Efficient** - Optimized for resource-constrained devices
540
547
 
541
- ### Advanced Features (v1.7.0+)
548
+ ### Advanced Features
542
549
 
543
550
  - **📡 Broadcast OTA** - Efficient firmware distribution for large meshes (50-100+ nodes)
544
551
  - **🌉 MQTT Bridge** - Professional monitoring with Grafana/InfluxDB/Prometheus
545
552
  - **📊 Topology Visualization** - D3.js, Cytoscape.js, Node-RED examples
546
553
  - **🎯 Production Ready** - Enterprise-grade stability and performance
554
+ - **🔄 Automatic Bridge Failover** - RSSI-based election for high availability
555
+ - **🌐 Multi-Bridge Coordination** - Load balancing and geographic redundancy
556
+ - **💾 Message Queueing** - Zero data loss during Internet outages
547
557
 
548
558
  ## Examples & Use Cases
549
559
 
@@ -553,18 +563,16 @@ These are the message types used by applications built on painlessMesh:
553
563
  - **Event Coordination** - Synchronized displays, distributed processing
554
564
  - **Bridge Networks** - Connect mesh to WiFi/Internet/MQTT - [📖 Bridge Guide](BRIDGE_TO_INTERNET.md)
555
565
 
556
- ## Latest Release: v1.9.6 (December 10, 2025)
566
+ ## Latest Release: v1.9.17 (December 21, 2025)
557
567
 
558
- **TCP Connection Improvements & Documentation Update**
568
+ **Documentation Enhancement & Package Organization**
559
569
 
560
- - **TCP Connection Retry Improvements** - Enhanced reliability with exponential backoff (#231)
561
- - Increased stabilization delay (100ms 500ms)
562
- - Increased retry delay (500ms 1000ms) with exponential backoff
563
- - More retry attempts (3 5) for better connection establishment
564
- - 📚 **Comprehensive Documentation Review** - Updated README.md for completeness and accuracy
565
- - 🔄 **Version Consistency** - Aligned version numbers across all distribution channels
570
+ - 📚 **Production-Level Documentation** - Removed phase terminology for clearer product positioning
571
+ - 📦 **Complete Package Catalog** - All 19 application-level package types documented in numerical order
572
+ - 🎯 **Enhanced Feature Clarity** - Improved Advanced Features section with comprehensive capability list
573
+ - **Professional Quality** - Documentation suitable for enterprise adoption and production deployments
566
574
 
567
- **Recent Key Features (v1.9.0 - v1.9.5):**
575
+ **Recent Key Features (v1.9.0 - v1.9.16):**
568
576
 
569
577
  - 🔍 **Mesh Connectivity Detection** - New `hasActiveMeshConnections()` and `getLastKnownBridge()` APIs
570
578
  - 🌉 **Improved Bridge Detection** - `getPrimaryBridge()` returns last known bridge when disconnected
@@ -146,6 +146,35 @@ mesh.sendToInternet("https://api.callmebot.com/...", "", callback);
146
146
  3. Check HTTP status code in callback (200 = success)
147
147
  4. URL-encode special characters in the message
148
148
 
149
+ ### Gateway shows "no internet access" but WiFi is connected
150
+
151
+ **Symptom:** Error message "Router has no internet access - check WAN connection"
152
+
153
+ **Cause:** The gateway node is connected to WiFi but the router itself has no internet connectivity. This is detected through DNS resolution testing.
154
+
155
+ **Solutions:**
156
+ 1. **Check router WAN connection:**
157
+ - Verify router's internet LED indicator
158
+ - Check router's WAN port cable connection
159
+ - Ensure modem is powered and connected
160
+
161
+ 2. **Check ISP service:**
162
+ - Verify your internet service is active
163
+ - Test internet on other devices connected to same router
164
+ - Contact ISP if service is down
165
+
166
+ 3. **Router configuration:**
167
+ - Verify router has obtained WAN IP address
168
+ - Check router's internet connection status page
169
+ - Restart router if necessary
170
+
171
+ **Technical Details:**
172
+ The gateway performs two connectivity checks:
173
+ 1. `WiFi.status() == WL_CONNECTED` - Verifies WiFi association
174
+ 2. DNS resolution test - Verifies actual internet routing
175
+
176
+ If WiFi is connected but DNS fails, it indicates the router has no upstream internet connection. This prevents unnecessary HTTP request timeouts and provides early error detection.
177
+
149
178
  ### Understanding HTTP Status Codes
150
179
 
151
180
  The callback provides `httpStatus` to indicate the result:
package/library.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/Alteriom/painlessMesh"
8
8
  },
9
- "version": "1.9.16",
9
+ "version": "1.9.18",
10
10
  "frameworks": [
11
11
  "arduino"
12
12
  ],
@@ -1,5 +1,5 @@
1
1
  name=Alteriom PainlessMesh
2
- version=1.9.16
2
+ version=1.9.18
3
3
  author=Coopdis,Scotty Franzyshen,Edwin van Leeuwen,Germán Martín,Maximilian Schwarz,Doanh Doanh,Alteriom
4
4
  maintainer=Alteriom
5
5
  sentence=A painless way to setup a mesh with ESP8266 and ESP32 devices with Alteriom extensions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alteriom/painlessmesh",
3
- "version": "1.9.16",
3
+ "version": "1.9.18",
4
4
  "description": "painlessMesh is a user-friendly library for creating mesh networks with ESP8266 and ESP32 devices. This Alteriom fork includes additional packages for sensor data (SensorPackage), device commands (CommandPackage), and status monitoring (StatusPackage). It handles routing and network management automatically, so you can focus on your application. The library uses JSON-based messaging and syncs time across all nodes, making it ideal for coordinated behaviour like synchronized light displays or sensor networks reporting to a central node.",
5
5
  "keywords": [
6
6
  "arduino",
@@ -29,10 +29,10 @@
29
29
  /**
30
30
  * @brief AlteriomPainlessMesh library version information
31
31
  */
32
- #define ALTERIOM_PAINLESS_MESH_VERSION "1.9.16"
32
+ #define ALTERIOM_PAINLESS_MESH_VERSION "1.9.18"
33
33
  #define ALTERIOM_PAINLESS_MESH_VERSION_MAJOR 1
34
34
  #define ALTERIOM_PAINLESS_MESH_VERSION_MINOR 9
35
- #define ALTERIOM_PAINLESS_MESH_VERSION_PATCH 16
35
+ #define ALTERIOM_PAINLESS_MESH_VERSION_PATCH 18
36
36
 
37
37
  /**
38
38
  * @brief Library description and usage information
@@ -2120,6 +2120,61 @@ class Mesh : public painlessmesh::Mesh<Connection> {
2120
2120
  router::broadcast<protocol::Variant, Connection>(variant, (*this), 0);
2121
2121
  }
2122
2122
 
2123
+ /**
2124
+ * Check if gateway has actual internet connectivity
2125
+ *
2126
+ * Tests DNS resolution to detect scenarios where WiFi is connected
2127
+ * but the router has no internet access. This provides early detection
2128
+ * before attempting HTTP requests that would timeout or fail.
2129
+ *
2130
+ * @return true if internet is accessible, false otherwise
2131
+ */
2132
+ bool hasActualInternetAccess() {
2133
+ using namespace logger;
2134
+
2135
+ // First check WiFi connection
2136
+ if (WiFi.status() != WL_CONNECTED) {
2137
+ return false;
2138
+ }
2139
+
2140
+ // Check if we have a valid local IP
2141
+ if (WiFi.localIP() == IPAddress(0, 0, 0, 0)) {
2142
+ return false;
2143
+ }
2144
+
2145
+ // Try to resolve a well-known DNS name
2146
+ // Using Google's servers as they have high availability globally
2147
+ IPAddress result;
2148
+
2149
+ #if defined(ESP32) || defined(ESP8266)
2150
+ // Both ESP32 and ESP8266 support WiFi.hostByName()
2151
+ int dnsResult = WiFi.hostByName("www.google.com", result);
2152
+
2153
+ // Check if DNS resolution succeeded
2154
+ if (dnsResult != 1) {
2155
+ Log(COMMUNICATION, "hasActualInternetAccess(): DNS resolution failed (code=%d)\n", dnsResult);
2156
+ return false;
2157
+ }
2158
+
2159
+ // Additional validation: Check if resolved IP is valid
2160
+ // Some ESP8266 versions may return success but set IP to 255.255.255.255 on error
2161
+ if (result == IPAddress(0, 0, 0, 0) || result == IPAddress(255, 255, 255, 255)) {
2162
+ TSTRING resultStr = result.toString();
2163
+ Log(COMMUNICATION, "hasActualInternetAccess(): Invalid DNS result IP: %s\n", resultStr.c_str());
2164
+ return false;
2165
+ }
2166
+ #else
2167
+ // Other platforms: assume internet is available if WiFi connected
2168
+ // (no reliable way to test without platform-specific APIs)
2169
+ return true;
2170
+ #endif
2171
+
2172
+ TSTRING resultStr = result.toString();
2173
+ Log(COMMUNICATION, "hasActualInternetAccess(): Internet connectivity verified (resolved to %s)\n",
2174
+ resultStr.c_str());
2175
+ return true;
2176
+ }
2177
+
2123
2178
  /**
2124
2179
  * Helper method to send gateway acknowledgment
2125
2180
  */
@@ -2196,8 +2251,16 @@ class Mesh : public painlessmesh::Mesh<Connection> {
2196
2251
  }
2197
2252
 
2198
2253
  // Check Internet connectivity
2254
+ // First check WiFi status for quick fail
2199
2255
  if (WiFi.status() != WL_CONNECTED) {
2200
- sendGatewayAck(pkg, false, 0, "Gateway not connected to Internet");
2256
+ sendGatewayAck(pkg, false, 0, "Gateway WiFi not connected");
2257
+ return true; // Consume package - we handled it (with error)
2258
+ }
2259
+
2260
+ // Then check actual internet access (DNS resolution)
2261
+ // This detects when WiFi is connected but router has no internet
2262
+ if (!hasActualInternetAccess()) {
2263
+ sendGatewayAck(pkg, false, 0, "Router has no internet access - check WAN connection");
2201
2264
  return true; // Consume package - we handled it (with error)
2202
2265
  }
2203
2266
 
@@ -2263,20 +2326,35 @@ class Mesh : public painlessmesh::Mesh<Connection> {
2263
2326
  Log(COMMUNICATION, "HTTP request completed: code=%d\n", httpCode);
2264
2327
  } else if (httpCode >= 200 && httpCode < 300) {
2265
2328
  // Other 2xx codes - ambiguous success
2329
+ // HTTP 203 is retryable, so log at COMMUNICATION level to reduce noise
2266
2330
  char errorBuf[128];
2267
2331
  snprintf(errorBuf, sizeof(errorBuf),
2268
2332
  "Ambiguous response - HTTP %d may indicate cached/proxied response, not actual delivery",
2269
2333
  httpCode);
2270
2334
  error = TSTRING(errorBuf);
2271
- Log(ERROR, "HTTP request ambiguous: code=%d (treated as failure)\n", httpCode);
2335
+ Log(COMMUNICATION, "HTTP request ambiguous: code=%d (treated as failure, will retry)\n", httpCode);
2336
+ } else if (httpCode >= 500 && httpCode < 600) {
2337
+ // 5xx server errors are retryable, log at COMMUNICATION level
2338
+ char errorBuf[32];
2339
+ snprintf(errorBuf, sizeof(errorBuf), "HTTP %d", httpCode);
2340
+ error = TSTRING(errorBuf);
2341
+ Log(COMMUNICATION, "HTTP server error: code=%d (will retry)\n", httpCode);
2342
+ } else if (httpCode == 429) {
2343
+ // HTTP 429 rate limit is retryable, log at COMMUNICATION level
2344
+ char errorBuf[32];
2345
+ snprintf(errorBuf, sizeof(errorBuf), "HTTP %d", httpCode);
2346
+ error = TSTRING(errorBuf);
2347
+ Log(COMMUNICATION, "HTTP rate limit: code=%d (will retry)\n", httpCode);
2272
2348
  } else {
2273
- // 1xx, 3xx, 4xx, 5xx
2349
+ // 1xx, 3xx, 4xx (except 429) - non-retryable, log at ERROR level
2274
2350
  char errorBuf[32];
2275
2351
  snprintf(errorBuf, sizeof(errorBuf), "HTTP %d", httpCode);
2276
2352
  error = TSTRING(errorBuf);
2277
2353
  Log(ERROR, "HTTP request failed: code=%d\n", httpCode);
2278
2354
  }
2279
2355
  } else {
2356
+ // Network errors (httpCode <= 0) are retryable but indicate serious issues
2357
+ // Keep at ERROR level as they may indicate gateway connectivity problems
2280
2358
  error = http.errorToString(httpCode);
2281
2359
  Log(ERROR, "HTTP request failed: %s\n", error.c_str());
2282
2360
  }
@@ -5,8 +5,8 @@
5
5
  * @file painlessMesh.h
6
6
  * @brief Main header file for Alteriom painlessMesh library
7
7
  *
8
- * @version 1.9.16
9
- * @date 2025-12-20
8
+ * @version 1.9.18
9
+ * @date 2025-12-21
10
10
  *
11
11
  * painlessMesh is a user-friendly library for creating mesh networks with
12
12
  * ESP8266 and ESP32 devices. This Alteriom fork includes additional packages