iobroker.eos-admin 9.0.18 → 9.0.19

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 (223) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +8 -9
  2. package/README.md +4 -2
  3. package/START_HIER_9.0.19.md +52 -0
  4. package/adminWww/.vite/manifest.json +114 -114
  5. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
  6. package/adminWww/assets/{AdapterUpdateDialog-ByJk9Cxj.js → AdapterUpdateDialog-JOf2z4Vg.js} +1 -1
  7. package/adminWww/assets/{Adapters-V2JtEPZX.js → Adapters-C9fcSdWm.js} +1 -1
  8. package/adminWww/assets/{ConfigManager-BKcdyJnN.js → ConfigManager-BeeLlT6D.js} +1 -1
  9. package/adminWww/assets/{Enums-ChbfAWzp.js → Enums-FqnXWl8U.js} +1 -1
  10. package/adminWww/assets/{Fields-DzaVXEvg.js → Fields-DMgrt5Pi.js} +1 -1
  11. package/adminWww/assets/{Files-CRpIXj4X.js → Files-CIHtt12g.js} +1 -1
  12. package/adminWww/assets/{Hosts-rOgfd2wo.js → Hosts-fPLBzvTy.js} +1 -1
  13. package/adminWww/assets/{Instances-BxLhJ6Pb.js → Instances-4XaVQlrT.js} +1 -1
  14. package/adminWww/assets/{Intro-BOql527d.js → Intro-5TKriiLO.js} +1 -1
  15. package/adminWww/assets/{Logs-WUUDY7a4.js → Logs-33zcIds-.js} +1 -1
  16. package/adminWww/assets/{Objects-DYaZkCK7.js → Objects-CNQPVbNG.js} +1 -1
  17. package/adminWww/assets/{Overview-C6hiiPbm.js → Overview-BskXGOc8.js} +1 -1
  18. package/adminWww/assets/{State-AH43l7fG.js → State-C8SJ_Iqo.js} +1 -1
  19. package/adminWww/assets/{UsedResources-jhsRMH4X.js → UsedResources-CgqRa9ei.js} +1 -1
  20. package/adminWww/assets/{Users-D9wyLyJ1.js → Users-0JVYWR9u.js} +1 -1
  21. package/adminWww/assets/{bootstrap-gVLo1K_2.js → bootstrap-D16lu6rd.js} +3 -3
  22. package/adminWww/assets/{hostInit-Dt_M-NAC.js → hostInit-C8YZJuzi.js} +1 -1
  23. package/adminWww/assets/{icons-material-DuVW_EUA.js → icons-material-CiNJ_6Ur.js} +1 -1
  24. package/adminWww/assets/{index-B1cnPkSO.js → index-DA9Sphgh.js} +2 -2
  25. package/adminWww/assets/{installSVGRenderer-GvgHjubR.js → installSVGRenderer-DPdkRa_d.js} +1 -1
  26. package/adminWww/assets/{mf-entry-bootstrap-0-6b32b635.js → mf-entry-bootstrap-0-a7ab91de.js} +2 -2
  27. package/adminWww/index.html +23 -23
  28. package/adminWww/mf-manifest.json +1 -1
  29. package/adminWww/mf-stats.json +1 -1
  30. package/adminWww/remoteEntry-eos-9.0.19.js +12 -0
  31. package/adminWww/remoteEntry.js +1 -1
  32. package/build/lib/eosCookieNamespace.js +12 -2
  33. package/build/lib/eosCookieNamespace.js.map +1 -1
  34. package/build/lib/eosDeviceEmsPlan.js +432 -24
  35. package/build/lib/eosDeviceEmsPlan.js.map +1 -1
  36. package/build/lib/eosDeviceEmsService.js +106 -10
  37. package/build/lib/eosDeviceEmsService.js.map +1 -1
  38. package/build/lib/eosModuleHost.js +178 -53
  39. package/build/lib/eosModuleHost.js.map +1 -1
  40. package/build/lib/web.js +19 -3
  41. package/build/lib/web.js.map +1 -1
  42. package/docs/reports/unified-9.0.19/ALIAS_MESSWERTFRISCHE.md +31 -0
  43. package/docs/reports/unified-9.0.19/COMMISSIONING_PLAN_REVIEW.md +56 -0
  44. package/docs/reports/unified-9.0.19/EMS_ABSCHLUSSREVIEW.md +43 -0
  45. package/docs/reports/unified-9.0.19/EMS_KATEGORIEN_ABDECKUNG.md +66 -0
  46. package/docs/reports/unified-9.0.19/EMS_VERGLEICH_UND_KOPPLUNG.md +25 -0
  47. package/docs/reports/unified-9.0.19/EVCS_STATE_OBJECTS.md +47 -0
  48. package/docs/reports/unified-9.0.19/GERAETE_EMS_EINRICHTUNG.md +100 -0
  49. package/docs/reports/unified-9.0.19/GERAETE_STARTAUSFALL.md +37 -0
  50. package/docs/reports/unified-9.0.19/INSTALLER_LIFECYCLE_REVIEW.md +59 -0
  51. package/docs/reports/unified-9.0.19/LEGACY_REGRESSION_REVIEW.md +42 -0
  52. package/docs/reports/unified-9.0.19/MODBUS_AUTHORIZATION_READS.md +25 -0
  53. package/docs/reports/unified-9.0.19/PRUEFBERICHT.md +56 -0
  54. package/docs/reports/unified-9.0.19/RUNTIME_START_UEBERNAHME.md +33 -0
  55. package/docs/reports/unified-9.0.19/SMA_RECEIVER_LIFECYCLE.md +42 -0
  56. package/docs/reports/unified-9.0.19/STATIC_REVIEW_DE.md +11 -0
  57. package/docs/reports/unified-9.0.19/TARIFF_PRICE_VALUES_REVIEW.md +31 -0
  58. package/docs/reports/unified-9.0.19/TARIF_VIERTELSTUNDEN_RUNTIME.md +17 -0
  59. package/docs/reports/unified-9.0.19/UNABHAENGIGER_REVIEW.md +49 -0
  60. package/docs/reports/unified-9.0.19/raw/INDEX.json +751 -0
  61. package/docs/reports/unified-9.0.19/raw/audit-full.log +345 -0
  62. package/docs/reports/unified-9.0.19/raw/audit-full.result.json +14 -0
  63. package/docs/reports/unified-9.0.19/raw/audit-runtime.log +23 -0
  64. package/docs/reports/unified-9.0.19/raw/audit-runtime.result.json +15 -0
  65. package/docs/reports/unified-9.0.19/raw/backend-final.log +5 -0
  66. package/docs/reports/unified-9.0.19/raw/backend-final.result.json +14 -0
  67. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.log +0 -0
  68. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.result.json +15 -0
  69. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.log +0 -0
  70. package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.result.json +15 -0
  71. package/docs/reports/unified-9.0.19/raw/devices-incident-build.log +5 -0
  72. package/docs/reports/unified-9.0.19/raw/devices-incident-host-final.log +70 -0
  73. package/docs/reports/unified-9.0.19/raw/devices-incident-lease-918-before.log +26 -0
  74. package/docs/reports/unified-9.0.19/raw/devices-incident-lease-after.log +9 -0
  75. package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-after.log +11 -0
  76. package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-before.log +28 -0
  77. package/docs/reports/unified-9.0.19/raw/devices-incident-web-pipeline.log +22 -0
  78. package/docs/reports/unified-9.0.19/raw/frontend-build.log +152 -0
  79. package/docs/reports/unified-9.0.19/raw/frontend-build.result.json +14 -0
  80. package/docs/reports/unified-9.0.19/raw/installer-build.log +26 -0
  81. package/docs/reports/unified-9.0.19/raw/installer-build.result.json +14 -0
  82. package/docs/reports/unified-9.0.19/raw/keygen-source.json +6 -0
  83. package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.log +6 -0
  84. package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.result.json +14 -0
  85. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.log +6 -0
  86. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.result.json +14 -0
  87. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.log +6 -0
  88. package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.result.json +14 -0
  89. package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.log +539 -0
  90. package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.result.json +14 -0
  91. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.log +6 -0
  92. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.result.json +14 -0
  93. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.log +6 -0
  94. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.result.json +14 -0
  95. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.log +6 -0
  96. package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.result.json +14 -0
  97. package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.log +6 -0
  98. package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.result.json +14 -0
  99. package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.log +2 -0
  100. package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.result.json +14 -0
  101. package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.log +6 -0
  102. package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.result.json +14 -0
  103. package/docs/reports/unified-9.0.19/raw/legacy-history-http.log +39 -0
  104. package/docs/reports/unified-9.0.19/raw/legacy-history-http.result.json +15 -0
  105. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.log +30 -0
  106. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.result.json +14 -0
  107. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.log +2 -0
  108. package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.result.json +14 -0
  109. package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.log +203 -0
  110. package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.result.json +14 -0
  111. package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.log +6 -0
  112. package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.result.json +14 -0
  113. package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.log +6 -0
  114. package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.result.json +14 -0
  115. package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.log +6 -0
  116. package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.result.json +14 -0
  117. package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.log +18 -0
  118. package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.result.json +14 -0
  119. package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.log +6 -0
  120. package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.result.json +14 -0
  121. package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.log +16 -0
  122. package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.result.json +14 -0
  123. package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.log +6 -0
  124. package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.result.json +14 -0
  125. package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.log +2 -0
  126. package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.result.json +14 -0
  127. package/docs/reports/unified-9.0.19/raw/legacy-test-loader.cjs +47 -0
  128. package/docs/reports/unified-9.0.19/raw/lint-final.log +16 -0
  129. package/docs/reports/unified-9.0.19/raw/lint-final.result.json +14 -0
  130. package/docs/reports/unified-9.0.19/raw/modules-build.log +5 -0
  131. package/docs/reports/unified-9.0.19/raw/modules-build.result.json +14 -0
  132. package/docs/reports/unified-9.0.19/raw/node22-tests-final.log +10719 -0
  133. package/docs/reports/unified-9.0.19/raw/node22-tests-final.result.json +13 -0
  134. package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.log +7 -0
  135. package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.result.json +14 -0
  136. package/docs/reports/unified-9.0.19/raw/node22-version.log +1 -0
  137. package/docs/reports/unified-9.0.19/raw/node24-tests-final.log +1805 -0
  138. package/docs/reports/unified-9.0.19/raw/node24-tests-final.result.json +13 -0
  139. package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.log +5 -0
  140. package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.result.json +14 -0
  141. package/docs/reports/unified-9.0.19/raw/node24-version.log +1 -0
  142. package/docs/reports/unified-9.0.19/raw/sbom-runtime.log +7 -0
  143. package/docs/reports/unified-9.0.19/raw/sbom-runtime.result.json +14 -0
  144. package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.log +1 -0
  145. package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.result.json +14 -0
  146. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.log +11 -0
  147. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.result.json +14 -0
  148. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.log +68 -0
  149. package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.result.json +14 -0
  150. package/docs/reports/unified-9.0.19/raw/ui-docs-check.log +6 -0
  151. package/docs/reports/unified-9.0.19/raw/ui-docs-check.result.json +14 -0
  152. package/docs/reports/unified-9.0.19/raw/ui-runtime-final.log +7 -0
  153. package/docs/reports/unified-9.0.19/raw/ui-runtime-final.result.json +14 -0
  154. package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.log +6 -0
  155. package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.result.json +14 -0
  156. package/docs/reports/unified-9.0.19/raw/ui-sbom-check.log +6 -0
  157. package/docs/reports/unified-9.0.19/raw/ui-sbom-check.result.json +14 -0
  158. package/docs/reports/unified-9.0.19/raw/ui-sbom-final.log +6 -0
  159. package/docs/reports/unified-9.0.19/raw/ui-sbom-final.result.json +14 -0
  160. package/docs/reports/unified-9.0.19/raw/ui-secret-final.log +6 -0
  161. package/docs/reports/unified-9.0.19/raw/ui-secret-final.result.json +14 -0
  162. package/docs/reports/unified-9.0.19/raw/ui-security-final.log +8 -0
  163. package/docs/reports/unified-9.0.19/raw/ui-security-final.result.json +14 -0
  164. package/io-package.json +8 -8
  165. package/modules/devices/admin/ems-assignment.d.ts +8 -2
  166. package/modules/devices/admin/ems-assignment.js +192 -30
  167. package/modules/devices/admin/host-bridge.js +36 -11
  168. package/modules/devices/admin/index.html +26 -5
  169. package/modules/devices/admin/index_m.js +87 -3
  170. package/modules/devices/admin/style.css +17 -4
  171. package/modules/devices/checks/emsAssignment.check.js +10 -6
  172. package/modules/devices/contracts.d.ts +1 -1
  173. package/modules/devices/index.js +54 -17
  174. package/modules/devices/lib/deviceAliasFreshness.js +65 -0
  175. package/modules/devices/lib/deviceRuntime.js +201 -127
  176. package/modules/devices/lib/drivers/modbus.js +18 -3
  177. package/modules/devices/lib/drivers/speedwire.js +42 -22
  178. package/modules/devices/test/deviceAliasFreshness.test.js +149 -0
  179. package/modules/devices/test/emsAssignmentUi.test.js +119 -11
  180. package/modules/devices/test/modbusAuthorizationReads.test.js +112 -0
  181. package/modules/devices/test/runtimeLiveness.test.js +1 -1
  182. package/modules/devices/test/speedwireLifecycle.test.js +118 -0
  183. package/modules/devices/tsconfig.alias-semantics.json +1 -1
  184. package/modules/devices/tsconfig.hosted.json +1 -1
  185. package/package.json +9 -7
  186. package/release-manifests/unified/build-environment.cdx.json +1483 -7370
  187. package/release-manifests/unified/files.json +295 -133
  188. package/release-manifests/unified/frontend.cdx.json +2688 -5952
  189. package/release-manifests/unified/installer.cdx.json +2053 -821
  190. package/release-manifests/unified/obsolete-admin-assets.json +88 -6
  191. package/release-manifests/unified/runtime.cdx.json +40 -3283
  192. package/release-manifests/unified/validation.json +15 -15
  193. package/tools/eos-release-manifest.cjs +3 -3
  194. package/ui/docs/security/eslint-reviewed-findings.json +20 -20
  195. package/ui/ems/engine.js +54 -7
  196. package/ui/ems/module-manager.js +44 -21
  197. package/ui/ems/modules/core-limits.js +5 -3
  198. package/ui/ems/modules/energy-wallet.js +31 -32
  199. package/ui/ems/modules/storage-control.js +5 -4
  200. package/ui/ems/modules/tarif-vis.js +36 -24
  201. package/ui/ems/modules/tariff-provider.js +28 -6
  202. package/ui/ems/services/tariff-provider-registry.js +11 -8
  203. package/ui/io-package.json +1 -1
  204. package/ui/lib/customer-tariff.js +5 -1
  205. package/ui/lib/installer-lifecycle.js +134 -1
  206. package/ui/lib/storage-farm-overview.js +115 -0
  207. package/ui/lib/tariff-price.js +115 -0
  208. package/ui/main.js +202 -51
  209. package/ui/package.json +8 -2
  210. package/ui/www/app.js +47 -134
  211. package/ui/www/ems-apps.html +2 -0
  212. package/ui/www/ems-apps.js +14 -2
  213. package/ui/www/index.html +2 -0
  214. package/ui/www/licenses/smarthome-markdown-components.json +156 -156
  215. package/ui/www/manifest.webmanifest +2 -2
  216. package/ui/www/power-measurements.js +62 -0
  217. package/ui/www/settings.html +2 -0
  218. package/ui/www/storagefarm-summary.css +17 -0
  219. package/ui/www/storagefarm-summary.js +136 -0
  220. package/ui/www/storagefarm.html +16 -1
  221. package/ui/www/storagefarm.js +10 -22
  222. package/ui/www/tariff-display.js +161 -0
  223. package/adminWww/remoteEntry-eos-9.0.18.js +0 -12
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright (c) 2026 NexoWatt. All rights reserved.
3
+ * Confidential and Proprietary.
4
+ * Use, modification or distribution without express written permission is prohibited.
5
+ */
6
+ /**
7
+ * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
8
+ *
9
+ * Quelle: src-ts/runtime-executables/lib/storage-farm-overview.ts
10
+ * Quell-Hash: sha256:986c2eaeb7ce486a4360bbe18dc61a3661f1df228174984453a53e9d6e385804
11
+ * Erzeugung: npm run sync:ts-runtime-executables
12
+ *
13
+ * Zweck:
14
+ * Diese JavaScript-Datei ist das ausführbare Build-Artefakt für lib/storage-farm-overview.js.
15
+ * Die fachliche Bearbeitung erfolgt ab 0.7.131 in der TypeScript-Quelle.
16
+ * Ab 0.7.132 sind doppelte Legacy-JS-Bäume wie .nwcore entfernt.
17
+ *
18
+ * Pflege-Regel:
19
+ * 1. Änderung zuerst in src-ts/runtime-executables/ vornehmen.
20
+ * 2. npm run sync:ts-runtime-executables ausführen.
21
+ * 3. npm run test:runtime-executables prüfen.
22
+ */
23
+ "use strict";
24
+ /**
25
+ * NexoWatt Quellcode-Erklärung (DE)
26
+ * Aufgabe: Bildet eine gemeinsame, lesende Farmübersicht aus frischen Messproben
27
+ * und der bekannten Nennkapazität ihrer aktiv konfigurierten Mitglieder.
28
+ * Daten und Wirkung: Unvollständige Leistungssummen bleiben null; gültige SoCs
29
+ * liefern einen ausdrücklich als Teilmittel gekennzeichneten arithmetischen Mittelwert.
30
+ * Zusammenhang: main.ts liefert bereits normalisierte, frisch geprüfte Proben.
31
+ * Diese Anzeige ändert weder alte Regler-SoCs noch Limits, Freigaben oder Sollwerte.
32
+ * Bei Änderungen: Gegenläufige Batterieflüsse, Offline-Mitglieder, fehlende
33
+ * Kapazitäten, doppelte Quellen und echte Nullwerte getrennt prüfen.
34
+ */
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildFarmOverview = buildFarmOverview;
37
+ function finite(value) { return typeof value === 'number' && Number.isFinite(value); }
38
+ function rounded(value, digits = 0) {
39
+ const factor = 10 ** digits;
40
+ return Math.round(value * factor) / factor;
41
+ }
42
+ function coverage(valid, total) { return { valid, total, complete: total > 0 && valid === total }; }
43
+ /** Conflicting duplicate member readings invalidate that metric instead of silently picking one. */
44
+ function commonSample(a, b) { return a === b ? a : null; }
45
+ function buildFarmOverview(members, sources, updatedAt) {
46
+ const unique = new Map();
47
+ for (const row of members) {
48
+ const normalized = {
49
+ key: row.key,
50
+ fresh: row.fresh === true,
51
+ batteryPowerW: row.fresh && finite(row.batteryPowerW) ? row.batteryPowerW : null,
52
+ socPct: finite(row.socPct) && row.socPct >= 0 && row.socPct <= 100 ? row.socPct : null,
53
+ capacityKWh: finite(row.capacityKWh) && row.capacityKWh > 0 ? row.capacityKWh : null,
54
+ };
55
+ const previous = unique.get(row.key);
56
+ unique.set(row.key, previous ? {
57
+ key: row.key, fresh: previous.fresh && normalized.fresh,
58
+ batteryPowerW: commonSample(previous.batteryPowerW, normalized.batteryPowerW),
59
+ socPct: commonSample(previous.socPct, normalized.socPct),
60
+ capacityKWh: commonSample(previous.capacityKWh, normalized.capacityKWh),
61
+ } : normalized);
62
+ }
63
+ let fresh = 0;
64
+ let batteryValid = 0;
65
+ let socValid = 0;
66
+ let capacityValid = 0;
67
+ let net = 0;
68
+ let charge = 0;
69
+ let discharge = 0;
70
+ let soc = 0;
71
+ let capacity = 0;
72
+ for (const row of unique.values()) {
73
+ if (row.fresh)
74
+ fresh++;
75
+ if (row.batteryPowerW !== null) {
76
+ batteryValid++;
77
+ net += row.batteryPowerW;
78
+ charge += Math.max(0, -row.batteryPowerW);
79
+ discharge += Math.max(0, row.batteryPowerW);
80
+ }
81
+ if (row.socPct !== null) {
82
+ socValid++;
83
+ soc += row.socPct;
84
+ }
85
+ if (row.capacityKWh !== null) {
86
+ capacityValid++;
87
+ capacity += row.capacityKWh;
88
+ }
89
+ }
90
+ const pvSources = new Map();
91
+ for (const row of sources) {
92
+ const value = finite(row.powerW) && row.powerW >= 0 ? row.powerW : null;
93
+ const previous = pvSources.get(row.key);
94
+ pvSources.set(row.key, previous === undefined ? value : commonSample(previous, value));
95
+ }
96
+ let pvValid = 0;
97
+ let pv = 0;
98
+ for (const value of pvSources.values())
99
+ if (value !== null) {
100
+ pvValid++;
101
+ pv += value;
102
+ }
103
+ const batteryCoverage = coverage(batteryValid, unique.size);
104
+ const capacityCoverage = coverage(capacityValid, unique.size);
105
+ const pvCoverage = coverage(pvValid, pvSources.size);
106
+ return {
107
+ v: 1, updatedAt, members: { total: unique.size, fresh },
108
+ battery: { ...batteryCoverage, netW: batteryCoverage.complete ? rounded(net) : null,
109
+ chargeW: batteryCoverage.complete ? rounded(charge) : null, dischargeW: batteryCoverage.complete ? rounded(discharge) : null },
110
+ soc: { ...coverage(socValid, unique.size), meanPct: socValid > 0 ? rounded(soc / socValid, 1) : null },
111
+ capacity: { ...capacityCoverage, totalKWh: capacityCoverage.complete ? rounded(capacity, 3) : null,
112
+ knownKWh: capacityValid > 0 ? rounded(capacity, 3) : null },
113
+ pv: { ...pvCoverage, powerW: pvCoverage.complete ? rounded(pv) : null },
114
+ };
115
+ }
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright (c) 2026 NexoWatt. All rights reserved.
3
+ * Confidential and Proprietary.
4
+ * Use, modification or distribution without express written permission is prohibited.
5
+ */
6
+ /**
7
+ * AUTO-GENERATED RUNTIME FILE - NICHT MANUELL BEARBEITEN.
8
+ *
9
+ * Quelle: src-ts/runtime-executables/lib/tariff-price.ts
10
+ * Quell-Hash: sha256:f63d79cc09008466c3c249f46ded3d5bc5fbe5cde028b5cba255f8d0297af485
11
+ * Erzeugung: npm run sync:ts-runtime-executables
12
+ *
13
+ * Zweck:
14
+ * Diese JavaScript-Datei ist das ausführbare Build-Artefakt für lib/tariff-price.js.
15
+ * Die fachliche Bearbeitung erfolgt ab 0.7.131 in der TypeScript-Quelle.
16
+ * Ab 0.7.132 sind doppelte Legacy-JS-Bäume wie .nwcore entfernt.
17
+ *
18
+ * Pflege-Regel:
19
+ * 1. Änderung zuerst in src-ts/runtime-executables/ vornehmen.
20
+ * 2. npm run sync:ts-runtime-executables ausführen.
21
+ * 3. npm run test:runtime-executables prüfen.
22
+ */
23
+ "use strict";
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.tariffPriceNumber = tariffPriceNumber;
26
+ exports.tariffPriceUnit = tariffPriceUnit;
27
+ exports.normalizeTariffPrice = normalizeTariffPrice;
28
+ exports.readTariffPriceState = readTariffPriceState;
29
+ exports.tariffDisplayConfig = tariffDisplayConfig;
30
+ /**
31
+ * NexoWatt Quellcode-Erklärung (DE)
32
+ * Aufgabe: Unterscheidet echte Tarifpreise einschließlich 0 und negativer Preise
33
+ * von fehlenden Werten, Statusflags und ungültigen Zahlen.
34
+ * Daten und Wirkung: Liest ausschließlich numerische Preisproben. Keine Umrechnung,
35
+ * Betriebsfreigabe, Konfigurationsänderung oder automatische Preisannahme.
36
+ * Zusammenhang: Wallet und der gezielte Tarifpreis-Leser im Core-Budget verwenden
37
+ * denselben Vertrag; andere Messgrößen und ihre bisherigen Leser bleiben unverändert.
38
+ * Bei Änderungen: null/leer/boolean, echte 0, negative Preise und IO-Fehler prüfen.
39
+ */
40
+ function tariffPriceNumber(value) {
41
+ if (typeof value !== 'number' && typeof value !== 'string')
42
+ return null;
43
+ if (typeof value === 'string' && value.trim() === '')
44
+ return null;
45
+ const parsed = Number(value);
46
+ return Number.isFinite(parsed) ? parsed : null;
47
+ }
48
+ /** Nur explizite Preis-Einheiten; ohne Vertrag bleibt der bisherige Auto-Pfad. */
49
+ function tariffPriceUnit(value) {
50
+ const unit = typeof value === 'string' ? value.trim().toLowerCase().replace(/\s+/g, '') : '';
51
+ if (unit === 'eur/kwh' || unit === '€/kwh')
52
+ return 'EUR/kWh';
53
+ if (unit === 'ct/kwh' || unit === 'cent/kwh' || unit === 'cents/kwh')
54
+ return 'ct/kWh';
55
+ if (unit === 'eur/mwh' || unit === '€/mwh')
56
+ return 'EUR/MWh';
57
+ return 'auto';
58
+ }
59
+ /** Bekannte Einheiten deterministisch umrechnen; EUR nicht erneut nach Größe deuten. */
60
+ function normalizeTariffPrice(value, unit) {
61
+ let price = tariffPriceNumber(value);
62
+ if (price === null)
63
+ return null;
64
+ if (unit === 'ct/kWh')
65
+ price /= 100;
66
+ else if (unit === 'EUR/MWh')
67
+ price /= 1000;
68
+ else if (unit === 'auto' && Math.abs(price) > 2 && Math.abs(price) <= 500)
69
+ price /= 100;
70
+ // Gleiche Grenze wie die geprüfte Provider-Normalisierung. Legacy-Auto bleibt ±2.
71
+ const limit = unit === 'auto' ? 2 : 100;
72
+ return Number.isFinite(price) && Math.abs(price) <= limit ? price : null;
73
+ }
74
+ async function readTariffPriceState(adapter, id) {
75
+ try {
76
+ const state = await adapter.getStateAsync(id);
77
+ if (state === null || typeof state !== 'object' || Array.isArray(state))
78
+ return null;
79
+ const quality = Reflect.get(state, 'q');
80
+ if (quality !== undefined && quality !== 0)
81
+ return null;
82
+ const value = Reflect.get(state, 'val');
83
+ return tariffPriceNumber(value);
84
+ }
85
+ catch {
86
+ return null;
87
+ }
88
+ }
89
+ /** Public source/unit metadata carries no object paths, endpoints or credentials. */
90
+ function tariffDisplayConfig(value, namespace) {
91
+ const rec = (item) => item !== null && typeof item === 'object' && !Array.isArray(item) ? item : {};
92
+ const root = rec(value);
93
+ const points = rec(root.datapoints);
94
+ const legacy = rec(root.vis);
95
+ const units = rec(root.units);
96
+ const source = (id, fallback, suffix) => {
97
+ const selected = typeof id === 'string' && id.trim() ? id.trim() : typeof fallback === 'string' ? fallback.trim() : '';
98
+ return selected === `${namespace}.tariffProvider.${suffix}` ? 'provider' : selected ? 'mapped' : 'none';
99
+ };
100
+ const currentSource = source(points.priceCurrent, legacy.priceCurrentId, 'currentPriceEurPerKwh');
101
+ const averageSource = source(points.priceAverage, legacy.priceAverageId, 'averagePriceEurPerKwh');
102
+ const unit = (raw, src) => {
103
+ if (src === 'provider')
104
+ return 'EUR/kWh';
105
+ const clean = typeof raw === 'string' ? raw.trim().toLowerCase() : '';
106
+ if (['eur/kwh', '€/kwh'].includes(clean))
107
+ return 'EUR/kWh';
108
+ if (['ct/kwh', 'cent/kwh', 'cents/kwh'].includes(clean))
109
+ return 'ct/kWh';
110
+ if (['eur/mwh', '€/mwh'].includes(clean))
111
+ return 'EUR/MWh';
112
+ return 'auto';
113
+ };
114
+ return { currentSource, averageSource, currentUnit: unit(units.priceCurrent, currentSource), averageUnit: unit(units.priceAverage, averageSource) };
115
+ }