iobroker.eos-admin 9.0.31 → 9.0.34

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 (242) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +10 -11
  2. package/README.md +7 -7
  3. package/adminWww/.vite/manifest.json +233 -224
  4. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13897 -13887
  5. package/adminWww/assets/AccessTime-CuR73YC3.js +1 -0
  6. package/adminWww/assets/{AdapterUpdateDialog-UhaQHyF1.js → AdapterUpdateDialog-5L75o18m.js} +5 -5
  7. package/adminWww/assets/{Adapters-Di3sM_ky.js → Adapters-FcghjF7E.js} +5 -5
  8. package/adminWww/assets/ConfigManager-BnHarBfH.js +1 -0
  9. package/adminWww/assets/Enums-BjLbLLQL.js +92 -0
  10. package/adminWww/assets/Fields-DDE1hVOa.js +1 -0
  11. package/adminWww/assets/Files-CDjnR4q6.js +1 -0
  12. package/adminWww/assets/{Hosts-DXjTE0pX.js → Hosts-CJKQaNrD.js} +6 -6
  13. package/adminWww/assets/Instances-DZNl369k.js +4 -0
  14. package/adminWww/assets/Intro-CjAmMGDB.js +2 -0
  15. package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +1 -0
  16. package/adminWww/assets/{Logs-DTo6XJF_.js → Logs-rUAV7SwM.js} +2 -2
  17. package/adminWww/assets/MoreHoriz-CS7nODK8.js +1 -0
  18. package/adminWww/assets/{Objects-DyEBMDK6.js → Objects-CqOH6rT_.js} +4 -4
  19. package/adminWww/assets/Overview-BOtXqsMy.js +3 -0
  20. package/adminWww/assets/Pageview-wzrLQZ-j.js +1 -0
  21. package/adminWww/assets/PersonOff-YtHcY0sV.js +1 -0
  22. package/adminWww/assets/Star-D8VNXawT.js +1 -0
  23. package/adminWww/assets/State-C8ncThop.js +1 -0
  24. package/adminWww/assets/UsedResources-lUYJqy4F.js +2 -0
  25. package/adminWww/assets/Users-CK1Cax82.js +1 -0
  26. package/adminWww/assets/ViewCompact-D7bHgn99.js +1 -0
  27. package/adminWww/assets/ViewSidebar-CjClbCI5.js +1 -0
  28. package/adminWww/assets/WifiTethering-DJ9VO12W.js +1 -0
  29. package/adminWww/assets/{bootstrap-BQ4OzwbT.js → bootstrap-CC0Qr-kr.js} +25 -25
  30. package/adminWww/assets/date-fns-BtR4dG_j.js +1 -0
  31. package/adminWww/assets/en-US-BjjaEI6N.js +1 -0
  32. package/adminWww/assets/{hostInit-CGSSNegd.js → hostInit-DqGL6nY8.js} +1 -1
  33. package/adminWww/assets/icons-material-07rWS63O.js +1 -0
  34. package/adminWww/assets/{index-C4CShixx.js → index-BhhkToP2.js} +2 -2
  35. package/adminWww/assets/{installSVGRenderer-DeaOAT3W.js → installSVGRenderer-B4-7lSQZ.js} +1 -1
  36. package/adminWww/assets/isSameWeek-WMSJR5Qs.js +1 -0
  37. package/adminWww/assets/locale-DN6Bdkdt.js +1 -0
  38. package/adminWww/assets/{mf-entry-bootstrap-0-c5733c2d.js → mf-entry-bootstrap-0-1afd2287.js} +2 -2
  39. package/adminWww/assets/sentry-CPzCHrwe.js +1 -0
  40. package/adminWww/assets/setYear-DDSuW45e.js +1 -0
  41. package/adminWww/index.html +23 -23
  42. package/adminWww/mf-manifest.json +1 -1
  43. package/adminWww/mf-stats.json +1 -1
  44. package/adminWww/{remoteEntry-eos-9.0.31.js → remoteEntry-eos-9.0.34.js} +1 -1
  45. package/adminWww/remoteEntry.js +1 -1
  46. package/build/lib/eosDeviceEmsPlan.js +285 -9
  47. package/build/lib/eosDeviceEmsPlan.js.map +1 -1
  48. package/build/lib/eosDeviceEmsService.js +29 -2
  49. package/build/lib/eosDeviceEmsService.js.map +1 -1
  50. package/build/lib/eosUiProcess.js +31 -14
  51. package/build/lib/eosUiProcess.js.map +1 -1
  52. package/build/lib/eosUiProcessRpc.js +3 -1
  53. package/build/lib/eosUiProcessRpc.js.map +1 -1
  54. package/build/lib/eosUiProcessWorker.js +6 -4
  55. package/build/lib/eosUiProcessWorker.js.map +1 -1
  56. package/docs/README.md +3 -2
  57. package/docs/reports/unified-9.0.32/PRUEFBERICHT.md +34 -0
  58. package/docs/reports/unified-9.0.32/PRUEFERGEBNISSE.json +112 -0
  59. package/docs/reports/unified-9.0.32/raw/INDEX.json +102 -0
  60. package/docs/reports/unified-9.0.32/raw/backend.log +5 -0
  61. package/docs/reports/unified-9.0.32/raw/browser-cadence-headless.json +63 -0
  62. package/docs/reports/unified-9.0.32/raw/browser-flow-headless.json +328 -0
  63. package/docs/reports/unified-9.0.32/raw/focused.log +67 -0
  64. package/docs/reports/unified-9.0.32/raw/frontend.log +151 -0
  65. package/docs/reports/unified-9.0.32/raw/installer.log +26 -0
  66. package/docs/reports/unified-9.0.32/raw/lint.log +5 -0
  67. package/docs/reports/unified-9.0.32/raw/modules.log +5 -0
  68. package/docs/reports/unified-9.0.32/raw/node22-tests-final.log +17212 -0
  69. package/docs/reports/unified-9.0.32/raw/node22-version.log +1 -0
  70. package/docs/reports/unified-9.0.32/raw/node24-tests-final.log +2869 -0
  71. package/docs/reports/unified-9.0.32/raw/node24-version.log +1 -0
  72. package/docs/reports/unified-9.0.32/raw/sbom.log +2 -0
  73. package/docs/reports/unified-9.0.32/raw/typecheck.log +5 -0
  74. package/docs/reports/unified-9.0.32/raw/ui-runtime.log +8 -0
  75. package/docs/reports/unified-9.0.32/raw/version-parity-928-929.log +6 -0
  76. package/docs/reports/unified-9.0.33/PRUEFBERICHT.md +60 -0
  77. package/docs/reports/unified-9.0.33/PRUEFERGEBNISSE.json +112 -0
  78. package/docs/reports/unified-9.0.33/raw/INDEX.json +272 -0
  79. package/docs/reports/unified-9.0.33/raw/backend.log +5 -0
  80. package/docs/reports/unified-9.0.33/raw/browser/UI_REVIEW.json +147 -0
  81. package/docs/reports/unified-9.0.33/raw/browser/admin-bundle.log +136 -0
  82. package/docs/reports/unified-9.0.33/raw/browser/eos-backup-settings-browser.log +67 -0
  83. package/docs/reports/unified-9.0.33/raw/browser/eos-customer-tariff-startup-browser.log +43 -0
  84. package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-browser-smoke.log +438 -0
  85. package/docs/reports/unified-9.0.33/raw/browser/eos-energyflow-cadence-browser-10s.log +108 -0
  86. package/docs/reports/unified-9.0.33/raw/browser/eos-evcs-delete-browser.log +1 -0
  87. package/docs/reports/unified-9.0.33/raw/browser/eos-history-setup-browser-smoke.log +49 -0
  88. package/docs/reports/unified-9.0.33/raw/browser/eos-kiosk-browser.log +59 -0
  89. package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-admin-browser.log +71 -0
  90. package/docs/reports/unified-9.0.33/raw/browser/eos-ocpp-installer-discovery-browser.log +11 -0
  91. package/docs/reports/unified-9.0.33/raw/browser/eos-pwa-trust-browser.log +35 -0
  92. package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-controls-browser.log +78 -0
  93. package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-health-browser.log +49 -0
  94. package/docs/reports/unified-9.0.33/raw/browser/eos-runtime-login-browser.log +34 -0
  95. package/docs/reports/unified-9.0.33/raw/browser/smarthome.log +46 -0
  96. package/docs/reports/unified-9.0.33/raw/browser-ten-seconds.json +108 -0
  97. package/docs/reports/unified-9.0.33/raw/changed-test-coverage.json +116 -0
  98. package/docs/reports/unified-9.0.33/raw/connected-control-node22.jsonl +42 -0
  99. package/docs/reports/unified-9.0.33/raw/connected-control-summary-node22.json +103 -0
  100. package/docs/reports/unified-9.0.33/raw/connected-control-summary.json +103 -0
  101. package/docs/reports/unified-9.0.33/raw/connected-control.jsonl +42 -0
  102. package/docs/reports/unified-9.0.33/raw/display-ui-node22.log +162 -0
  103. package/docs/reports/unified-9.0.33/raw/display-ui.log +35 -0
  104. package/docs/reports/unified-9.0.33/raw/frontend.log +151 -0
  105. package/docs/reports/unified-9.0.33/raw/git-delivery-fix.log +10 -0
  106. package/docs/reports/unified-9.0.33/raw/installer.log +26 -0
  107. package/docs/reports/unified-9.0.33/raw/license-central-node24.log +173 -0
  108. package/docs/reports/unified-9.0.33/raw/lint-final.log +45 -0
  109. package/docs/reports/unified-9.0.33/raw/modules.log +5 -0
  110. package/docs/reports/unified-9.0.33/raw/node22-npm-version.log +1 -0
  111. package/docs/reports/unified-9.0.33/raw/node22-tests-final.log +17646 -0
  112. package/docs/reports/unified-9.0.33/raw/node22-version.log +1 -0
  113. package/docs/reports/unified-9.0.33/raw/node24-npm-version.log +1 -0
  114. package/docs/reports/unified-9.0.33/raw/node24-tests-final.log +2941 -0
  115. package/docs/reports/unified-9.0.33/raw/node24-version.log +1 -0
  116. package/docs/reports/unified-9.0.33/raw/process-final-node22.log +220 -0
  117. package/docs/reports/unified-9.0.33/raw/process-final-node24.log +110 -0
  118. package/docs/reports/unified-9.0.33/raw/ram-picker.jsonl +12 -0
  119. package/docs/reports/unified-9.0.33/raw/reg-combined-node22.log +622 -0
  120. package/docs/reports/unified-9.0.33/raw/reg-combined.log +108 -0
  121. package/docs/reports/unified-9.0.33/raw/sbom-final.log +8 -0
  122. package/docs/reports/unified-9.0.33/raw/tariff-update-all-final-node22.log +1185 -0
  123. package/docs/reports/unified-9.0.33/raw/typecheck-final.log +5 -0
  124. package/docs/reports/unified-9.0.33/raw/ui-functional-node24.log +430 -0
  125. package/docs/reports/unified-9.0.33/raw/ui-runtime-final-verification.log +1 -0
  126. package/docs/reports/unified-9.0.33/raw/update-controller-standard-7-2-5.log +4 -0
  127. package/docs/reports/unified-9.0.33/raw/worker-memory-eos933.log +12 -0
  128. package/docs/reports/unified-9.0.33/raw/worker-memory-flow932.log +12 -0
  129. package/docs/reports/unified-9.0.34/PRUEFBERICHT.md +40 -0
  130. package/docs/reports/unified-9.0.34/PRUEFERGEBNISSE.json +112 -0
  131. package/docs/reports/unified-9.0.34/raw/INDEX.json +137 -0
  132. package/docs/reports/unified-9.0.34/raw/backend.log +5 -0
  133. package/docs/reports/unified-9.0.34/raw/dashboard-interval.json +108 -0
  134. package/docs/reports/unified-9.0.34/raw/fixtures-verification.log +44 -0
  135. package/docs/reports/unified-9.0.34/raw/frontend.log +152 -0
  136. package/docs/reports/unified-9.0.34/raw/installer.log +26 -0
  137. package/docs/reports/unified-9.0.34/raw/lint.log +45 -0
  138. package/docs/reports/unified-9.0.34/raw/mira-dashboard-browser.json +1 -0
  139. package/docs/reports/unified-9.0.34/raw/mira-devices-browser.log +9 -0
  140. package/docs/reports/unified-9.0.34/raw/mira-memory-process.json +379 -0
  141. package/docs/reports/unified-9.0.34/raw/modules.log +5 -0
  142. package/docs/reports/unified-9.0.34/raw/node22-mira.log +216 -0
  143. package/docs/reports/unified-9.0.34/raw/node22-protocol-to-ems.log +8 -0
  144. package/docs/reports/unified-9.0.34/raw/node22-tests-final.log +17850 -0
  145. package/docs/reports/unified-9.0.34/raw/node22-version.log +1 -0
  146. package/docs/reports/unified-9.0.34/raw/node24-mira.log +40 -0
  147. package/docs/reports/unified-9.0.34/raw/node24-protocol-to-ems.log +6 -0
  148. package/docs/reports/unified-9.0.34/raw/node24-tests-final.log +2973 -0
  149. package/docs/reports/unified-9.0.34/raw/node24-version.log +1 -0
  150. package/docs/reports/unified-9.0.34/raw/protocol-to-ems.cjs +364 -0
  151. package/docs/reports/unified-9.0.34/raw/release-metadata.log +13 -0
  152. package/docs/reports/unified-9.0.34/raw/sbom.log +8 -0
  153. package/docs/reports/unified-9.0.34/raw/typecheck.log +5 -0
  154. package/docs/reports/unified-9.0.34/raw/ui-runtime.log +8 -0
  155. package/docs/start/START_HIER_9.0.32.md +16 -0
  156. package/docs/start/START_HIER_9.0.33.md +32 -0
  157. package/docs/start/START_HIER_9.0.34.md +25 -0
  158. package/io-package.json +16 -16
  159. package/modules/devices/admin/alias-contract-v1.json +22 -0
  160. package/modules/devices/admin/ems-assignment.js +6 -1
  161. package/modules/devices/admin/host-bridge.js +2 -0
  162. package/modules/devices/admin/index.html +16 -0
  163. package/modules/devices/admin/index_m.js +168 -9
  164. package/modules/devices/admin/templates.json +976 -0
  165. package/modules/devices/checks/emsAssignment.check.js +52 -2
  166. package/modules/devices/index.js +5 -1
  167. package/modules/devices/lib/alias-contract-v1.json +22 -0
  168. package/modules/devices/lib/deviceRuntime.js +17 -7
  169. package/modules/devices/lib/drivers/modbus.js +1 -1
  170. package/modules/devices/lib/drivers/modbusRtuBus.js +7 -1
  171. package/modules/devices/lib/drivers/ovumMira.js +148 -0
  172. package/modules/devices/lib/ovumMiraAliases.js +61 -0
  173. package/modules/devices/lib/ovumMiraConnection.js +32 -0
  174. package/modules/devices/lib/templates.json +976 -0
  175. package/modules/devices/test/aliasContractV1.test.js +4 -4
  176. package/modules/devices/test/deviceAliasSemantics.test.js +2 -2
  177. package/modules/devices/test/fixtures/approved-additive-templates.json +3 -1
  178. package/modules/devices/test/ovumMiraPairing.test.js +76 -0
  179. package/modules/devices/test/ovumMiraTemplates.test.js +110 -0
  180. package/modules/devices/test/ovumMiraTransport.test.js +162 -0
  181. package/package.json +10 -5
  182. package/release-manifests/unified/build-environment.cdx.json +7 -7
  183. package/release-manifests/unified/files.json +302 -180
  184. package/release-manifests/unified/frontend.cdx.json +7 -7
  185. package/release-manifests/unified/installer.cdx.json +7 -7
  186. package/release-manifests/unified/obsolete-admin-assets.json +281 -28
  187. package/release-manifests/unified/runtime.cdx.json +28 -28
  188. package/release-manifests/unified/validation.json +15 -15
  189. package/tools/eos-release-manifest.cjs +2 -2
  190. package/ui/ems/consumers/ovum-mira.js +164 -0
  191. package/ui/ems/consumers/sg-ready.js +26 -6
  192. package/ui/ems/datapoints.js +12 -4
  193. package/ui/ems/modules/charging-management.js +58 -67
  194. package/ui/ems/modules/core-limits.js +59 -36
  195. package/ui/ems/modules/para14a.js +3 -2
  196. package/ui/ems/modules/prime-mover-control.js +141 -29
  197. package/ui/ems/modules/stage-a-diagnostics.js +4 -2
  198. package/ui/ems/modules/storage-control.js +31 -38
  199. package/ui/ems/modules/storage-mapping.js +14 -13
  200. package/ui/ems/modules/tarif-vis.js +38 -56
  201. package/ui/ems/modules/thermal-control.js +91 -10
  202. package/ui/ems/services/measurement-freshness.js +58 -21
  203. package/ui/ems/services/safety-envelope.js +13 -6
  204. package/ui/io-package.json +13 -1
  205. package/ui/lib/datapoint-picker.js +27 -20
  206. package/ui/lib/installer-lifecycle.js +11 -2
  207. package/ui/lib/tariff-price.js +7 -1
  208. package/ui/lib/ts-mirrors/ems/core-limits/core-runtime.js +5 -1
  209. package/ui/main.js +313 -188
  210. package/ui/package.json +4 -3
  211. package/ui/www/app.js +238 -100
  212. package/ui/www/ems-apps.js +30 -10
  213. package/ui/www/index.html +1 -0
  214. package/ui/www/licenses/smarthome-markdown-components.json +156 -156
  215. package/ui/www/live-display.js +38 -4
  216. package/ui/www/manifest.webmanifest +2 -2
  217. package/ui/www/power-measurements.js +28 -3
  218. package/adminWww/assets/AddLink-0L0E-LsA.js +0 -1
  219. package/adminWww/assets/ColorLens-DA51K29x.js +0 -1
  220. package/adminWww/assets/ConfigManager-C2naRwDl.js +0 -1
  221. package/adminWww/assets/Enums-B9ucB-qg.js +0 -92
  222. package/adminWww/assets/Fields-DN41WFbp.js +0 -1
  223. package/adminWww/assets/FileCopy-B16lEuur.js +0 -1
  224. package/adminWww/assets/Files-C3PbbeNR.js +0 -1
  225. package/adminWww/assets/Instances-PKvEjDNQ.js +0 -4
  226. package/adminWww/assets/Intro-BnYMjDZr.js +0 -2
  227. package/adminWww/assets/Lens-9lkeoWGk.js +0 -1
  228. package/adminWww/assets/LinearScale-Be5h2beh.js +0 -1
  229. package/adminWww/assets/North-C2whbHM-.js +0 -1
  230. package/adminWww/assets/Overview-CWLYuqZx.js +0 -3
  231. package/adminWww/assets/PersonOff-DqBq0Fho.js +0 -1
  232. package/adminWww/assets/PlaylistAdd-O8k92YBd.js +0 -1
  233. package/adminWww/assets/State-Ca9_Ke_c.js +0 -1
  234. package/adminWww/assets/UsedResources-20bsoxmj.js +0 -2
  235. package/adminWww/assets/Users-yZyZX-18.js +0 -1
  236. package/adminWww/assets/date-fns-C1dqkno9.js +0 -1
  237. package/adminWww/assets/icons-material-C3PNaipj.js +0 -1
  238. package/adminWww/assets/isSameWeek-Crh37s7U.js +0 -1
  239. package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +0 -1
  240. package/adminWww/assets/locale-hLcz_Xh2.js +0 -1
  241. package/adminWww/assets/sentry-DwQQLI7N.js +0 -1
  242. package/adminWww/assets/startOfWeek-DJph8SIW.js +0 -1
package/ui/www/app.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
8
8
  *
9
9
  * Quelle: src-ts/runtime-executables/www/app.ts
10
- * Quell-Hash: sha256:18104cb2b08b3c23c36643230efeb9f8a940be31f60d25193001491594db06ea
10
+ * Quell-Hash: sha256:8886479238d20c1219eec9882822102510e91d8ab11bd5ea4d1741bff6cec969
11
11
  * Erzeugung: npm run sync:ts-runtime-executables
12
12
  *
13
13
  * Zweck:
@@ -470,7 +470,15 @@ const _RENDER_MIN_INTERVAL_MS = 120;
470
470
  * Zusammenhang: Teil von Kunden-LIVE-Frontend: Dashboard, Energiefluss, Schnellsteuerung; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
471
471
  * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
472
472
  */
473
- function scheduleRender(force = false){
473
+ function scheduleRender(force = false, telemetryFrame = false){
474
+ // Settings changes and modal actions must not paint intermediate meter values.
475
+ // Keep immediate button feedback separate from the shared dashboard frame.
476
+ if (!telemetryFrame && document.getElementById('energyWebSvg')) {
477
+ try { window.__evcsApply?.(key => state[key]?.value, state); }
478
+ catch (error) { console.warn('EVCS controls', error); }
479
+ scheduleLiveTelemetryRender(false);
480
+ return;
481
+ }
474
482
  if (_renderScheduled && !force) return;
475
483
  _renderScheduled = true;
476
484
 
@@ -487,54 +495,57 @@ function scheduleRender(force = false){
487
495
  _renderScheduled = false;
488
496
  if (document.visibilityState !== 'visible' || _liveTelemetryPaused) return;
489
497
  _lastRenderTs = performance.now();
490
- try{ render(); }catch(_e){}
498
+ window.__nwLiveFrameNow = Date.now();
499
+ try { render(); } catch (_e) {}
500
+ finally { delete window.__nwLiveFrameNow; }
491
501
  }, wait);
492
502
  }
493
503
 
494
- // Kundenanzeige: Messwerte des Energieflussmonitors werden bewusst nur alle 5 Sekunden
504
+ // Kundenanzeige: Messwerte des Energieflussmonitors werden bewusst nur alle 10 Sekunden
495
505
  // neu gerendert. Die Backend-Messung und sämtliche EMS-Regelkreise bleiben unverändert
496
506
  // schnell; gedrosselt wird ausschließlich die sichtbare LIVE-Darstellung, damit kurze
497
507
  // NVP-/Speicher-Messversätze nicht als hektisches Springen erscheinen.
498
- const LIVE_TELEMETRY_RENDER_INTERVAL_MS = 5000;
508
+ const LIVE_TELEMETRY_RENDER_INTERVAL_MS = 10000;
509
+ const OTHER_PAGE_TELEMETRY_INTERVAL_MS = 5000;
499
510
  let _liveTelemetryRenderTimer = null;
500
511
  let _lastLiveTelemetryRenderTs = null;
501
512
  let _liveTelemetryPaused = false;
502
513
 
503
514
  /**
504
515
  * Code-Teil: scheduleLiveTelemetryRender
505
- * Zweck: Bündelt häufige SSE-Messwertupdates auf einen festen 5-Sekunden-Anzeigetakt.
516
+ * Zweck: Bündelt häufige SSE-Messwertupdates auf einen festen 10-Sekunden-Anzeigetakt.
506
517
  * Zusammenhang: Verändert keine Statewerte und keine Regelung; nur render() im LIVE-Frontend
507
- * wird verzögert. Initialdaten, Konfigurationsänderungen und bewusste UI-Aktionen dürfen
508
- * weiterhin sofort gerendert werden.
518
+ * wird verzögert. Erstansicht und Verbindungswechsel werden unmittelbar sichtbar.
509
519
  */
510
520
  function scheduleLiveTelemetryRender(force = false){
511
521
  // Eine monotone Zeitbasis verhindert Verzögerungen bei NTP-/Uhrzeitkorrekturen.
512
522
  // Eingehende SSE-Werte werden auch verborgen gepuffert, nur die Anzeige pausiert.
513
523
  if (_liveTelemetryPaused || document.visibilityState !== 'visible') return;
514
524
  const now = performance.now();
525
+ const interval = document.getElementById('energyWebSvg') ? LIVE_TELEMETRY_RENDER_INTERVAL_MS : OTHER_PAGE_TELEMETRY_INTERVAL_MS;
515
526
  const elapsed = _lastLiveTelemetryRenderTs === null ? Infinity : now - _lastLiveTelemetryRenderTs;
516
527
 
517
- if (force || elapsed >= LIVE_TELEMETRY_RENDER_INTERVAL_MS) {
528
+ if (force || elapsed >= interval) {
518
529
  if (_liveTelemetryRenderTimer !== null) {
519
530
  clearTimeout(_liveTelemetryRenderTimer);
520
531
  _liveTelemetryRenderTimer = null;
521
532
  }
522
533
  _lastLiveTelemetryRenderTs = now;
523
- scheduleRender(true);
534
+ scheduleRender(true, true);
524
535
  return;
525
536
  }
526
537
 
527
538
  if (_liveTelemetryRenderTimer !== null) return;
528
- const wait = Math.max(0, LIVE_TELEMETRY_RENDER_INTERVAL_MS - elapsed);
539
+ const wait = Math.max(0, interval - elapsed);
529
540
  _liveTelemetryRenderTimer = setTimeout(() => {
530
541
  _liveTelemetryRenderTimer = null;
531
542
  if (_liveTelemetryPaused || document.visibilityState !== 'visible') return;
532
543
  _lastLiveTelemetryRenderTs = performance.now();
533
- scheduleRender(true);
544
+ scheduleRender(true, true);
534
545
  }, wait);
535
546
  }
536
547
 
537
- // Auch ohne neue SSE-Werte alle 5 s den aktuellen Snapshot neu bewerten. Dadurch
548
+ // Auch ohne neue SSE-Werte alle 10 s den aktuellen Snapshot neu bewerten. Dadurch
538
549
  // altern echte Messzeitstempel sichtbar; das Rendering erzeugt keine neue Messung.
539
550
  function refreshLiveMeasurementAge() {
540
551
  if (document.visibilityState === 'visible' && document.getElementById('energyWebSvg')) scheduleLiveTelemetryRender(false);
@@ -557,7 +568,7 @@ function resumeLiveTelemetryRendering() {
557
568
  scheduleLiveTelemetryRender(true);
558
569
  }
559
570
  // Nach Tab-Rückkehr / BFcache sofort den neuesten gepufferten Stand zeigen,
560
- // danach einen einzigen 5-s-Takt. Kein Hintergrundrender und keine Timer-Duplikate.
571
+ // danach einen einzigen 10-s-Takt. Kein Hintergrundrender und keine Timer-Duplikate.
561
572
  document.addEventListener('visibilitychange', () => {
562
573
  if (document.visibilityState === 'visible') resumeLiveTelemetryRendering();
563
574
  else pauseLiveTelemetryRendering();
@@ -1862,28 +1873,13 @@ function nwFormatDashboardTimestamp(ts) {
1862
1873
  */
1863
1874
  function nwLatestStateTimestamp(keys) {
1864
1875
  const st = window.latestState || state || {};
1865
- let best = 0;
1866
- /**
1867
- * Code-Teil: scanKey
1868
- * Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
1869
- * Zusammenhang: Teil von Kunden-LIVE-Frontend: Dashboard, Energiefluss, Schnellsteuerung; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
1870
- * TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
1871
- */
1872
- const scanKey = (k) => {
1873
- const rec = st && st[k];
1874
- const ts = rec && Number(rec.ts);
1875
- if (Number.isFinite(ts) && ts > best) best = ts;
1876
- };
1877
- if (Array.isArray(keys)) keys.forEach(scanKey);
1878
- if (!best) {
1879
- try {
1880
- Object.keys(st || {}).forEach((k) => {
1881
- const ts = Number(st[k] && st[k].ts);
1882
- if (Number.isFinite(ts) && ts > best) best = ts;
1883
- });
1884
- } catch (_e) {}
1876
+ const now = window.__nwLiveFrameNow ?? Date.now(), age = getFlowFreshMaxAgeMs(), online = window.__nwTariffLiveOnline !== false;
1877
+ let best = null;
1878
+ for (const key of keys) {
1879
+ if (window.NexoWattLiveDisplay.read(st, key, now, age, online) === null) continue;
1880
+ best = Math.max(best ?? 0, Number(st[key].ts));
1885
1881
  }
1886
- return best || Date.now();
1882
+ return best;
1887
1883
  }
1888
1884
  /**
1889
1885
  * Code-Teil: nwSetLiveOnline
@@ -1902,7 +1898,7 @@ function nwSetLiveOnline(isOnline) {
1902
1898
  if (dot) dot.classList.toggle('is-offline', !online);
1903
1899
  if (!online) {
1904
1900
  for (const id of ['pvPower', 'gridBuyPower', 'gridSellPower', 'storagePower', 'consumptionTotal', 'sidePvPower', 'sideBuildingPower', 'sideBatteryPower', 'sideGridBuyPower', 'sideGridSellPower', 'pvVal', 'gridVal', 'restVal', 'centerPower']) setText(id, '--');
1905
- setText('batterySocIn', '-- %'); setText('sideStorage', '-- %'); setText('sideBatterySoc', '-- %');
1901
+ setText('batteryFlowDirection', ''); setText('batterySocIn', '-- %'); setText('sideStorage', '-- %'); setText('sideBatterySoc', '-- %');
1906
1902
  setText('sideEms', 'Verbindung unterbrochen'); setText('sideGridStatus', 'Messstatus unbekannt');
1907
1903
  }
1908
1904
  }
@@ -1928,20 +1924,19 @@ function updateDashboardShellUi(data) {
1928
1924
  const liveDot = document.getElementById('liveDot');
1929
1925
  nwSetLiveOnline(!liveDot || liveDot.classList.contains('live'));
1930
1926
 
1931
- const { pv, buy, sell, load, charge, discharge } = getLiveMeasurementView();
1927
+ const { pv, buy, sell, load, charge, discharge, soc } = getLiveMeasurementView();
1932
1928
  const batterySigned = charge === null || discharge === null ? null : discharge - charge;
1933
1929
  const evcsAvailable = nwEvcsFeatureFromConfig();
1934
1930
  const evcsPower = evcsAvailable ? getEvcsPowerW(d) : null;
1935
1931
  try { nwApplyCustomerFeatureVisibility(window.__nwCfg || {}, window.latestState || state || {}); } catch (_e) {}
1936
1932
 
1937
- const soc = getLiveMeasurementView().soc;
1938
1933
  const autarky = (snap.autarkyN !== undefined && snap.autarkyN !== null) ? Number(snap.autarkyN) : getFreshFlowNumber('autarky');
1939
1934
  const selfc = (snap.selfcN !== undefined && snap.selfcN !== null) ? Number(snap.selfcN) : getFreshFlowNumber('selfConsumption');
1940
1935
 
1941
1936
  setText('sideStorage', Number.isFinite(soc) ? `${Math.round(soc)} %` : '-- %');
1942
1937
  setText('sideBatterySoc', Number.isFinite(soc) ? `${Math.round(soc)} %` : '-- %');
1943
1938
  const p14 = !!d('ems.core.para14aActive') || !!d('para14a.active'), peak = String(d('peakShaving.control.status') || '').trim(), safety = String(d('chargingManagement.audit.safetyStage') || '').trim(), p14Fallback = d('para14a.communicationFallbackActive') === true;
1944
- const health = window.NexoWattLiveDisplay?.status(window.latestState || state || {}, window.__nwTariffLiveOnline !== false, Date.now());
1939
+ const health = window.NexoWattLiveDisplay?.status(window.latestState || state || {}, window.__nwTariffLiveOnline !== false, window.__nwLiveFrameNow ?? Date.now(), getFlowFreshMaxAgeMs());
1945
1940
  setText('sideEms', safety === 'EOS-SAFETY-STOP' ? 'Safety aktiv' : health?.ems || 'Status unbekannt');
1946
1941
  setText('sideGridStatus', p14Fallback ? '§14a Fallback' : (p14 ? '§14a aktiv' : (peak === 'active' ? 'Peak aktiv' : health?.grid || 'Messstatus unbekannt')));
1947
1942
  setText('sideStatusText', health?.summary || 'Betriebsstatus unbekannt');
@@ -1953,15 +1948,19 @@ function updateDashboardShellUi(data) {
1953
1948
  setText('sideCo2Savings', snap.co2Text || '--');
1954
1949
 
1955
1950
  setText('sidePvPower', pv === null ? '--' : formatFlowPower(Math.abs(pv)));
1956
- setText('sideBuildingPower', load === null ? '--' : formatFlowPower(Math.max(0, load)));
1951
+ // With separate consumers the energy diagram publishes its reconciled building value below.
1952
+ if (!flowExtras?.consumers?.length && !flowExtras?.meta?.evcsAvailable) {
1953
+ setText('sideBuildingPower', load === null ? '--' : formatFlowPower(Math.max(0, load)));
1954
+ }
1957
1955
  setText('sideGridBuyPower', buy === null ? '--' : formatFlowPower(Math.max(0, buy)));
1958
1956
  setText('sideGridSellPower', sell === null ? '--' : formatFlowPower(Math.max(0, sell)));
1959
1957
  setText('sideBatteryPower', batterySigned === null ? '--' : (batterySigned < 0 ? '-' : '') + formatFlowPower(Math.abs(batterySigned)));
1960
1958
  if (evcsAvailable) setText('sideEvcsPower', evcsPower === null ? '--' : formatFlowPower(Math.abs(evcsPower)));
1961
1959
 
1962
1960
  const ts = nwLatestStateTimestamp([
1963
- 'pvPower', 'productionTotal', 'consumptionTotal', 'gridPower', 'gridBuyPower',
1964
- 'gridSellPower', 'storageSoc', 'storagePower', 'consumptionEvcs'
1961
+ 'derived.core.pv.totalW', 'derived.core.grid.netW', 'derived.core.storage.netW', 'derived.core.building.loadTotalW',
1962
+ 'pvPower', 'productionTotal', 'consumptionTotal', 'gridPointPower', 'gridBuyPower', 'gridSellPower',
1963
+ 'batteryPower', 'storageChargePower', 'storageDischargePower', 'storageSoc', 'consumptionEvcs', 'evcs.totalPowerW'
1965
1964
  ]);
1966
1965
  setText('sideTimestamp', nwFormatDashboardTimestamp(ts));
1967
1966
  }
@@ -1996,7 +1995,7 @@ function initEnergyWebExtras(flowSlots){
1996
1995
  // They are configured in the App-Center (Energiefluss-Monitor -> Verbraucher/Erzeuger).
1997
1996
  // Only mapped items (a datapoint is selected) will be rendered.
1998
1997
 
1999
- const maxConsumers = 9;
1998
+ const maxConsumers = 10;
2000
1999
  const maxProducers = 5;
2001
2000
 
2002
2001
  // Backward compatible: older builds used flowOptionalConsumers/flowOptionalProducers
@@ -2152,7 +2151,7 @@ function initEnergyWebExtras(flowSlots){
2152
2151
 
2153
2152
  // value above
2154
2153
  const valEl = _svgEl('text', { id: valId, class: 'val', y: -(rNode + 8), 'text-anchor': 'middle' });
2155
- valEl.textContent = formatFlowPower(0);
2154
+ valEl.textContent = '--';
2156
2155
  g.appendChild(valEl);
2157
2156
 
2158
2157
  // label below
@@ -2444,7 +2443,7 @@ const placeSpecialLowerLeftArc = (items) => {
2444
2443
  }
2445
2444
 
2446
2445
  // Keep a free corridor around the fixed EVCS node at 0° and avoid the very
2447
- // top/bottom zones close to PV/battery. The split keeps 1..9 consumers readable.
2446
+ // top/bottom zones close to PV/battery. The split keeps 1..10 consumers readable.
2448
2447
  if (count === 1) return [-46];
2449
2448
  const upperCount = Math.ceil(count / 2);
2450
2449
  const lowerCount = count - upperCount;
@@ -2957,8 +2956,9 @@ function getStateAgeMs(key) {
2957
2956
  try {
2958
2957
  const rec = state && state[key];
2959
2958
  const ts = Number(rec && rec.ts);
2960
- if (!Number.isFinite(ts) || ts <= 0 || ts > Date.now() + 5000) return null;
2961
- return Math.max(0, Date.now() - ts);
2959
+ const now = window.__nwLiveFrameNow ?? Date.now();
2960
+ if (!Number.isFinite(ts) || ts <= 0 || ts > now + 5000) return null;
2961
+ return Math.max(0, now - ts);
2962
2962
  } catch (_e) {
2963
2963
  return null;
2964
2964
  }
@@ -2987,7 +2987,7 @@ function getFlowFreshMaxAgeMs() {
2987
2987
  */
2988
2988
  function getFreshFlowNumber(key, opts = {}) {
2989
2989
  if (opts.onlyIfMapped && !isMappedDatapoint(key)) return null;
2990
- return window.NexoWattLiveDisplay?.read(state, key, Date.now(), getFlowFreshMaxAgeMs(), window.__nwTariffLiveOnline !== false) ?? null;
2990
+ return window.NexoWattLiveDisplay?.read(state, key, window.__nwLiveFrameNow ?? Date.now(), getFlowFreshMaxAgeMs(), window.__nwTariffLiveOnline !== false) ?? null;
2991
2991
  }
2992
2992
  /**
2993
2993
  * Code-Teil: getStableFlowNumber
@@ -3044,29 +3044,45 @@ function getBalanceDerivedBatteryFlow(opts = {}) {
3044
3044
  const hasDirectLoad = isMappedDatapoint('consumptionTotal') || isMappedDatapoint('housePower');
3045
3045
  if (!hasDirectLoad) return null;
3046
3046
 
3047
- const load = coerceNumber(read('consumptionTotal') ?? read('housePower'));
3048
- if (load === null) return null;
3047
+ const load = (isMappedDatapoint('consumptionTotal') ? read('consumptionTotal') : null)
3048
+ ?? (isMappedDatapoint('housePower') ? read('housePower') : null);
3049
+ if (load === null || load < 0) return null;
3049
3050
 
3050
- const grid = getGridImportExport(read);
3051
- if (!grid || grid.rawBuy === null || grid.rawSell === null) return null;
3052
3051
  const nvp = st['ems.gridMeasurementFresh'];
3053
- if (nvp && (nvp.value !== true || getStateAgeMs('ems.gridMeasurementFresh') === null || getStateAgeMs('ems.gridMeasurementFresh') > getFlowFreshMaxAgeMs())) return null;
3054
-
3055
- let pv = coerceNumber(read('pvPower'));
3056
- if (pv === null && isMappedDatapoint('productionTotal')) pv = coerceNumber(read('productionTotal'));
3052
+ if (nvp && (nvp.value !== true || (nvp.q !== undefined && nvp.q !== 0) || getStateAgeMs('ems.gridMeasurementFresh') === null || getStateAgeMs('ems.gridMeasurementFresh') > getFlowFreshMaxAgeMs())) return null;
3053
+ let net;
3054
+ if (Object.hasOwn(st, 'derived.core.grid.netW')) {
3055
+ net = read('derived.core.grid.netW');
3056
+ if (net === null) return null;
3057
+ } else {
3058
+ const grid = getGridImportExport(read);
3059
+ if (!grid || grid.rawBuy === null || grid.rawSell === null) return null;
3060
+ net = grid.buy - grid.sell;
3061
+ if (st['settings.flowInvertGrid']?.value) net = -net;
3062
+ }
3063
+ const pv = Object.hasOwn(st, 'derived.core.pv.totalW') ? read('derived.core.pv.totalW')
3064
+ : read('pvPower') ?? (isMappedDatapoint('productionTotal') ? read('productionTotal') : null);
3057
3065
  if (pv === null) return null;
3058
3066
 
3059
- let production = Math.max(0, Math.abs(Number(pv) || 0));
3060
- for (let i = 1; i <= 5; i++) {
3061
- const p = coerceNumber(read(`producer${i}Power`));
3062
- if (p !== null) production += Math.max(0, Math.abs(p));
3067
+ let production = Math.abs(pv);
3068
+ if (Object.hasOwn(st, 'derived.core.production.extraW')) {
3069
+ const extra = read('derived.core.production.extraW');
3070
+ if (extra === null) return null;
3071
+ production += extra;
3072
+ } else {
3073
+ for (let i = 1; i <= 5; i++) {
3074
+ const key = `producer${i}Power`;
3075
+ const power = read(key);
3076
+ if (power === null && isMappedDatapoint(key)) return null;
3077
+ if (power !== null) production += Math.abs(power);
3078
+ }
3063
3079
  }
3064
3080
 
3065
- const signed = Math.round((Math.max(0, load) - production - Math.max(0, grid.buy || 0) + Math.max(0, grid.sell || 0)));
3081
+ const signed = Math.round(load - production - net);
3066
3082
  if (!Number.isFinite(signed) || Math.abs(signed) <= deadbandW) return null;
3067
3083
 
3068
3084
  // Plausibilitätsbremsen gegen kurze Messversätze oder unbekannte Verbraucher.
3069
- const activity = production + Math.max(0, load) + Math.max(0, grid.buy || 0) + Math.max(0, grid.sell || 0);
3085
+ const activity = production + load + Math.abs(net);
3070
3086
  if (activity < 500) return null;
3071
3087
  if (Math.abs(signed) > Math.max(3000, activity * 1.15)) return null;
3072
3088
  if (signed < 0 && soc >= 99.5) return null;
@@ -3254,25 +3270,75 @@ function getCanonicalPvPowerW(readValue) {
3254
3270
  * Keine Regelung, keine Ersatzmessung und keine Änderung der Kundenzuordnung. */
3255
3271
  function getLiveMeasurementView() {
3256
3272
  const fresh = key => getFreshFlowNumber(key);
3257
- const grid = getGridImportExport(fresh);
3258
- const nvp = state?.['ems.gridMeasurementFresh'];
3259
- const nvpUsable = !nvp || (nvp.value === true && getStateAgeMs('ems.gridMeasurementFresh') !== null && getStateAgeMs('ems.gridMeasurementFresh') <= getFlowFreshMaxAgeMs());
3260
- const gridAvailable = nvpUsable && grid.rawBuy !== null && grid.rawSell !== null;
3261
- const battery = getNormalizedBatteryFlow();
3262
- const batteryAvailable = !['missing', 'mapped-missing', 'storageFarm-missing-power', 'storageFarm-unavailable', 'stale-or-missing'].includes(String(battery.src)) && battery.incomplete !== true;
3273
+ let buy = null, sell = null;
3274
+ if (state && Object.hasOwn(state, 'derived.core.grid.netW')) {
3275
+ // Der Netzpunkt stammt aus demselben Messsatz wie der berechnete Verbrauch.
3276
+ const net = fresh('derived.core.grid.netW');
3277
+ if (net !== null) {
3278
+ buy = Math.max(0, net);
3279
+ sell = Math.max(0, -net);
3280
+ }
3281
+ } else {
3282
+ const nvp = state?.['ems.gridMeasurementFresh'];
3283
+ const nvpAge = nvp ? getStateAgeMs('ems.gridMeasurementFresh') : null;
3284
+ const nvpUsable = !nvp || (nvp.value === true && (nvp.q === undefined || nvp.q === 0) && nvpAge !== null && nvpAge <= getFlowFreshMaxAgeMs());
3285
+ if (nvpUsable) {
3286
+ const grid = getGridImportExport(fresh);
3287
+ if (grid.rawBuy !== null && grid.rawSell !== null) {
3288
+ const inverted = !!((window.latestState || state)?.['settings.flowInvertGrid']?.value);
3289
+ [buy, sell] = inverted ? [grid.sell, grid.buy] : [grid.buy, grid.sell];
3290
+ }
3291
+ }
3292
+ }
3293
+ const hasStorageObservation = state && Object.hasOwn(state, 'derived.core.storage.netW');
3263
3294
  const farm = nwStorageFarmFeatureFromConfig(window.__nwCfg || {}, state || {});
3264
- const farmView = farm ? window.NexoWattLiveDisplay?.farm(state, Date.now(), window.__nwTariffLiveOnline !== false) : null;
3265
- const directLoad = fresh('consumptionTotal');
3266
- const derivedLoad = fresh('derived.core.building.loadTotalW');
3267
- const load = directLoad !== null && directLoad >= 0 ? directLoad : derivedLoad !== null && derivedLoad >= 0 ? derivedLoad : null;
3295
+ const farmView = farm ? window.NexoWattLiveDisplay?.farm(state, window.__nwLiveFrameNow ?? Date.now(), window.__nwTariffLiveOnline !== false) : null;
3296
+ let charge = null, discharge = null, batteryDerived = false;
3297
+ if (farmView) {
3298
+ ({ charge, discharge } = farmView);
3299
+ } else if (hasStorageObservation) {
3300
+ const net = fresh('derived.core.storage.netW');
3301
+ if (net !== null) {
3302
+ charge = Math.max(0, -net);
3303
+ discharge = Math.max(0, net);
3304
+ } else if (!farm && !isMappedDatapoint('batteryPower') && !isMappedDatapoint('storageChargePower') && !isMappedDatapoint('storageDischargePower')) {
3305
+ const estimate = getBalanceDerivedBatteryFlow();
3306
+ if (estimate) {
3307
+ ({ chargeW: charge, dischargeW: discharge } = estimate);
3308
+ batteryDerived = true;
3309
+ }
3310
+ }
3311
+ } else {
3312
+ const battery = getNormalizedBatteryFlow();
3313
+ const missing = ['missing', 'mapped-missing', 'storageFarm-missing-power', 'storageFarm-unavailable', 'stale-or-missing'];
3314
+ if (!missing.includes(String(battery.src)) && battery.incomplete !== true) {
3315
+ ({ chargeW: charge, dischargeW: discharge } = battery);
3316
+ batteryDerived = battery.derived === true;
3317
+ }
3318
+ }
3319
+ // A direct meter can arrive one SSE batch before the backend publishes the new balance.
3320
+ // Unmapped consumptionTotal may be a mirror of the previous balance; never revive it here.
3321
+ const directKey = isMappedDatapoint('consumptionTotal') ? 'consumptionTotal'
3322
+ : isMappedDatapoint('housePower') ? 'housePower' : null;
3323
+ const directLoad = directKey ? fresh(directKey) : null;
3324
+ const canonicalKey = 'derived.core.building.loadTotalW';
3325
+ const canonical = state?.[canonicalKey];
3326
+ let load = canonical ? fresh(canonicalKey) : fresh('consumptionTotal');
3327
+ const directRow = directKey ? state?.[directKey] : null;
3328
+ const evaluatedAt = Math.max(canonical?.ts || 0, state?.['derived.core.building.loadSource']?.ts || 0, state?.['derived.core.building.quality']?.ts || 0);
3329
+ if (directLoad !== null && directLoad >= 0 && (!canonical || directRow.ts > evaluatedAt || directRow === window.__nwPendingDirectSample)) {
3330
+ load = directLoad;
3331
+ } else if (directKey && state?.[directKey] && state?.['derived.core.building.loadSource']?.value === 'mapped:' + directKey
3332
+ && (directRow === window.__nwPendingDirectSample || directRow.ts >= (canonical?.ts ?? 0))) {
3333
+ // An invalidating sample for the same physical meter takes precedence immediately.
3334
+ load = null;
3335
+ }
3336
+ const pv = getCanonicalPvPowerW(fresh);
3268
3337
  const soc = farmView ? farmView.soc : farm ? fresh('storageFarm.totalSoc') ?? fresh('storageFarm.medianSoc') : fresh('storageSoc');
3269
3338
  return {
3270
- pv: getCanonicalPvPowerW(fresh), load,
3271
- buy: gridAvailable ? grid.buy : null, sell: gridAvailable ? grid.sell : null,
3272
- charge: farmView ? farmView.charge : batteryAvailable ? battery.chargeW : null,
3273
- discharge: farmView ? farmView.discharge : batteryAvailable ? battery.dischargeW : null,
3339
+ pv: pv !== null && pv >= 0 ? pv : null, load: load !== null && load >= 0 ? load : null, buy, sell,
3340
+ charge, discharge, batteryDerived,
3274
3341
  soc: soc !== null && soc >= 0 && soc <= 100 ? soc : null,
3275
- batteryDerived: !farmView && battery.derived === true,
3276
3342
  };
3277
3343
  }
3278
3344
 
@@ -3568,6 +3634,7 @@ async function chargingControlFetch(url, options = {}) {
3568
3634
  }
3569
3635
 
3570
3636
  async function bootstrap() {
3637
+ window.__nwFlowConnection = 'connecting';
3571
3638
  let cfg = {};
3572
3639
  try {
3573
3640
  const cfgRes = await fetch('/config');
@@ -3750,8 +3817,19 @@ const refreshConfig = async () => {
3750
3817
  }
3751
3818
  }
3752
3819
  };
3753
- const snap = await fetch('/api/state').then(r => r.json());
3754
- state = snap || {};
3820
+ try {
3821
+ const response = await fetch('/api/state', { cache: 'no-store' });
3822
+ if (!response.ok) throw new Error('HTTP ' + response.status);
3823
+ const snap = await response.json();
3824
+ if (!snap || typeof snap !== 'object' || Array.isArray(snap)) throw new Error('invalid snapshot');
3825
+ state = snap;
3826
+ window.__nwFlowConnection = 'snapshot';
3827
+ document.getElementById('liveDot')?.classList.add('live');
3828
+ nwSetLiveOnline(true);
3829
+ } catch (error) {
3830
+ // The EventSource below still obtains a complete snapshot after an HTTP bootstrap error.
3831
+ console.warn('[live-state]', error);
3832
+ }
3755
3833
  try { lastInstallerConfigJson = (state && state['installer.configJson'] && state['installer.configJson'].value) || null; } catch (_e) {}
3756
3834
  // merge cfg.settings into state if missing (for initial checkbox values)
3757
3835
  try{
@@ -3791,16 +3869,47 @@ const refreshConfig = async () => {
3791
3869
  try{
3792
3870
  const es = new EventSource((window.NW_RUNTIME?.url('/events') ?? '/events'));
3793
3871
  const dot = document.getElementById('liveDot');
3794
- if (dot) dot.classList.remove('live');
3795
- es.onopen = () => { if (dot) dot.classList.add('live'); try{ nwSetLiveOnline(true); }catch(_e){} };
3796
- es.onerror = () => { if (dot) dot.classList.remove('live'); try{ nwSetLiveOnline(false); }catch(_e){} try{ es.close(); }catch(_){ } setTimeout(startEvents, 3000); };
3872
+ let initialized = false;
3873
+ let closed = false;
3874
+ const reconnect = () => {
3875
+ if (closed) return;
3876
+ closed = true;
3877
+ window.__nwFlowConnection = 'disconnected';
3878
+ dot?.classList.remove('live');
3879
+ nwSetLiveOnline(false);
3880
+ es.close();
3881
+ scheduleLiveTelemetryRender(true);
3882
+ setTimeout(startEvents, 3000);
3883
+ };
3884
+ es.onerror = reconnect;
3797
3885
  es.onmessage = (ev) => {
3798
3886
  try {
3799
3887
  const msg = JSON.parse(ev.data);
3800
- const isInitMessage = msg.type === 'init' && msg.payload;
3801
- const isUpdateMessage = msg.type === 'update' && msg.payload;
3802
- if (isInitMessage) { state = msg.payload; window.latestState = state; }
3803
- else if (isUpdateMessage) { Object.assign(state, msg.payload); window.latestState = state; }
3888
+ if (closed || !msg || !msg.payload || typeof msg.payload !== 'object' || Array.isArray(msg.payload)) return;
3889
+ const isInitMessage = msg.type === 'init';
3890
+ const isUpdateMessage = msg.type === 'update';
3891
+ if (isInitMessage) {
3892
+ if (msg.degraded === true) { reconnect(); return; }
3893
+ state = msg.payload;
3894
+ window.latestState = state;
3895
+ initialized = true;
3896
+ window.__nwPendingDirectSample = null;
3897
+ window.__nwFlowConnection = 'ready';
3898
+ dot?.classList.add('live');
3899
+ nwSetLiveOnline(true);
3900
+ } else if (isUpdateMessage && initialized) {
3901
+ const hasBalance = Object.hasOwn(msg.payload, 'derived.core.building.loadTotalW');
3902
+ if (hasBalance) window.__nwPendingDirectSample = null;
3903
+ if (msg.payload.consumptionTotal || msg.payload.housePower) {
3904
+ const key = isMappedDatapoint('consumptionTotal') ? 'consumptionTotal'
3905
+ : isMappedDatapoint('housePower') ? 'housePower' : null;
3906
+ const sample = key ? msg.payload[key] : null;
3907
+ if (sample && sample.ts > 0 && state[key]?.ts > sample.ts) delete msg.payload[key];
3908
+ else if (sample && !hasBalance) window.__nwPendingDirectSample = sample;
3909
+ }
3910
+ Object.assign(state, msg.payload);
3911
+ window.latestState = state;
3912
+ } else return;
3804
3913
 
3805
3914
  // App-Center config changed? Refresh /config so tiles + slot layout update without reload.
3806
3915
  try {
@@ -3815,7 +3924,14 @@ const refreshConfig = async () => {
3815
3924
  else if (isUpdateMessage) scheduleLiveTelemetryRender(false);
3816
3925
  } catch (e) { console.warn(e); }
3817
3926
  };
3818
- } catch(e){ console.warn('events', e); setTimeout(startEvents, 3000); }
3927
+ } catch (e) {
3928
+ console.warn('events', e);
3929
+ window.__nwFlowConnection = 'disconnected';
3930
+ document.getElementById('liveDot')?.classList.remove('live');
3931
+ nwSetLiveOnline(false);
3932
+ scheduleLiveTelemetryRender(true);
3933
+ setTimeout(startEvents, 3000);
3934
+ }
3819
3935
  }
3820
3936
  startEvents();
3821
3937
 
@@ -8409,8 +8525,8 @@ function _ensureThermalConsumerTiles(){
8409
8525
  const grid = document.getElementById('liveQuickTiles');
8410
8526
  if (!grid) return;
8411
8527
 
8412
- // Wir erstellen feste Platzhalter für bis zu 9 Verbraucher-Slots.
8413
- for (let idx = 1; idx <= 9; idx++) {
8528
+ // Wir erstellen feste Platzhalter für bis zu 10 Verbraucher-Slots.
8529
+ for (let idx = 1; idx <= 10; idx++) {
8414
8530
  const id = `thermalConsumerCard${idx}`;
8415
8531
  if (document.getElementById(id)) continue;
8416
8532
 
@@ -8558,7 +8674,7 @@ function updateThermalConsumerUi(){
8558
8674
  */
8559
8675
  const sv = (k) => (st && st[k] && st[k].value !== undefined) ? st[k].value : undefined;
8560
8676
 
8561
- for (let idx = 1; idx <= 9; idx++) {
8677
+ for (let idx = 1; idx <= 10; idx++) {
8562
8678
  const refs = _thermalConsTiles.get(idx);
8563
8679
  if (!refs) continue;
8564
8680
 
@@ -8572,11 +8688,12 @@ function updateThermalConsumerUi(){
8572
8688
  refs.tile.style.display = show ? '' : 'none';
8573
8689
  if (!show) continue;
8574
8690
 
8575
- const dev = isRod ? (rodDevices[idx - 1] || {}) : (thermalDevices[idx - 1] || {});
8691
+ const dev = (isRod ? rodDevices : thermalDevices).find(row => Number(row?.slot ?? row?.consumerSlot) === idx)
8692
+ || (isRod ? rodDevices[idx - 1] : thermalDevices[idx - 1]) || {};
8576
8693
  const name = (dev && dev.name) ? String(dev.name) : (slot && slot.name ? String(slot.name) : `Verbraucher ${idx}`);
8577
8694
 
8578
8695
  if (refs.title) refs.title.textContent = name;
8579
- if (refs.sub) refs.sub.textContent = isRod ? 'Heizstab' : 'Thermik';
8696
+ if (refs.sub) refs.sub.textContent = isRod ? 'Heizstab' : (slot?.qc?.ovumMira ? 'OVUM MIRA · Wärmepumpe' : 'Thermik');
8580
8697
  const iconEl = document.getElementById(`thermalConsumerIcon${idx}`);
8581
8698
  if (iconEl) iconEl.textContent = isRod ? '🔥' : '♨';
8582
8699
 
@@ -8586,7 +8703,10 @@ function updateThermalConsumerUi(){
8586
8703
  pW = Number(sv(`heatingRod.devices.c${idx}.appliedW`) ?? sv(`heatingRod.devices.c${idx}.targetW`) ?? 0);
8587
8704
  }
8588
8705
  if (!Number.isFinite(pW)) pW = 0;
8589
- if (refs.power) refs.power.textContent = formatPower(Math.abs(pW));
8706
+ if (refs.power) {
8707
+ const measured = slot?.qc?.ovumMira ? getFreshFlowNumber(pKey) : pW;
8708
+ refs.power.textContent = measured === null ? '—' : formatPower(Math.abs(measured));
8709
+ }
8590
8710
 
8591
8711
  if (refs.metaM) refs.metaM.textContent = `Slot ${idx}`;
8592
8712
 
@@ -8654,16 +8774,15 @@ function updateEnergyWeb() {
8654
8774
 
8655
8775
  const measurements = getLiveMeasurementView();
8656
8776
  let pv = measurements.pv ?? 0;
8657
- let buy = measurements.buy ?? 0, sell = measurements.sell ?? 0;
8777
+ const buy = measurements.buy ?? 0, sell = measurements.sell ?? 0;
8658
8778
  const load = measurements.load ?? 0;
8659
8779
  const evcsPowerW = getEvcsPowerW(d);
8660
8780
  let c2 = evcsPowerW ?? 0; // Nur Geometrie, niemals Ersatzmessung.
8661
8781
  const batCharge = measurements.charge ?? 0, batDischarge = measurements.discharge ?? 0;
8662
8782
  const soc = measurements.soc;
8663
8783
 
8664
- // Invert toggles (Batterie ist bereits im Normalizer enthalten)
8784
+ // Netz und Speicher wurden bereits bei der Messwertauswahl normalisiert.
8665
8785
  const invPv = !!(s['settings.flowInvertPv']?.value);
8666
- const invGrid = !!(s['settings.flowInvertGrid']?.value);
8667
8786
  const invEv = !!(s['settings.flowInvertEv']?.value);
8668
8787
  const subEvFromLoad = (s['settings.flowSubtractEvFromBuilding']?.value ?? true) ? true : false;
8669
8788
  const evAvail = nwEvcsFeatureFromConfig() && ((flowExtras && flowExtras.meta) ? !!flowExtras.meta.evcsAvailable : false);
@@ -8671,7 +8790,6 @@ function updateEnergyWeb() {
8671
8790
  if (invPv) pv = -pv;
8672
8791
  if (invEv) c2 = -c2;
8673
8792
  if (!evAvail) c2 = 0;
8674
- if (invGrid) { const t=buy; buy = sell; sell = t; } // swap semantics if inverted grid
8675
8793
 
8676
8794
  // Optionale Extra-Kreise aktualisieren (Rückgabe = Summe der optionalen Verbraucher)
8677
8795
  const extrasConsumersSum = updateEnergyWebExtras(key => getFreshFlowNumber(key));
@@ -8680,6 +8798,10 @@ function updateEnergyWeb() {
8680
8798
  // keine echte Null. Die vorhandene EV-/Verbraucher-Betragskonvention bleibt erhalten.
8681
8799
  const flowBalance = window.NexoWattPowerMeasurements?.resolveFlowBalance({
8682
8800
  load: measurements.load, ev: evcsPowerW === null ? null : c2,
8801
+ buildingQuality: measurements.load === null
8802
+ ? (window.__nwFlowConnection === 'connecting' ? 'awaiting-snapshot'
8803
+ : window.NexoWattLiveDisplay?.buildingQuality?.(state, window.__nwLiveFrameNow ?? Date.now(), getFlowFreshMaxAgeMs(), window.__nwTariffLiveOnline !== false, isMappedDatapoint))
8804
+ : null,
8683
8805
  consumers: extrasConsumersSum, pv: measurements.pv,
8684
8806
  producers: state && Object.hasOwn(state, 'derived.core.production.extraW') ? getFreshFlowNumber('derived.core.production.extraW')
8685
8807
  : window.__nwFlowExtraProductionW ?? (flowExtras?.producers?.length || flowExtras?.special?.length ? null : 0),
@@ -8737,7 +8859,14 @@ function updateEnergyWeb() {
8737
8859
  // EV & Batterie Texte
8738
8860
  T('c2Val', evcsPowerW === null ? '--' : formatFlowPower(evShowVal));
8739
8861
  T('restVal', measurements.charge === null || measurements.discharge === null ? '--' : batShowVal ? (batRev ? ('-'+formatFlowPower(batShowVal)) : formatFlowPower(batShowVal)) : formatFlowPower(0));
8740
- T('centerPower', loadDisplay === null ? '--' : formatFlowPower(loadDisplay));
8862
+ const hasBatteryDirection = measurements.charge !== null && measurements.discharge !== null;
8863
+ const grossBoth = batCharge > 0 && batDischarge > 0;
8864
+ const direction = !hasBatteryDirection || !batShowVal ? (grossBoth ? 'Netto 0' : '')
8865
+ : batRev ? (grossBoth ? 'Netto laden' : 'Laden') : (grossBoth ? 'Netto entladen' : 'Entladen');
8866
+ T('batteryFlowDirection', direction);
8867
+ const buildingText = loadDisplay === null ? '--' : formatFlowPower(loadDisplay);
8868
+ T('centerPower', buildingText);
8869
+ T('sideBuildingPower', buildingText);
8741
8870
  const balanceStatus = flowBalance.mismatchW === null ? (flowBalance.status || (measurements.batteryDerived ? 'Batterieleistung aus Energiebilanz berechnet' : ''))
8742
8871
  : `Bilanzabweichung ${formatFlowPower(Math.abs(flowBalance.mismatchW))} – Messpunkte, Vorzeichen und Zeitstempel prüfen`;
8743
8872
  T('energyFlowQuality', balanceStatus);
@@ -10457,6 +10586,7 @@ function openFlowQc(kind, idx){
10457
10586
  const meta = getSlotMeta(ctx.kind, ctx.idx);
10458
10587
  const fallbackKey = (ctx.kind === 'producer') ? `producer${ctx.idx}Power` : `consumer${ctx.idx}Power`;
10459
10588
  const stateKey = (entry && entry.stateKey) || (meta && meta.stateKey) || fallbackKey;
10589
+ if (ctx.qc?.ovumMira) return { valueW: getFreshFlowNumber(stateKey), maxW: ctx.qc.max };
10460
10590
  let n = readStateNumber(stateKey, NaN);
10461
10591
  let maxW = Number(ctx && ctx.qc && ctx.qc.max);
10462
10592
 
@@ -10493,6 +10623,12 @@ function openFlowQc(kind, idx){
10493
10623
  const updatePower = (readbackData = null) => {
10494
10624
  if (!ctx || !powerEl) return;
10495
10625
  const resolved = resolveFlowPower(readbackData);
10626
+ if (resolved.valueW === null) {
10627
+ powerEl.textContent = '—';
10628
+ setFlowGaugeFill(0, resolved.maxW);
10629
+ if (flowGauge) flowGauge.title = 'Keine aktuelle elektrische Leistungsmessung';
10630
+ return;
10631
+ }
10496
10632
  const rod = (readbackData && readbackData.heatingRod && readbackData.heatingRod.available) ? readbackData.heatingRod : null;
10497
10633
  const isRod = !!(ctx && ctx.kind === 'consumer' && ((ctx.qc && String(ctx.qc.controlKind || '').toLowerCase() === 'heatingrod') || rod));
10498
10634
  const modeRaw = rod ? String(rod.effectiveMode || rod.userMode || rod.mode || '').toLowerCase() : '';
@@ -10579,7 +10715,9 @@ function openFlowQc(kind, idx){
10579
10715
  const nightStatus = isRod ? nwHeatingRodNightStatus(ctl) : '';
10580
10716
  if (regStatus) regStatus.textContent = nightStatus ? 'Nachtpause' : (uEn ? 'Aktiv' : 'Aus');
10581
10717
  if (regHint) {
10582
- regHint.textContent = nightStatus
10718
+ regHint.textContent = ctl.ovumMira
10719
+ ? 'EOS steuert die PV-Anforderung. Heizung und Warmwasser regelt weiterhin die MIRA.'
10720
+ : nightStatus
10583
10721
  ? `${nightStatus}. Stufen 1–3 und Boost bleiben manuell verfügbar.`
10584
10722
  : isRod
10585
10723
  ? (uEn
@@ -10803,7 +10941,7 @@ function openFlowQc(kind, idx){
10803
10941
  if (subtitle) {
10804
10942
  subtitle.textContent = (qc.controlKind === 'heatingRod')
10805
10943
  ? 'Heizstab'
10806
- : ((k === 'producer') ? 'Erzeuger' : 'Verbraucher');
10944
+ : (qc.ovumMira ? 'OVUM MIRA · Elektrische Aufnahmeleistung' : ((k === 'producer') ? 'Erzeuger' : 'Verbraucher'));
10807
10945
  }
10808
10946
 
10809
10947
  if (swWrap) swWrap.style.display = qc.hasSwitch ? '' : 'none';