homebridge-enphase-envoy 10.8.4 → 10.8.5

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
@@ -11,6 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - For plugin >= v10.4.0 use Homebridge UI >= v5.13.0
12
12
  - after update to v10.0.0 and above the accessory and bridge need to be removed from the homebridge / Home.app and added again
13
13
 
14
+ ## [10.8.5] - (18.11.2026)
15
+
16
+ ### Changes
17
+
18
+ - fixed: the RESTFul server tries again every 10 seconds when its port cannot be opened at the start of the plugin, a server that starts later is used by the running device
19
+ - fixed: MQTT does not queue the messages while the broker is not connected, the plugin stops to publish when the connection to the broker is lost and starts again after it is connected
20
+ - updated: dependencies, axios and fast-xml-parser to the latest versions
21
+
14
22
  ## [10.8.4] - (16.11.2026)
15
23
 
16
24
  ### Changes
package/index.js CHANGED
@@ -125,9 +125,11 @@ class EnvoyPlatform {
125
125
  logWarn: logLevel.warn,
126
126
  logDebug: logLevel.debug,
127
127
  })
128
- .once('connected', (msg) => {
128
+ .on('connected', (msg) => {
129
129
  clearTimeout(timer);
130
130
  restFulConnected = true;
131
+ // The server can start later than the plugin, when the port was busy, the running device uses it from then
132
+ if (activeDevice) activeDevice.restFulConnected = true;
131
133
  if (logLevel.success) log.success(`Device: ${host} ${deviceName}, ${msg}`);
132
134
  resolve();
133
135
  })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "displayName": "Enphase Envoy",
4
4
  "name": "homebridge-enphase-envoy",
5
- "version": "10.8.4",
5
+ "version": "10.8.5",
6
6
  "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -36,9 +36,9 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "mqtt": "^5.16.1",
39
- "axios": "^1.21.0",
39
+ "axios": "^1.21.1",
40
40
  "express": "^5.3.0",
41
- "fast-xml-parser": "^5.12.0",
41
+ "fast-xml-parser": "^5.12.1",
42
42
  "fakegato-history": "^0.6.7",
43
43
  "node-cron": "^4.6.0"
44
44
  },
@@ -126,6 +126,7 @@ class EnvoyDevice extends EventEmitter {
126
126
  this.mqttConnected = mqttConnected;
127
127
  // The broker may come online after the start or restart, the device then publishes again
128
128
  this.mqtt1?.on('online', () => this.mqttOnline().catch((error) => this.emit('warn', `MQTT online error: ${error}`)));
129
+ this.mqtt1?.on('offline', () => { this.mqttConnected = false; });
129
130
 
130
131
  //system accessory
131
132
  this.systemAccessory = {
package/src/mqtt.js CHANGED
@@ -94,7 +94,10 @@ class Mqtt extends EventEmitter {
94
94
  if (config.logDebug) this.emit('debug', 'MQTT Reconnecting...');
95
95
  })
96
96
  .on('close', () => {
97
+ // The broker is gone, the plugin stops to publish until it is connected again, the client would only queue the messages
98
+ const wasConnected = this.connected;
97
99
  this.connected = false;
100
+ if (wasConnected) this.emit('offline');
98
101
  if (!hasConnected && !warnedStalled && Date.now() - startTime > 30000) {
99
102
  warnedStalled = true;
100
103
  this.emit('warn', `MQTT has not connected after 30s of retries using protocol v${protocolVersion}. Check broker address, credentials, and whether the broker supports this MQTT protocol version.`);
package/src/restful.js CHANGED
@@ -162,14 +162,27 @@ class RestFul extends EventEmitter {
162
162
  }
163
163
  });
164
164
 
165
- app.listen(this.port, () => {
166
- this.emit('connected', `RESTful started on port: ${this.port}`);
167
- });
165
+ this.listen(app);
168
166
  } catch (error) {
169
167
  if (this.logWarn) this.emit('warn', `RESTful Connect error: ${error}`);
170
168
  }
171
169
  }
172
170
 
171
+ // When the port cannot be opened, for example it is still used after a restart, the server tries again until it starts
172
+ listen(app) {
173
+ const server = app.listen(this.port);
174
+ server.once('listening', () => {
175
+ this.listenWarned = false;
176
+ this.emit('connected', `RESTful started on port: ${this.port}`);
177
+ });
178
+ server.on('error', (error) => {
179
+ if (this.logWarn && !this.listenWarned) this.emit('warn', `RESTful cannot start on port: ${this.port}, ${error.code ?? error}, trying again every 10 seconds`);
180
+ this.listenWarned = true;
181
+ server.close();
182
+ setTimeout(() => this.listen(app), 10000).unref?.();
183
+ });
184
+ }
185
+
173
186
  tokenValid(provided) {
174
187
  // Compare fixed-length hashes so the check takes the same time regardless of token length or content
175
188
  const a = createHash('sha256').update(provided).digest();