iobroker.eos-admin 9.0.36 → 9.0.39

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 (202) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +12 -10
  2. package/README.md +23 -3
  3. package/adminWww/.vite/manifest.json +39 -39
  4. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
  5. package/adminWww/assets/{AdapterUpdateDialog-D2nDWE_N.js → AdapterUpdateDialog-DDmYbnK4.js} +1 -1
  6. package/adminWww/assets/{Adapters-D0sVqNBU.js → Adapters-73Uo4VUy.js} +1 -1
  7. package/adminWww/assets/{ConfigManager-Zm7UoaaN.js → ConfigManager-DoFx_j4o.js} +1 -1
  8. package/adminWww/assets/{Enums-BGL7pR-O.js → Enums-BRQSAW9I.js} +1 -1
  9. package/adminWww/assets/{Fields-A8J3u1yq.js → Fields-pcmISvLk.js} +1 -1
  10. package/adminWww/assets/{Files-CQPjCvW6.js → Files-E8-7c9Ab.js} +1 -1
  11. package/adminWww/assets/{Hosts-CxzkkNBj.js → Hosts-D4a3shrq.js} +1 -1
  12. package/adminWww/assets/{Instances-eEbEukDh.js → Instances-ByxEHRoo.js} +1 -1
  13. package/adminWww/assets/{Intro-I_Tknp0E.js → Intro-DFriWa6g.js} +1 -1
  14. package/adminWww/assets/{Logs-C3GPz61Q.js → Logs-BXR0h5Sz.js} +1 -1
  15. package/adminWww/assets/{Objects-DDnisxNB.js → Objects-h6jg_6uT.js} +1 -1
  16. package/adminWww/assets/{Overview-BpZFdEmp.js → Overview-B39PiMGJ.js} +1 -1
  17. package/adminWww/assets/{State-DY6Nw0SB.js → State-CqF2ARx_.js} +1 -1
  18. package/adminWww/assets/{UsedResources-CtUpdP2b.js → UsedResources-CnbnoF3d.js} +1 -1
  19. package/adminWww/assets/{Users-DcqlSfc5.js → Users-BQik0rIi.js} +1 -1
  20. package/adminWww/assets/{bootstrap-Didkuj-F.js → bootstrap-Dllnekqb.js} +3 -3
  21. package/adminWww/assets/{hostInit-Chrs-wsg.js → hostInit-CQbS-SCS.js} +1 -1
  22. package/adminWww/assets/{icons-material-SqwOQW6y.js → icons-material-rYFYu2DM.js} +1 -1
  23. package/adminWww/assets/{index-CpDo61Mz.js → index-BzbVZbb2.js} +2 -2
  24. package/adminWww/assets/{installSVGRenderer-DZMZ3pJw.js → installSVGRenderer-DbH6B8B8.js} +1 -1
  25. package/adminWww/assets/{mf-entry-bootstrap-0-b0c4981a.js → mf-entry-bootstrap-0-4dee1225.js} +2 -2
  26. package/adminWww/index.html +23 -23
  27. package/adminWww/mf-manifest.json +1 -1
  28. package/adminWww/mf-stats.json +1 -1
  29. package/adminWww/remoteEntry-eos-9.0.39.js +12 -0
  30. package/adminWww/remoteEntry.js +1 -1
  31. package/build/lib/eosLegacyMigration.js +351 -60
  32. package/build/lib/eosLegacyMigration.js.map +1 -1
  33. package/build/lib/eosLegacySource.js +172 -0
  34. package/build/lib/eosLegacySource.js.map +1 -0
  35. package/build/lib/eosModuleHost.js +38 -1
  36. package/build/lib/eosModuleHost.js.map +1 -1
  37. package/build/lib/eosModuleHttp.js +55 -8
  38. package/build/lib/eosModuleHttp.js.map +1 -1
  39. package/build/lib/eosRuntimeControl.js +3 -1
  40. package/build/lib/eosRuntimeControl.js.map +1 -1
  41. package/build/main.js +1 -1
  42. package/build/main.js.map +1 -1
  43. package/docs/README.md +3 -0
  44. package/docs/reports/EMS_ZIELLADEN_2026-11-28.md +45 -0
  45. package/docs/reports/unified-9.0.37/PRUEFBERICHT.md +59 -0
  46. package/docs/reports/unified-9.0.37/PRUEFERGEBNISSE.json +112 -0
  47. package/docs/reports/unified-9.0.37/raw/INDEX.json +232 -0
  48. package/docs/reports/unified-9.0.37/raw/backend.log +5 -0
  49. package/docs/reports/unified-9.0.37/raw/core-final-node22.log +1439 -0
  50. package/docs/reports/unified-9.0.37/raw/core-final-node24.log +1381 -0
  51. package/docs/reports/unified-9.0.37/raw/dashboard-935-screenshot.json +15 -0
  52. package/docs/reports/unified-9.0.37/raw/dashboard-de-en-nl.json +1059 -0
  53. package/docs/reports/unified-9.0.37/raw/ems-ui-nvp-integration.json +245 -0
  54. package/docs/reports/unified-9.0.37/raw/farm-and-dashboard-935.json +11 -0
  55. package/docs/reports/unified-9.0.37/raw/farm-tracking-source-tests.log +80 -0
  56. package/docs/reports/unified-9.0.37/raw/fixtures-verification.log +39 -0
  57. package/docs/reports/unified-9.0.37/raw/frontend.log +160 -0
  58. package/docs/reports/unified-9.0.37/raw/installer.log +26 -0
  59. package/docs/reports/unified-9.0.37/raw/lint.log +45 -0
  60. package/docs/reports/unified-9.0.37/raw/measure-storage-display.cjs +47 -0
  61. package/docs/reports/unified-9.0.37/raw/modules.log +5 -0
  62. package/docs/reports/unified-9.0.37/raw/node22-isolated-start-deadlines.log +28 -0
  63. package/docs/reports/unified-9.0.37/raw/node22-migration.log +1329 -0
  64. package/docs/reports/unified-9.0.37/raw/node22-mira.log +222 -0
  65. package/docs/reports/unified-9.0.37/raw/node22-parallel-initial.log +13278 -0
  66. package/docs/reports/unified-9.0.37/raw/node22-startzeiten.json +21 -0
  67. package/docs/reports/unified-9.0.37/raw/node22-system-status.log +639 -0
  68. package/docs/reports/unified-9.0.37/raw/node22-tests-final.log +18494 -0
  69. package/docs/reports/unified-9.0.37/raw/node22-version.log +1 -0
  70. package/docs/reports/unified-9.0.37/raw/node24-migration.log +1301 -0
  71. package/docs/reports/unified-9.0.37/raw/node24-mira.log +41 -0
  72. package/docs/reports/unified-9.0.37/raw/node24-system-status.log +111 -0
  73. package/docs/reports/unified-9.0.37/raw/node24-tests-final.log +3080 -0
  74. package/docs/reports/unified-9.0.37/raw/node24-version.log +1 -0
  75. package/docs/reports/unified-9.0.37/raw/npm-runtime-audit.json +77 -0
  76. package/docs/reports/unified-9.0.37/raw/platform-acl-node22.log +98 -0
  77. package/docs/reports/unified-9.0.37/raw/platform-acl-node24.log +22 -0
  78. package/docs/reports/unified-9.0.37/raw/platform-nginx-node22.json +21 -0
  79. package/docs/reports/unified-9.0.37/raw/platform-nginx-node24.json +21 -0
  80. package/docs/reports/unified-9.0.37/raw/qa-source-check.log +2 -0
  81. package/docs/reports/unified-9.0.37/raw/release-metadata.log +13 -0
  82. package/docs/reports/unified-9.0.37/raw/sbom.log +8 -0
  83. package/docs/reports/unified-9.0.37/raw/speicher-warnschwelle-integration.json +172 -0
  84. package/docs/reports/unified-9.0.37/raw/sse-backpressure-9.0.35.log +1 -0
  85. package/docs/reports/unified-9.0.37/raw/sse-backpressure-9.0.37.log +1 -0
  86. package/docs/reports/unified-9.0.37/raw/storage-display-memory-node22.json +19 -0
  87. package/docs/reports/unified-9.0.37/raw/storage-display-memory-node24.json +19 -0
  88. package/docs/reports/unified-9.0.37/raw/typecheck.log +5 -0
  89. package/docs/reports/unified-9.0.37/raw/ui-runtime.log +7 -0
  90. package/docs/reports/unified-9.0.38/PRUEFBERICHT.md +51 -0
  91. package/docs/reports/unified-9.0.38/PRUEFERGEBNISSE.json +112 -0
  92. package/docs/reports/unified-9.0.38/raw/INDEX.json +272 -0
  93. package/docs/reports/unified-9.0.38/raw/backend.log +5 -0
  94. package/docs/reports/unified-9.0.38/raw/core-final-node22.log +1439 -0
  95. package/docs/reports/unified-9.0.38/raw/core-final-node24.log +1381 -0
  96. package/docs/reports/unified-9.0.38/raw/dashboard-de-en-nl.json +1044 -0
  97. package/docs/reports/unified-9.0.38/raw/field-upgrade-936-node22.log +21 -0
  98. package/docs/reports/unified-9.0.38/raw/field-upgrade-936-node24.log +10 -0
  99. package/docs/reports/unified-9.0.38/raw/fixtures-verification.log +39 -0
  100. package/docs/reports/unified-9.0.38/raw/frontend.log +152 -0
  101. package/docs/reports/unified-9.0.38/raw/installer.log +26 -0
  102. package/docs/reports/unified-9.0.38/raw/legacy-historian-provenance.json +44 -0
  103. package/docs/reports/unified-9.0.38/raw/legacy-history-built-influx.log +10 -0
  104. package/docs/reports/unified-9.0.38/raw/legacy-history-misbinding-937.log +1 -0
  105. package/docs/reports/unified-9.0.38/raw/legacy-history-providers-node22.log +326 -0
  106. package/docs/reports/unified-9.0.38/raw/legacy-history-providers-node24.log +58 -0
  107. package/docs/reports/unified-9.0.38/raw/legacy-history-real-influx.log +10 -0
  108. package/docs/reports/unified-9.0.38/raw/legacy-history-source-comparison.json +12 -0
  109. package/docs/reports/unified-9.0.38/raw/legacy-template-interfaces.json +21 -0
  110. package/docs/reports/unified-9.0.38/raw/lint.log +45 -0
  111. package/docs/reports/unified-9.0.38/raw/migration-admin-browser-node22.log +86 -0
  112. package/docs/reports/unified-9.0.38/raw/migration-admin-browser-node24.log +84 -0
  113. package/docs/reports/unified-9.0.38/raw/migration-live-children-node22.log +20 -0
  114. package/docs/reports/unified-9.0.38/raw/migration-live-children-node24.log +9 -0
  115. package/docs/reports/unified-9.0.38/raw/migration-process-admin-node22.log +831 -0
  116. package/docs/reports/unified-9.0.38/raw/migration-process-admin-node24.log +144 -0
  117. package/docs/reports/unified-9.0.38/raw/modules.log +5 -0
  118. package/docs/reports/unified-9.0.38/raw/node22-initial-destination-channel.log +13298 -0
  119. package/docs/reports/unified-9.0.38/raw/node22-migration.log +1443 -0
  120. package/docs/reports/unified-9.0.38/raw/node22-mira.log +222 -0
  121. package/docs/reports/unified-9.0.38/raw/node22-system-status.log +639 -0
  122. package/docs/reports/unified-9.0.38/raw/node22-tests-final.log +18620 -0
  123. package/docs/reports/unified-9.0.38/raw/node22-version.log +1 -0
  124. package/docs/reports/unified-9.0.38/raw/node24-migration.log +1411 -0
  125. package/docs/reports/unified-9.0.38/raw/node24-mira.log +41 -0
  126. package/docs/reports/unified-9.0.38/raw/node24-system-status.log +111 -0
  127. package/docs/reports/unified-9.0.38/raw/node24-tests-final.log +3102 -0
  128. package/docs/reports/unified-9.0.38/raw/node24-version.log +1 -0
  129. package/docs/reports/unified-9.0.38/raw/npm-runtime-audit.json +77 -0
  130. package/docs/reports/unified-9.0.38/raw/platform-acl-node22.log +98 -0
  131. package/docs/reports/unified-9.0.38/raw/platform-acl-node24.log +22 -0
  132. package/docs/reports/unified-9.0.38/raw/platform-nginx-node22.json +21 -0
  133. package/docs/reports/unified-9.0.38/raw/platform-nginx-node24.json +21 -0
  134. package/docs/reports/unified-9.0.38/raw/qa-source-check.log +2 -0
  135. package/docs/reports/unified-9.0.38/raw/release-metadata.log +13 -0
  136. package/docs/reports/unified-9.0.38/raw/sbom.log +8 -0
  137. package/docs/reports/unified-9.0.38/raw/source-shape-node22.log +438 -0
  138. package/docs/reports/unified-9.0.38/raw/source-shape-node24.log +78 -0
  139. package/docs/reports/unified-9.0.38/raw/target-owner-bootstrap-node22.log +509 -0
  140. package/docs/reports/unified-9.0.38/raw/target-owner-bootstrap-node24.log +92 -0
  141. package/docs/reports/unified-9.0.38/raw/typecheck.log +5 -0
  142. package/docs/reports/unified-9.0.38/raw/ui-runtime.log +7 -0
  143. package/docs/reports/unified-9.0.39/PRUEFBERICHT.md +48 -0
  144. package/docs/reports/unified-9.0.39/raw/INDEX.json +51 -0
  145. package/docs/reports/unified-9.0.39/raw/node22-tests-final.log +18189 -0
  146. package/docs/reports/unified-9.0.39/raw/node22-version.log +1 -0
  147. package/docs/reports/unified-9.0.39/raw/node24-tests-final.log +3129 -0
  148. package/docs/reports/unified-9.0.39/raw/node24-version.log +1 -0
  149. package/docs/reports/unified-9.0.39/raw/npm-runtime-audit.json +77 -0
  150. package/docs/reports/unified-9.0.39/raw/overnight-simulation.json +117 -0
  151. package/docs/start/START_HIER_9.0.37.md +38 -0
  152. package/docs/start/START_HIER_9.0.38.md +21 -0
  153. package/docs/start/START_HIER_9.0.39.md +14 -0
  154. package/docs/unified/BESTANDSUEBERNAHME_9_0_7.md +2 -0
  155. package/docs/unified/DEVELOPMENT_FINDINGS.md +3 -1
  156. package/docs/unified/SECURITY_CRA.md +6 -0
  157. package/io-package.json +16 -16
  158. package/modules/ocpp/README.md +2 -0
  159. package/modules/ocpp/ocpp/common.js +64 -40
  160. package/modules/ocpp/ocpp/eos-contract.js +8 -3
  161. package/modules/ocpp/runtime.js +10 -5
  162. package/modules/ocpp/test/eos-contract.test.js +67 -0
  163. package/modules/ocpp/test/hosted.test.cjs +29 -1
  164. package/package.json +12 -4
  165. package/public/eos-migration/index.html +11 -4
  166. package/public/eos-migration/index.js +156 -18
  167. package/release-manifests/unified/build-environment.cdx.json +6 -6
  168. package/release-manifests/unified/files.json +290 -164
  169. package/release-manifests/unified/frontend.cdx.json +6 -6
  170. package/release-manifests/unified/installer.cdx.json +6 -6
  171. package/release-manifests/unified/obsolete-admin-assets.json +249 -0
  172. package/release-manifests/unified/runtime.cdx.json +27 -27
  173. package/release-manifests/unified/validation.json +17 -17
  174. package/tools/eos-release-manifest.cjs +3 -1
  175. package/ui/docs/STATES_AND_DATAPOINTS_DE.md +132 -0
  176. package/ui/ems/engine.js +5 -3
  177. package/ui/ems/evcs-control-mapping.js +13 -1
  178. package/ui/ems/modules/charging-management.js +40 -76
  179. package/ui/ems/modules/para14a.js +8 -3
  180. package/ui/ems/modules/storage-control.js +10 -5
  181. package/ui/ems/services/admin-overview-publisher.js +13 -7
  182. package/ui/ems/services/charging-management-audit.js +32 -1
  183. package/ui/ems/services/forecast-aware-target-planner.js +12 -5
  184. package/ui/ems/services/forecast-target-runtime-bridge.js +12 -5
  185. package/ui/io-package.json +13 -1
  186. package/ui/lib/charging-point-identity.js +91 -16
  187. package/ui/lib/hosted-adapter.js +35 -1
  188. package/ui/lib/notification-mail.js +95 -8
  189. package/ui/main.js +407 -61
  190. package/ui/package.json +1 -1
  191. package/ui/www/app.js +104 -89
  192. package/ui/www/charging-diagnostics-appcenter.js +12 -7
  193. package/ui/www/dashboard-lp-status.js +19 -12
  194. package/ui/www/evcs.js +71 -98
  195. package/ui/www/i18n/en.json +15 -0
  196. package/ui/www/i18n/nl.json +15 -0
  197. package/ui/www/live-display.js +145 -27
  198. package/ui/www/manifest.webmanifest +2 -2
  199. package/ui/www/storagefarm-dispatch.js +59 -8
  200. package/ui/www/storagefarm-summary.css +3 -1
  201. package/ui/www/storagefarm.html +2 -0
  202. package/adminWww/remoteEntry-eos-9.0.36.js +0 -12
package/ui/main.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
8
8
  *
9
9
  * Quelle: src-ts/runtime-executables/main.ts
10
- * Quell-Hash: sha256:2316c9c2553f364bf54c35a456deb0345dc306a146b2d649e6c341b77f0413b2
10
+ * Quell-Hash: sha256:4545287807d1439b1405fc6fa06c7f8532bbde620e8fabd8c1563c9f5d763773
11
11
  * Erzeugung: npm run sync:ts-runtime-executables
12
12
  *
13
13
  * Zweck:
@@ -31,6 +31,7 @@
31
31
  // Canonical main.js runtime source; generate with `npm run sync:ts-runtime-executables`.
32
32
  'use strict';
33
33
  const { emsControlField, validEmsControlValue } = require('./lib/ems-control-values');
34
+ const { isDeepStrictEqual } = require('node:util');
34
35
  const { HostedAdapter, centralLicenseSnapshot, centralAccess } = require('./lib/hosted-adapter');
35
36
  const { stopHostedRuntime, createHostedCleanup } = require('./lib/hosted-runtime-stop');
36
37
  const { readHostedStartup } = require('./lib/hosted-startup-status');
@@ -57,6 +58,7 @@ const bodyParser = express.json({ limit: '5mb', inflate: false });
57
58
  const crypto = require('crypto');
58
59
  const { installerRevision, assertInstallerRevision, provisionInstallerObjects, assertDeviceAppActivations, numericMeasurement, activeDeviceProfileReferences, awaitEmsTransition } = require('./lib/installer-lifecycle');
59
60
  const { buildFarmOverview } = require('./lib/storage-farm-overview');
61
+ const { compareFarmPower } = require('./www/live-display');
60
62
  const { readFlowMeasurement, sumFlowMeasurements } = require('./lib/flow-measurement');
61
63
  const nwDefaultFlowMappings = require('./io-package.json').native.datapoints;
62
64
  const { tariffDisplayConfig, tariffPriceNumber } = require('./lib/tariff-price');
@@ -84,7 +86,7 @@ const tariffProviderRegistry = require('./ems/services/tariff-provider-registry'
84
86
  const { normalizeEvcsEnergyTotalKwh } = require('./ems/services/evcs-unit-conversion');
85
87
  const { validateEvcsElectricalConfig } = require('./lib/evcs-electrical-limits');
86
88
  const { OcppAutoDiscovery, collectOcppStations, filterOcppDiscoverySources, planOcppDiscovery, prepareOcppDiscoveryExclusions, normalizeOcppDiscovery, ocppDiscoveryPatterns } = require('./lib/ocpp-auto-discovery');
87
- const { beginChargingControlWrite, bindChargingPointIdentityBaseline, chargingPointLayoutChanged, remapChargingPointDefaultModes, publicChargingControlIdentity, assertChargingControlIdentity } = require('./lib/charging-point-identity');
89
+ const { beginChargingControlWrite, bindChargingPointIdentityBaseline, chargingPointLayoutChanged, configuredChargingPointRows, remapChargingPointDefaultModes, publicChargingControlIdentity, assertChargingControlIdentity } = require('./lib/charging-point-identity');
88
90
  const { remapChargingStationAssignments } = require('./lib/charging-station-identity');
89
91
  const { NotificationMail, validAddress } = require('./lib/notification-mail');
90
92
  const { startOpenMeteoPvForecastRuntime, requestOpenMeteoJson, validateOpenMeteoWeather, safeOpenMeteoError, configuredOpenMeteoApiKey } = require('./ems/services/open-meteo-pv-forecast'), { AdminOverviewPublisher } = require('./ems/services/admin-overview-publisher');
@@ -242,6 +244,15 @@ class NexoWattVis extends HostedAdapter {
242
244
  });
243
245
 
244
246
  this.stateCache = {};
247
+ // Read-only projection of the three EMS health reports. Keep producer evidence
248
+ // separate from normalized cache rows used by flow calculations and controls.
249
+ this._nwDashboardHealth = {
250
+ 'ems.core.schedulerAlive': undefined,
251
+ 'ems.core.schedulerHeartbeatAt': undefined,
252
+ 'ems.gridMeasurementFresh': undefined,
253
+ };
254
+ this._nwDashboardHealthSent = Object.create(null);
255
+ this._nwFarmDisplay = Object.create(null);
245
256
  // Public values may be normalized for UI/module safety (e.g. charge/discharge magnitudes).
246
257
  // Keep the original signed input values as well so signed battery fallbacks can be split correctly.
247
258
  this._nwRawValueCache = {};
@@ -278,7 +289,7 @@ class NexoWattVis extends HostedAdapter {
278
289
  const snapshot = client?.internal
279
290
  ? adapter.stateCache
280
291
  : publicBuilder(adapter.stateCache, true);
281
- const chunk = `data: ${JSON.stringify({ type: 'init', payload: snapshot })}\n\n`;
292
+ const chunk = `data: ${JSON.stringify({ type: 'init', payload: Object.assign(client?.internal ? { ...snapshot, ...adapter._nwFarmDisplay } : snapshot, adapter._nwDashboardHealth) })}\n\n`;
282
293
  cacheRoot[cacheKey] = { createdAt: now, chunk };
283
294
  adapter._nwSseSnapshotBuilds = Number(adapter._nwSseSnapshotBuilds || 0) + 1;
284
295
  return chunk;
@@ -2571,23 +2582,6 @@ class NexoWattVis extends HostedAdapter {
2571
2582
  p.emsApps = this._nwApplyLicenseLimitsToEmsApps(p.emsApps);
2572
2583
  }
2573
2584
  } catch (_e) {}
2574
- try {
2575
- const maxWb = this._nwLicenseMaxWallboxes();
2576
- if (maxWb > 0 && p.settingsConfig && typeof p.settingsConfig === 'object') {
2577
- const rawCount = Number(p.settingsConfig.evcsCount);
2578
- const count = Number.isFinite(rawCount) ? Math.max(0, Math.min(maxWb, Math.round(rawCount))) : 0;
2579
- p.settingsConfig.evcsCount = count;
2580
- if (Array.isArray(p.settingsConfig.evcsList)) p.settingsConfig.evcsList = p.settingsConfig.evcsList.slice(0, count);
2581
- if (Array.isArray(p.settingsConfig.stationGroups)) {
2582
- p.settingsConfig.stationGroups = p.settingsConfig.stationGroups.map((g) => {
2583
- const row = (g && typeof g === 'object') ? Object.assign({}, g) : {};
2584
- if (Array.isArray(row.members)) row.members = row.members.filter((x) => Number(x) >= 1 && Number(x) <= count);
2585
- if (Array.isArray(row.connectors)) row.connectors = row.connectors.filter((x) => Number(x) >= 1 && Number(x) <= count);
2586
- return row;
2587
- });
2588
- }
2589
- }
2590
- } catch (_e) {}
2591
2585
  try {
2592
2586
  const edition = this._nwCurrentLicenseEdition();
2593
2587
  const profile = (nwFeatureFlagsService && typeof nwFeatureFlagsService.storagePerformanceProfile === 'function')
@@ -4912,15 +4906,8 @@ class NexoWattVis extends HostedAdapter {
4912
4906
  * The old engine and accepted customer writes are drained before snapshots;
4913
4907
  * Engine.init recovers/copies the journal before new controllers can start. */
4914
4908
  async _nwPrepareChargingPointReconfigure(nextConfig, restartEms) {
4915
- const configuredRows = config => {
4916
- const settings = config?.settingsConfig || {};
4917
- const list = Array.isArray(settings.evcsList) ? settings.evcsList : [];
4918
- const configuredCount = settings.evcsCount === undefined ? list.length : Number(settings.evcsCount);
4919
- const count = Number.isFinite(configuredCount) ? Math.max(0, Math.min(50, Math.round(configuredCount))) : list.length;
4920
- return Array.from({ length: count }, (_, index) => list[index] && typeof list[index] === 'object' ? list[index] : {});
4921
- };
4922
- const previous = Array.isArray(this.evcsList) ? this.evcsList : configuredRows(this.config);
4923
- const desired = remapChargingPointDefaultModes(previous, configuredRows(nextConfig), this.namespace);
4909
+ const previous = configuredChargingPointRows(this.config?.settingsConfig, this.evcsList);
4910
+ const desired = remapChargingPointDefaultModes(previous, configuredChargingPointRows(nextConfig?.settingsConfig), this.namespace);
4924
4911
  const changed = chargingPointLayoutChanged(previous, desired, this.config?.chargeKiosk, nextConfig?.chargeKiosk, this.namespace);
4925
4912
  let stopped = false;
4926
4913
  const stopPrevious = async () => {
@@ -6716,6 +6703,7 @@ class NexoWattVis extends HostedAdapter {
6716
6703
  const getUnit = async (id) => {
6717
6704
  const sid = String(id || '').trim();
6718
6705
  if (!sid) return '';
6706
+ if (this._sfTrackingLayout?.units.has(sid)) return this._sfTrackingLayout.units.get(sid);
6719
6707
  if (_unitCache.has(sid)) return _unitCache.get(sid) || '';
6720
6708
 
6721
6709
  let unit = '';
@@ -6851,6 +6839,29 @@ class NexoWattVis extends HostedAdapter {
6851
6839
  const statusRows = [];
6852
6840
  const overviewMembers = [];
6853
6841
  const overviewPvSources = [];
6842
+ // A shared actuator or meter cannot identify a single battery. Count owners
6843
+ // before inspecting live values so even the first duplicate is excluded.
6844
+ const trackingOwners = new Map();
6845
+ const trackingForbiddenMeters = new Set();
6846
+ const trackingRoutes = await this._sfTrackingRoutes(list, cfg);
6847
+ assertCurrent();
6848
+ for (const member of list.filter(entry => entry.enabled !== false)) {
6849
+ const actuators = [member.setSignedPowerId, member.setChargePowerId, member.setDischargePowerId, member.feneconGridSetpointId]
6850
+ .filter(Boolean).map(id => trackingRoutes.write.get(id));
6851
+ const meters = [member.batteryFlowPowerId, member.signedPowerId, member.feneconEssActualPowerId,
6852
+ member.chargePowerId, member.dischargePowerId].filter(Boolean).map(id => trackingRoutes.read.get(id));
6853
+ const foreignRoles = [member.pvPowerId, member.feneconPvDcId, member.feneconPvAcId, member.feneconPvTotalId,
6854
+ member.feneconNvpPowerId, member.feneconConsumptionTotalId, member.feneconActualSetpointId, member.socId];
6855
+ for (const id of [...actuators, ...foreignRoles.map(id => trackingRoutes.read.get(id))]) {
6856
+ if (id) trackingForbiddenMeters.add(id);
6857
+ }
6858
+ const hardware = member._eosDevice?.baseId;
6859
+ for (const id of new Set([...actuators, ...meters, ...(hardware ? [`device:${hardware}`] : [])].filter(Boolean))) {
6860
+ trackingOwners.set(id, (trackingOwners.get(id) || 0) + 1);
6861
+ }
6862
+ }
6863
+ const trackingMaxAgeMs = Math.min(staleMs, 30000);
6864
+ const trackingBindings = [];
6854
6865
  const farmWritableStorageCount = list.filter((row) => this._nwStorageFarmRowHasWritableDatapoint(row)).length;
6855
6866
 
6856
6867
  const maxLicensedStorages = this._nwLicenseMaxStorages();
@@ -6877,6 +6888,7 @@ class NexoWattVis extends HostedAdapter {
6877
6888
  dischargePowerId: String(row.dischargePowerId || '').trim(),
6878
6889
  socId: String(row.socId || '').trim(),
6879
6890
  soc: null,
6891
+ powerComparison: null,
6880
6892
  chargePowerW: null,
6881
6893
  dischargePowerW: null,
6882
6894
  signedPowerW: null,
@@ -7515,10 +7527,44 @@ class NexoWattVis extends HostedAdapter {
7515
7527
  status.batteryFlowPowerW = physicalPower;
7516
7528
  overviewMember.batteryPowerW = physicalPower;
7517
7529
  if (duplicateBatteryFlow) status.batteryFlowDuplicate = true;
7530
+
7518
7531
  } else {
7519
7532
  status.batteryFlowMissing = true;
7520
7533
  }
7521
7534
  }
7535
+ // A direct Home ESS command addresses the AC converter (706 → 604).
7536
+ // Its battery-only channel 415 can differ substantially whenever DC PV runs.
7537
+ const essAc = feneconHybridRow && feneconMode.mode === 'direct-ess'
7538
+ && this._sfHasHomeEssComparison(row, trackingRoutes) && signedFeedbackUsable;
7539
+ const domain = essAc ? 'ess-ac' : 'battery';
7540
+ const signedMeasurement = !!(essAc || batteryFlowId || signedFeedbackUsable);
7541
+ const observedIds = essAc ? [signedId] : batteryFlowId ? [batteryFlowId] : signedFeedbackUsable ? [signedId] : [chgId, dchgId];
7542
+ const observedKeys = observedIds.map(id => trackingRoutes.read.get(id));
7543
+ const targetKeys = targetPowerIds.map(id => trackingRoutes.write.get(id));
7544
+ const deviceKey = row._eosDevice?.baseId;
7545
+ const unique = [...targetKeys, ...observedKeys, ...(deviceKey ? [`device:${deviceKey}`] : [])]
7546
+ .every(key => !!key && trackingOwners.get(key) === 1);
7547
+ if (!status.licenseBlocked && status.dispatchAvailable && directTargetAvailable && (!feneconHybridRow || essAc)
7548
+ && !['fems-grid', 'invalid'].includes(feneconMode.mode) && unique
7549
+ && (signedMeasurement || (chargeFeedbackUsable && dischargeFeedbackUsable && observedKeys[0] !== observedKeys[1]))
7550
+ && observedKeys.every(key => !trackingForbiddenMeters.has(key) && key !== trackingRoutes.read.get(pvId))) {
7551
+ const samples = observedIds.map(id => _stCache.get(id));
7552
+ const valid = samples.every(st => st?.ack === true && (st.q === undefined || st.q === 0)
7553
+ && Number.isFinite(st.ts) && st.ts > 0 && st.ts <= now && now - st.ts <= trackingMaxAgeMs
7554
+ && (typeof st.val === 'number' && Number.isFinite(st.val) || typeof st.val === 'string'
7555
+ && /^[-+]?\d+(?:[.,]\d+)?(?:e[-+]?\d+)?\s*(?:[kmg]?w|(?:kilo|mega|giga)?watts?)?$/i.test(st.val.trim())));
7556
+ // Already read for this snapshot. Reject a direction/sign conflict
7557
+ // rather than inheriting display-only clamping of an invalid split.
7558
+ const charge = !signedMeasurement && valid ? parseNum(samples[0].val) * (invChg ? -1 : 1) : 0;
7559
+ const discharge = !signedMeasurement && valid ? parseNum(samples[1].val) * (invDchg ? -1 : 1) : 0;
7560
+ const measured = essAc ? await readNumber(signedId, 'power', { allowStale: false, display: true })
7561
+ : status.batteryFlowPowerW;
7562
+ if (valid && Number.isFinite(measured) && charge >= 0 && discharge >= 0 && !(charge > 0 && discharge > 0)) {
7563
+ const observedAt = Math.min(...samples.map(st => st.ts));
7564
+ status.trackingMeasurement = { signedW: measured, observedAt, domain };
7565
+ trackingBindings.push({ status, binding: this._sfPowerComparisonBinding(row), domain });
7566
+ }
7567
+ }
7522
7568
  statusRows.push(status);
7523
7569
  available++;
7524
7570
  }
@@ -7569,6 +7615,17 @@ class NexoWattVis extends HostedAdapter {
7569
7615
  const capacityWeightedSocOnlineState = Math.round(capacityWeightedSocOnline * 10) / 10;
7570
7616
  const totalPowerState = Math.round(totalPower);
7571
7617
  const farmOverview = buildFarmOverview(overviewMembers, overviewPvSources, now);
7618
+ // Join only the currently accepted command phase. All lookups are synchronous
7619
+ // and local; no new timers, physical reads or actuator writes are introduced.
7620
+ if (!runtimeInfo.dispatchActive || dynamicGridHasControl(this)) this._sfInvalidatePowerTracking();
7621
+ for (const { status, binding, domain } of trackingBindings) {
7622
+ const command = this._sfPowerTracking?.get(status.dispatchKey);
7623
+ if (!command || command.binding !== binding || command.config !== cfg) continue;
7624
+ const sample = status.trackingMeasurement;
7625
+ const validUntil = Math.min(command.acceptedAt, sample.observedAt) + trackingMaxAgeMs;
7626
+ status.powerComparison = compareFarmPower(command.signedW, sample.signedW, command.acceptedSince,
7627
+ sample.observedAt, validUntil, Date.now(), domain === 'ess-ac' ? domain : undefined);
7628
+ }
7572
7629
  const farmOverviewJson = JSON.stringify(farmOverview);
7573
7630
  const totalBatteryPowerState = farmOverview.battery.netW;
7574
7631
  const totalChargeState = Math.round(totalCharge);
@@ -8061,7 +8118,116 @@ class NexoWattVis extends HostedAdapter {
8061
8118
  return { ok: false, skipped: false, changed: false, error: msg };
8062
8119
  }
8063
8120
  }
8121
+ _sfInvalidatePowerTracking() {
8122
+ this._sfPowerTracking?.clear();
8123
+ if (this._sfTrackingWriters) this._sfTrackingOverlap = true;
8124
+ }
8125
+
8126
+ async _sfTrackingRoutes(rows, config) {
8127
+ // Resolve the configured metadata graph once per layout. State observations
8128
+ // always come from the aggregation's existing per-tick cache.
8129
+ const inputs = new Set(), outputs = new Set();
8130
+ for (const row of rows) {
8131
+ if (!row.enabled) continue;
8132
+ for (const id of [row.setSignedPowerId, row.setChargePowerId, row.setDischargePowerId, row.feneconGridSetpointId]) if (id) outputs.add(id);
8133
+ for (const id of [row.batteryFlowPowerId, row.signedPowerId, row.feneconEssActualPowerId, row.chargePowerId,
8134
+ row.dischargePowerId, row.socId, row.pvPowerId, row.feneconPvDcId, row.feneconPvAcId,
8135
+ row.feneconPvTotalId, row.feneconNvpPowerId, row.feneconConsumptionTotalId, row.feneconActualSetpointId]) if (id) inputs.add(id);
8136
+ }
8137
+ const signature = JSON.stringify([[...inputs], [...outputs]]);
8138
+ const previous = this._sfTrackingLayout;
8139
+ if (previous?.signature === signature && previous.config === config && Date.now() < previous.retryAt) return previous;
8140
+ const layout = previous?.signature === signature && previous.config === config
8141
+ ? { ...previous, retryAt: Infinity }
8142
+ : { config, signature, retryAt: Infinity, read: new Map(), write: new Map(), units: new Map(), homeIds: new Set() };
8143
+ const objects = new Map();
8144
+ const resolve = async (start, write) => {
8145
+ let id = start;
8146
+ const visited = new Set();
8147
+ while (id && !visited.has(id) && visited.size < 8) {
8148
+ visited.add(id);
8149
+ if (!objects.has(id)) objects.set(id, await this.getForeignObjectAsync(id).catch(() => null));
8150
+ const obj = objects.get(id);
8151
+ if (obj?.type !== 'state' || !obj.common) {
8152
+ layout.retryAt = Math.min(layout.retryAt, Date.now() + 30000);
8153
+ return null;
8154
+ }
8155
+ if (write ? obj.common.write === false : obj.common.read === false) return null;
8156
+ layout.units.set(id, String(obj.common.unit || '').trim());
8157
+ const native = obj.native || {};
8158
+ const alias = obj.common.alias;
8159
+ if (alias !== undefined && alias !== null) {
8160
+ const next = typeof alias.id === 'string' ? alias.id : alias.id?.[write ? 'write' : 'read'];
8161
+ if (typeof next !== 'string' || !next || alias[write ? 'write' : 'read']) return null;
8162
+ id = next;
8163
+ continue;
8164
+ }
8165
+ if (native.isAlias === true) {
8166
+ const base = id.split('.aliases.')[0];
8167
+ const dp = (write && native.writeDpId) || native.dpId;
8168
+ if (base === id || !native.deviceId || !base.endsWith(`.devices.${native.deviceId}`) || typeof dp !== 'string' || !dp) return null;
8169
+ id = `${base}.${dp}`;
8170
+ continue;
8171
+ }
8172
+ if (native.templateId === 'ess.fenecon.FeneconHomeEssImpl' && native.deviceId && native.datapointId
8173
+ && id.endsWith(`.devices.${native.deviceId}.${native.datapointId}`)) layout.homeIds.add(id);
8174
+ return id;
8175
+ }
8176
+ return null;
8177
+ };
8178
+ for (const id of inputs) if (!layout.read.get(id)) layout.read.set(id, await resolve(id, false));
8179
+ for (const id of outputs) if (!layout.write.get(id)) layout.write.set(id, await resolve(id, true));
8180
+ this._sfTrackingLayout = layout;
8181
+ return layout;
8182
+ }
8183
+
8184
+ _sfHasHomeEssComparison(s, layout) {
8185
+ if (!layout || s.setChargePowerId && s.setDischargePowerId) return false;
8186
+ const actualDp = s.feneconEssActualPowerId || s.signedPowerId;
8187
+ const targetDp = s.setSignedPowerId;
8188
+ const actual = layout.read.get(actualDp);
8189
+ const target = layout.write.get(targetDp);
8190
+ if (!target?.endsWith('.sET_ACTIVE_POWER') || !layout.homeIds.has(target) || !layout.homeIds.has(actual)) return false;
8191
+ const base = s._eosDevice?.baseId || target.slice(0, -'.sET_ACTIVE_POWER'.length);
8192
+ const matches = (id, leaf, alias) => [`${base}.${leaf}`, `${base}.aliases.${alias}`, `${base}.aliases.v1.${alias}`].includes(id);
8193
+ return target === `${base}.sET_ACTIVE_POWER` && actual === `${base}.eSS0_ACTIVE_POWER`
8194
+ && matches(targetDp, 'sET_ACTIVE_POWER', 'ctrl.powerSetpointW') && matches(actualDp, 'eSS0_ACTIVE_POWER', 'r.essActivePower')
8195
+ && layout.units.get(targetDp) === 'W' && ['W', 'kW'].includes(layout.units.get(actualDp));
8196
+
8197
+ }
8198
+
8199
+ _sfPowerComparisonBinding(s) {
8200
+ // A retained name/command value is insufficient after replacing a meter, a
8201
+ // port, a wiring convention or the physical member.
8202
+ return JSON.stringify([s._eosDevice?.baseId, s._eosDevice?.devId, s.socId, s.vendorProfile, s.coupling, s.feneconControlMode,
8203
+ s.setSignedPowerId, s.setChargePowerId, s.setDischargePowerId, s.feneconGridSetpointId,
8204
+ s.batteryFlowPowerId, s.signedPowerId, s.feneconEssActualPowerId, s.chargePowerId, s.dischargePowerId,
8205
+ s.invertSignedPowerSign, s.invertSetSignedPowerSign, s.invertChargeSign, s.invertDischargeSign]);
8206
+ }
8207
+
8064
8208
  async applyStorageFarmTargetW(targetW, meta = {}) {
8209
+ // Journal covers only the current dispatch and the current member list.
8210
+ // Overlap, early exits, handover and restart invalidate comparison evidence.
8211
+ const writesInFlight = this._sfTrackingWriters || 0;
8212
+ this._sfTrackingWriters = writesInFlight + 1;
8213
+ if (writesInFlight) {
8214
+ this._sfTrackingOverlap = true;
8215
+ this._sfPowerTracking?.clear();
8216
+ }
8217
+ const tracking = { next: new Map(), config: this.config };
8218
+ try {
8219
+ const result = await this._sfApplyStorageFarmTargetW(targetW, meta, tracking);
8220
+ if (!this._sfTrackingOverlap && this.config === tracking.config) this._sfPowerTracking = tracking.next;
8221
+ return result;
8222
+ } catch (error) {
8223
+ this._sfPowerTracking?.clear();
8224
+ throw error;
8225
+ } finally {
8226
+ if (!--this._sfTrackingWriters) this._sfTrackingOverlap = false;
8227
+ }
8228
+ }
8229
+
8230
+ async _sfApplyStorageFarmTargetW(targetW, meta, tracking) {
8065
8231
  if (dynamicGridHasControl(this)) return { applied: false, reason: 'dynamic-grid-owns-storage' };
8066
8232
  const w = Number.isFinite(Number(targetW)) ? Math.round(Number(targetW)) : 0;
8067
8233
  const sf = this._sfGetNormalizedFarmConfig();
@@ -8940,6 +9106,14 @@ class NexoWattVis extends HostedAdapter {
8940
9106
  writes: {},
8941
9107
  };
8942
9108
 
9109
+ const signedAllocatedW = direction === 'charge' ? -Math.abs(alloc) : (direction === 'discharge' ? Math.abs(alloc) : 0);
9110
+ const homeEssAc = nwIsFeneconHybrid(s) && commandFamily === 'signed' && this._sfHasHomeEssComparison(s, this._sfTrackingLayout);
9111
+ const trackingSignedW = homeEssAc ? outSignedW : signedAllocatedW;
9112
+ const binding = this._sfPowerComparisonBinding(s);
9113
+ const previous = this._sfPowerTracking?.get(r.dispatchKey);
9114
+ const continuity = previous && previous.config === tracking.config && previous.binding === binding && previous.source === src
9115
+ && previous.signedW === trackingSignedW && previous.acceptedAt <= now && now - previous.acceptedAt < 30000;
9116
+ if (!continuity) this._sfPowerTracking?.delete(r.dispatchKey);
8943
9117
  const selectedIds = new Set();
8944
9118
  if (commandFamily === 'signed' && signedId) selectedIds.add(signedId);
8945
9119
  if (commandFamily === 'split') {
@@ -9008,7 +9182,6 @@ class NexoWattVis extends HostedAdapter {
9008
9182
  && !r.writes.conflict
9009
9183
  && releaseAccepted
9010
9184
  && selectedAccepted;
9011
- const signedAllocatedW = direction === 'charge' ? -Math.abs(alloc) : (direction === 'discharge' ? Math.abs(alloc) : 0);
9012
9185
  r.commandRequired = commandRequired;
9013
9186
  r.commandAccepted = commandAccepted;
9014
9187
  r.releaseAccepted = releaseAccepted;
@@ -9017,6 +9190,22 @@ class NexoWattVis extends HostedAdapter {
9017
9190
  r.failedW = (commandRequired && commandAccepted !== true && direction !== 'idle') ? signedAllocatedW : 0;
9018
9191
  r.stopAccepted = direction === 'idle' && commandRequired ? commandAccepted === true : null;
9019
9192
 
9193
+ // A skipped equal command alone cannot prove a new phase or extend its
9194
+ // lifetime. Keep its first acceptance only while the whole path is valid.
9195
+ const submitted = selectedWrites.every(write => write.submitted === true);
9196
+ const freshlySent = submitted && selectedWrites.every(write => write.changed === true);
9197
+ if (commandAccepted && submitted && (freshlySent || continuity) && !this._sfTrackingOverlap
9198
+ && s.statusMatch === 'dispatch-key' && !s.licenseBlocked && s.dispatchAvailable && s.online
9199
+ && (commandFamily === 'signed' || completeSplit) && !splitPairConflict
9200
+ && [...selectedIds].every(id => this._sfTrackingLayout?.units.get(id) === 'W')
9201
+ && (!nwIsFeneconHybrid(s) || homeEssAc)) {
9202
+ const acceptedAt = freshlySent ? Date.now() : previous.acceptedAt;
9203
+ const acceptedSince = continuity ? previous.acceptedSince : acceptedAt;
9204
+ r.trackingCommand = { signedW: trackingSignedW, acceptedSince, acceptedAt };
9205
+ tracking.next.set(r.dispatchKey, { ...r.trackingCommand, binding, source: src, config: tracking.config });
9206
+ } else {
9207
+ this._sfPowerTracking?.delete(r.dispatchKey);
9208
+ }
9020
9209
  if (commandAccepted === true) this._sfRememberDispatchSnapshot(s, direction, alloc);
9021
9210
  results.push(r);
9022
9211
  }
@@ -9150,6 +9339,7 @@ class NexoWattVis extends HostedAdapter {
9150
9339
  commandRequired: r.commandRequired === true,
9151
9340
  commandAccepted: r.commandAccepted === true,
9152
9341
  acceptedW: Number.isFinite(Number(r.acceptedW)) ? Math.round(Number(r.acceptedW)) : 0,
9342
+ ...(r.trackingCommand ? { trackingCommand: r.trackingCommand } : {}),
9153
9343
  failedW: Number.isFinite(Number(r.failedW)) ? Math.round(Number(r.failedW)) : 0,
9154
9344
  stopAccepted: r.stopAccepted,
9155
9345
  authorityBlocked: authorityBlocks.length > 0,
@@ -9405,7 +9595,8 @@ class NexoWattVis extends HostedAdapter {
9405
9595
  }
9406
9596
  const name = (row && typeof row.name === 'string' && row.name.trim()) ? row.name.trim() : `Ladepunkt ${i+1}`;
9407
9597
  const note = (row && typeof row.note === 'string' && row.note.trim()) ? row.note.trim() : '';
9408
- const powerId = (row && typeof row.powerId === 'string' && row.powerId.trim()) ? row.powerId.trim() : '';
9598
+ const powerId = (typeof row?.powerId === 'string' ? row.powerId.trim() : '')
9599
+ || (typeof row?.actualPowerWId === 'string' ? row.actualPowerWId.trim() : '');
9409
9600
  const energyTotalId = (row && typeof row.energyTotalId === 'string' && row.energyTotalId.trim()) ? row.energyTotalId.trim() : '';
9410
9601
  // Interner EVCS-Energievertrag: energyTotalKwh ist immer kWh. Einige
9411
9602
  // Wallboxen bzw. der NexoWatt-Aliasvertrag liefern den kumulierten Zaehler
@@ -9513,6 +9704,15 @@ class NexoWattVis extends HostedAdapter {
9513
9704
  if (discovery) normalized.ocppDiscovery = discovery;
9514
9705
  }
9515
9706
  this.evcsList = evcsList;
9707
+ // Connectors can share one station-wide meter. Keep a slot with no meter
9708
+ // in the list so it cannot silently turn an incomplete sum into a measurement.
9709
+ const evcsPowerSources = new Set();
9710
+ this._nwEvcsPowerSumKeys = [];
9711
+ for (const wb of evcsList) {
9712
+ if (wb.powerId && evcsPowerSources.has(wb.powerId)) continue;
9713
+ if (wb.powerId) evcsPowerSources.add(wb.powerId);
9714
+ this._nwEvcsPowerSumKeys.push(`evcs.${wb.index}.powerW`);
9715
+ }
9516
9716
  // Stationsgruppen (für DC-Stationen mit mehreren Ladepunkten)
9517
9717
  const sgRaw = Array.isArray(cfg.stationGroups) ? cfg.stationGroups : [];
9518
9718
  const stationGroups = [];
@@ -9704,7 +9904,7 @@ class NexoWattVis extends HostedAdapter {
9704
9904
  const ts = (typeof state.ts === 'number' && Number.isFinite(state.ts))
9705
9905
  ? state.ts
9706
9906
  : ((typeof state.lc === 'number' && Number.isFinite(state.lc)) ? state.lc : null);
9707
- const normalized = this._nwScaleMappedValue(binding.key, configuredId, state.val);
9907
+ const normalized = this._nwScaleMappedValue(binding.key, configuredId, state.val, state.ack);
9708
9908
  const prev = (this.stateCache && this.stateCache[binding.key]) ? this.stateCache[binding.key] : null;
9709
9909
  const cacheChanged = !(prev && prev.ts === ts && Object.is(prev.value, normalized) && prev.q === state.q);
9710
9910
  if (cacheChanged) this.updateValue(binding.key, normalized, ts, { q: state.q });
@@ -12587,6 +12787,16 @@ async onReady() {
12587
12787
  try { await this.subscribeForeignStatesAsync(`${this.namespace}.chargingManagement.*`); } catch (_e) {}
12588
12788
  try { await this.subscribeForeignStatesAsync(`${this.namespace}.ems.*`); } catch (_e2) {}
12589
12789
 
12790
+ // The subscription is live before the reads. A delayed read must never
12791
+ // resurrect a state that was changed or deleted during startup.
12792
+ await Promise.all(Object.keys(this._nwDashboardHealth).map(async key => {
12793
+ const before = this._nwDashboardHealth[key];
12794
+ try {
12795
+ const state = await this.getStateAsync(key);
12796
+ if (before === this._nwDashboardHealth[key] && (state || before)) this._nwObserveDashboardHealth(key, state);
12797
+ } catch (_ignored) {}
12798
+ }));
12799
+
12590
12800
  // Prime a minimal subset that the UI uses on first render.
12591
12801
  /**
12592
12802
  * Code-Teil: primeKey
@@ -12597,8 +12807,9 @@ async onReady() {
12597
12807
  const primeKey = async (key) => {
12598
12808
  if (!key) return;
12599
12809
  try {
12810
+ const before = this.stateCache?.[key];
12600
12811
  const st = await this.getStateAsync(key);
12601
- if (st && st.val !== undefined) {
12812
+ if (before === this.stateCache?.[key] && st && st.val !== undefined) {
12602
12813
  this.updateValue(key, st.val, st.ts || Date.now());
12603
12814
  }
12604
12815
  } catch (_e) {
@@ -12940,10 +13151,32 @@ async onReady() {
12940
13151
 
12941
13152
  /** Öffentlichen State-/SSE-Snapshot erzeugen; operative Leistungswerte bleiben unverändert. */
12942
13153
  const nwBuildPublicStateSnapshot = (source, includeDerived = true) => {
12943
- const input = (source && typeof source === 'object') ? source : {};
13154
+ // Apply canonical diagnostics before the public privacy filter, also on backpressure resync.
13155
+ const input = includeDerived && this._nwFarmDisplay
13156
+ ? Object.assign({}, source, this._nwFarmDisplay) : (source || {});
12944
13157
  const out = {};
12945
13158
  for (const [key, entry] of Object.entries(input)) {
12946
13159
  if (nwPublicStateKeyBlocked(key)) continue;
13160
+ if (key === 'speicher.regelung.dispatcherJson') {
13161
+ // Die Farmseite benötigt nur die Reglerentscheidung. Hersteller- und
13162
+ // Prüfdaten des internen Dispatchers gehören nicht in den Kundenfeed.
13163
+ let publicDecision = null;
13164
+ if (entry && typeof entry.value === 'string' && entry.value.length <= 262144) {
13165
+ try {
13166
+ const data = JSON.parse(entry.value);
13167
+ if (data && Number.isFinite(data.ts) && typeof data.active === 'boolean') {
13168
+ publicDecision = JSON.stringify({
13169
+ ts: data.ts, active: data.active, disabled: data.disabled === true,
13170
+ finalW: Number.isFinite(data.finalW) ? data.finalW : null,
13171
+ src: typeof data.src === 'string' ? data.src.slice(0, 180) : '',
13172
+ reason: typeof data.reason === 'string' ? data.reason.slice(0, 260) : '',
13173
+ });
13174
+ }
13175
+ } catch (_) { /* Ungültige Meldung ersetzt den vorherigen Kundenwert. */ }
13176
+ }
13177
+ out[key] = { value: publicDecision, ts: entry?.ts, q: entry?.q, ack: entry?.ack };
13178
+ continue;
13179
+ }
12947
13180
  if (entry && typeof entry === 'object' && Object.prototype.hasOwnProperty.call(entry, 'value')) {
12948
13181
  out[key] = Object.assign({}, entry, { value: nwRedactPublicValue(entry.value) });
12949
13182
  } else {
@@ -16294,6 +16527,43 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
16294
16527
  // Persist (state-based) + apply to runtime config.
16295
16528
  // We merge into the already persisted patch (loaded on startup) to keep full configuration.
16296
16529
  const basePatch = (this._nwInstallerConfigPatch && typeof this._nwInstallerConfigPatch === 'object') ? this._nwInstallerConfigPatch : {};
16530
+ // A reduced license limits the active runtime. Never trim the persisted
16531
+ // station list when another installer setting is saved. Explicit point
16532
+ // edits may retain previously configured rows beyond the current limit.
16533
+ const pointEdit = safePatch.settingsConfig;
16534
+ if (pointEdit && (Object.hasOwn(pointEdit, 'evcsList') || Object.hasOwn(pointEdit, 'evcsCount'))) {
16535
+ const prior = this.nwApplyInstallerPatchToRuntimeConfig(this.config || {}, basePatch).settingsConfig || {};
16536
+ const priorRows = Array.isArray(prior.evcsList) ? prior.evcsList : [];
16537
+ const rows = Object.hasOwn(pointEdit, 'evcsList') ? pointEdit.evcsList : priorRows;
16538
+ const rawCount = Object.hasOwn(pointEdit, 'evcsCount') ? pointEdit.evcsCount : rows?.length;
16539
+ const count = typeof rawCount === 'number' || (typeof rawCount === 'string' && /^\d+$/.test(rawCount)) ? Number(rawCount) : NaN;
16540
+ if (!Array.isArray(rows) || !Number.isSafeInteger(count) || count < 0 || count > 50 || rows.length > 50) {
16541
+ return res.status(400).json({ ok: false, error: 'evcs_layout_invalid' });
16542
+ }
16543
+ const max = this._nwLicenseMaxWallboxes();
16544
+ const previousCount = configuredChargingPointRows(prior).length;
16545
+ const retained = rows.slice(0, count);
16546
+ const previous = priorRows.slice();
16547
+ if (count > max) {
16548
+ if (count > previousCount) return res.status(400).json({ ok: false, error: 'evcs_license_limit' });
16549
+ for (const row of retained.slice(max)) {
16550
+ const index = previous.findIndex(old => isDeepStrictEqual(old, row));
16551
+ if (index < 0) return res.status(400).json({ ok: false, error: 'evcs_license_limit' });
16552
+ previous.splice(index, 1);
16553
+ }
16554
+ }
16555
+ safePatch.settingsConfig = { ...pointEdit, evcsCount: count, evcsList: retained };
16556
+ const groups = pointEdit.stationGroups ?? prior.stationGroups;
16557
+ if (count < previousCount && Array.isArray(groups)) {
16558
+ safePatch.settingsConfig.stationGroups = groups.map(group => {
16559
+ const copy = { ...group };
16560
+ for (const key of ['members', 'connectors']) {
16561
+ if (Array.isArray(copy[key])) copy[key] = copy[key].filter(n => Number(n) >= 1 && Number(n) <= count);
16562
+ }
16563
+ return copy;
16564
+ });
16565
+ }
16566
+ }
16297
16567
  if (safePatch.tariffProvider && typeof safePatch.tariffProvider === 'object') {
16298
16568
  safePatch.tariffProvider = _nwMergeTariffProviderSecrets(safePatch.tariffProvider, basePatch.tariffProvider);
16299
16569
  }
@@ -24528,7 +24798,8 @@ settingsConfig: {
24528
24798
  const source = tsStates || this.stateCache;
24529
24799
  const access = authEnabled ? await resolveAccess(req) : null;
24530
24800
  const installerAccess = !!(authEnabled && access && access.isInstaller);
24531
- return res.json(installerAccess ? source : nwBuildPublicStateSnapshot(source, true));
24801
+ const visible = installerAccess ? source : nwBuildPublicStateSnapshot(source, true);
24802
+ return res.json(Object.assign(installerAccess ? { ...visible, ...this._nwFarmDisplay } : visible, this._nwDashboardHealth));
24532
24803
  });
24533
24804
 
24534
24805
  // RFID-Kundendaten liegen bewusst nicht mehr im globalen State-/SSE-Snapshot.
@@ -26695,7 +26966,7 @@ return res.json(out);
26695
26966
  const initialPayload = client.internal ? this.stateCache : nwBuildPublicStateSnapshot(this.stateCache, true);
26696
26967
  this._nwSseGuard.write(
26697
26968
  client,
26698
- "retry: 3000\n" + "data: " + JSON.stringify({ type: 'init', payload: initialPayload }) + "\n\n",
26969
+ "retry: 3000\n" + "data: " + JSON.stringify({ type: 'init', payload: Object.assign(client.internal ? { ...initialPayload, ...this._nwFarmDisplay } : initialPayload, this._nwDashboardHealth) }) + "\n\n",
26699
26970
  { kind: 'init' },
26700
26971
  );
26701
26972
  });
@@ -26946,7 +27217,8 @@ return res.json(out);
26946
27217
  * Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
26947
27218
  * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
26948
27219
  */
26949
- _nwScaleMappedValue(key, objectId, val) {
27220
+ _nwScaleMappedValue(key, objectId, val, ack) {
27221
+ if (ack === false && (key === 'consumptionEvcs' || /^evcs\.\d+\.powerW$/.test(key))) return null;
26950
27222
  // EVCS-Energie wird intern immer in kWh gefuehrt. Die Umrechnung ist
26951
27223
  // bewusst pro Ladepunkt konfigurierbar, weil Hersteller sowohl Wh- als auch
26952
27224
  // kWh-Zaehler ausgeben. Leistung (W/kW) und Energie (Wh/kWh) werden nicht
@@ -27209,7 +27481,7 @@ return res.json(out);
27209
27481
  const keys = Array.isArray(entry.keys) ? entry.keys : [];
27210
27482
  for (const key of keys) {
27211
27483
  if (!key || handledEvcsKeys.has(key)) continue;
27212
- const scaled = this._nwScaleMappedValue(key, entry.id, st.val);
27484
+ const scaled = this._nwScaleMappedValue(key, entry.id, st.val, st.ack);
27213
27485
  const prev = (this.stateCache && this.stateCache[key]) ? this.stateCache[key] : null;
27214
27486
  const sameScaled = !!(prev && prev.ts === ts && Object.is(prev.value, scaled) && prev.q === st.q);
27215
27487
  if (sameScaled) continue;
@@ -27423,7 +27695,7 @@ return res.json(out);
27423
27695
  // "Datenpunkte" gemappt wurden. Daher wird im Subscribe-Loop unten auf die lokalen
27424
27696
  // Adapter-States (namespace + key) zurückgefallen.
27425
27697
  const localUiKeys = [
27426
- 'speicher.dcPvPowerW',
27698
+ 'speicher.dcPvPowerW', 'speicher.regelung.dispatcherJson',
27427
27699
  'tarif.statusText', 'tarif.intentStatusText', 'tarif.intentSnapshotAgeMs', 'tarif.intentSnapshotFresh', 'tarif.statusJson',
27428
27700
  'tarif.speicherIntentW', 'tarif.speicherIntentStatus', 'tarif.speicherIntentGrund',
27429
27701
  'tarif.speicherRequestW', 'tarif.speicherRequestQuelle', 'tarif.speicherRequestGrund',
@@ -27483,15 +27755,22 @@ return res.json(out);
27483
27755
 
27484
27756
  if (!id) continue;
27485
27757
 
27486
- // subscribe
27487
- this.subscribeForeignStates(id);
27758
+ const farmDisplay = this._nwIsFarmDisplayKey(key) && id === namespace + key;
27759
+ const before = farmDisplay ? this._nwFarmDisplay?.[key] : undefined;
27760
+ if (farmDisplay && typeof this.subscribeForeignStatesAsync === 'function') {
27761
+ try { await this.subscribeForeignStatesAsync(id); }
27762
+ catch (error) { this.log.warn(`Live-Diagnose ${key} konnte nicht abonniert werden: ${error.message}`); }
27763
+ } else this.subscribeForeignStates(id);
27488
27764
 
27489
27765
  // get initial value
27490
27766
  try {
27491
27767
  await this._nwPrimeForeignPowerScale(id);
27492
27768
  const state = await this.getForeignStateAsync(id);
27769
+ if (farmDisplay && before === this._nwFarmDisplay?.[key] && (state || before)) {
27770
+ this._nwObserveFarmDisplay(key, state);
27771
+ }
27493
27772
  if (state && state.val !== undefined) {
27494
- this.updateValue(key, this._nwScaleMappedValue(key, id, state.val), state.ts, { q: state.q });
27773
+ this.updateValue(key, this._nwScaleMappedValue(key, id, state.val, state.ack), state.ts, { q: state.q });
27495
27774
  }
27496
27775
  } catch (e) {
27497
27776
  this.log.warn(`Cannot read initial state for ${key} (${id}): ${e.message}`);
@@ -27522,7 +27801,7 @@ return res.json(out);
27522
27801
  await this._nwPrimeForeignPowerScale(id);
27523
27802
  const st = await this.getForeignStateAsync(id);
27524
27803
  if (st && st.val !== undefined) {
27525
- this.updateValue(slot.stateKey, this._nwScaleMappedValue(slot.stateKey, id, st.val), st.ts, { q: st.q });
27804
+ this.updateValue(slot.stateKey, this._nwScaleMappedValue(slot.stateKey, id, st.val, st.ack), st.ts, { q: st.q });
27526
27805
  }
27527
27806
  } catch (e) {
27528
27807
  this.log.warn(`Cannot read initial flow slot state for ${slot.stateKey} (${id}): ${e.message}`);
@@ -27609,6 +27888,11 @@ return res.json(out);
27609
27888
  async onStateChange(id, state) {
27610
27889
  if (this._nwShuttingDown) return;
27611
27890
  this._ocppAutoDiscovery?.onStateChange(id, state);
27891
+ if (typeof id === 'string' && id.startsWith(this.namespace + '.')) {
27892
+ const key = id.slice(this.namespace.length + 1);
27893
+ if (Object.hasOwn(this._nwDashboardHealth || {}, key)) this._nwObserveDashboardHealth(key, state);
27894
+ else if (this._nwIsFarmDisplayKey(key)) this._nwObserveFarmDisplay(key, state);
27895
+ }
27612
27896
  if (state && state.ack === false && String(id).startsWith(this.namespace + '.')
27613
27897
  && !centralLicenseSnapshot(this._bridge).ok) return;
27614
27898
  // Ordinary ioBroker controls remain usable without a separate token or
@@ -27663,7 +27947,7 @@ return res.json(out);
27663
27947
  && this._nwIsReadOnlyEvcsMirrorKey(key));
27664
27948
  let normalizedMappedValue = state.val;
27665
27949
  if (key && !evcsMappedAlreadyHandled && !ownReadOnlyEvcsMirrorAck) {
27666
- normalizedMappedValue = this._nwScaleMappedValue(key, id, state.val);
27950
+ normalizedMappedValue = this._nwScaleMappedValue(key, id, state.val, state.ack);
27667
27951
  this.updateValue(key, normalizedMappedValue, state.ts, { q: state.q });
27668
27952
 
27669
27953
  // Bedienzustände der Ladepunkte werden sofort im stateCache sichtbar und
@@ -31259,8 +31543,9 @@ return res.json(out);
31259
31543
  : (selectedStorageTopologyHist === 'single'
31260
31544
  ? readHistory('storageSoc')
31261
31545
  : null);
31262
- const evW = readHistory('evcs.totalPowerW');
31263
- const historyEvAbsent = Number(this.evcsCount) === 0 && !String(historyDps.consumptionEvcs || '').trim();
31546
+ const historyEvMapped = !!String(historyDps.consumptionEvcs || '').trim();
31547
+ const evW = (historyEvMapped ? readHistory('consumptionEvcs') : null) ?? readHistory('evcs.totalPowerW');
31548
+ const historyEvAbsent = Number(this.evcsCount) === 0 && !historyEvMapped;
31264
31549
 
31265
31550
  const gridBuy = hasGrid === true && Number.isFinite(gridBuyW) ? Math.max(0, gridBuyW) : null;
31266
31551
  const gridSell = hasGrid === true && Number.isFinite(gridSellW) ? Math.max(0, gridSellW) : null;
@@ -32167,7 +32452,9 @@ return res.json(out);
32167
32452
  }
32168
32453
  const now = Date.now();
32169
32454
  const cached = this._nwPara14aInfluxProvision;
32170
- if (!force && cached && cached.result && (now - Number(cached.ts || 0) < 10 * 60 * 1000)) {
32455
+ const configured = this._nwTrimId(this.config && this.config.history && this.config.history.instance);
32456
+ const retainedHistorian = configured && this.namespace !== this.hostNamespace && /^nexowatt-ui\.\d+$/.test(this.namespace);
32457
+ if (!retainedHistorian && !force && cached && cached.result && (now - Number(cached.ts || 0) < 10 * 60 * 1000)) {
32171
32458
  return cached.result;
32172
32459
  }
32173
32460
 
@@ -32187,7 +32474,7 @@ return res.json(out);
32187
32474
  provisionError: '',
32188
32475
  }, partial || {});
32189
32476
  out.instance = this._nwTrimId(out.instance);
32190
- out.ready = !!out.instance && typeof this._nwEnsureInfluxCustom === 'function';
32477
+ out.ready = partial.ready !== false && !!out.instance && typeof this._nwEnsureInfluxCustom === 'function';
32191
32478
  this._nwPara14aInfluxProvision = { ts: Date.now(), result: out };
32192
32479
  return out;
32193
32480
  };
@@ -32243,7 +32530,14 @@ return res.json(out);
32243
32530
  };
32244
32531
 
32245
32532
  try {
32246
- const configured = this._nwTrimId(this.config && this.config.history && this.config.history.instance);
32533
+ if (retainedHistorian) {
32534
+ // Der Bestand bleibt auch bei Lesefehlern an seinem gespeicherten Historiker.
32535
+ // Eine benachbarte Influx-Instanz kann eine andere Datenbank bedienen.
32536
+ const object = await this.getForeignObjectAsync(`system.adapter.${configured}`).catch(() => null);
32537
+ const available = object?.type === 'instance' && object.common?.enabled === true;
32538
+ return finish({ instance: configured, ready: available, provisionState: available ? 'shared_configured' : 'configured_unavailable',
32539
+ provisionError: available ? '' : `Übernommene History-Instanz ist nicht verfügbar: ${configured}` });
32540
+ }
32247
32541
  const existingInfluxInstances = await this._nwListAdapterInstances('influxdb');
32248
32542
  const sharedInflux = pickSharedInfluxInstance(existingInfluxInstances);
32249
32543
 
@@ -32992,8 +33286,9 @@ return res.json(out);
32992
33286
  if (!this._derivedFlow.last) this._derivedFlow.last = {};
32993
33287
 
32994
33288
  const restTimes = [];
32995
- const evAbsent = Number(this.evcsCount) === 0 && !this._nwHasMappedDatapoint('consumptionEvcs');
32996
- const evRaw = this._nwHasMappedDatapoint('consumptionEvcs') ? readLive('consumptionEvcs', restTimes) : readLive('evcs.totalPowerW', restTimes);
33289
+ const evMapped = this._nwHasMappedDatapoint('consumptionEvcs');
33290
+ const evAbsent = Number(this.evcsCount) === 0 && !evMapped;
33291
+ const evRaw = (evMapped ? readLive('consumptionEvcs', restTimes) : null) ?? readLive('evcs.totalPowerW', restTimes);
32997
33292
  const evW = evRaw !== null ? Math.abs(evRaw) : (evAbsent ? 0 : null);
32998
33293
  let consumersW = 0;
32999
33294
  let consumersObserved = true;
@@ -34310,6 +34605,49 @@ return res.json(out);
34310
34605
  }
34311
34606
  }
34312
34607
  }
34608
+ _nwIsFarmDisplayKey(key) {
34609
+ return key === 'storageFarm.storagesStatusJson' || key === 'storageFarm.lastDispatchJson'
34610
+ || key === 'storageFarm.overviewJson' || key === 'speicher.regelung.dispatcherJson';
34611
+ }
34612
+
34613
+ _nwObserveFarmDisplay(key, state) {
34614
+ // Preserve the source's observation across separate EMS and UI processes.
34615
+ // The regular control and history caches retain their existing semantics.
34616
+ const value = typeof state?.val === 'string' && state.val.length <= 262144 ? state.val : null;
34617
+ const ts = Number.isSafeInteger(state?.ts) && state.ts > 0 ? state.ts : 0;
34618
+ const q = state?.q === undefined ? undefined : Number.isSafeInteger(state.q) ? state.q : 128;
34619
+ const row = { value, ts, ack: state?.ack === true, ...(q === undefined ? {} : { q }) };
34620
+ this._nwFarmDisplay ??= Object.create(null);
34621
+ this._nwFarmDisplay[key] = row;
34622
+ this._nwSseSnapshotChunkCache = null;
34623
+ if (!this.sseClients?.size) return;
34624
+ (this._ssePendingPayload ??= Object.create(null))[key] = row;
34625
+ this._nwScheduleSseFlush();
34626
+ }
34627
+
34628
+ _nwObserveDashboardHealth(key, state) {
34629
+ const heartbeat = key === 'ems.core.schedulerHeartbeatAt';
34630
+ const raw = state?.val;
34631
+ const value = (heartbeat ? Number.isSafeInteger(raw) && raw > 0 : typeof raw === 'boolean') ? raw : null;
34632
+ const ts = Number.isSafeInteger(state?.ts) && state.ts > 0 ? state.ts : 0;
34633
+ const ack = state?.ack === true;
34634
+ const q = state?.q === undefined ? undefined : Number.isSafeInteger(state.q) ? state.q : 128;
34635
+ const row = { value, ts, ack, ...(q === undefined ? {} : { q }) };
34636
+ this._nwDashboardHealth[key] = row;
34637
+ this._nwSseSnapshotChunkCache = null;
34638
+ // No timers, serialization or broadcasts for an idle dashboard. Repeated
34639
+ // confirmations share the existing SSE batch; faults and recovery go at once.
34640
+ if (!this.sseClients?.size) return;
34641
+ const sent = this._nwDashboardHealthSent[key];
34642
+ const regularHeartbeat = heartbeat && value > 0 && sent?.value > 0 && value >= sent.value
34643
+ && Math.abs(value - ts) < 4000 && Math.abs(sent.value - sent.ts) < 4000;
34644
+ if (sent && sent.ack === ack && sent.q === q && (sent.value === value || regularHeartbeat)
34645
+ && ts >= sent.ts && ts - sent.ts < 4000) return;
34646
+ this._nwDashboardHealthSent[key] = row;
34647
+ (this._ssePendingPayload ??= Object.create(null))[key] = row;
34648
+ this._nwScheduleSseFlush();
34649
+ }
34650
+
34313
34651
  updateValue(key, value, ts, opts = {}) {
34314
34652
  // Nach Beginn des Unloads keine Cache-Kaskaden, abgeleiteten Berechnungen oder
34315
34653
  // SSE-Batches mehr erzeugen. Laufende Hardware-/State-Schreibvorgänge werden durch
@@ -34339,16 +34677,23 @@ return res.json(out);
34339
34677
 
34340
34678
  this.stateCache[key] = { value, ts, ...(opts.q !== undefined ? { q: opts.q } : {}) };
34341
34679
 
34680
+ // The admin overview periodically normalizes scheduler rows for its own cache.
34681
+ // Only the original producer observation may reach dashboard clients.
34682
+ if (this._nwDashboardHealth && Object.hasOwn(this._nwDashboardHealth, key)) return;
34683
+ // A synthetic local refresh must not replace the producer's ack/q/ts in the
34684
+ // outgoing batch. Other calculations below still see their original cache value.
34685
+ const authoritativeFarmRow = this._nwFarmDisplay?.[key];
34686
+
34342
34687
  // Allocate one patch per delivery batch, and none while no dashboard is listening.
34343
34688
  const payload = this.sseClients?.size ? (this._ssePendingPayload ??= Object.create(null)) : null;
34344
- if (payload) payload[key] = this.stateCache[key];
34689
+ if (payload) payload[key] = authoritativeFarmRow || this.stateCache[key];
34345
34690
 
34346
34691
  // derived EVCS aggregates
34347
34692
  try {
34348
34693
  if (/^evcs\.\d+\.powerW$/.test(key)) {
34349
34694
  const count = Math.max(0, Math.round(Number(this.evcsCount || 0) || 0));
34350
34695
  const maxAgeMs = this._nwLiveInputMaxAgeMs();
34351
- const keys = Array.from({ length: Math.min(count, 1024) }, (_, index) => `evcs.${index + 1}.powerW`);
34696
+ const keys = this._nwEvcsPowerSumKeys ?? Array.from({ length: Math.min(count, 1024) }, (_, index) => `evcs.${index + 1}.powerW`);
34352
34697
  const observation = sumFlowMeasurements(this.stateCache, keys, Date.now(), maxAgeMs);
34353
34698
  const aggregate = observation || { value: null, ts: Date.now() };
34354
34699
  this.stateCache['evcs.totalPowerW'] = aggregate;
@@ -34400,15 +34745,16 @@ return res.json(out);
34400
34745
  if (isTrigger) this.scheduleDerivedFlowUpdate(`key:${key}`);
34401
34746
  } catch (_e3) {}
34402
34747
 
34403
- // push update to all SSE clients (batched to avoid UI freezes)
34748
+ // RC88_SSE_IDLE_ZERO_ALLOCATION: only schedule a batch for active dashboards.
34749
+ if (!payload) {
34750
+ this._ssePendingPayload = null;
34751
+ return;
34752
+ }
34753
+ this._nwScheduleSseFlush();
34754
+ }
34755
+
34756
+ _nwScheduleSseFlush() {
34404
34757
  try {
34405
- // RC88_SSE_IDLE_ZERO_ALLOCATION: without connected dashboards there is
34406
- // nothing to batch or serialize. Avoid a permanent 120-ms timer/allocation
34407
- // chain on headless customer systems.
34408
- if (!payload) {
34409
- this._ssePendingPayload = null;
34410
- return;
34411
- }
34412
34758
  if (!this._sseFlushTimer) {
34413
34759
  const batchMs = (this.config && Number(this.config.sseBatchMs)) || 120;
34414
34760
  this._sseFlushTimer = this._nwSetTimeout(() => {