homebridge-enphase-envoy 10.7.4 → 10.7.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,12 @@ 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.7.5] - (22.07.2026)
15
+
16
+ ### Fixed
17
+
18
+ - Energy history: reserve-space pruning (`energyHistoryReserveSpace`) could delete yesterday's and today's records when free disk space stayed below the configured reserve; since the daily energy diff (`prit`/`cnit`/`ctit`) baseline is anchored to the last record of the previous day, losing it caused today's energy values to be computed incorrectly after a prune; pruning now always keeps yesterday's and today's records intact and only removes older history, logging a warning instead of pruning when no removable records remain outside that protected window
19
+
14
20
  ## [10.7.4] - (04.06.2026)
15
21
 
16
22
  ### Fixed
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.7.4",
5
+ "version": "10.7.5",
6
6
  "description": "Homebridge plugin for Photovoltaic Energy System manufactured by Enphase.",
7
7
  "license": "MIT",
8
8
  "author": "grzegorz914",
@@ -35,12 +35,12 @@
35
35
  "node": "^20 || ^22 || ^24 || ^25 || ^26"
36
36
  },
37
37
  "dependencies": {
38
- "mqtt": "^5.15.1",
39
- "axios": "^1.17.0",
38
+ "mqtt": "^5.15.2",
39
+ "axios": "^1.18.1",
40
40
  "express": "^5.2.1",
41
- "fast-xml-parser": "^5.8.0",
41
+ "fast-xml-parser": "^5.10.1",
42
42
  "fakegato-history": "^0.6.7",
43
- "node-cron": "^4.2.1"
43
+ "node-cron": "^4.6.0"
44
44
  },
45
45
  "keywords": [
46
46
  "homebridge",
@@ -4383,9 +4383,21 @@ class EnvoyDevice extends EventEmitter {
4383
4383
  const deficitBytes = (this.energyHistoryReserveSpace - freeGB) * 1073741824;
4384
4384
  const fileStats = await stat(this.energyLifetimeHistoryFile).catch(() => null);
4385
4385
  const bytesPerRecord = fileStats && energyHistory.length > 0 ? fileStats.size / energyHistory.length : 200;
4386
- const toRemove = Math.min(Math.max(1, Math.ceil(deficitBytes / bytesPerRecord)), energyHistory.length - 1);
4387
- energyHistory.splice(0, toRemove);
4388
- if (this.logWarn) this.emit('warn', `Energy history pruned ${toRemove} oldest records (free: ${freeGB.toFixed(2)} GB < reserve: ${this.energyHistoryReserveSpace} GB)`);
4386
+
4387
+ // Never prune yesterday's/today's records, they anchor the daily energy diff baseline (see yesterdaySnapshot/todaySnapshot lookup above)
4388
+ const protectedFromTs = Math.floor(new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime() / 1000) - 86400;
4389
+ const firstProtectedIdx = energyHistory.findIndex(item => item && typeof item.ts === 'number' && item.ts >= protectedFromTs);
4390
+ const maxRemovable = firstProtectedIdx === -1 ? energyHistory.length - 1 : Math.min(energyHistory.length - 1, firstProtectedIdx);
4391
+
4392
+ const wanted = Math.max(1, Math.ceil(deficitBytes / bytesPerRecord));
4393
+ const toRemove = Math.min(wanted, maxRemovable);
4394
+
4395
+ if (toRemove > 0) {
4396
+ energyHistory.splice(0, toRemove);
4397
+ if (this.logWarn) this.emit('warn', `Energy history pruned ${toRemove} oldest records (free: ${freeGB.toFixed(2)} GB < reserve: ${this.energyHistoryReserveSpace} GB)`);
4398
+ } else if (this.logWarn) {
4399
+ this.emit('warn', `Energy history low disk space (free: ${freeGB.toFixed(2)} GB < reserve: ${this.energyHistoryReserveSpace} GB) but no prunable records remain outside yesterday/today`);
4400
+ }
4389
4401
  }
4390
4402
  } catch (e) {
4391
4403
  if (this.logWarn) this.emit('warn', `Energy history space check error: ${e.message}`);