iobroker.eos-admin 9.0.19 → 9.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +4 -4
- package/README.md +7 -3
- package/START_HIER_9.0.20.md +65 -0
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +110 -109
- package/adminWww/assets/{AdapterUpdateDialog-JOf2z4Vg.js → AdapterUpdateDialog-Dxl_b7Op.js} +1 -1
- package/adminWww/assets/{Adapters-C9fcSdWm.js → Adapters-CVKKhXmI.js} +1 -1
- package/adminWww/assets/{ConfigManager-BeeLlT6D.js → ConfigManager-Bf6nTAkL.js} +1 -1
- package/adminWww/assets/{Enums-FqnXWl8U.js → Enums-CJHVJY7t.js} +1 -1
- package/adminWww/assets/{Fields-DMgrt5Pi.js → Fields-DWHbZKvm.js} +1 -1
- package/adminWww/assets/{Files-CIHtt12g.js → Files-a6owMTXA.js} +1 -1
- package/adminWww/assets/{Hosts-fPLBzvTy.js → Hosts-LtEMeXpV.js} +1 -1
- package/adminWww/assets/{Instances-4XaVQlrT.js → Instances-DhChziA1.js} +1 -1
- package/adminWww/assets/{Intro-5TKriiLO.js → Intro-Cyq9gVDC.js} +1 -1
- package/adminWww/assets/{Logs-33zcIds-.js → Logs-wcramXsg.js} +1 -1
- package/adminWww/assets/{Objects-CNQPVbNG.js → Objects-DINVHd_e.js} +1 -1
- package/adminWww/assets/{Overview-BskXGOc8.js → Overview-DK4R41zR.js} +1 -1
- package/adminWww/assets/{State-C8SJ_Iqo.js → State-DcEACXzL.js} +1 -1
- package/adminWww/assets/{UsedResources-CgqRa9ei.js → UsedResources-C1LcM0Rb.js} +1 -1
- package/adminWww/assets/{Users-0JVYWR9u.js → Users-DvDdSyDY.js} +1 -1
- package/adminWww/assets/{bootstrap-D16lu6rd.js → bootstrap-Dbj_GbnP.js} +3 -3
- package/adminWww/assets/{hostInit-C8YZJuzi.js → hostInit-BNFIx0-f.js} +1 -1
- package/adminWww/assets/icons/nexowatt-180.png +0 -0
- package/adminWww/assets/{icons-material-CiNJ_6Ur.js → icons-material-DVbdXNgr.js} +1 -1
- package/adminWww/assets/{index-DA9Sphgh.js → index-CoKP1NSA.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-DPdkRa_d.js → installSVGRenderer-CMvku1F1.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-a7ab91de.js → mf-entry-bootstrap-0-ac330bce.js} +2 -2
- package/adminWww/index.html +24 -24
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-9.0.19.js → remoteEntry-eos-9.0.21.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosCustomerUpdateHttp.js +203 -0
- package/build/lib/eosCustomerUpdateHttp.js.map +1 -0
- package/build/lib/eosCustomerUpdateTransport.js +472 -0
- package/build/lib/eosCustomerUpdateTransport.js.map +1 -0
- package/build/lib/eosCustomerUpdateWorker.js +567 -0
- package/build/lib/eosCustomerUpdateWorker.js.map +1 -0
- package/build/lib/eosCustomerUpdates.js +631 -0
- package/build/lib/eosCustomerUpdates.js.map +1 -0
- package/build/lib/eosDeviceEmsPlan.js +18 -5
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosDeviceEmsService.js +52 -2
- package/build/lib/eosDeviceEmsService.js.map +1 -1
- package/build/lib/eosLegacyMigration.js +26 -1
- package/build/lib/eosLegacyMigration.js.map +1 -1
- package/build/lib/eosModuleConfigStore.js +12 -1
- package/build/lib/eosModuleConfigStore.js.map +1 -1
- package/build/lib/eosModuleHost.js +81 -26
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +8 -2
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/eosStateSubscriptions.js +59 -2
- package/build/lib/eosStateSubscriptions.js.map +1 -1
- package/build/lib/eosUpdateSnapshot.js +290 -0
- package/build/lib/eosUpdateSnapshot.js.map +1 -0
- package/build/lib/eosUploadGuard.js +124 -81
- package/build/lib/eosUploadGuard.js.map +1 -1
- package/build/lib/web.js +83 -0
- package/build/lib/web.js.map +1 -1
- package/docs/reports/unified-9.0.20/ANFORDERUNGEN_UND_INBETRIEBNAHME.md +159 -0
- package/docs/reports/unified-9.0.20/DEVICE_COMMAND_DELIVERY_REVIEW.md +82 -0
- package/docs/reports/unified-9.0.20/DEVICE_LIFECYCLE_REVIEW.md +46 -0
- package/docs/reports/unified-9.0.20/DEVICE_PLAN_REVIEW.md +33 -0
- package/docs/reports/unified-9.0.20/DEVICE_POWER_CAPABILITY_REVIEW.md +25 -0
- package/docs/reports/unified-9.0.20/FARM_CONTROLLER_REVIEW.md +27 -0
- package/docs/reports/unified-9.0.20/FARM_DIAGNOSE_UI.md +81 -0
- package/docs/reports/unified-9.0.20/FARM_DISPATCH_REVIEW.md +47 -0
- package/docs/reports/unified-9.0.20/HISTORY_REVIEW.md +68 -0
- package/docs/reports/unified-9.0.20/INFLUXDB2_INSTALLER_UI.md +39 -0
- package/docs/reports/unified-9.0.20/INFLUX_CREDENTIAL_NETWORK_REVIEW.md +38 -0
- package/docs/reports/unified-9.0.20/INFLUX_DIRECT_UNABHAENGIGE_PRUEFUNG.md +64 -0
- package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_INTEGRATION_REVIEW.md +53 -0
- package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_UNABHAENGIGE_PRUEFUNG.md +34 -0
- package/docs/reports/unified-9.0.20/INFLUX_TRANSPORT_ABSCHLUSSPRUEFUNG.md +55 -0
- package/docs/reports/unified-9.0.20/LOGIN_WEBAPP_LOGO.md +29 -0
- package/docs/reports/unified-9.0.20/MIGRATION_REVIEW.md +35 -0
- package/docs/reports/unified-9.0.20/PRUEFBERICHT.md +54 -0
- package/docs/reports/unified-9.0.20/PWA_ANONYMOUS_HTTPS_REVIEW.md +28 -0
- package/docs/reports/unified-9.0.20/PWA_ICON_UNABHAENGIGE_PRUEFUNG.md +60 -0
- package/docs/reports/unified-9.0.20/SERIAL_LIFECYCLE_REVIEW.md +37 -0
- package/docs/reports/unified-9.0.20/SOLAX_READBACK_REVIEW.md +43 -0
- package/docs/reports/unified-9.0.20/SOLAX_READBACK_UNABHAENGIGE_PRUEFUNG.md +34 -0
- package/docs/reports/unified-9.0.20/STATIC_REVIEW_DE.md +175 -0
- package/docs/reports/unified-9.0.20/STORAGE_COMMAND_ACK_REVIEW.md +36 -0
- package/docs/reports/unified-9.0.20/TARIFF_REPORT_REVIEW.md +29 -0
- package/docs/reports/unified-9.0.20/VISUALISIERUNG.md +64 -0
- package/docs/reports/unified-9.0.20/history-setup-navigation-proxy.txt +26 -0
- package/docs/reports/unified-9.0.20/history-setup-navigation-ssr.txt +7 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-node22.txt +102 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-node24.txt +23 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-security.txt +0 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-hashes.txt +9 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-node22.txt +42 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-node24.txt +13 -0
- package/docs/reports/unified-9.0.20/raw/INDEX.json +1913 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node22.log +16 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node24.log +14 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-after.json +1 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-before.json +1 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/modbus-stop-backoff.cjs +22 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-control-review.log +29 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.log +325 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-review.log +278 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.log +58 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-review.log +51 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-gaps-before.log +64 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-negative-before.log +46 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/chart-gaps-before.log +127 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-after.log +67 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-before.log +61 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-js.log +0 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-ts.log +0 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node22.log +442 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node24.log +78 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/fix.py +73 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-eslint-final.json +7 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node22.log +279 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node24.log +52 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node22.log +223 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node24.log +43 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-own-cache.log +17 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/negative-pricing-before.log +96 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-after.log +66 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-repro.log +8 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-after.log +17 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-repro.log +8 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/repro.cjs +39 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/chromium-probe.log +3 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/patch-live.py +101 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.cjs +26 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.log +36 -0
- package/docs/reports/unified-9.0.20/raw/audit-full.log +345 -0
- package/docs/reports/unified-9.0.20/raw/audit-full.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/audit-runtime.log +23 -0
- package/docs/reports/unified-9.0.20/raw/audit-runtime.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/backend-final.log +5 -0
- package/docs/reports/unified-9.0.20/raw/backend-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.result.json +20 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.tap +721 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.result.json +20 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.tap +127 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-evidence.json +69 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-failed-init-drain-919-before.log +14 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-final-node22.log +882 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-final-node24.log +149 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-planner-919-before.log +70 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-retained-readiness-before.log +34 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-runtime-retry-919-before.log +46 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-types-node24.log +0 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/DEVICE_FARM_READONLY_REVIEW.md +66 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/run-readback-tests.cjs +13 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/solax-control-chain.test.cjs +58 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node22.log +16 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node24.log +14 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-evidence.json +55 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-after.json +1 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-before.json +1 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-modbus-stop-backoff.cjs +22 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-control-review.log +29 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.log +325 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-review.log +278 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.log +58 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-review.log +51 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.log +0 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.log +0 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node22.log +110 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node24.log +24 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/evidence.json +33 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node22.txt +113 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node24.txt +26 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-security.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/allocator-baseline.jsonl +6 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-before.log +138 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-delta.patch +77 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-lint.json +7 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.log +64 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.log +18 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/final-ui-independent-review.json +194 -0
- package/docs/reports/unified-9.0.20/raw/frontend-build.log +152 -0
- package/docs/reports/unified-9.0.20/raw/frontend-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.json +35 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.json +31 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-before.json +31 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-reproducer.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.tap +34 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.tap +11 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/node22-focused.log +165 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/node24-focused.log +35 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/review-receipt.json +57 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-after.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-before.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response.cjs +16 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race-generation-guard.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race.cjs +13 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/eslint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/node24.log +24 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/hosted-module-history.test.cjs +85 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.log +100 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.log +21 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-after.test.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-loss-before.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/security-scan.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.log +227 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.result.json +11 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.log +44 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.result.json +11 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node22.result.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node24.log +23 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node24.result.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/runtime-after.test.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/evidence.json +24 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node22.log +326 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node24.log +59 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node22.log +62 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node24.log +16 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.log +106 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/source-sha256.json +5 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.log +124 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.log +26 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-final.json +285 -0
- package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-intermediate.json +285 -0
- package/docs/reports/unified-9.0.20/raw/installer-build.log +26 -0
- package/docs/reports/unified-9.0.20/raw/installer-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/INDEX.json +332 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.log +6 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.log +296 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.log +56 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.log +54 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.log +332 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.log +62 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.log +342 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.log +72 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.log +482 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.result.json +19 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node24.log +87 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.log +330 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.log +72 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.log +60 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-migration-start-budget.cjs +49 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-serial-release.cjs +21 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-sunspec-discovery.cjs +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.log +32 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.result.json +28 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.log +2 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.result.json +26 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.log +344 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.log +62 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/keygen-source.json +6 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-919.log +70 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-920.log +71 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/diff.json +82 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/receipt.json +48 -0
- package/docs/reports/unified-9.0.20/raw/lint-final.log +16 -0
- package/docs/reports/unified-9.0.20/raw/lint-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-cache-boundary-fix.json +112 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-capability-ack.json +103 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-farm-diagnostics.json +102 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-final.json +103 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review.json +93 -0
- package/docs/reports/unified-9.0.20/raw/modules-build.log +5 -0
- package/docs/reports/unified-9.0.20/raw/modules-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node22-tests-final.log +12471 -0
- package/docs/reports/unified-9.0.20/raw/node22-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.log +7 -0
- package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.20/raw/node24-tests-final.log +2093 -0
- package/docs/reports/unified-9.0.20/raw/node24-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/evidence.json +69 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-existing-regressions-node24.log +94 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node22.log +304 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node24.log +56 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/evidence.json +45 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node22-build.log +21 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node22-source.log +23 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node24-build.log +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node24-source.log +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-boundaries.test.cjs +45 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-receipt.json +71 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v22.23.4.tap +34 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v24.22.3.tap +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-ui-independent-review-final.json +348 -0
- package/docs/reports/unified-9.0.20/raw/repro-failed-init-drain-before.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/repro-profile-replacement-after-unmapped.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/repro-runtime-retry-before.cjs +18 -0
- package/docs/reports/unified-9.0.20/raw/sbom-runtime.log +7 -0
- package/docs/reports/unified-9.0.20/raw/sbom-runtime.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.log +1 -0
- package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node22.json +30 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node22.log +542 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node24.json +30 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node24.log +97 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-before.log +147 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-evidence.json +48 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-final-node22.log +151 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-final-node24.log +32 -0
- package/docs/reports/unified-9.0.20/raw/ui-docs-check.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-docs-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-final.log +7 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-check.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-final.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-secret-final.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-secret-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-security-final.log +8 -0
- package/docs/reports/unified-9.0.20/raw/ui-security-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/visuals-baseline-919.txt +36 -0
- package/docs/reports/unified-9.0.20/raw/visuals-browser-limit.txt +3 -0
- package/docs/reports/unified-9.0.20/raw/visuals-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/visuals-node22.txt +258 -0
- package/docs/reports/unified-9.0.20/raw/visuals-node24.txt +51 -0
- package/docs/reports/unified-9.0.20/raw/visuals-security.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/visuals-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.log +19 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.log +31 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.tap +10 -0
- package/io-package.json +12 -12
- package/modules/backup/admin/index.js +4 -1
- package/modules/devices/admin/host-bridge.js +5 -1
- package/modules/devices/lib/device-alias-semantics-v1.json +22 -1
- package/modules/devices/lib/deviceAliasFreshness.js +1 -0
- package/modules/devices/lib/deviceAliasSemantics.js +13 -3
- package/modules/devices/lib/deviceRuntime.js +106 -12
- package/modules/devices/lib/drivers/modbus.js +90 -21
- package/modules/devices/lib/drivers/modbusAsciiBus.js +47 -31
- package/modules/devices/lib/drivers/modbusRtuBus.js +33 -9
- package/modules/devices/lib/drivers/modbusSerialLease.js +29 -0
- package/modules/devices/lib/drivers/mqtt.js +204 -82
- package/modules/devices/lib/drivers/mqttPendingOperations.js +119 -0
- package/modules/devices/lib/modbusReadEvidence.js +29 -0
- package/modules/devices/test/deviceAliasFreshness.test.js +7 -2
- package/modules/devices/test/modbusConnectLifecycle.test.js +148 -0
- package/modules/devices/test/modbusSerialLifecycle.test.js +91 -0
- package/modules/devices/test/mqttCommandLifecycle.test.js +255 -0
- package/modules/devices/test/mqttResourceBounds.test.js +98 -0
- package/modules/devices/test/mqttRuntimeSession.test.js +109 -0
- package/modules/devices/test/serialOperationGate.test.js +3 -3
- package/modules/devices/test/solaxReadbackContext.test.js +472 -0
- package/modules/devices/tsconfig.alias-semantics.json +1 -1
- package/modules/devices/tsconfig.mqtt-lifecycle.json +20 -0
- package/modules/devices/tsconfig.serial-lifecycle.json +18 -0
- package/modules/eebus/admin/index.js +6 -3
- package/package.json +9 -7
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +848 -169
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +154 -6
- package/release-manifests/unified/runtime.cdx.json +25 -25
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-check.cjs +2 -2
- package/tools/eos-release-manifest.cjs +3 -3
- package/ui/admin/react/assets/index-BJO3q7oe.js +13 -0
- package/ui/admin/react/assets/{index-CuquHlsY.css → index-ofLP_Y7y.css} +1 -1
- package/ui/admin/react/index.html +2 -2
- package/ui/docs/security/eslint-reviewed-findings.json +91 -35
- package/ui/ems/engine.js +14 -3
- package/ui/ems/modules/energy-wallet.js +9 -3
- package/ui/ems/modules/storage-control.js +60 -19
- package/ui/ems/modules/tariff-provider.js +34 -10
- package/ui/ems/services/tariff-provider-registry.js +18 -8
- package/ui/io-package.json +1 -1
- package/ui/lib/influx-config.js +204 -0
- package/ui/lib/influx-direct.js +527 -0
- package/ui/lib/influx-history-runtime.js +326 -0
- package/ui/lib/influx-network-policy.js +112 -0
- package/ui/lib/ui-access-policy.js +2 -2
- package/ui/main.js +614 -255
- package/ui/package.json +12 -6
- package/ui/www/app.js +152 -203
- package/ui/www/ems-apps.html +2 -1
- package/ui/www/ems-apps.js +8 -1
- package/ui/www/energy-ledger.html +1 -1
- package/ui/www/eos-updates.css +15 -0
- package/ui/www/eos-updates.js +351 -0
- package/ui/www/evcs.html +1 -1
- package/ui/www/history.html +1 -1
- package/ui/www/history.js +114 -74
- package/ui/www/index.html +4 -1
- package/ui/www/live-display.js +115 -0
- package/ui/www/logic.html +1 -1
- package/ui/www/login.css +1 -0
- package/ui/www/login.html +2 -1
- package/ui/www/manifest.webmanifest +3 -3
- package/ui/www/settings.html +36 -1
- package/ui/www/simulation.html +1 -1
- package/ui/www/smarthome-config.html +1 -1
- package/ui/www/smarthome.html +1 -1
- package/ui/www/storagefarm-dispatch.js +287 -0
- package/ui/www/storagefarm-summary.css +15 -0
- package/ui/www/storagefarm.html +15 -1
- package/ui/www/storagefarm.js +8 -26
- package/ui/www/tariff-report.js +43 -25
- package/ui/admin/react/assets/index-Bq5IupDw.js +0 -13
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:
|
|
10
|
+
* Quell-Hash: sha256:f61d808e29a1884d6fe6d80783d784beef53f7053fedd14fd49a0b661e04dd52
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -54,10 +54,13 @@ const os = require('os');
|
|
|
54
54
|
// JSON bleibt unkomprimiert: inflate:false verhindert Dekompressionsfehler auch mit älteren ioBroker-Abhängigkeitsbäumen.
|
|
55
55
|
const bodyParser = express.json({ limit: '5mb', inflate: false });
|
|
56
56
|
const crypto = require('crypto');
|
|
57
|
-
const { installerRevision, assertInstallerRevision, provisionInstallerObjects, assertDeviceAppActivations, numericMeasurement, activeDeviceProfileReferences } = require('./lib/installer-lifecycle');
|
|
57
|
+
const { installerRevision, assertInstallerRevision, provisionInstallerObjects, assertDeviceAppActivations, numericMeasurement, activeDeviceProfileReferences, awaitEmsTransition } = require('./lib/installer-lifecycle');
|
|
58
58
|
const { buildFarmOverview } = require('./lib/storage-farm-overview');
|
|
59
|
-
const { tariffDisplayConfig } = require('./lib/tariff-price');
|
|
59
|
+
const { tariffDisplayConfig, tariffPriceNumber } = require('./lib/tariff-price');
|
|
60
60
|
const { customerTariffView, prepareCustomerTariffChange } = require('./lib/customer-tariff');
|
|
61
|
+
const { InfluxDirectClient } = require('./lib/influx-direct');
|
|
62
|
+
const { InfluxHistoryRuntime } = require('./lib/influx-history-runtime');
|
|
63
|
+
const { prepareInfluxHistoryChange, protectInfluxHistoryConfig, restoreInfluxHistoryConfig, redactInfluxHistoryConfig } = require('./lib/influx-config');
|
|
61
64
|
const https = require('https');
|
|
62
65
|
const pkg = require('./package.json');
|
|
63
66
|
const { defaultEnergyOriginConfig, registerEnergyOriginApi } = require('./lib/energy-origin-api');
|
|
@@ -391,6 +394,16 @@ class NexoWattVis extends HostedAdapter {
|
|
|
391
394
|
// responsive and avoids unnecessary InfluxDB round-trips.
|
|
392
395
|
this._nwHistoryApiCache = new EphemeralMap(5000, 4);
|
|
393
396
|
this._nwHistoryApiInflight = new Map();
|
|
397
|
+
this._nwDirectHistory = new InfluxHistoryRuntime(this.namespace);
|
|
398
|
+
// Only fulfilled ioBroker writes may enter the historian. Capture the event's
|
|
399
|
+
// timestamp before awaiting persistence; never await network I/O in an EMS tick.
|
|
400
|
+
const writeHistoryState = this.setStateAsync.bind(this);
|
|
401
|
+
this.setStateAsync = async (...args) => {
|
|
402
|
+
const captured = this._nwDirectHistory.capture(args[0], args[1], args[2]);
|
|
403
|
+
const result = await writeHistoryState(...args);
|
|
404
|
+
if (!isActuatorAuthorityBlockedResult(result)) this._nwDirectHistory.commit(captured);
|
|
405
|
+
return result;
|
|
406
|
+
};
|
|
394
407
|
this._nwShcfgDetectCache = new EphemeralMap(30000, 1);
|
|
395
408
|
this._nwTypeDetectorObjectsCache = null;
|
|
396
409
|
|
|
@@ -3355,6 +3368,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
3355
3368
|
'settingsConfig',
|
|
3356
3369
|
'datapoints',
|
|
3357
3370
|
'installerConfig',
|
|
3371
|
+
'history',
|
|
3358
3372
|
'eosDeviceEms', // Server-owned commissioning identities survive updates and app changes.
|
|
3359
3373
|
'countryProfile',
|
|
3360
3374
|
'emsApps',
|
|
@@ -4700,7 +4714,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
4700
4714
|
this._partnerRuntime = new PartnerRuntime({
|
|
4701
4715
|
getRoot: () => this.config || {},
|
|
4702
4716
|
isAppActive: (appId) => this._nwPartnerAppActive(appId),
|
|
4703
|
-
controlAvailable: () =>
|
|
4717
|
+
controlAvailable: () => this._nwIsEmsReady() && this._nwPartnerAppActive('arbitrage'),
|
|
4704
4718
|
isResourceAvailable: (resourceId) => {
|
|
4705
4719
|
const availability = this._nwPartnerResourceAvailability?.[resourceId];
|
|
4706
4720
|
const now = Date.now();
|
|
@@ -4774,6 +4788,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
4774
4788
|
|
|
4775
4789
|
// Neue Laufzeitfelder werden ausschließlich im Speicher ergänzt. Ein normales
|
|
4776
4790
|
// Update/Neustart schreibt keine normalisierte Fassung über vorhandene Kundendaten.
|
|
4791
|
+
patch = restoreInfluxHistoryConfig(patch, this._nwHistorySecretCodec());
|
|
4777
4792
|
const norm = this.nwNormalizeInstallerPatch(patch, baseNative);
|
|
4778
4793
|
patch = norm.patch;
|
|
4779
4794
|
|
|
@@ -4784,6 +4799,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
4784
4799
|
|
|
4785
4800
|
// Apply patch as installer SoT (replace installer-managed sections)
|
|
4786
4801
|
this.config = this.nwApplyInstallerPatchToRuntimeConfig(baseNative, patch);
|
|
4802
|
+
this._nwConfigureHistory();
|
|
4787
4803
|
try { await this._nwValidateNvpTopology(); }
|
|
4788
4804
|
catch (_nvpError) { this._nwNvpTopologyValidation = { configFingerprint: JSON.stringify(this.config.nvpTopology), validation: { valid: false, errors: [{ code: 'NVP_SOURCE_VALIDATION_FAILED', message: 'NVP-Quellenprüfung fehlgeschlagen.' }] } }; }
|
|
4789
4805
|
|
|
@@ -4869,6 +4885,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
4869
4885
|
}
|
|
4870
4886
|
|
|
4871
4887
|
async _nwApplyInstallerRuntime(restartEms, reason) {
|
|
4888
|
+
this._nwConfigureHistory();
|
|
4872
4889
|
const currentTariffModule = this.emsEngine?.mm?.modules?.find(entry => entry.key === 'tariffProvider')?.instance;
|
|
4873
4890
|
if (currentTariffModule && typeof currentTariffModule.invalidateConfiguration === 'function') await currentTariffModule.invalidateConfiguration();
|
|
4874
4891
|
if (currentTariffModule && typeof currentTariffModule.applyTariffMappings === 'function') await currentTariffModule.applyTariffMappings();
|
|
@@ -5009,7 +5026,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5009
5026
|
if (dynamicTransition && dynamicGridAppState(nextRuntime).active) this._nwDynamicGridOwnershipPending = nextRuntime.dynamicGridConnection;
|
|
5010
5027
|
try {
|
|
5011
5028
|
const obj = (patchObj && typeof patchObj === 'object') ? patchObj : {};
|
|
5012
|
-
const json = JSON.stringify(obj);
|
|
5029
|
+
const json = JSON.stringify(protectInfluxHistoryConfig(obj, this._nwHistorySecretCodec()));
|
|
5013
5030
|
await this._nwProtectCredentialState('installer.configJson');
|
|
5014
5031
|
await this.setStateAsync('installer.configJson', { val: json, ack: true });
|
|
5015
5032
|
if (dynamicTransition) this._nwDynamicGridPendingCommit = dynamicTransition;
|
|
@@ -5166,7 +5183,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5166
5183
|
adapterVersion: (pkg && pkg.version) ? String(pkg.version) : '',
|
|
5167
5184
|
instance: this.instance,
|
|
5168
5185
|
reason: reason ? String(reason) : '',
|
|
5169
|
-
configPatch: patch,
|
|
5186
|
+
configPatch: protectInfluxHistoryConfig(patch, this._nwHistorySecretCodec()),
|
|
5170
5187
|
};
|
|
5171
5188
|
|
|
5172
5189
|
await this._nwProtectCredentialState(`${base}.backupJson`, true);
|
|
@@ -5210,6 +5227,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5210
5227
|
parseInstallerConfigState({ val: JSON.stringify(parsed.configPatch) });
|
|
5211
5228
|
}
|
|
5212
5229
|
if (parsed && typeof parsed === 'object') {
|
|
5230
|
+
parsed.configPatch = restoreInfluxHistoryConfig(parsed.configPatch, this._nwHistorySecretCodec());
|
|
5213
5231
|
// Automatische Erst-Recovery nimmt die aktuelle Sicherung; ein älterer
|
|
5214
5232
|
// Stand mit mehr Geräten ist kein besserer Kundenstand.
|
|
5215
5233
|
if (strict) return parsed;
|
|
@@ -5340,7 +5358,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5340
5358
|
const s = raw.trim();
|
|
5341
5359
|
if (!s) return null;
|
|
5342
5360
|
const patch = JSON.parse(s);
|
|
5343
|
-
return (patch && typeof patch === 'object') ? patch : null;
|
|
5361
|
+
return (patch && typeof patch === 'object') ? restoreInfluxHistoryConfig(patch, this._nwHistorySecretCodec()) : null;
|
|
5344
5362
|
} catch (_e) {
|
|
5345
5363
|
return null;
|
|
5346
5364
|
}
|
|
@@ -5612,7 +5630,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5612
5630
|
|
|
5613
5631
|
// Backup current App-Center patch so we can restore after simulation.
|
|
5614
5632
|
const basePatch = (this._nwInstallerConfigPatch && typeof this._nwInstallerConfigPatch === 'object') ? this._nwInstallerConfigPatch : {};
|
|
5615
|
-
const backupJson = JSON.stringify(basePatch);
|
|
5633
|
+
const backupJson = JSON.stringify(protectInfluxHistoryConfig(basePatch, this._nwHistorySecretCodec()));
|
|
5616
5634
|
const backupWritten = await this.nwSimWriteStatus({
|
|
5617
5635
|
active: false,
|
|
5618
5636
|
instanceId: inst,
|
|
@@ -5885,6 +5903,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
5885
5903
|
// Grenzen / optionale Signale
|
|
5886
5904
|
maxChargeW: numberOrNull('maxChargeW', 'maxChargePowerW'),
|
|
5887
5905
|
maxDischargeW: numberOrNull('maxDischargeW', 'maxDischargePowerW'),
|
|
5906
|
+
allowedChargePowerId: textFrom('allowedChargePowerId'),
|
|
5907
|
+
allowedDischargePowerId: textFrom('allowedDischargePowerId'),
|
|
5888
5908
|
availableId: textFrom('availableId', 'availableObjectId', 'availableDp', 'availabilityId'),
|
|
5889
5909
|
faultId: textFrom('faultId', 'faultObjectId', 'faultDp', 'errorId'),
|
|
5890
5910
|
chargeAllowedId: textFrom('chargeAllowedId', 'chargeAllowedObjectId', 'chargeAllowedDp', 'chargeEnableId'),
|
|
@@ -6353,11 +6373,40 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6353
6373
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
6354
6374
|
*/
|
|
6355
6375
|
async updateStorageFarmDerived(reason = 'timer') {
|
|
6376
|
+
if (this._nwShuttingDown) return;
|
|
6377
|
+
// Timerläufe werden bei laufendem Snapshot verworfen: kein wachsender
|
|
6378
|
+
// Rückstau bei langsamer Datenbank. Explizite Übernahmen/Preflights lesen
|
|
6379
|
+
// anschließend neu, damit sie keinen älteren Snapshot als Ergebnis erben.
|
|
6380
|
+
while (this._nwStorageFarmDerivePromise) {
|
|
6381
|
+
if (reason === 'timer') return;
|
|
6382
|
+
await this._nwStorageFarmDerivePromise;
|
|
6383
|
+
if (this._nwShuttingDown) return;
|
|
6384
|
+
}
|
|
6385
|
+
const pending = this._nwUpdateStorageFarmDerivedSnapshot(reason);
|
|
6386
|
+
this._nwStorageFarmDerivePromise = pending;
|
|
6387
|
+
try { await pending; }
|
|
6388
|
+
finally {
|
|
6389
|
+
if (this._nwStorageFarmDerivePromise === pending) this._nwStorageFarmDerivePromise = null;
|
|
6390
|
+
}
|
|
6391
|
+
}
|
|
6392
|
+
|
|
6393
|
+
/** Liest genau einen Farm-Snapshot. Nach Stop oder Konfigurationswechsel
|
|
6394
|
+
* dürfen dessen verzögerte Antworten keine neuen aktuellen Summen erzeugen. */
|
|
6395
|
+
async _nwUpdateStorageFarmDerivedSnapshot(reason) {
|
|
6356
6396
|
try {
|
|
6357
6397
|
// Die Farm-Aggregation folgt derselben autoritativen Aktivierung wie AppCenter,
|
|
6358
6398
|
// Navigation, Dispatcher und Energiefluss. Ein reines Legacy-Flag darf weder eine
|
|
6359
6399
|
// aktive App abschalten noch eine inaktive Farm heimlich wieder einschalten.
|
|
6360
6400
|
const cfg = this.config || {};
|
|
6401
|
+
const assertCurrent = () => {
|
|
6402
|
+
if (this._nwShuttingDown || this.config !== cfg) throw new Error('EOS_FARM_SNAPSHOT_CANCELLED');
|
|
6403
|
+
};
|
|
6404
|
+
/** @param {string} id @param {{ val: string | number | boolean | null, ack: true }} state */
|
|
6405
|
+
const writeDerived = async (id, state) => {
|
|
6406
|
+
assertCurrent();
|
|
6407
|
+
await this.setStateAsync(id, state);
|
|
6408
|
+
assertCurrent();
|
|
6409
|
+
};
|
|
6361
6410
|
const runtimeInfo = (typeof this._nwGetStorageFarmRuntimeInfo === 'function')
|
|
6362
6411
|
? this._nwGetStorageFarmRuntimeInfo()
|
|
6363
6412
|
: { active: !!cfg.enableStorageFarm };
|
|
@@ -6393,6 +6442,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6393
6442
|
if (!sid) return null;
|
|
6394
6443
|
if (_stCache.has(sid)) return _stCache.get(sid);
|
|
6395
6444
|
const st = await this.getForeignStateAsync(sid).catch(() => null);
|
|
6445
|
+
assertCurrent();
|
|
6396
6446
|
_stCache.set(sid, st);
|
|
6397
6447
|
return st;
|
|
6398
6448
|
};
|
|
@@ -6516,6 +6566,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6516
6566
|
} catch (_e) {
|
|
6517
6567
|
unit = '';
|
|
6518
6568
|
}
|
|
6569
|
+
assertCurrent();
|
|
6519
6570
|
_unitCache.set(sid, unit);
|
|
6520
6571
|
return unit;
|
|
6521
6572
|
};
|
|
@@ -6754,9 +6805,9 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6754
6805
|
}
|
|
6755
6806
|
}
|
|
6756
6807
|
|
|
6757
|
-
//
|
|
6758
|
-
//
|
|
6759
|
-
//
|
|
6808
|
+
// Fixed installer limits remain authoritative upper bounds. Separately
|
|
6809
|
+
// bound device capabilities may only reduce them. Optional unsupported
|
|
6810
|
+
// registers are never automatically bound just because an object exists.
|
|
6760
6811
|
const availableId = String(row.availableId || '').trim();
|
|
6761
6812
|
const faultId = String(row.faultId || '').trim();
|
|
6762
6813
|
const chargeAllowedId = String(row.chargeAllowedId || '').trim();
|
|
@@ -6981,6 +7032,23 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6981
7032
|
return { limitW: staticLimit, configured: false, fresh: true, missing: false, invalid: false };
|
|
6982
7033
|
};
|
|
6983
7034
|
|
|
7035
|
+
// A bound numeric device capability is a safety input, unlike optional
|
|
7036
|
+
// change-only boolean flags. Missing/stale/invalid observations block
|
|
7037
|
+
// this direction, never become an unlimited or fabricated zero value.
|
|
7038
|
+
const readCapabilityW = async (id, staticLimit) => {
|
|
7039
|
+
const sid = String(id || '').trim();
|
|
7040
|
+
if (!sid) return { configured: false, limitW: staticLimit, status: 'unconfigured', valueW: null };
|
|
7041
|
+
const st = await getState(sid);
|
|
7042
|
+
let reason = '';
|
|
7043
|
+
if (!st || st.val === undefined || st.val === null) reason = 'missing';
|
|
7044
|
+
else if (typeof st.val !== 'number' || !Number.isFinite(st.val) || st.val < 0 || st.val > 1000000000
|
|
7045
|
+
|| st.ack !== true || (st.q !== undefined && st.q !== 0) || await getUnit(sid) !== 'W') reason = 'invalid';
|
|
7046
|
+
else if (typeof st.ts !== 'number' || !Number.isFinite(st.ts) || st.ts > now + 1000 || now - st.ts > Math.min(staleMs, 30000)) reason = 'stale';
|
|
7047
|
+
if (reason) return { configured: true, limitW: 0, status: reason, valueW: null };
|
|
7048
|
+
const valueW = Math.floor(st.val);
|
|
7049
|
+
return { configured: true, limitW: staticLimit === null ? valueW : Math.min(staticLimit, valueW), status: 'valid', valueW };
|
|
7050
|
+
};
|
|
7051
|
+
|
|
6984
7052
|
const availState = await readBoolDp(availableId);
|
|
6985
7053
|
const faultState = await readBoolDp(faultId);
|
|
6986
7054
|
const chargeAllowedState = await readBoolDp(chargeAllowedId);
|
|
@@ -6988,8 +7056,10 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6988
7056
|
const chargeLimitState = await readLimitW(row.maxChargeW);
|
|
6989
7057
|
const dischargeLimitState = await readLimitW(row.maxDischargeW);
|
|
6990
7058
|
|
|
6991
|
-
const
|
|
6992
|
-
const
|
|
7059
|
+
const chargeCapability = await readCapabilityW(row.allowedChargePowerId, chargeLimitState.limitW);
|
|
7060
|
+
const dischargeCapability = await readCapabilityW(row.allowedDischargePowerId, dischargeLimitState.limitW);
|
|
7061
|
+
const maxChargeW = chargeCapability.limitW;
|
|
7062
|
+
const maxDischargeW = dischargeCapability.limitW;
|
|
6993
7063
|
|
|
6994
7064
|
const baseBlocked = [];
|
|
6995
7065
|
if (status.licenseBlocked) baseBlocked.push('license_storage_limit');
|
|
@@ -7019,6 +7089,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7019
7089
|
else if (!chargeAllowedState.fresh) dispatchWarnings.push('charge_allowed_stale_using_last');
|
|
7020
7090
|
}
|
|
7021
7091
|
if (maxChargeW !== null && maxChargeW <= 0) chargeBlocked.push('charge_limit_zero');
|
|
7092
|
+
if (chargeCapability.configured && chargeCapability.status !== 'valid') chargeBlocked.push(`charge_capability_${chargeCapability.status}`);
|
|
7093
|
+
else if (chargeCapability.configured && chargeCapability.valueW === 0) chargeBlocked.push('charge_capability_zero');
|
|
7022
7094
|
|
|
7023
7095
|
const dischargeBlocked = baseBlocked.slice();
|
|
7024
7096
|
if (!hasDischargeSetpoint) dischargeBlocked.push('discharge_setpoint_missing');
|
|
@@ -7029,6 +7101,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7029
7101
|
else if (!dischargeAllowedState.fresh) dispatchWarnings.push('discharge_allowed_stale_using_last');
|
|
7030
7102
|
}
|
|
7031
7103
|
if (maxDischargeW !== null && maxDischargeW <= 0) dischargeBlocked.push('discharge_limit_zero');
|
|
7104
|
+
if (dischargeCapability.configured && dischargeCapability.status !== 'valid') dischargeBlocked.push(`discharge_capability_${dischargeCapability.status}`);
|
|
7105
|
+
else if (dischargeCapability.configured && dischargeCapability.valueW === 0) dischargeBlocked.push('discharge_capability_zero');
|
|
7032
7106
|
|
|
7033
7107
|
const chargeDispatchAvailable = chargeBlocked.length === 0;
|
|
7034
7108
|
const dischargeDispatchAvailable = dischargeBlocked.length === 0;
|
|
@@ -7046,6 +7120,10 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7046
7120
|
status.dischargeDispatchAvailable = !!dischargeDispatchAvailable;
|
|
7047
7121
|
status.maxChargeW = (maxChargeW !== null) ? maxChargeW : null;
|
|
7048
7122
|
status.maxDischargeW = (maxDischargeW !== null) ? maxDischargeW : null;
|
|
7123
|
+
status.configuredMaxChargeW = chargeLimitState.limitW;
|
|
7124
|
+
status.configuredMaxDischargeW = dischargeLimitState.limitW;
|
|
7125
|
+
status.chargeCapability = { objectId: row.allowedChargePowerId || '', ...chargeCapability };
|
|
7126
|
+
status.dischargeCapability = { objectId: row.allowedDischargePowerId || '', ...dischargeCapability };
|
|
7049
7127
|
status.chargeBlockedReasons = chargeBlocked;
|
|
7050
7128
|
status.dischargeBlockedReasons = dischargeBlocked;
|
|
7051
7129
|
if (dispatchWarnings.length) status.dispatchWarnings = Array.from(new Set(dispatchWarnings));
|
|
@@ -7339,42 +7417,42 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7339
7417
|
const totalPvUnknownState = Math.round(totalPvUnknown);
|
|
7340
7418
|
const pvSourcesJson = JSON.stringify(pvSourceRows);
|
|
7341
7419
|
|
|
7342
|
-
await
|
|
7343
|
-
await
|
|
7344
|
-
await
|
|
7345
|
-
await
|
|
7346
|
-
await
|
|
7347
|
-
await
|
|
7348
|
-
await
|
|
7349
|
-
await
|
|
7350
|
-
await
|
|
7351
|
-
await
|
|
7352
|
-
await
|
|
7353
|
-
await
|
|
7354
|
-
await
|
|
7355
|
-
await
|
|
7356
|
-
await
|
|
7357
|
-
await
|
|
7358
|
-
await
|
|
7359
|
-
await
|
|
7360
|
-
await
|
|
7361
|
-
await
|
|
7362
|
-
await
|
|
7363
|
-
await
|
|
7364
|
-
await
|
|
7365
|
-
await
|
|
7366
|
-
await
|
|
7367
|
-
await
|
|
7368
|
-
await
|
|
7369
|
-
await
|
|
7420
|
+
await writeDerived('storageFarm.totalSoc', { val: totalSocState, ack: true });
|
|
7421
|
+
await writeDerived('storageFarm.medianSoc', { val: Math.round(medianSoc * 10) / 10, ack: true });
|
|
7422
|
+
await writeDerived('storageFarm.totalSocOnline', { val: totalSocOnlineState, ack: true });
|
|
7423
|
+
await writeDerived('storageFarm.capacityWeightedSoc', { val: capacityWeightedSocState, ack: true });
|
|
7424
|
+
await writeDerived('storageFarm.capacityWeightedSocOnline', { val: capacityWeightedSocOnlineState, ack: true });
|
|
7425
|
+
await writeDerived('storageFarm.socSourcesTotal', { val: socSourcesTotal, ack: true });
|
|
7426
|
+
await writeDerived('storageFarm.socSourcesOnline', { val: socSourcesOnline, ack: true });
|
|
7427
|
+
await writeDerived('storageFarm.socDegraded', { val: !!socDegraded, ack: true });
|
|
7428
|
+
await writeDerived('storageFarm.totalPowerW', { val: totalPowerState, ack: true });
|
|
7429
|
+
await writeDerived('storageFarm.totalBatteryPowerW', { val: totalBatteryPowerState, ack: true });
|
|
7430
|
+
await writeDerived('storageFarm.totalBatteryChargePowerW', { val: farmOverview.battery.chargeW, ack: true });
|
|
7431
|
+
await writeDerived('storageFarm.totalBatteryDischargePowerW', { val: farmOverview.battery.dischargeW, ack: true });
|
|
7432
|
+
await writeDerived('storageFarm.displayMeanSoc', { val: farmOverview.soc.meanPct, ack: true });
|
|
7433
|
+
await writeDerived('storageFarm.totalCapacityKWh', { val: farmOverview.capacity.totalKWh, ack: true });
|
|
7434
|
+
await writeDerived('storageFarm.overviewJson', { val: farmOverviewJson, ack: true });
|
|
7435
|
+
await writeDerived('storageFarm.powerSourcesTotal', { val: seenPowerSourceKeys.size, ack: true });
|
|
7436
|
+
await writeDerived('storageFarm.powerSourcesOnline', { val: powerSourcesOnline, ack: true });
|
|
7437
|
+
await writeDerived('storageFarm.totalChargePowerW', { val: totalChargeState, ack: true });
|
|
7438
|
+
await writeDerived('storageFarm.totalDischargePowerW', { val: totalDischargeState, ack: true });
|
|
7439
|
+
await writeDerived('storageFarm.totalPvPowerW', { val: totalPvState, ack: true });
|
|
7440
|
+
await writeDerived('storageFarm.totalPvAcPowerW', { val: totalPvAcState, ack: true });
|
|
7441
|
+
await writeDerived('storageFarm.totalPvDcPowerW', { val: totalPvDcState, ack: true });
|
|
7442
|
+
await writeDerived('storageFarm.totalPvUnknownPowerW', { val: totalPvUnknownState, ack: true });
|
|
7443
|
+
await writeDerived('storageFarm.pvSourcesTotal', { val: pvSourceRows.length, ack: true });
|
|
7444
|
+
await writeDerived('storageFarm.pvSourcesOnline', { val: pvSourcesOnline, ack: true });
|
|
7445
|
+
await writeDerived('storageFarm.pvSourcesJson', { val: pvSourcesJson, ack: true });
|
|
7446
|
+
await writeDerived('storageFarm.storagesOnline', { val: available, ack: true });
|
|
7447
|
+
await writeDerived('storageFarm.storagesDegraded', { val: degraded, ack: true });
|
|
7370
7448
|
const availableChargePowerState = availableChargePowerUnbounded ? null : Math.round(availableChargePowerW);
|
|
7371
7449
|
const availableDischargePowerState = availableDischargePowerUnbounded ? null : Math.round(availableDischargePowerW);
|
|
7372
7450
|
|
|
7373
|
-
await
|
|
7374
|
-
await
|
|
7375
|
-
await
|
|
7376
|
-
await
|
|
7377
|
-
await
|
|
7451
|
+
await writeDerived('storageFarm.storagesDispatchAvailable', { val: dispatchAvailableCount, ack: true });
|
|
7452
|
+
await writeDerived('storageFarm.availableChargePowerW', { val: availableChargePowerState, ack: true });
|
|
7453
|
+
await writeDerived('storageFarm.availableDischargePowerW', { val: availableDischargePowerState, ack: true });
|
|
7454
|
+
await writeDerived('storageFarm.storagesTotal', { val: configured, ack: true });
|
|
7455
|
+
await writeDerived('storageFarm.storagesStatusJson', { val: JSON.stringify(statusRows), ack: true });
|
|
7378
7456
|
|
|
7379
7457
|
// keep stateCache fresh for the UI
|
|
7380
7458
|
try {
|
|
@@ -7648,9 +7726,9 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7648
7726
|
});
|
|
7649
7727
|
}
|
|
7650
7728
|
/**
|
|
7651
|
-
*
|
|
7652
|
-
*
|
|
7653
|
-
*
|
|
7729
|
+
* Trennt den angeforderten Kommandowert (ack:false) von einer aktuellen
|
|
7730
|
+
* Adapter-/Treiberquittierung (ack:true). Auch letztere ist weder ein separat
|
|
7731
|
+
* gelesenes Geräteregister noch eine bestätigte physische Batteriereaktion.
|
|
7654
7732
|
*/
|
|
7655
7733
|
async _sfReadbackNumber(objectId, expectedValue, options = {}) {
|
|
7656
7734
|
const id = String(objectId || '').trim();
|
|
@@ -7660,28 +7738,40 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7660
7738
|
const attempts = Math.max(1, Math.min(3, Number(options.attempts) || 3));
|
|
7661
7739
|
const delayMs = Math.max(0, Math.min(100, Number(options.delayMs) || 30));
|
|
7662
7740
|
const expected = Number(expectedValue);
|
|
7741
|
+
const notBeforeTs = Math.max(0, Number(options.notBeforeTs) || 0);
|
|
7663
7742
|
let last = null;
|
|
7664
7743
|
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
7665
7744
|
try {
|
|
7666
7745
|
const state = await this.getForeignStateAsync(id);
|
|
7667
7746
|
const raw = state && Object.prototype.hasOwnProperty.call(state, 'val') ? state.val : null;
|
|
7668
|
-
const actual = typeof raw === 'number'
|
|
7669
|
-
? raw
|
|
7670
|
-
: Number(String(raw === null || raw === undefined ? '' : raw).trim().replace(',', '.'));
|
|
7747
|
+
const actual = typeof raw === 'number' ? raw
|
|
7748
|
+
: (typeof raw === 'string' && raw.trim() ? Number(raw.trim().replace(',', '.')) : Number.NaN);
|
|
7671
7749
|
const tolerance = Math.max(0.000001, Math.abs(expected) * 0.000001);
|
|
7672
|
-
const
|
|
7750
|
+
const matches = Number.isFinite(actual) && Number.isFinite(expected) && Math.abs(actual - expected) <= tolerance;
|
|
7751
|
+
const ts = state && typeof state.ts === 'number' && Number.isFinite(state.ts) && state.ts > 0 ? state.ts : null;
|
|
7752
|
+
const qualityOk = !!state && (state.q === undefined || state.q === 0);
|
|
7753
|
+
const current = ts !== null && ts >= notBeforeTs && ts <= Date.now() + 1000;
|
|
7754
|
+
const ok = matches && qualityOk && state.ack === true && current;
|
|
7755
|
+
const pending = matches && qualityOk && !ok;
|
|
7673
7756
|
last = {
|
|
7674
7757
|
supported: true,
|
|
7675
7758
|
ok,
|
|
7676
|
-
|
|
7759
|
+
pending,
|
|
7760
|
+
status: ok ? 'driver-acknowledged' : (pending ? 'pending-ack'
|
|
7761
|
+
: (!qualityOk && state ? 'quality-invalid' : (Number.isFinite(actual) ? 'mismatch' : 'value-missing'))),
|
|
7762
|
+
confirmationLevel: ok ? 'driver-acknowledged' : (pending ? 'requested' : 'none'),
|
|
7763
|
+
pendingReason: pending ? (state.ack !== true ? 'ack-not-received' : 'ack-not-current') : '',
|
|
7677
7764
|
objectId: id,
|
|
7678
7765
|
expected,
|
|
7679
7766
|
actual: Number.isFinite(actual) ? actual : raw,
|
|
7680
|
-
ts
|
|
7767
|
+
ts,
|
|
7681
7768
|
ack: state && typeof state.ack === 'boolean' ? state.ack : null,
|
|
7769
|
+
q: state && state.q !== undefined ? state.q : null,
|
|
7682
7770
|
attempts: attempt,
|
|
7683
7771
|
};
|
|
7684
|
-
|
|
7772
|
+
// A matching request is an asynchronous handoff, not a retryable
|
|
7773
|
+
// mismatch. Observe the later ack on the next tick without blocking it.
|
|
7774
|
+
if (ok || pending) return last;
|
|
7685
7775
|
} catch (error) {
|
|
7686
7776
|
last = {
|
|
7687
7777
|
supported: true,
|
|
@@ -7736,13 +7826,16 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7736
7826
|
const age = now - lastTs;
|
|
7737
7827
|
|
|
7738
7828
|
if (same && (!keepaliveEnabled || age < effectiveKeepaliveMs)) {
|
|
7739
|
-
const current = await this._sfReadbackNumber(objectId, value, { attempts: 1, delayMs: 0 });
|
|
7740
|
-
if (!current.supported || current.ok) {
|
|
7829
|
+
const current = await this._sfReadbackNumber(objectId, value, { attempts: 1, delayMs: 0, notBeforeTs: lastTs });
|
|
7830
|
+
if (!current.supported || current.ok || current.pending === true) {
|
|
7741
7831
|
return {
|
|
7742
7832
|
ok: true,
|
|
7743
7833
|
skipped: true,
|
|
7744
7834
|
changed: false,
|
|
7745
7835
|
same: true,
|
|
7836
|
+
submitted: true,
|
|
7837
|
+
pending: current.pending === true,
|
|
7838
|
+
confirmationLevel: current.confirmationLevel || 'requested',
|
|
7746
7839
|
readback: current,
|
|
7747
7840
|
readbackSupported: current.supported === true,
|
|
7748
7841
|
readbackOk: current.supported === true ? current.ok === true : null,
|
|
@@ -7765,8 +7858,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7765
7858
|
};
|
|
7766
7859
|
}
|
|
7767
7860
|
|
|
7768
|
-
const readback = await this._sfReadbackNumber(objectId, value, { attempts: 3, delayMs: 30 });
|
|
7769
|
-
if (readback.supported && !readback.ok) {
|
|
7861
|
+
const readback = await this._sfReadbackNumber(objectId, value, { attempts: 3, delayMs: 30, notBeforeTs: now });
|
|
7862
|
+
if (readback.supported && !readback.ok && readback.pending !== true) {
|
|
7770
7863
|
this._sfLastSetpoints.delete(objectId);
|
|
7771
7864
|
this._sfLastSetpointsTs.delete(objectId);
|
|
7772
7865
|
return {
|
|
@@ -7787,6 +7880,9 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7787
7880
|
skipped: false,
|
|
7788
7881
|
changed: true,
|
|
7789
7882
|
same,
|
|
7883
|
+
submitted: true,
|
|
7884
|
+
pending: readback.pending === true,
|
|
7885
|
+
confirmationLevel: readback.confirmationLevel || 'requested',
|
|
7790
7886
|
keepalive: keepaliveEnabled && same && age >= effectiveKeepaliveMs,
|
|
7791
7887
|
readback,
|
|
7792
7888
|
readbackSupported: readback.supported === true,
|
|
@@ -7918,6 +8014,9 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7918
8014
|
return {
|
|
7919
8015
|
...s,
|
|
7920
8016
|
soc,
|
|
8017
|
+
// Preserve the observed value for diagnostics; do not change the
|
|
8018
|
+
// established dispatch calculation's treatment of absent status fields.
|
|
8019
|
+
_sfReportedSoc: numericMeasurement(st.soc),
|
|
7921
8020
|
online,
|
|
7922
8021
|
displayOnline,
|
|
7923
8022
|
offlineReason,
|
|
@@ -8070,6 +8169,16 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8070
8169
|
if (Number.isFinite(minPowerW)) effectiveBatteryTargetW = Math.max(Number(minPowerW), effectiveBatteryTargetW);
|
|
8071
8170
|
if (Number.isFinite(maxPowerW)) effectiveBatteryTargetW = Math.min(Number(maxPowerW), effectiveBatteryTargetW);
|
|
8072
8171
|
}
|
|
8172
|
+
// A bound device capability must also constrain the exclusive native
|
|
8173
|
+
// FEMS path before translating battery power into a grid target. Without
|
|
8174
|
+
// these new bindings, retain the established native controller behavior.
|
|
8175
|
+
if (w > 0 && String(storage.allowedDischargePowerId || '').trim()) {
|
|
8176
|
+
effectiveBatteryTargetW = storage.dischargeDispatchAvailable === true && Number.isFinite(storage.maxDischargeW)
|
|
8177
|
+
? Math.min(Math.max(0, effectiveBatteryTargetW), storage.maxDischargeW) : 0;
|
|
8178
|
+
} else if (w < 0 && String(storage.allowedChargePowerId || '').trim()) {
|
|
8179
|
+
effectiveBatteryTargetW = storage.chargeDispatchAvailable === true && Number.isFinite(storage.maxChargeW)
|
|
8180
|
+
? -Math.min(Math.max(0, -effectiveBatteryTargetW), storage.maxChargeW) : 0;
|
|
8181
|
+
}
|
|
8073
8182
|
// A FEMS grid target is not an ESS target: calculate the NVP value for
|
|
8074
8183
|
// zero battery power instead of writing a misleading literal 0 to the grid DP.
|
|
8075
8184
|
if (storage.licenseBlocked) effectiveBatteryTargetW = 0;
|
|
@@ -8167,7 +8276,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8167
8276
|
const readbackOk = readbackSupported ? writeResult.readbackOk === true : writeOk;
|
|
8168
8277
|
const commandStatus = !calculation.ok
|
|
8169
8278
|
? String(calculation.reason || 'fenecon-calculation-failed')
|
|
8170
|
-
: (!releaseOk ? 'fenecon-direct-release-failed' : (writeOk
|
|
8279
|
+
: (!releaseOk ? 'fenecon-direct-release-failed' : (writeOk
|
|
8280
|
+
? String(writeResult.readback && writeResult.readback.status || 'unavailable') : 'fenecon-grid-write-failed'));
|
|
8171
8281
|
const acceptedW = writeOk ? effectiveBatteryTargetW : 0;
|
|
8172
8282
|
const failedW = writeOk ? 0 : w;
|
|
8173
8283
|
const nativeResult = {
|
|
@@ -8201,6 +8311,11 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8201
8311
|
acceptedDeliveredW: acceptedW,
|
|
8202
8312
|
failedW,
|
|
8203
8313
|
unservedW: writeOk ? (w - effectiveBatteryTargetW) : w,
|
|
8314
|
+
commandDpReadbackSupported: readbackSupported,
|
|
8315
|
+
commandDpReadbackOk: readbackOk,
|
|
8316
|
+
commandDpReadbackStatus: commandStatus,
|
|
8317
|
+
commandDpReadbackPending: !!(writeResult && writeResult.pending === true),
|
|
8318
|
+
commandConfirmationLevel: writeResult && writeResult.confirmationLevel || 'none',
|
|
8204
8319
|
validation: feneconFarmValidation,
|
|
8205
8320
|
results: [nativeResult],
|
|
8206
8321
|
};
|
|
@@ -8233,6 +8348,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8233
8348
|
commandDpReadbackSupported: readbackSupported,
|
|
8234
8349
|
commandDpReadbackOk: readbackOk,
|
|
8235
8350
|
commandDpReadbackStatus: commandStatus,
|
|
8351
|
+
commandDpReadbackPending: !!(writeResult && writeResult.pending === true),
|
|
8352
|
+
commandConfirmationLevel: writeResult && writeResult.confirmationLevel || 'none',
|
|
8236
8353
|
commandDpReadbackRows: writeResult && writeResult.readback ? [writeResult.readback] : [],
|
|
8237
8354
|
requestSatisfied: writeOk && effectiveBatteryTargetW === w,
|
|
8238
8355
|
partiallyAccepted: writeOk && effectiveBatteryTargetW !== w,
|
|
@@ -8618,9 +8735,21 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8618
8735
|
|| commandFamily === 'signed'
|
|
8619
8736
|
|| (commandFamily === 'split' && (direction === 'charge' ? !!chargeId : !!dischargeId));
|
|
8620
8737
|
|
|
8738
|
+
// Explain this exact dispatch decision without redefining the status
|
|
8739
|
+
// capability flags or changing the allocator/write path above.
|
|
8740
|
+
const directionDispatchAvailable = eligibleForDispatch.includes(s);
|
|
8741
|
+
const blockedReasons = [...(direction === 'charge' ? (s.chargeBlockedReasons || [])
|
|
8742
|
+
: direction === 'discharge' ? (s.dischargeBlockedReasons || []) : [])];
|
|
8743
|
+
if (direction === 'discharge' && dispatchEligible.includes(s) && !directionDispatchAvailable) {
|
|
8744
|
+
blockedReasons.push(s._sfReportedSoc === null ? 'soc_missing' : 'soc_at_or_below_discharge_floor');
|
|
8745
|
+
}
|
|
8746
|
+
const effectiveDischargeLimit = direction === 'discharge'
|
|
8747
|
+
? (directionDispatchAvailable ? getLimitW(s, 'discharge') : 0) : null;
|
|
8748
|
+
|
|
8621
8749
|
const r = {
|
|
8622
8750
|
name: s.name || '',
|
|
8623
|
-
|
|
8751
|
+
dispatchKey: s._sfKey,
|
|
8752
|
+
soc: s._sfReportedSoc,
|
|
8624
8753
|
state: s.state || '',
|
|
8625
8754
|
online: !!s.online,
|
|
8626
8755
|
dispatchAvailable: !!s.dispatchAvailable,
|
|
@@ -8628,7 +8757,10 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8628
8757
|
dischargeDispatchAvailable: !!s.dischargeDispatchAvailable,
|
|
8629
8758
|
maxChargeW: (s.maxChargeW !== null && Number.isFinite(Number(s.maxChargeW))) ? Number(s.maxChargeW) : null,
|
|
8630
8759
|
maxDischargeW: (s.maxDischargeW !== null && Number.isFinite(Number(s.maxDischargeW))) ? Number(s.maxDischargeW) : null,
|
|
8631
|
-
|
|
8760
|
+
directionDispatchAvailable,
|
|
8761
|
+
dischargeFloorSocPct: direction === 'discharge' ? dischargeFloorSoc : null,
|
|
8762
|
+
effectiveMaxDischargeW: Number.isFinite(effectiveDischargeLimit) ? effectiveDischargeLimit : null,
|
|
8763
|
+
blockedReasons,
|
|
8632
8764
|
warnings: Array.isArray(s.dispatchWarnings) ? s.dispatchWarnings : [],
|
|
8633
8765
|
statusMatch: String(s.statusMatch || ''),
|
|
8634
8766
|
actualChargeW: Number.isFinite(Number(s.chargePowerW)) ? Number(s.chargePowerW) : null,
|
|
@@ -8747,20 +8879,30 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8747
8879
|
key,
|
|
8748
8880
|
objectId: readback ? String(readback.objectId || '') : '',
|
|
8749
8881
|
expected: readback && Number.isFinite(Number(readback.expected)) ? Number(readback.expected) : null,
|
|
8750
|
-
actual: readback &&
|
|
8882
|
+
actual: readback && typeof readback.actual === 'number' && Number.isFinite(readback.actual)
|
|
8883
|
+
? readback.actual : (readback ? readback.actual : null),
|
|
8751
8884
|
supported: !!(wr && wr.readbackSupported === true),
|
|
8752
8885
|
ok: wr && typeof wr.readbackOk === 'boolean' ? wr.readbackOk : null,
|
|
8886
|
+
pending: !!(readback && readback.pending === true),
|
|
8887
|
+
ack: readback && typeof readback.ack === 'boolean' ? readback.ack : null,
|
|
8888
|
+
ts: readback ? readback.ts : null,
|
|
8889
|
+
q: readback ? readback.q : null,
|
|
8890
|
+
confirmationLevel: readback ? String(readback.confirmationLevel || 'none') : 'none',
|
|
8753
8891
|
status: readback ? String(readback.status || '') : String((wr && wr.reason) || ''),
|
|
8754
8892
|
};
|
|
8755
8893
|
}));
|
|
8756
8894
|
const supportedCommandDpReadbacks = commandDpReadbackRows.filter((row) => row.supported);
|
|
8757
8895
|
const commandDpReadbackSupported = supportedCommandDpReadbacks.length > 0;
|
|
8758
8896
|
const commandDpReadbackOk = commandDpReadbackSupported
|
|
8759
|
-
?
|
|
8897
|
+
? commandDpReadbackRows.every((row) => row.supported && row.ok === true)
|
|
8760
8898
|
: true;
|
|
8761
8899
|
const commandDpReadbackStatus = commandDpReadbackSupported
|
|
8762
|
-
? (commandDpReadbackOk ? '
|
|
8900
|
+
? (commandDpReadbackOk ? 'driver-acknowledged'
|
|
8901
|
+
: (commandDpReadbackRows.every(row => !row.supported || row.ok === true || row.pending === true) ? 'pending-ack' : 'command-dp-mismatch'))
|
|
8763
8902
|
: 'unavailable';
|
|
8903
|
+
const commandDpReadbackPending = supportedCommandDpReadbacks.some(row => row.pending === true);
|
|
8904
|
+
const commandConfirmationLevel = commandDpReadbackSupported && commandDpReadbackOk
|
|
8905
|
+
? 'driver-acknowledged' : (allConfiguredWritesAccepted ? 'requested' : 'none');
|
|
8764
8906
|
const anyAcceptedPower = direction === 'idle' ? allConfiguredWritesAccepted : acceptedAbsW > 0;
|
|
8765
8907
|
const requestSatisfied = direction === 'idle'
|
|
8766
8908
|
? allConfiguredWritesAccepted
|
|
@@ -8789,6 +8931,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8789
8931
|
commandDpReadbackSupported,
|
|
8790
8932
|
commandDpReadbackOk,
|
|
8791
8933
|
commandDpReadbackStatus,
|
|
8934
|
+
commandDpReadbackPending,
|
|
8935
|
+
commandConfirmationLevel,
|
|
8792
8936
|
commandDpReadbackRows,
|
|
8793
8937
|
requestSatisfied,
|
|
8794
8938
|
status: dispatchStatus,
|
|
@@ -8803,7 +8947,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8803
8947
|
return Number.isFinite(v) ? Math.round(v) : null;
|
|
8804
8948
|
})(),
|
|
8805
8949
|
availableDischargePowerW: (() => {
|
|
8806
|
-
const v = sumLimitW(
|
|
8950
|
+
const v = sumLimitW(direction === 'discharge' ? eligibleForDispatch
|
|
8951
|
+
: storages.filter(s => s.dischargeDispatchAvailable === true), 'discharge');
|
|
8807
8952
|
return Number.isFinite(v) ? Math.round(v) : null;
|
|
8808
8953
|
})(),
|
|
8809
8954
|
results: results.map(r => {
|
|
@@ -8811,6 +8956,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8811
8956
|
const authorityBlocks = writeRows.filter(wr => wr && wr.blocked === true);
|
|
8812
8957
|
return {
|
|
8813
8958
|
name: r.name || '',
|
|
8959
|
+
dispatchKey: r.dispatchKey,
|
|
8814
8960
|
state: r.state || '',
|
|
8815
8961
|
online: r.online,
|
|
8816
8962
|
dispatchAvailable: r.dispatchAvailable,
|
|
@@ -8818,6 +8964,9 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8818
8964
|
dischargeDispatchAvailable: r.dischargeDispatchAvailable,
|
|
8819
8965
|
maxChargeW: r.maxChargeW,
|
|
8820
8966
|
maxDischargeW: r.maxDischargeW,
|
|
8967
|
+
directionDispatchAvailable: r.directionDispatchAvailable,
|
|
8968
|
+
dischargeFloorSocPct: r.dischargeFloorSocPct,
|
|
8969
|
+
effectiveMaxDischargeW: r.effectiveMaxDischargeW,
|
|
8821
8970
|
blockedReasons: r.blockedReasons,
|
|
8822
8971
|
warnings: r.warnings,
|
|
8823
8972
|
statusMatch: r.statusMatch,
|
|
@@ -8875,6 +9024,8 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8875
9024
|
commandDpReadbackSupported,
|
|
8876
9025
|
commandDpReadbackOk,
|
|
8877
9026
|
commandDpReadbackStatus,
|
|
9027
|
+
commandDpReadbackPending,
|
|
9028
|
+
commandConfirmationLevel,
|
|
8878
9029
|
commandDpReadbackRows,
|
|
8879
9030
|
requestSatisfied,
|
|
8880
9031
|
partiallyAccepted: !allConfiguredWritesAccepted && acceptedAbsW > 0,
|
|
@@ -12027,9 +12178,10 @@ async onReady() {
|
|
|
12027
12178
|
try { await startupStep(() => this.initLogicEngine()); } catch (e) { this.log.warn('NexoLogic init failed: ' + (e && e.message ? e.message : e)); }
|
|
12028
12179
|
if (this._nwShuttingDown) return;
|
|
12029
12180
|
assertStartupAuthority();
|
|
12030
|
-
|
|
12181
|
+
const emsReady = this._nwIsEmsReady();
|
|
12182
|
+
this._hostedStartup = { state: emsReady ? 'ready' : 'degraded', error: emsReady ? '' : 'EOS_EMS_INIT_FAILED' };
|
|
12031
12183
|
this._bridge.deviceEmsConfigChanged?.();
|
|
12032
|
-
if (
|
|
12184
|
+
if (emsReady) this.log.info('NexoWatt EOS ist bereit.');
|
|
12033
12185
|
else this.log.warn('EOS_EMS_INIT_FAILED: Bedienoberfläche verfügbar, Betriebsstart unvollständig.');
|
|
12034
12186
|
} catch (e) {
|
|
12035
12187
|
if (this._nwShuttingDown) return;
|
|
@@ -12096,6 +12248,14 @@ async onReady() {
|
|
|
12096
12248
|
throw e;
|
|
12097
12249
|
}
|
|
12098
12250
|
}
|
|
12251
|
+
// A retained engine can be fenced while asynchronous module cleanup is
|
|
12252
|
+
// unresolved. Its presence alone does not establish operational readiness.
|
|
12253
|
+
_nwIsEmsReady() {
|
|
12254
|
+
const engine = this.emsEngine;
|
|
12255
|
+
return !this._nwShuttingDown && !this._nwEmsInitError &&
|
|
12256
|
+
!!engine?._timer && engine._reconfiguring !== true;
|
|
12257
|
+
}
|
|
12258
|
+
|
|
12099
12259
|
/**
|
|
12100
12260
|
* Code-Teil: initEmsEngine
|
|
12101
12261
|
* Zweck: Initialisiert diesen Bereich und verbindet abhängige Startlogik.
|
|
@@ -12104,38 +12264,52 @@ async onReady() {
|
|
|
12104
12264
|
*/
|
|
12105
12265
|
async initEmsEngine(force) {
|
|
12106
12266
|
if (this._nwShuttingDown) throw new Error('EOS_UI_STOPPING');
|
|
12107
|
-
|
|
12108
|
-
|
|
12109
|
-
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
|
|
12121
|
-
|
|
12122
|
-
try {
|
|
12123
|
-
if (!this.emsEngine) this.emsEngine = new EmsEngine(this);
|
|
12124
|
-
await this.emsEngine.init();
|
|
12125
|
-
if (this._nwShuttingDown) throw new Error('EOS_UI_STOPPING');
|
|
12126
|
-
await this._meshCoordinator?.syncAppLifecycle();
|
|
12267
|
+
if (this._nwEmsInitPending) return this._nwEmsInitPending;
|
|
12268
|
+
const initialize = async () => {
|
|
12269
|
+
if (!force && this._nwIsEmsReady()) return;
|
|
12270
|
+
// Failed initialization may already own asynchronous module work. Keep
|
|
12271
|
+
// that engine reachable until its bounded drain has actually completed.
|
|
12272
|
+
const drainPrevious = async () => {
|
|
12273
|
+
const previous = this.emsEngine;
|
|
12274
|
+
if (!previous) return;
|
|
12275
|
+
this._nwEmsInitError ||= 'EOS_EMS_CONFIG_APPLY_PENDING';
|
|
12276
|
+
if (typeof previous.stopForReconfigure === 'function') await previous.stopForReconfigure();
|
|
12277
|
+
else if (typeof previous.stop === 'function') await awaitEmsTransition(Promise.resolve(previous.stop()));
|
|
12278
|
+
else throw new Error('EOS_EMS_STOP_UNCONFIRMED');
|
|
12279
|
+
if (this.emsEngine === previous) this.emsEngine = null;
|
|
12280
|
+
};
|
|
12281
|
+
await drainPrevious();
|
|
12127
12282
|
if (this._nwShuttingDown) throw new Error('EOS_UI_STOPPING');
|
|
12128
|
-
this._nwEmsInitError = '';
|
|
12129
|
-
} catch (e) {
|
|
12130
|
-
this._nwEmsInitError = (e && e.message) ? String(e.message) : String(e);
|
|
12131
|
-
|
|
12283
|
+
this._nwEmsInitError = 'EOS_EMS_STARTING';
|
|
12132
12284
|
try {
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12285
|
+
this.emsEngine = new EmsEngine(this);
|
|
12286
|
+
await this.emsEngine.init();
|
|
12287
|
+
if (this._nwShuttingDown) throw new Error('EOS_UI_STOPPING');
|
|
12288
|
+
await this._meshCoordinator?.syncAppLifecycle();
|
|
12289
|
+
if (this._nwShuttingDown) throw new Error('EOS_UI_STOPPING');
|
|
12290
|
+
this._nwEmsInitError = '';
|
|
12291
|
+
if (this._hostedStartup?.state === 'degraded' && this._hostedStartup.error === 'EOS_EMS_INIT_FAILED' && this._nwIsEmsReady()) {
|
|
12292
|
+
this._hostedStartup = { state: 'ready', error: '' };
|
|
12293
|
+
}
|
|
12294
|
+
} catch (e) {
|
|
12295
|
+
this._nwEmsInitError = (e && e.message) ? String(e.message) : String(e);
|
|
12296
|
+
try { await drainPrevious(); }
|
|
12297
|
+
catch (_cleanupError) {
|
|
12298
|
+
this.log.warn('EOS_EMS_FAILED_START_CLEANUP_PENDING: Alte EMS-Laufzeit bleibt bis zum bestätigten Stopp gesperrt.');
|
|
12299
|
+
}
|
|
12300
|
+
throw e;
|
|
12301
|
+
}
|
|
12302
|
+
};
|
|
12303
|
+
const operation = initialize();
|
|
12304
|
+
this._nwEmsInitPending = operation;
|
|
12305
|
+
try { return await operation; }
|
|
12306
|
+
catch (error) {
|
|
12307
|
+
if (this._hostedStartup?.state === 'ready' && !this._nwIsEmsReady()) {
|
|
12308
|
+
this._hostedStartup = { state: 'degraded', error: 'EOS_EMS_INIT_FAILED' };
|
|
12309
|
+
}
|
|
12310
|
+
throw error;
|
|
12138
12311
|
}
|
|
12312
|
+
finally { if (this._nwEmsInitPending === operation) this._nwEmsInitPending = null; }
|
|
12139
12313
|
}
|
|
12140
12314
|
|
|
12141
12315
|
/**
|
|
@@ -12618,7 +12792,7 @@ async onReady() {
|
|
|
12618
12792
|
|
|
12619
12793
|
/** Öffentliche /config-Antwort von Datenpunktpfaden und Migrationsdiagnose befreien. */
|
|
12620
12794
|
const nwSanitizePublicConfig = (payload, installerAccess = false) => {
|
|
12621
|
-
if (installerAccess) return payload;
|
|
12795
|
+
if (installerAccess) return redactInfluxHistoryConfig(payload);
|
|
12622
12796
|
const src = (payload && typeof payload === 'object') ? payload : {};
|
|
12623
12797
|
const out = Object.assign({}, src);
|
|
12624
12798
|
delete out.featureVisibilityTsPreview;
|
|
@@ -12672,7 +12846,7 @@ async onReady() {
|
|
|
12672
12846
|
customerWritePolicy: 'session',
|
|
12673
12847
|
remoteIp: '',
|
|
12674
12848
|
};
|
|
12675
|
-
return out;
|
|
12849
|
+
return redactInfluxHistoryConfig(out);
|
|
12676
12850
|
};
|
|
12677
12851
|
this._nwSanitizePublicConfig = nwSanitizePublicConfig;
|
|
12678
12852
|
|
|
@@ -12905,6 +13079,11 @@ app.get('/apple-touch-icon.png', (_req, res) => {
|
|
|
12905
13079
|
res.type('image/png');
|
|
12906
13080
|
res.sendFile(path.join(__dirname, 'www', 'apple-touch-icon.png'));
|
|
12907
13081
|
});
|
|
13082
|
+
// Conventional iOS probes are fixed public image aliases, never a public directory.
|
|
13083
|
+
app.get(['/apple-touch-icon-precomposed.png', '/apple-touch-icon-180x180.png', '/apple-touch-icon-180x180-precomposed.png'], (_req, res) => {
|
|
13084
|
+
res.type('image/png');
|
|
13085
|
+
res.sendFile(path.join(__dirname, 'www', 'assets', 'icons', 'nexowatt-180.png'));
|
|
13086
|
+
});
|
|
12908
13087
|
// API-Kommentar: GET-Route. Zweck: stellt einen Web-/API-Endpunkt bereit. Zusammenhang: Frontend-Dateien in www/* können diesen Endpunkt direkt nutzen. Route/Handler: '/favicon.ico', (_req, res) => {
|
|
12909
13088
|
app.get('/favicon.ico', (_req, res) => {
|
|
12910
13089
|
res.type('image/x-icon');
|
|
@@ -13270,7 +13449,7 @@ registerSmartHomeDeviceApi(app, {
|
|
|
13270
13449
|
history: (id, options) => new Promise(resolve => {
|
|
13271
13450
|
const instance = String(this._nwGetHistoryInstance() || '').trim();
|
|
13272
13451
|
if (!instance) return resolve({ error: 'HISTORY_NOT_CONFIGURED' });
|
|
13273
|
-
this.
|
|
13452
|
+
this._nwDispatchHistory(instance, { id, options: { ...options, addId: false, ignoreNull: true, limit: 1000 } }, resolve);
|
|
13274
13453
|
}),
|
|
13275
13454
|
}, requireAuth, requireDpDiscovery);
|
|
13276
13455
|
|
|
@@ -15867,7 +16046,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15867
16046
|
// Antworten werden zusätzlich durch die bestehende globale Redaction abgesichert.
|
|
15868
16047
|
const _nwTariffSecretKeys = new Set(['accessToken','securityToken','clientSecret','bearerToken','apiKey','password','refreshToken']);
|
|
15869
16048
|
const _nwMaskTariffProviderForUi = (cfg) => {
|
|
15870
|
-
const clone = this._nwDeepClone(cfg || {}) || {};
|
|
16049
|
+
const clone = redactInfluxHistoryConfig(this._nwDeepClone(cfg || {}) || {});
|
|
15871
16050
|
if (clone?.tariffProvider) delete clone.tariffProvider.retainedProviderCredentials;
|
|
15872
16051
|
const creds = clone && clone.tariffProvider && clone.tariffProvider.credentials;
|
|
15873
16052
|
if (creds && typeof creds === 'object') {
|
|
@@ -15878,7 +16057,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15878
16057
|
return clone;
|
|
15879
16058
|
};
|
|
15880
16059
|
const stripRetainedTariffCredentials = (patch) => {
|
|
15881
|
-
const clean = this._nwDeepClone(patch || {}) || {};
|
|
16060
|
+
const clean = protectInfluxHistoryConfig(this._nwDeepClone(patch || {}) || {}, this._nwHistorySecretCodec());
|
|
15882
16061
|
if (clean.tariffProvider) delete clean.tariffProvider.retainedProviderCredentials;
|
|
15883
16062
|
return clean;
|
|
15884
16063
|
};
|
|
@@ -15921,6 +16100,61 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
15921
16100
|
};
|
|
15922
16101
|
|
|
15923
16102
|
// Abschnitt: Installer/App-Center-APIs. Änderungen wirken direkt auf EMS-Module und DP-Mapping.
|
|
16103
|
+
const requireHistoryInstaller = (req, res, next) => {
|
|
16104
|
+
if (!['admin', 'installer'].includes(req.nwSession?.role)) return sendForbidden(res);
|
|
16105
|
+
return next();
|
|
16106
|
+
};
|
|
16107
|
+
const historyResponse = () => ({ ok: true, config: redactInfluxHistoryConfig({ history: this.config?.history || { provider: 'adapter' } }).history, configurationRevision: this._nwInstallerConfigRevision(), status: this._nwDirectHistory.status() });
|
|
16108
|
+
const historyFailure = (res, error) => {
|
|
16109
|
+
const rawCode = error?.code;
|
|
16110
|
+
const code = typeof rawCode === 'string' && /^EOS_INFLUX_[A-Z_]{1,64}$/.test(rawCode) ? rawCode : 'EOS_INFLUX_REQUEST_FAILED';
|
|
16111
|
+
const invalid = ['EOS_INFLUX_CONFIG_INVALID', 'EOS_INFLUX_PROVIDER_INVALID', 'EOS_INFLUX_TOKEN_INVALID', 'EOS_INFLUX_CA_INVALID', 'EOS_INFLUX_URL_INVALID', 'EOS_INFLUX_NEW_DESTINATION_REQUIRES_TOKEN'].includes(code);
|
|
16112
|
+
return res.status(invalid ? 400 : 503).json({ ok: false, error: code });
|
|
16113
|
+
};
|
|
16114
|
+
app.get('/api/installer/history', requireInstaller, requireHistoryInstaller, (_req, res) => {
|
|
16115
|
+
sendNoStore(res); this._nwConfigureHistory(); return res.json(historyResponse());
|
|
16116
|
+
});
|
|
16117
|
+
app.post('/api/installer/history/check', requireInstaller, requireHistoryInstaller, async (req, res) => {
|
|
16118
|
+
sendNoStore(res);
|
|
16119
|
+
if (this._nwShuttingDown || this._bridge.canWrite() !== true) return res.status(503).json({ ok: false, error: 'EOS_UI_OWNERSHIP_REQUIRED' });
|
|
16120
|
+
if (this._nwHistoryCheckInFlight) return res.status(409).json({ ok: false, error: 'EOS_INFLUX_CHECK_BUSY' });
|
|
16121
|
+
this._nwHistoryCheckInFlight = true;
|
|
16122
|
+
let client = null;
|
|
16123
|
+
try {
|
|
16124
|
+
const candidate = prepareInfluxHistoryChange(this.config?.history, req.body?.history || { provider: 'influxdb2' });
|
|
16125
|
+
if (candidate.provider !== 'influxdb2') return res.status(400).json({ ok: false, error: 'EOS_INFLUX_PROVIDER_INVALID' });
|
|
16126
|
+
client = new InfluxDirectClient(candidate.influxdb2);
|
|
16127
|
+
this._nwHistoryCheckClient = client;
|
|
16128
|
+
const check = await client.check();
|
|
16129
|
+
return res.json({ ok: true, check });
|
|
16130
|
+
} catch (error) { return historyFailure(res, error); }
|
|
16131
|
+
finally { client?.close(); this._nwHistoryCheckClient = null; this._nwHistoryCheckInFlight = false; }
|
|
16132
|
+
});
|
|
16133
|
+
app.post('/api/installer/history', requireInstaller, requireHistoryInstaller, async (req, res) => {
|
|
16134
|
+
sendNoStore(res);
|
|
16135
|
+
if (this._nwShuttingDown || this._bridge.canWrite() !== true) return res.status(503).json({ ok: false, error: 'EOS_UI_OWNERSHIP_REQUIRED' });
|
|
16136
|
+
const mutation = beginMeshAppSave();
|
|
16137
|
+
if (!mutation) return res.status(409).json({ ok: false, error: 'EOS_INFLUX_CONFIG_BUSY' });
|
|
16138
|
+
try {
|
|
16139
|
+
if (typeof req.body?.expectedConfigurationRevision !== 'string' || req.body.expectedConfigurationRevision !== this._nwInstallerConfigRevision()) {
|
|
16140
|
+
return res.status(409).json({ ok: false, error: 'EOS_INSTALLER_CONFIG_CONFLICT' });
|
|
16141
|
+
}
|
|
16142
|
+
const history = prepareInfluxHistoryChange(this.config?.history, req.body?.history);
|
|
16143
|
+
const patch = { ...this._nwDeepClone(this._nwInstallerConfigPatch || {}), history };
|
|
16144
|
+
if (await this.persistInstallerConfigToState(patch) === false) return res.status(503).json({ ok: false, error: 'EOS_INFLUX_CONFIG_SAVE_FAILED' });
|
|
16145
|
+
this._nwInstallerConfigPatch = patch;
|
|
16146
|
+
this.config = this.nwApplyInstallerPatchToRuntimeConfig(this.config, patch);
|
|
16147
|
+
if (this._nwShuttingDown || this._bridge.canWrite() !== true) return res.status(503).json({ ok: false, saved: true, error: 'EOS_UI_OWNERSHIP_REQUIRED' });
|
|
16148
|
+
this._nwConfigureHistory();
|
|
16149
|
+
await this.ensureHistorieExportStates();
|
|
16150
|
+
if (!this._nwShuttingDown && this._bridge.canWrite() === true) {
|
|
16151
|
+
void this.updateHistorieExportStates('history-save').catch(() => {});
|
|
16152
|
+
}
|
|
16153
|
+
try { await this.nwWriteUserdataBackup(patch, 'history-save'); } catch (_error) {}
|
|
16154
|
+
return res.json(historyResponse());
|
|
16155
|
+
} catch (error) { return historyFailure(res, error); }
|
|
16156
|
+
finally { endMeshAppSave(mutation); }
|
|
16157
|
+
});
|
|
15924
16158
|
// API-Kommentar: GET-Route. Zweck: stellt einen Web-/API-Endpunkt bereit. Zusammenhang: Frontend-Dateien in www/* können diesen Endpunkt direkt nutzen. Route/Handler: '/api/installer/config', requireInstaller, async (_req, res) => {
|
|
15925
16159
|
app.get('/api/installer/config', requireInstaller, async (_req, res) => {
|
|
15926
16160
|
try {
|
|
@@ -16233,6 +16467,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16233
16467
|
res.status(400).json({ ok: false, error: 'invalid backup/patch' });
|
|
16234
16468
|
return;
|
|
16235
16469
|
}
|
|
16470
|
+
patch = restoreInfluxHistoryConfig(patch, this._nwHistorySecretCodec());
|
|
16236
16471
|
const tokenError = nwValidateStationTokenChanges(patch);
|
|
16237
16472
|
if (tokenError) return res.status(400).json({ ok: false, error: 'invalid_station_token', message: tokenError });
|
|
16238
16473
|
|
|
@@ -16253,7 +16488,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16253
16488
|
'settingsConfig',
|
|
16254
16489
|
|
|
16255
16490
|
// Optional diagnostics settings
|
|
16256
|
-
'diagnostics',
|
|
16491
|
+
'diagnostics', 'history',
|
|
16257
16492
|
]);
|
|
16258
16493
|
|
|
16259
16494
|
// Build sanitized patch
|
|
@@ -16281,6 +16516,11 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16281
16516
|
if (Object.prototype.hasOwnProperty.call(safePatch, 'nvpTopology')) finalPatch.nvpTopology = this._nwDeepClone(safePatch.nvpTopology);
|
|
16282
16517
|
else if (this.config.nvpTopology !== undefined) finalPatch.nvpTopology = this._nwDeepClone(this.config.nvpTopology);
|
|
16283
16518
|
|
|
16519
|
+
// Credentials are atomic even for merge imports: a quarantined incoming
|
|
16520
|
+
// envelope must never inherit the previous destination's plaintext token.
|
|
16521
|
+
if (safePatch.history !== undefined) finalPatch.history = this._nwDeepClone(safePatch.history);
|
|
16522
|
+
else if (this.config.history !== undefined) finalPatch.history = this._nwDeepClone(this.config.history);
|
|
16523
|
+
|
|
16284
16524
|
// Apply to runtime config based on instance native (drop old patch leftovers)
|
|
16285
16525
|
let baseNative = {};
|
|
16286
16526
|
try {
|
|
@@ -16326,7 +16566,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
16326
16566
|
await this._nwApplyInstallerRuntime(restartEms, 'import');
|
|
16327
16567
|
try { await this.nwWriteUserdataBackup(finalPatch, 'import'); } catch (_e) {}
|
|
16328
16568
|
|
|
16329
|
-
res.json({ ok: true, imported: true, restarted: !!restartEms, config: _nwPickPersistedInstallerConfig(), configurationRevision: this._nwInstallerConfigRevision() });
|
|
16569
|
+
res.json({ ok: true, imported: true, restarted: !!restartEms, config: _nwMaskTariffProviderForUi(_nwPickPersistedInstallerConfig()), configurationRevision: this._nwInstallerConfigRevision() });
|
|
16330
16570
|
this._bridge.deviceEmsConfigChanged?.();
|
|
16331
16571
|
} catch (e) {
|
|
16332
16572
|
const failure = safeConfigurationFailure(e);
|
|
@@ -17346,7 +17586,7 @@ app.get('/api/smarthome/type-detect', requireDpDiscovery, async (req, res) => {
|
|
|
17346
17586
|
app.get('/api/ems/status', requireInstaller, async (req, res) => {
|
|
17347
17587
|
try {
|
|
17348
17588
|
const engine = this.emsEngine;
|
|
17349
|
-
const running =
|
|
17589
|
+
const running = this._nwIsEmsReady();
|
|
17350
17590
|
const intervalMs = engine && typeof engine._intervalMs === 'number' ? engine._intervalMs : null;
|
|
17351
17591
|
|
|
17352
17592
|
const mm = engine && engine.mm ? engine.mm : null;
|
|
@@ -18545,7 +18785,7 @@ app.get('/api/history', async (req, res) => {
|
|
|
18545
18785
|
* Zusammenhang: Gehört zu ioBroker-Adapterkern (Adapter-Lifecycle, Webserver, REST-/SSE-API, State-Anlage, Lizenz und EMS-Engine) und wird von benachbarten UI-/API-/EMS-Bausteinen genutzt.
|
|
18546
18786
|
* Wartung/TypeScript: Änderungen können Adapterstart, APIs, States und Webserver beeinflussen; unload/connection immer mittesten. Beim TS-Umbau Parameter, Rückgabe und genutzte State-/Config-Objekte explizit typisieren.
|
|
18547
18787
|
*/
|
|
18548
|
-
const densifyHoldLast = (values, rangeStart = start, rangeEnd = end, rangeStepMs = stepMs) => {
|
|
18788
|
+
const densifyHoldLast = (values, rangeStart = start, rangeEnd = end, rangeStepMs = stepMs, maxHoldMs = Infinity) => {
|
|
18549
18789
|
const rStart = Number(rangeStart);
|
|
18550
18790
|
const rEnd = Number(rangeEnd);
|
|
18551
18791
|
const rStep = Number(rangeStepMs);
|
|
@@ -18572,12 +18812,15 @@ app.get('/api/history', async (req, res) => {
|
|
|
18572
18812
|
const out = [];
|
|
18573
18813
|
let havePrev = false;
|
|
18574
18814
|
let prev = null;
|
|
18815
|
+
let prevTs = -Infinity;
|
|
18575
18816
|
for (let i = 0; i <= n; i++) {
|
|
18576
18817
|
if (byIdx.has(i)) {
|
|
18577
18818
|
prev = byIdx.get(i);
|
|
18578
18819
|
havePrev = true;
|
|
18820
|
+
prevTs = rStart + i * rStep;
|
|
18579
18821
|
}
|
|
18580
|
-
|
|
18822
|
+
const ts = rStart + i * rStep;
|
|
18823
|
+
out.push([ts, havePrev && ts - prevTs <= maxHoldMs ? prev : null]);
|
|
18581
18824
|
}
|
|
18582
18825
|
|
|
18583
18826
|
// Ensure the series reaches exactly `rangeEnd` so the chart does not visually "stop"
|
|
@@ -18586,7 +18829,7 @@ app.get('/api/history', async (req, res) => {
|
|
|
18586
18829
|
if (out.length) {
|
|
18587
18830
|
const lastTs = out[out.length - 1][0];
|
|
18588
18831
|
if (Number.isFinite(lastTs) && lastTs < rEnd) {
|
|
18589
|
-
out.push([rEnd, havePrev ? prev : null]);
|
|
18832
|
+
out.push([rEnd, havePrev && rEnd - prevTs <= maxHoldMs ? prev : null]);
|
|
18590
18833
|
}
|
|
18591
18834
|
}
|
|
18592
18835
|
return out;
|
|
@@ -18691,11 +18934,21 @@ app.get('/api/history', async (req, res) => {
|
|
|
18691
18934
|
const cacheKey = `${cacheId}|${queryStart}|${queryEnd}|${queryStepMs}`;
|
|
18692
18935
|
if (requestSeriesCache.has(cacheKey)) return requestSeriesCache.get(cacheKey);
|
|
18693
18936
|
const options = { start: queryStart, end: queryEnd, step: queryStepMs, aggregate: 'average', addId: false, ignoreNull: true };
|
|
18937
|
+
// Canonical power/SoC states are exported periodically even when unchanged
|
|
18938
|
+
// (tolAbs=0, Influx changesOnly=false). Missing later buckets are unknown,
|
|
18939
|
+
// not permission to extend an old measurement across a device outage.
|
|
18940
|
+
// Explicit legacy mappings and tariff states can be on-change: keep their
|
|
18941
|
+
// established sparse-series contract instead of inventing a freshness age.
|
|
18942
|
+
const periodicHistory = ['core.', 'evcs.', 'consumers.', 'producers.']
|
|
18943
|
+
.some(part => sid?.startsWith(`${this.namespace}.historie.${part}`));
|
|
18944
|
+
const exportRaw = Number(this.config?.history?.exportIntervalMs || this.config?.history?.intervalMs);
|
|
18945
|
+
const exportMs = Math.max(600000, Math.min(3600000, Number.isFinite(exportRaw) ? Math.round(exportRaw) : 600000));
|
|
18946
|
+
const maxHoldMs = periodicHistory ? Math.max(exportMs, queryStepMs) : Infinity;
|
|
18694
18947
|
const promise = !sid ? Promise.resolve({ id: sid || id, values: [] }) : historyRequest(
|
|
18695
|
-
callback => this.
|
|
18948
|
+
callback => this._nwDispatchHistory(inst, { id: sid, options }, callback),
|
|
18696
18949
|
result => ({ id: sid, values: densifyHoldLast(
|
|
18697
18950
|
this._nwNormalizeHistoryResult(result, 10000).map(point => [point.ts, point.val]),
|
|
18698
|
-
queryStart, queryEnd, queryStepMs,
|
|
18951
|
+
queryStart, queryEnd, queryStepMs, maxHoldMs,
|
|
18699
18952
|
) }),
|
|
18700
18953
|
);
|
|
18701
18954
|
|
|
@@ -18726,7 +18979,7 @@ app.get('/api/history', async (req, res) => {
|
|
|
18726
18979
|
const netFeeActiveNow = !!(this.stateCache && this.stateCache['settings.netFeeEnabled'] && this.stateCache['settings.netFeeEnabled'].value);
|
|
18727
18980
|
const pricingActiveNow = !!(dynamicTariffActiveNow || netFeeActiveNow);
|
|
18728
18981
|
const wantSocSeries = stepMs <= (10 * 60 * 1000);
|
|
18729
|
-
const manualGrossPriceNow =
|
|
18982
|
+
const manualGrossPriceNow = tariffPriceNumber(this.stateCache?.['settings.price']?.value);
|
|
18730
18983
|
const grossPriceCandidates = [
|
|
18731
18984
|
`${this.namespace}.historie.tariff.providerCurrentEurPerKwh`,
|
|
18732
18985
|
`${this.namespace}.tarif.preisAktuellEurProKwh`,
|
|
@@ -18820,13 +19073,13 @@ app.get('/api/history', async (req, res) => {
|
|
|
18820
19073
|
: ((!dynamicTariffActive && Number.isFinite(manualGrossPrice)) ? manualGrossPrice : rawTotal);
|
|
18821
19074
|
if (!Number.isFinite(total) && Number.isFinite(rawBase)) total = rawBase + netFee;
|
|
18822
19075
|
if (!Number.isFinite(total) && Number.isFinite(manualGrossPrice)) total = manualGrossPrice;
|
|
18823
|
-
|
|
18824
|
-
|
|
19076
|
+
// These archived values already use EUR/kWh. Keep genuine signed
|
|
19077
|
+
// prices; neither missing values nor a lower clamp create a quote.
|
|
19078
|
+
if (!Number.isFinite(total)) total = null;
|
|
18825
19079
|
|
|
18826
|
-
let base = total - netFee;
|
|
19080
|
+
let base = total === null ? null : total - netFee;
|
|
18827
19081
|
if (!Number.isFinite(base) && Number.isFinite(rawBase)) base = rawBase;
|
|
18828
19082
|
if (!Number.isFinite(base)) base = total;
|
|
18829
|
-
base = Math.max(-5, base);
|
|
18830
19083
|
|
|
18831
19084
|
baseOut.push([ts, base]);
|
|
18832
19085
|
totalOut.push([ts, total]);
|
|
@@ -18888,6 +19141,7 @@ app.get('/api/history', async (req, res) => {
|
|
|
18888
19141
|
lpIds.push(`${this.namespace}.historie.evcs.lp${i}.powerW`);
|
|
18889
19142
|
}
|
|
18890
19143
|
const sumByTs = new Map();
|
|
19144
|
+
const samplesByTs = new Map();
|
|
18891
19145
|
// Avoid keeping up to 200 full charge-point arrays alive together.
|
|
18892
19146
|
// Eight parallel reads still share the whole request deadline.
|
|
18893
19147
|
for (let offset = 0; offset < lpIds.length; offset += 8) {
|
|
@@ -18895,18 +19149,21 @@ app.get('/api/history', async (req, res) => {
|
|
|
18895
19149
|
const lpSeries = await Promise.all(batchIds.map(id => ask(id)));
|
|
18896
19150
|
for (const series of lpSeries) {
|
|
18897
19151
|
for (const point of series.values) {
|
|
18898
|
-
if (point[1] === null || point[1] === undefined) continue;
|
|
18899
19152
|
const ts = Number(point[0]);
|
|
19153
|
+
if (!Number.isFinite(ts)) continue;
|
|
19154
|
+
if (!sumByTs.has(ts)) sumByTs.set(ts, 0);
|
|
19155
|
+
if (point[1] === null || point[1] === undefined) continue;
|
|
18900
19156
|
const value = Number(point[1]);
|
|
18901
19157
|
if (!Number.isFinite(ts) || !Number.isFinite(value)) continue;
|
|
18902
19158
|
sumByTs.set(ts, (sumByTs.get(ts) || 0) + value);
|
|
19159
|
+
samplesByTs.set(ts, (samplesByTs.get(ts) || 0) + 1);
|
|
18903
19160
|
}
|
|
18904
19161
|
}
|
|
18905
19162
|
for (const id of batchIds) requestSeriesCache.delete(`${id}|${start}|${end}|${Math.max(60000, stepS * 1000)}`);
|
|
18906
19163
|
}
|
|
18907
19164
|
const vals = Array.from(sumByTs.entries())
|
|
18908
19165
|
.sort((a, b) => a[0] - b[0])
|
|
18909
|
-
.map(([ts, v]) => [ts, v]);
|
|
19166
|
+
.map(([ts, v]) => [ts, samplesByTs.get(ts) === count ? v : null]);
|
|
18910
19167
|
if (vals.length >= 2) {
|
|
18911
19168
|
evcs.id = `${this.namespace}.historie.evcs.sum.powerW`;
|
|
18912
19169
|
evcs.values = vals;
|
|
@@ -18945,7 +19202,7 @@ const readCounterPoint = (id, newest) => {
|
|
|
18945
19202
|
count: 1, returnNewestEntries: !!newest, removeBorderValues: false,
|
|
18946
19203
|
};
|
|
18947
19204
|
return historyRequest(
|
|
18948
|
-
callback => this.
|
|
19205
|
+
callback => this._nwDispatchHistory(inst, { id, options }, callback),
|
|
18949
19206
|
result => {
|
|
18950
19207
|
const points = this._nwNormalizeHistoryResult(result, 10000);
|
|
18951
19208
|
return points.length ? (newest ? points[points.length - 1] : points[0]) : null;
|
|
@@ -19102,21 +19359,25 @@ const buildEnergyExact = async () => {
|
|
|
19102
19359
|
if (count > 0) {
|
|
19103
19360
|
const query = { start, end: energyExactEnd, stepMs: energyExactStepMs };
|
|
19104
19361
|
const sumByTs = new Map();
|
|
19362
|
+
const samplesByTs = new Map();
|
|
19105
19363
|
for (let offset = 0; offset < count; offset += 8) {
|
|
19106
19364
|
const ids = Array.from({ length: Math.min(8, count - offset) }, (_value, index) => `${this.namespace}.historie.evcs.lp${offset + index + 1}.powerW`);
|
|
19107
19365
|
const lpSeries = await Promise.all(ids.map(id => ask(id, query)));
|
|
19108
19366
|
for (const series of lpSeries) {
|
|
19109
19367
|
for (const row of series.values) {
|
|
19110
|
-
if (row[1] === null || row[1] === undefined) continue;
|
|
19111
19368
|
const ts = Number(row[0]);
|
|
19369
|
+
if (!Number.isFinite(ts) || ts > energyExactEnd) continue;
|
|
19370
|
+
if (!sumByTs.has(ts)) sumByTs.set(ts, 0);
|
|
19371
|
+
if (row[1] === null || row[1] === undefined) continue;
|
|
19112
19372
|
const value = Number(row[1]);
|
|
19113
19373
|
if (!Number.isFinite(ts) || !Number.isFinite(value) || ts > energyExactEnd) continue;
|
|
19114
19374
|
sumByTs.set(ts, (sumByTs.get(ts) || 0) + value);
|
|
19375
|
+
samplesByTs.set(ts, (samplesByTs.get(ts) || 0) + 1);
|
|
19115
19376
|
}
|
|
19116
19377
|
}
|
|
19117
19378
|
for (const id of ids) requestSeriesCache.delete(`${id}|${start}|${energyExactEnd}|${energyExactStepMs}`);
|
|
19118
19379
|
}
|
|
19119
|
-
const vals = Array.from(sumByTs.entries()).sort((a, b) => a[0] - b[0]).map(([ts, v]) => [ts, v]);
|
|
19380
|
+
const vals = Array.from(sumByTs.entries()).sort((a, b) => a[0] - b[0]).map(([ts, v]) => [ts, samplesByTs.get(ts) === count ? v : null]);
|
|
19120
19381
|
if (vals.length >= 2) evExact = clipSeriesForIntegration({ id: `${this.namespace}.historie.evcs.sum.powerW`, values: vals }, energyExactEnd);
|
|
19121
19382
|
}
|
|
19122
19383
|
}
|
|
@@ -19147,7 +19408,8 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19147
19408
|
active: !!((this.stateCache && this.stateCache['settings.dynamicTariff'] && this.stateCache['settings.dynamicTariff'].value) || (this.stateCache && this.stateCache['settings.netFeeEnabled'] && this.stateCache['settings.netFeeEnabled'].value)),
|
|
19148
19409
|
dynamicTariff: dynamicTariffActiveNow,
|
|
19149
19410
|
netFeeEnabled: !!(this.stateCache && this.stateCache['settings.netFeeEnabled'] && this.stateCache['settings.netFeeEnabled'].value),
|
|
19150
|
-
historyReady: [normalizedPricingSeries.base,
|
|
19411
|
+
historyReady: [normalizedPricingSeries.base, normalizedPricingSeries.total].some(s => Array.isArray(s && s.values)
|
|
19412
|
+
&& s.values.some(point => Number.isFinite(tariffPriceNumber(point?.[1])))),
|
|
19151
19413
|
series: { base: normalizedPricingSeries.base, netFee: priceNetFee, total: normalizedPricingSeries.total },
|
|
19152
19414
|
};
|
|
19153
19415
|
return { ok:true, start, end, step: stepS, series: out, extras: { consumers: extraConsumers, producers: extraProducers }, energy, energyExact, pricing };
|
|
@@ -19179,6 +19441,9 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19179
19441
|
app.get('/api/tariff/report', async (req, res) => {
|
|
19180
19442
|
try {
|
|
19181
19443
|
const intervalMs = 15 * 60 * 1000;
|
|
19444
|
+
const retentionTargetDays = 730;
|
|
19445
|
+
const maxDurationMs = retentionTargetDays * 24 * 3600 * 1000;
|
|
19446
|
+
const maxReportBuckets = Math.ceil(maxDurationMs / intervalMs) + 1;
|
|
19182
19447
|
/**
|
|
19183
19448
|
* Code-Teil: parseTs
|
|
19184
19449
|
* Zweck: Wandelt Rohwerte in ein stabiles internes Format um, damit spätere Logik konsistent arbeiten kann.
|
|
@@ -19187,6 +19452,7 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19187
19452
|
*/
|
|
19188
19453
|
const parseTs = (raw, { endOfDay = false } = {}) => {
|
|
19189
19454
|
if (raw === null || raw === undefined || raw === '') return null;
|
|
19455
|
+
if (typeof raw !== 'number' && typeof raw !== 'string') return null;
|
|
19190
19456
|
if (typeof raw === 'number' && Number.isFinite(raw)) return raw < 1e12 ? raw * 1000 : raw;
|
|
19191
19457
|
const s = String(raw).trim();
|
|
19192
19458
|
if (!s) return null;
|
|
@@ -19198,6 +19464,7 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19198
19464
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) {
|
|
19199
19465
|
const [y, m, d] = s.split('-').map((n) => Number(n));
|
|
19200
19466
|
const dt = new Date(y, m - 1, d, 0, 0, 0, 0);
|
|
19467
|
+
if (dt.getFullYear() !== y || dt.getMonth() !== m - 1 || dt.getDate() !== d) return null;
|
|
19201
19468
|
if (endOfDay) dt.setHours(23, 59, 59, 999);
|
|
19202
19469
|
return dt.getTime();
|
|
19203
19470
|
}
|
|
@@ -19226,48 +19493,46 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19226
19493
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
19227
19494
|
*/
|
|
19228
19495
|
const defaultFrom = (() => { const d = new Date(now); d.setHours(0, 0, 0, 0); return d.getTime(); })();
|
|
19229
|
-
const requestedFrom = parseTs(req.query.from)
|
|
19230
|
-
const requestedTo = parseTs(req.query.to, { endOfDay: true })
|
|
19496
|
+
const requestedFrom = req.query.from === undefined ? defaultFrom : parseTs(req.query.from);
|
|
19497
|
+
const requestedTo = req.query.to === undefined ? now : parseTs(req.query.to, { endOfDay: true });
|
|
19231
19498
|
const start = alignDown(requestedFrom);
|
|
19232
|
-
const end =
|
|
19499
|
+
const end = alignUp(requestedTo);
|
|
19500
|
+
const bucketCount = Math.ceil((end - start) / intervalMs);
|
|
19501
|
+
// Keep the existing two-year report horizon, including one boundary
|
|
19502
|
+
// bucket, but reject malformed or unbounded requests before any IO.
|
|
19503
|
+
if (!Number.isSafeInteger(requestedFrom) || !Number.isSafeInteger(requestedTo) || requestedFrom < 0 ||
|
|
19504
|
+
requestedTo <= requestedFrom || requestedTo > 8640000000000000 || requestedTo - requestedFrom > maxDurationMs ||
|
|
19505
|
+
!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || !Number.isSafeInteger(bucketCount) ||
|
|
19506
|
+
bucketCount < 1 || bucketCount > maxReportBuckets) {
|
|
19507
|
+
return res.status(400).json({ ok: false, error: 'EOS_HISTORY_RANGE_INVALID' });
|
|
19508
|
+
}
|
|
19233
19509
|
/**
|
|
19234
|
-
* Code-Teil:
|
|
19510
|
+
* Code-Teil: intervalSeries
|
|
19235
19511
|
* Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
|
|
19236
19512
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
19237
19513
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
19238
19514
|
*/
|
|
19239
|
-
const
|
|
19515
|
+
const intervalSeries = (series) => {
|
|
19240
19516
|
const src = Array.isArray(series) ? series : [];
|
|
19241
|
-
const count = Math.max(1, Math.ceil((end - start) / intervalMs));
|
|
19242
19517
|
const byIdx = new Map();
|
|
19243
|
-
let havePrev = false;
|
|
19244
|
-
let prev = null;
|
|
19245
19518
|
for (const p of src) {
|
|
19246
19519
|
const ts = this._nwNormTsMs(p && p.ts);
|
|
19247
|
-
const val =
|
|
19248
|
-
if (!Number.isFinite(ts) ||
|
|
19249
|
-
|
|
19250
|
-
prev = val;
|
|
19251
|
-
havePrev = true;
|
|
19252
|
-
continue;
|
|
19253
|
-
}
|
|
19254
|
-
const idx = Math.round((ts - start) / intervalMs);
|
|
19255
|
-
if (idx < 0 || idx >= count) continue;
|
|
19520
|
+
const val = tariffPriceNumber(p && p.val);
|
|
19521
|
+
if (!Number.isFinite(ts) || ts < start || ts >= end) continue;
|
|
19522
|
+
const idx = Math.floor((ts - start) / intervalMs);
|
|
19256
19523
|
byIdx.set(idx, val);
|
|
19257
19524
|
}
|
|
19258
19525
|
const out = [];
|
|
19259
|
-
for (let i = 0; i <
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
havePrev = true;
|
|
19263
|
-
}
|
|
19264
|
-
out.push({ ts: start + (i * intervalMs), val: havePrev ? prev : null });
|
|
19526
|
+
for (let i = 0; i < bucketCount; i++) {
|
|
19527
|
+
// Missing averages are gaps, not zero and not another quarter's value.
|
|
19528
|
+
out.push({ ts: start + (i * intervalMs), val: byIdx.has(i) ? byIdx.get(i) : null });
|
|
19265
19529
|
}
|
|
19266
19530
|
return out;
|
|
19267
19531
|
};
|
|
19268
19532
|
|
|
19269
19533
|
const dynamicTariffActive = !!(this.stateCache?.['settings.dynamicTariff']?.value);
|
|
19270
|
-
const
|
|
19534
|
+
const netFeeEnabled = !!(this.stateCache?.['settings.netFeeEnabled']?.value);
|
|
19535
|
+
const manualGrossPrice = tariffPriceNumber(this.stateCache?.['settings.price']?.value);
|
|
19271
19536
|
const grossPriceCandidates = [
|
|
19272
19537
|
`${this.namespace}.historie.tariff.providerCurrentEurPerKwh`,
|
|
19273
19538
|
`${this.namespace}.tarif.preisAktuellEurProKwh`,
|
|
@@ -19278,14 +19543,14 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19278
19543
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
19279
19544
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
19280
19545
|
*/
|
|
19281
|
-
const seriesFor = async (name) =>
|
|
19546
|
+
const seriesFor = async (name) => intervalSeries(await this._nwGetHistoryAvgSeriesAny(this._nwGetHistoryDpCandidates(name), start, end, intervalMs));
|
|
19282
19547
|
/**
|
|
19283
19548
|
* Code-Teil: seriesForIds
|
|
19284
19549
|
* Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
|
|
19285
19550
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
19286
19551
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
19287
19552
|
*/
|
|
19288
|
-
const seriesForIds = async (ids) =>
|
|
19553
|
+
const seriesForIds = async (ids) => intervalSeries(await this._nwGetHistoryAvgSeriesAny(ids, start, end, intervalMs));
|
|
19289
19554
|
const [baseSeries, netFeeSeries, totalSeries, grossSeries, buySeries] = await Promise.all([
|
|
19290
19555
|
seriesFor('priceBase'),
|
|
19291
19556
|
seriesFor('priceNetFee'),
|
|
@@ -19294,36 +19559,31 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19294
19559
|
seriesFor('gridBuyPower'),
|
|
19295
19560
|
]);
|
|
19296
19561
|
|
|
19297
|
-
const bucketCount = Math.max(1, Math.ceil((end - start) / intervalMs));
|
|
19298
19562
|
const intervals = [];
|
|
19299
19563
|
for (let i = 0; i < bucketCount; i++) {
|
|
19300
19564
|
const rowStart = start + (i * intervalMs);
|
|
19301
19565
|
const rowEnd = rowStart + intervalMs;
|
|
19302
|
-
const rawBase =
|
|
19303
|
-
const rawNet =
|
|
19304
|
-
const rawTotal =
|
|
19305
|
-
const rawGross =
|
|
19306
|
-
const rawBuy =
|
|
19307
|
-
|
|
19308
|
-
|
|
19309
|
-
let total = Number.isFinite(rawGross)
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
if (
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
const
|
|
19323
|
-
const importKwh = (importAvgW * intervalMs) / 3600000000;
|
|
19324
|
-
const baseCostEur = importKwh * base;
|
|
19325
|
-
const netFeeCostEur = importKwh * netFee;
|
|
19326
|
-
const totalCostEur = importKwh * total;
|
|
19566
|
+
const rawBase = tariffPriceNumber(baseSeries.at(i)?.val);
|
|
19567
|
+
const rawNet = tariffPriceNumber(netFeeSeries.at(i)?.val);
|
|
19568
|
+
const rawTotal = tariffPriceNumber(totalSeries.at(i)?.val);
|
|
19569
|
+
const rawGross = tariffPriceNumber(grossSeries.at(i)?.val);
|
|
19570
|
+
const rawBuy = tariffPriceNumber(buySeries.at(i)?.val);
|
|
19571
|
+
|
|
19572
|
+
const netFee = Number.isFinite(rawNet) ? Math.max(0, rawNet) : netFeeEnabled ? null : 0;
|
|
19573
|
+
let total = Number.isFinite(rawGross) ? rawGross : rawTotal;
|
|
19574
|
+
if (!Number.isFinite(total) && Number.isFinite(rawBase) && Number.isFinite(netFee)) total = rawBase + netFee;
|
|
19575
|
+
const configuredPriceFallback = !Number.isFinite(total) && !dynamicTariffActive && Number.isFinite(manualGrossPrice);
|
|
19576
|
+
if (configuredPriceFallback) total = manualGrossPrice;
|
|
19577
|
+
|
|
19578
|
+
const base = Number.isFinite(total) && Number.isFinite(netFee) ? total - netFee : rawBase;
|
|
19579
|
+
|
|
19580
|
+
const importAvgW = Number.isFinite(rawBuy) ? Math.max(0, rawBuy) : null;
|
|
19581
|
+
const intervalClosed = rowEnd <= now;
|
|
19582
|
+
const importKwh = Number.isFinite(importAvgW) && intervalClosed ? (importAvgW * intervalMs) / 3600000000 : null;
|
|
19583
|
+
const cost = price => Number.isFinite(importKwh) && Number.isFinite(price) ? importKwh * price : null;
|
|
19584
|
+
const baseCostEur = cost(base);
|
|
19585
|
+
const netFeeCostEur = cost(netFee);
|
|
19586
|
+
const totalCostEur = cost(total);
|
|
19327
19587
|
|
|
19328
19588
|
intervals.push({
|
|
19329
19589
|
startTs: rowStart,
|
|
@@ -19336,16 +19596,27 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19336
19596
|
baseCostEur,
|
|
19337
19597
|
netFeeCostEur,
|
|
19338
19598
|
totalCostEur,
|
|
19599
|
+
complete: [baseCostEur, netFeeCostEur, totalCostEur].every(Number.isFinite),
|
|
19600
|
+
intervalClosed,
|
|
19601
|
+
configuredPriceFallback,
|
|
19339
19602
|
});
|
|
19340
19603
|
}
|
|
19341
|
-
const prices = intervals.map(
|
|
19342
|
-
const
|
|
19343
|
-
|
|
19344
|
-
const
|
|
19345
|
-
const
|
|
19346
|
-
const
|
|
19604
|
+
const prices = intervals.map(row => row.totalEurPerKwh).filter(Number.isFinite);
|
|
19605
|
+
const completeSum = value => intervals.every(row => Number.isFinite(value(row)))
|
|
19606
|
+
? intervals.reduce((sum, row) => sum + value(row), 0) : null;
|
|
19607
|
+
const totalImportKwh = completeSum(row => row.importKwh);
|
|
19608
|
+
const totalBaseCost = completeSum(row => row.baseCostEur);
|
|
19609
|
+
const totalNetFeeCost = completeSum(row => row.netFeeCostEur);
|
|
19610
|
+
const totalCost = completeSum(row => row.totalCostEur);
|
|
19611
|
+
const avgPrice = !Number.isFinite(totalImportKwh) || !Number.isFinite(totalCost) ? null : totalImportKwh > 0.0001
|
|
19347
19612
|
? (totalCost / totalImportKwh)
|
|
19348
|
-
: (prices.length ? prices.reduce((a, b) => a + b, 0) / prices.length : null);
|
|
19613
|
+
: (prices.length === bucketCount ? prices.reduce((a, b) => a + b, 0) / prices.length : null);
|
|
19614
|
+
const completeIntervals = intervals.filter(row => row.complete).length;
|
|
19615
|
+
const coverage = { complete: completeIntervals === bucketCount, completeIntervals,
|
|
19616
|
+
missingIntervals: bucketCount - completeIntervals, priceIntervals: prices.length,
|
|
19617
|
+
importIntervals: intervals.filter(row => Number.isFinite(row.importKwh)).length,
|
|
19618
|
+
openIntervals: intervals.filter(row => !row.intervalClosed).length,
|
|
19619
|
+
configuredPriceIntervals: intervals.filter(row => row.configuredPriceFallback).length };
|
|
19349
19620
|
|
|
19350
19621
|
const historyInstance = String(this._nwGetHistoryInstance() || '').trim();
|
|
19351
19622
|
res.json({
|
|
@@ -19360,17 +19631,19 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19360
19631
|
netFeeEnabled: !!(this.stateCache?.['settings.netFeeEnabled']?.value),
|
|
19361
19632
|
historyInstance,
|
|
19362
19633
|
historyReady: !!historyInstance,
|
|
19363
|
-
retentionTargetDays
|
|
19634
|
+
retentionTargetDays,
|
|
19635
|
+
coverage,
|
|
19364
19636
|
},
|
|
19365
19637
|
summary: {
|
|
19366
|
-
minPrice: prices.length ? Math.min(
|
|
19367
|
-
maxPrice: prices.length ? Math.max(
|
|
19638
|
+
minPrice: prices.length ? prices.reduce((a, b) => Math.min(a, b), Infinity) : null,
|
|
19639
|
+
maxPrice: prices.length ? prices.reduce((a, b) => Math.max(a, b), -Infinity) : null,
|
|
19368
19640
|
avgPrice,
|
|
19369
19641
|
importKwh: totalImportKwh,
|
|
19370
19642
|
baseCost: totalBaseCost,
|
|
19371
19643
|
netFeeCost: totalNetFeeCost,
|
|
19372
19644
|
totalCost,
|
|
19373
19645
|
intervals: intervals.length,
|
|
19646
|
+
complete: coverage.complete,
|
|
19374
19647
|
},
|
|
19375
19648
|
intervals,
|
|
19376
19649
|
});
|
|
@@ -19401,6 +19674,7 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19401
19674
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) {
|
|
19402
19675
|
const [y, m, d] = s.split('-').map((n) => Number(n));
|
|
19403
19676
|
const dt = new Date(y, m - 1, d, 0, 0, 0, 0);
|
|
19677
|
+
if (dt.getFullYear() !== y || dt.getMonth() !== m - 1 || dt.getDate() !== d) return null;
|
|
19404
19678
|
if (endOfDay) dt.setHours(23, 59, 59, 999);
|
|
19405
19679
|
return dt.getTime();
|
|
19406
19680
|
}
|
|
@@ -19409,10 +19683,13 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19409
19683
|
};
|
|
19410
19684
|
|
|
19411
19685
|
const now = Date.now();
|
|
19412
|
-
const requestedFrom =
|
|
19413
|
-
const requestedTo = parseTs(req.query.to, { endOfDay: true })
|
|
19686
|
+
const requestedFrom = req.query.from === undefined ? now - (30 * 24 * 3600 * 1000) : parseTs(req.query.from);
|
|
19687
|
+
const requestedTo = req.query.to === undefined ? now : parseTs(req.query.to, { endOfDay: true });
|
|
19414
19688
|
const start = requestedFrom;
|
|
19415
|
-
const end =
|
|
19689
|
+
const end = requestedTo;
|
|
19690
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end <= start || end - start > 730 * 86400000) {
|
|
19691
|
+
return res.status(400).json({ ok: false, error: 'EOS_HISTORY_RANGE_INVALID' });
|
|
19692
|
+
}
|
|
19416
19693
|
const historyInstance = String(this._nwGetHistoryInstance() || '').trim();
|
|
19417
19694
|
/**
|
|
19418
19695
|
* Code-Teil: getRawHistory
|
|
@@ -19420,9 +19697,10 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19420
19697
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
19421
19698
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
19422
19699
|
*/
|
|
19423
|
-
const getRawHistory = (id) => new Promise((resolve) => {
|
|
19700
|
+
const getRawHistory = (id) => new Promise((resolve, reject) => {
|
|
19701
|
+
const unavailable = () => Object.assign(new Error('EOS_HISTORY_UNAVAILABLE'), { code: 'EOS_HISTORY_UNAVAILABLE' });
|
|
19424
19702
|
const sid = this._nwTrimId(id);
|
|
19425
|
-
if (!historyInstance || !sid) return
|
|
19703
|
+
if (!historyInstance || !sid) return reject(unavailable());
|
|
19426
19704
|
const spanMs = Math.max(1, end - start);
|
|
19427
19705
|
const approxCount = Math.max(200, Math.min(50000, Math.ceil(spanMs / 60000) + 500));
|
|
19428
19706
|
const options = {
|
|
@@ -19439,13 +19717,15 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19439
19717
|
const timer = setTimeout(() => {
|
|
19440
19718
|
if (done) return;
|
|
19441
19719
|
done = true;
|
|
19442
|
-
|
|
19443
|
-
},
|
|
19720
|
+
reject(unavailable());
|
|
19721
|
+
}, 5000);
|
|
19444
19722
|
try {
|
|
19445
|
-
this.
|
|
19723
|
+
this._nwDispatchHistory(historyInstance, { id: sid, options }, (resu) => {
|
|
19446
19724
|
if (done) return;
|
|
19447
19725
|
done = true;
|
|
19448
19726
|
clearTimeout(timer);
|
|
19727
|
+
if (resu?.error) return reject(unavailable());
|
|
19728
|
+
try {
|
|
19449
19729
|
let outArr = [];
|
|
19450
19730
|
if (Array.isArray(resu)) outArr = resu;
|
|
19451
19731
|
else if (resu && Array.isArray(resu.result)) {
|
|
@@ -19455,7 +19735,8 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19455
19735
|
outArr = resu.series[0].values.map((v) => ({ ts: v[0], val: v[1] }));
|
|
19456
19736
|
} else if (resu && Array.isArray(resu.data)) {
|
|
19457
19737
|
outArr = resu.data;
|
|
19458
|
-
}
|
|
19738
|
+
} else return reject(unavailable());
|
|
19739
|
+
if (outArr.length > 50000) return reject(unavailable());
|
|
19459
19740
|
const norm = (outArr || []).map((p) => {
|
|
19460
19741
|
const tRaw = Array.isArray(p) ? p[0] : (p.ts ?? p.time ?? p.t ?? p[0]);
|
|
19461
19742
|
const vRaw = Array.isArray(p) ? p[1] : (p.val ?? p.value ?? p[1]);
|
|
@@ -19464,10 +19745,12 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19464
19745
|
return { ts, value: vRaw };
|
|
19465
19746
|
}).filter(Boolean).sort((a, b) => a.ts - b.ts);
|
|
19466
19747
|
resolve(norm);
|
|
19748
|
+
} catch (_error) { reject(unavailable()); }
|
|
19467
19749
|
});
|
|
19468
19750
|
} catch (_e) {
|
|
19751
|
+
done = true;
|
|
19469
19752
|
clearTimeout(timer);
|
|
19470
|
-
|
|
19753
|
+
reject(unavailable());
|
|
19471
19754
|
}
|
|
19472
19755
|
});
|
|
19473
19756
|
|
|
@@ -19538,6 +19821,7 @@ if (performance.now() >= historyDeadlineMs) throw Object.assign(new Error('EOS_H
|
|
|
19538
19821
|
events,
|
|
19539
19822
|
});
|
|
19540
19823
|
} catch (e) {
|
|
19824
|
+
if (e?.code === 'EOS_HISTORY_UNAVAILABLE') return res.status(503).json({ ok: false, error: e.code });
|
|
19541
19825
|
res.json({ ok: false, error: 'internal_error' });
|
|
19542
19826
|
}
|
|
19543
19827
|
});
|
|
@@ -19580,6 +19864,7 @@ const nwBuildEvcsReport = async (query = {}) => {
|
|
|
19580
19864
|
if (/^\d{4}-\d{2}-\d{2}$/.test(s)) {
|
|
19581
19865
|
const [y, m, d] = s.split('-').map(n => Number(n));
|
|
19582
19866
|
const dt = new Date(y, m - 1, d, 0, 0, 0, 0);
|
|
19867
|
+
if (dt.getFullYear() !== y || dt.getMonth() !== m - 1 || dt.getDate() !== d) return null;
|
|
19583
19868
|
if (endOfDay) dt.setHours(23, 59, 59, 999);
|
|
19584
19869
|
return dt.getTime();
|
|
19585
19870
|
}
|
|
@@ -19595,14 +19880,19 @@ const nwBuildEvcsReport = async (query = {}) => {
|
|
|
19595
19880
|
const defFrom = nowMs - 7 * 24 * 3600 * 1000;
|
|
19596
19881
|
const defTo = nowMs;
|
|
19597
19882
|
|
|
19598
|
-
const fromQ = parseTs(
|
|
19599
|
-
const toQ = parseTs(
|
|
19883
|
+
const fromQ = parseTs(query.from !== undefined ? query.from : defFrom);
|
|
19884
|
+
const toQ = parseTs(query.to !== undefined ? query.to : defTo, { endOfDay: true });
|
|
19885
|
+
const rangeFailure = () => Object.assign(new Error('EOS_HISTORY_RANGE_INVALID'), { code: 'EOS_HISTORY_RANGE_INVALID' });
|
|
19886
|
+
if (!Number.isSafeInteger(fromQ) || !Number.isSafeInteger(toQ) || fromQ < 0 || toQ < fromQ) throw rangeFailure();
|
|
19600
19887
|
|
|
19601
19888
|
// normalize to full local days
|
|
19602
19889
|
const d0 = new Date(fromQ); d0.setHours(0, 0, 0, 0);
|
|
19603
19890
|
const d1 = new Date(toQ); d1.setHours(23, 59, 59, 999);
|
|
19604
19891
|
const start = +d0;
|
|
19605
19892
|
const end = +d1;
|
|
19893
|
+
// Limit calendar days before allocation, including DST transition days.
|
|
19894
|
+
const calendarDays = (Date.UTC(d1.getFullYear(), d1.getMonth(), d1.getDate()) - Date.UTC(d0.getFullYear(), d0.getMonth(), d0.getDate())) / 86400000 + 1;
|
|
19895
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || !Number.isInteger(calendarDays) || calendarDays < 1 || calendarDays > 730) throw rangeFailure();
|
|
19606
19896
|
/**
|
|
19607
19897
|
* Code-Teil: dayKeyOf
|
|
19608
19898
|
* Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
|
|
@@ -19678,7 +19968,7 @@ const nwBuildEvcsReport = async (query = {}) => {
|
|
|
19678
19968
|
* Zusammenhang: Gehört zu ioBroker-Adapterkern (Adapter-Lifecycle, Webserver, REST-/SSE-API, State-Anlage, Lizenz und EMS-Engine) und wird von benachbarten UI-/API-/EMS-Bausteinen genutzt.
|
|
19679
19969
|
* Wartung/TypeScript: Änderungen können Adapterstart, APIs, States und Webserver beeinflussen; unload/connection immer mittesten. Beim TS-Umbau Parameter, Rückgabe und genutzte State-/Config-Objekte explizit typisieren.
|
|
19680
19970
|
*/
|
|
19681
|
-
const getHist = (id, startMs, endMs, aggregate = 'none', step = 0) => new Promise(resolve => {
|
|
19971
|
+
const getHist = (id, startMs, endMs, aggregate = 'none', step = 0) => new Promise((resolve, reject) => {
|
|
19682
19972
|
if (!id) return resolve([]);
|
|
19683
19973
|
const agg = aggregate || 'none';
|
|
19684
19974
|
const spanMs = Number(endMs) - Number(startMs);
|
|
@@ -19698,7 +19988,8 @@ const nwBuildEvcsReport = async (query = {}) => {
|
|
|
19698
19988
|
if (wantsStep) options.step = stepMs;
|
|
19699
19989
|
|
|
19700
19990
|
try {
|
|
19701
|
-
this.
|
|
19991
|
+
this._nwDispatchHistory(inst, { id, options }, (resu) => {
|
|
19992
|
+
if (resu?.error) return reject(Object.assign(new Error('EOS_HISTORY_UNAVAILABLE'), { code: 'EOS_HISTORY_UNAVAILABLE' }));
|
|
19702
19993
|
let outArr = [];
|
|
19703
19994
|
if (Array.isArray(resu)) outArr = resu;
|
|
19704
19995
|
else if (resu && Array.isArray(resu.result)) {
|
|
@@ -19725,7 +20016,7 @@ const nwBuildEvcsReport = async (query = {}) => {
|
|
|
19725
20016
|
resolve(norm);
|
|
19726
20017
|
});
|
|
19727
20018
|
} catch (e) {
|
|
19728
|
-
|
|
20019
|
+
reject(Object.assign(new Error('EOS_HISTORY_UNAVAILABLE'), { code: 'EOS_HISTORY_UNAVAILABLE' }));
|
|
19729
20020
|
}
|
|
19730
20021
|
});
|
|
19731
20022
|
|
|
@@ -19888,6 +20179,8 @@ app.get('/api/evcs/report', async (req, res) => {
|
|
|
19888
20179
|
const report = await nwBuildEvcsReport(req.query || {});
|
|
19889
20180
|
res.json({ ok: true, ...report });
|
|
19890
20181
|
} catch (e) {
|
|
20182
|
+
if (e?.code === 'EOS_HISTORY_RANGE_INVALID') return res.status(400).json({ ok: false, error: e.code });
|
|
20183
|
+
if (e?.code === 'EOS_HISTORY_UNAVAILABLE') return res.status(503).json({ ok: false, error: e.code });
|
|
19891
20184
|
res.json({ ok: false, error: 'internal_error' });
|
|
19892
20185
|
}
|
|
19893
20186
|
});
|
|
@@ -20018,6 +20311,8 @@ app.get('/api/evcs/report.csv', async (req, res) => {
|
|
|
20018
20311
|
res.setHeader('Content-Disposition', `attachment; filename="${filename}"`);
|
|
20019
20312
|
res.status(200).send(csv);
|
|
20020
20313
|
} catch (e) {
|
|
20314
|
+
if (e?.code === 'EOS_HISTORY_RANGE_INVALID') return res.status(400).json({ ok: false, error: e.code });
|
|
20315
|
+
if (e?.code === 'EOS_HISTORY_UNAVAILABLE') return res.status(503).json({ ok: false, error: e.code });
|
|
20021
20316
|
res.status(500).type('text/plain').send('EVCS CSV Fehler.');
|
|
20022
20317
|
}
|
|
20023
20318
|
});
|
|
@@ -27235,7 +27530,7 @@ return res.json(out);
|
|
|
27235
27530
|
*/
|
|
27236
27531
|
_nwRequestImmediateEmsTick(reason = 'customer-control', delayMs) {
|
|
27237
27532
|
try {
|
|
27238
|
-
if (this.
|
|
27533
|
+
if (!this._nwIsEmsReady()) return false;
|
|
27239
27534
|
const engine = this.emsEngine;
|
|
27240
27535
|
if (engine && typeof engine.requestImmediateTick === 'function') {
|
|
27241
27536
|
if (Number.isFinite(Number(delayMs))) {
|
|
@@ -27588,7 +27883,7 @@ return res.json(out);
|
|
|
27588
27883
|
*/
|
|
27589
27884
|
setLocalStateWithCache(id, val, ts) {
|
|
27590
27885
|
const t = Number(ts) || Date.now();
|
|
27591
|
-
this.setStateAsync(id, val, true).catch(()=>{});
|
|
27886
|
+
this.setStateAsync(id, { val, ack: true, ts: t }).catch(()=>{});
|
|
27592
27887
|
try { this.updateValue(id, val, t); } catch(_e) {}
|
|
27593
27888
|
}
|
|
27594
27889
|
|
|
@@ -28184,6 +28479,15 @@ return res.json(out);
|
|
|
28184
28479
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
28185
28480
|
*/
|
|
28186
28481
|
async _nwEnsureInfluxCustom(localId, inst, opts = null) {
|
|
28482
|
+
this._nwConfigureHistory();
|
|
28483
|
+
this._nwDirectHistory.register(localId, opts?.changesOnly === true);
|
|
28484
|
+
if (this.config?.history?.provider === 'influxdb2') {
|
|
28485
|
+
const object = await this.getObjectAsync(localId).catch(() => null);
|
|
28486
|
+
const custom = object?.common?.custom;
|
|
28487
|
+
const active = custom && typeof custom === 'object' && Object.entries(custom).some(([id, entry]) => /^influxdb\.\d+$/.test(id) && entry?.enabled === true);
|
|
28488
|
+
this._nwDirectHistory.legacyRecording(localId, !!active);
|
|
28489
|
+
return;
|
|
28490
|
+
}
|
|
28187
28491
|
try {
|
|
28188
28492
|
const instance = String(inst || '').trim();
|
|
28189
28493
|
if (!instance) return;
|
|
@@ -30531,8 +30835,8 @@ return res.json(out);
|
|
|
30531
30835
|
*/
|
|
30532
30836
|
_nwSetHistorieValue(localId, val, ts, tolAbs = 1) {
|
|
30533
30837
|
try {
|
|
30534
|
-
const n =
|
|
30535
|
-
if (
|
|
30838
|
+
const n = numericMeasurement(val);
|
|
30839
|
+
if (n === null) return;
|
|
30536
30840
|
if (!this._nwHistorieLast) this._nwHistorieLast = {};
|
|
30537
30841
|
const last = this._nwHistorieLast[localId];
|
|
30538
30842
|
const tol = Number.isFinite(Number(tolAbs)) ? Math.max(0, Number(tolAbs)) : 0;
|
|
@@ -30806,26 +31110,50 @@ return res.json(out);
|
|
|
30806
31110
|
const {
|
|
30807
31111
|
gridBuyW,
|
|
30808
31112
|
gridSellW,
|
|
31113
|
+
hasGrid,
|
|
30809
31114
|
} = this._nwResolveGridImportExportFromCache();
|
|
30810
31115
|
const historyCoreMaxAgeMs = Math.max(30000, Number(this.config?.settings?.deviceStaleTimeoutSec || 60) * 1000);
|
|
30811
|
-
|
|
30812
|
-
|
|
30813
|
-
const
|
|
30814
|
-
|
|
31116
|
+
// History samples are observations, not a refresh of the last cached value.
|
|
31117
|
+
// Missing timestamps, stale values and missing measurements remain gaps.
|
|
31118
|
+
const readHistory = (key, maxAgeMs = historyCoreMaxAgeMs) => {
|
|
31119
|
+
// Flow slots may supply a cache key. Only own data records are observations:
|
|
31120
|
+
// no prototype lookup, getter invocation, or object path traversal is allowed.
|
|
31121
|
+
if (typeof key !== 'string' || !/^[A-Za-z0-9_.-]{1,256}$/.test(key)
|
|
31122
|
+
|| key.split('.').some(part => ['__proto__', 'prototype', 'constructor'].includes(part))
|
|
31123
|
+
|| !this.stateCache || typeof this.stateCache !== 'object') return null;
|
|
31124
|
+
const entry = Object.getOwnPropertyDescriptor(this.stateCache, key);
|
|
31125
|
+
if (!entry || !('value' in entry) || !entry.value || typeof entry.value !== 'object') return null;
|
|
31126
|
+
const timestamp = Object.getOwnPropertyDescriptor(entry.value, 'ts');
|
|
31127
|
+
const measurement = Object.getOwnPropertyDescriptor(entry.value, 'value');
|
|
31128
|
+
const quality = Object.getOwnPropertyDescriptor(entry.value, 'q');
|
|
31129
|
+
if (!timestamp || !('value' in timestamp) || !measurement || !('value' in measurement)
|
|
31130
|
+
|| (quality && (!('value' in quality) || (quality.value !== undefined && quality.value !== 0)))) return null;
|
|
31131
|
+
const stamp = numericMeasurement(timestamp.value);
|
|
31132
|
+
if (stamp === null || stamp <= 0 || stamp > now || now - stamp > maxAgeMs) return null;
|
|
31133
|
+
return numericMeasurement(measurement.value);
|
|
31134
|
+
};
|
|
31135
|
+
const pvDerivedW = readHistory('derived.core.pv.totalW');
|
|
31136
|
+
const pvW = readHistory('pvPower') ?? readHistory('productionTotal');
|
|
31137
|
+
const loadDerivedW = readHistory('derived.core.building.loadTotalW');
|
|
31138
|
+
const loadW = loadDerivedW !== null ? loadDerivedW : readHistory('consumptionTotal');
|
|
30815
31139
|
const storageAuthorityHist = (typeof this._nwGetStorageControlAuthority === 'function')
|
|
30816
31140
|
? this._nwGetStorageControlAuthority()
|
|
30817
31141
|
: { selectedTopology: 'none', writerActive: false };
|
|
30818
31142
|
const selectedStorageTopologyHist = String(storageAuthorityHist.selectedTopology || 'none');
|
|
30819
|
-
const storageFlowHist = this._nwResolveBatteryFlowFromCache({ now });
|
|
30820
|
-
|
|
30821
|
-
|
|
31143
|
+
const storageFlowHist = this._nwResolveBatteryFlowFromCache({ now, strictStale: true });
|
|
31144
|
+
const storageMissing = ['missing', 'mapped-missing', 'storageFarm-missing-power', 'storageFarm-unavailable'].includes(storageFlowHist.src);
|
|
31145
|
+
const farmPowerAge = storageFlowHist.staleMs && numericMeasurement(storageFlowHist.staleMs.farmPower);
|
|
31146
|
+
const farmPowerStale = selectedStorageTopologyHist === 'farm'
|
|
31147
|
+
&& (farmPowerAge === null || farmPowerAge === undefined || farmPowerAge > historyCoreMaxAgeMs);
|
|
31148
|
+
const chgW = storageMissing || farmPowerStale ? null : numericMeasurement(storageFlowHist.chargeW);
|
|
31149
|
+
const dchgW = storageMissing || farmPowerStale ? null : numericMeasurement(storageFlowHist.dischargeW);
|
|
30822
31150
|
// Mess-/Anzeigehoheit und Speicher-Schreibhoheit sind bewusst getrennt:
|
|
30823
31151
|
// Ein im Energiefluss manuell zugeordneter SoC-DP muss auch dann in die
|
|
30824
31152
|
// Historie gelangen, wenn NexoWatt den Speicher nur visualisiert und die
|
|
30825
31153
|
// Speicherregelung/Farm nicht aktiv ist (z. B. herstellereigene 0-Einspeisung).
|
|
30826
31154
|
const explicitStorageSocMapped = !!String(historyDps.storageSoc || '').trim();
|
|
30827
31155
|
const explicitStorageSocValue = explicitStorageSocMapped
|
|
30828
|
-
?
|
|
31156
|
+
? readHistory('storageSoc')
|
|
30829
31157
|
: null;
|
|
30830
31158
|
const explicitStorageSocValid = explicitStorageSocMapped
|
|
30831
31159
|
&& explicitStorageSocValue !== null
|
|
@@ -30835,21 +31163,22 @@ return res.json(out);
|
|
|
30835
31163
|
let soc = explicitStorageSocValid
|
|
30836
31164
|
? Math.max(0, Math.min(100, Number(explicitStorageSocValue)))
|
|
30837
31165
|
: (selectedStorageTopologyHist === 'single'
|
|
30838
|
-
?
|
|
31166
|
+
? readHistory('storageSoc')
|
|
30839
31167
|
: null);
|
|
30840
|
-
const evW =
|
|
31168
|
+
const evW = readHistory('evcs.totalPowerW');
|
|
31169
|
+
const historyEvAbsent = Number(this.evcsCount) === 0 && !String(historyDps.consumptionEvcs || '').trim();
|
|
30841
31170
|
|
|
30842
|
-
const gridBuy = Number.isFinite(gridBuyW) ? Math.max(0, gridBuyW) :
|
|
30843
|
-
const gridSell = Number.isFinite(gridSellW) ? Math.max(0, gridSellW) :
|
|
30844
|
-
const gridNet = gridBuy - gridSell;
|
|
31171
|
+
const gridBuy = hasGrid === true && Number.isFinite(gridBuyW) ? Math.max(0, gridBuyW) : null;
|
|
31172
|
+
const gridSell = hasGrid === true && Number.isFinite(gridSellW) ? Math.max(0, gridSellW) : null;
|
|
31173
|
+
const gridNet = gridBuy !== null && gridSell !== null ? gridBuy - gridSell : null;
|
|
30845
31174
|
|
|
30846
31175
|
// Der bereits abgeleitete PV-Gesamtwert ist die kanonische Quelle für LIVE,
|
|
30847
31176
|
// Historie und Budgetierung. Nur wenn er fehlt/veraltet ist, wird die Farm-PV
|
|
30848
31177
|
// hier noch einmal mit dem direkten Anlagen-PV-DP zusammengeführt.
|
|
30849
|
-
let pvTotal =
|
|
30850
|
-
? Math.max(0,
|
|
30851
|
-
: (
|
|
30852
|
-
const pvTotalFromDerived =
|
|
31178
|
+
let pvTotal = pvDerivedW !== null
|
|
31179
|
+
? Math.max(0, pvDerivedW)
|
|
31180
|
+
: (pvW !== null ? Math.max(0, pvW) : null);
|
|
31181
|
+
const pvTotalFromDerived = pvDerivedW !== null;
|
|
30853
31182
|
|
|
30854
31183
|
// Historie und LIVE verwenden dieselbe zentrale Farm-PV-Zusammenführung. Dadurch
|
|
30855
31184
|
// stimmen die aktuellen Energieflüsse, History-States und späteren Energiesummen
|
|
@@ -30863,7 +31192,8 @@ return res.json(out);
|
|
|
30863
31192
|
&& this.config.storage
|
|
30864
31193
|
&& String(this.config.storage.coupling || '').trim().toLowerCase() === 'dc');
|
|
30865
31194
|
|
|
30866
|
-
if (!pvTotalFromDerived && sfEnabled &&
|
|
31195
|
+
if (!pvTotalFromDerived && sfEnabled && readHistory('storageFarm.totalPvPowerW') !== null
|
|
31196
|
+
&& typeof this._nwMergeStorageFarmPvWithBase === 'function') {
|
|
30867
31197
|
const baseSourceId = String(historyDps.pvPower || historyDps.productionTotal || '').trim();
|
|
30868
31198
|
const merged = this._nwMergeStorageFarmPvWithBase(pvTotal || 0, {
|
|
30869
31199
|
now,
|
|
@@ -30871,8 +31201,8 @@ return res.json(out);
|
|
|
30871
31201
|
baseSourceId,
|
|
30872
31202
|
});
|
|
30873
31203
|
pvTotal = Math.max(0, Number(merged.totalW) || 0);
|
|
30874
|
-
} else if (singleStorageDcEnabled) {
|
|
30875
|
-
const dcValueW =
|
|
31204
|
+
} else if (!pvTotalFromDerived && singleStorageDcEnabled) {
|
|
31205
|
+
const dcValueW = readHistory('speicher.dcPvPowerW');
|
|
30876
31206
|
if (Number.isFinite(dcValueW) && Number(dcValueW) !== 0) {
|
|
30877
31207
|
const dcAbs = Math.abs(Number(dcValueW));
|
|
30878
31208
|
if (pvTotal === null || pvTotal === 0) pvTotal = dcAbs;
|
|
@@ -30889,38 +31219,31 @@ return res.json(out);
|
|
|
30889
31219
|
// autoritativ und wird nicht durch Writer-/App-Lifecycle auf null gesetzt.
|
|
30890
31220
|
if (!explicitStorageSocValid) {
|
|
30891
31221
|
if (selectedStorageTopologyHist === 'farm') {
|
|
30892
|
-
const socFarm =
|
|
30893
|
-
|
|
30894
|
-
: this._nwGetNumberFromCache('storageFarm.totalSocOnline');
|
|
30895
|
-
const socFarmFallback = Number.isFinite(Number(socFarm))
|
|
30896
|
-
? Number(socFarm)
|
|
30897
|
-
: this._nwGetNumberFromCache('storageFarm.totalSoc');
|
|
30898
|
-
soc = Number.isFinite(Number(socFarmFallback))
|
|
30899
|
-
? Math.max(0, Math.min(100, Number(socFarmFallback)))
|
|
30900
|
-
: null;
|
|
31222
|
+
const socFarm = readHistory('storageFarm.totalSocOnline') ?? readHistory('storageFarm.totalSoc');
|
|
31223
|
+
soc = socFarm !== null ? Math.max(0, Math.min(100, socFarm)) : null;
|
|
30901
31224
|
} else if (selectedStorageTopologyHist !== 'single') {
|
|
30902
31225
|
soc = null;
|
|
30903
31226
|
}
|
|
30904
31227
|
}
|
|
30905
31228
|
|
|
30906
31229
|
let loadTotal = Number.isFinite(loadW) ? Math.max(0, loadW) : null;
|
|
30907
|
-
const chg = Number.isFinite(chgW) ? Math.max(0, chgW) :
|
|
30908
|
-
const dchg = Number.isFinite(dchgW) ? Math.max(0, dchgW) :
|
|
30909
|
-
const evAbs = Number.isFinite(evW) ? Math.abs(evW) :
|
|
31230
|
+
const chg = Number.isFinite(chgW) ? Math.max(0, chgW) : null;
|
|
31231
|
+
const dchg = Number.isFinite(dchgW) ? Math.max(0, dchgW) : null;
|
|
31232
|
+
const evAbs = Number.isFinite(evW) ? Math.abs(evW) : null;
|
|
30910
31233
|
|
|
30911
|
-
if (loadTotal === null) {
|
|
30912
|
-
|
|
30913
|
-
loadTotal = Math.max(0, pvUse + gridBuy + dchg - gridSell - chg);
|
|
31234
|
+
if (loadTotal === null && pvTotal !== null && gridBuy !== null && gridSell !== null && chg !== null && dchg !== null) {
|
|
31235
|
+
loadTotal = Math.max(0, pvTotal + gridBuy + dchg - gridSell - chg);
|
|
30914
31236
|
}
|
|
30915
31237
|
|
|
30916
31238
|
// Energiefluss-Display (Rest) = Gesamtverbrauch - EV - optionale Verbraucher
|
|
30917
31239
|
let extrasConsumersSum = 0;
|
|
30918
31240
|
for (let i = 1; i <= 10; i++) {
|
|
30919
|
-
const v =
|
|
31241
|
+
const v = readHistory(`consumer${i}Power`);
|
|
30920
31242
|
if (!Number.isFinite(v)) continue;
|
|
30921
31243
|
extrasConsumersSum += Math.max(0, Math.abs(v));
|
|
30922
31244
|
}
|
|
30923
|
-
const loadRest =
|
|
31245
|
+
const loadRest = loadTotal !== null && (evAbs !== null || historyEvAbsent)
|
|
31246
|
+
? Math.max(0, loadTotal - (evAbs ?? 0) - extrasConsumersSum) : null;
|
|
30924
31247
|
/**
|
|
30925
31248
|
* Code-Teil: _rawCacheValue
|
|
30926
31249
|
* Zweck: Kapselt einen lokalen Verarbeitungsschritt, damit Aufrufer nicht direkt in Detaildaten eingreifen.
|
|
@@ -30943,8 +31266,8 @@ return res.json(out);
|
|
|
30943
31266
|
*/
|
|
30944
31267
|
const _numOr = (key, fallback = null) => {
|
|
30945
31268
|
try {
|
|
30946
|
-
const n =
|
|
30947
|
-
return
|
|
31269
|
+
const n = numericMeasurement(_rawCacheValue(key));
|
|
31270
|
+
return n !== null ? n : fallback;
|
|
30948
31271
|
} catch (_e) {
|
|
30949
31272
|
return fallback;
|
|
30950
31273
|
}
|
|
@@ -31068,8 +31391,11 @@ return res.json(out);
|
|
|
31068
31391
|
};
|
|
31069
31392
|
|
|
31070
31393
|
const dynamicTariffActive = _boolOr('settings.dynamicTariff', false);
|
|
31071
|
-
const
|
|
31072
|
-
const
|
|
31394
|
+
const tariffMaxAgeMs = Math.max(15 * 60000, Math.min(360 * 60000, _numOr('tarif.currentPriceMaxAgeMs', 90 * 60000)));
|
|
31395
|
+
const providerPrice = _rawCacheValue('tarif.currentPriceFresh') === false
|
|
31396
|
+
? null : readHistory('tarif.preisAktuellEurProKwh', tariffMaxAgeMs);
|
|
31397
|
+
const providerAveragePrice = _rawCacheValue('tarif.curveFresh') === false
|
|
31398
|
+
? null : readHistory('tarif.preisDurchschnittEurProKwh', tariffMaxAgeMs);
|
|
31073
31399
|
const manualPrice = _numOr('settings.price', 0.25);
|
|
31074
31400
|
|
|
31075
31401
|
// Die in LIVE und vom Provider gelieferten Strompreise werden als Bruttopreise
|
|
@@ -31080,7 +31406,7 @@ return res.json(out);
|
|
|
31080
31406
|
// So bleiben LIVE-Sicht und Historie konsistent.
|
|
31081
31407
|
let tariffDisplayedGrossPrice = Number.isFinite(providerPrice) && dynamicTariffActive ? providerPrice : manualPrice;
|
|
31082
31408
|
if (!Number.isFinite(tariffDisplayedGrossPrice)) tariffDisplayedGrossPrice = Number.isFinite(providerPrice) ? providerPrice : 0;
|
|
31083
|
-
|
|
31409
|
+
// Canonical EUR/kWh prices are already validated by the provider; retain negative prices unchanged.
|
|
31084
31410
|
|
|
31085
31411
|
const netFeeModeNow = _computeNetFeeModeNow();
|
|
31086
31412
|
const netFeePriceNt = Math.max(0, Number(_numOr('settings.netFeePriceNt', 0)) || 0);
|
|
@@ -31090,19 +31416,19 @@ return res.json(out);
|
|
|
31090
31416
|
if (_boolOr('settings.netFeeEnabled', false)) {
|
|
31091
31417
|
tariffNetFeePrice = (netFeeModeNow === 'NT') ? netFeePriceNt : (netFeeModeNow === 'HT') ? netFeePriceHt : netFeePriceSt;
|
|
31092
31418
|
}
|
|
31093
|
-
const tariffTotalPrice =
|
|
31419
|
+
const tariffTotalPrice = tariffDisplayedGrossPrice;
|
|
31094
31420
|
let tariffBasePrice = tariffTotalPrice - tariffNetFeePrice;
|
|
31095
31421
|
if (!Number.isFinite(tariffBasePrice)) tariffBasePrice = tariffTotalPrice;
|
|
31096
|
-
|
|
31422
|
+
|
|
31097
31423
|
|
|
31098
31424
|
// Core series
|
|
31099
31425
|
this._nwSetHistorieValue('historie.core.grid.buyW', gridBuy, now, 0);
|
|
31100
31426
|
this._nwSetHistorieValue('historie.core.grid.sellW', gridSell, now, 0);
|
|
31101
31427
|
this._nwSetHistorieValue('historie.core.grid.netW', gridNet, now, 0);
|
|
31102
31428
|
|
|
31103
|
-
this._nwSetHistorieValue('historie.core.pv.totalW', pvTotal
|
|
31104
|
-
this._nwSetHistorieValue('historie.core.building.loadTotalW', loadTotal
|
|
31105
|
-
this._nwSetHistorieValue('historie.core.building.loadRestW', loadRest
|
|
31429
|
+
this._nwSetHistorieValue('historie.core.pv.totalW', pvTotal, now, 0);
|
|
31430
|
+
this._nwSetHistorieValue('historie.core.building.loadTotalW', loadTotal, now, 0);
|
|
31431
|
+
this._nwSetHistorieValue('historie.core.building.loadRestW', loadRest, now, 0);
|
|
31106
31432
|
|
|
31107
31433
|
this._nwSetHistorieValue('historie.core.storage.chargeW', chg, now, 0);
|
|
31108
31434
|
this._nwSetHistorieValue('historie.core.storage.dischargeW', dchg, now, 0);
|
|
@@ -31227,7 +31553,7 @@ return res.json(out);
|
|
|
31227
31553
|
const evcsCount = Number(this.evcsCount || 0);
|
|
31228
31554
|
if (Number.isFinite(evcsCount) && evcsCount > 0) {
|
|
31229
31555
|
for (let i = 1; i <= evcsCount; i++) {
|
|
31230
|
-
const v =
|
|
31556
|
+
const v = readHistory(`evcs.${i}.powerW`);
|
|
31231
31557
|
if (Number.isFinite(v)) this._nwSetHistorieValue(`historie.evcs.lp${i}.powerW`, Math.max(0, Math.abs(v)), now, 0);
|
|
31232
31558
|
}
|
|
31233
31559
|
}
|
|
@@ -31236,13 +31562,13 @@ return res.json(out);
|
|
|
31236
31562
|
for (let i = 1; i <= 10; i++) {
|
|
31237
31563
|
const info = this._nwGetFlowSlotInfo ? this._nwGetFlowSlotInfo('consumers', i) : null;
|
|
31238
31564
|
if (!info || !String(info.objectId || '').trim()) continue;
|
|
31239
|
-
const v =
|
|
31565
|
+
const v = readHistory(info.stateKey || info.key || `consumer${i}Power`);
|
|
31240
31566
|
if (Number.isFinite(v)) this._nwSetHistorieValue(`historie.consumers.c${i}.powerW`, Math.abs(v), now, 0);
|
|
31241
31567
|
}
|
|
31242
31568
|
for (let i = 1; i <= 5; i++) {
|
|
31243
31569
|
const info = this._nwGetFlowSlotInfo ? this._nwGetFlowSlotInfo('producers', i) : null;
|
|
31244
31570
|
if (!info || !String(info.objectId || '').trim()) continue;
|
|
31245
|
-
const v =
|
|
31571
|
+
const v = readHistory(info.stateKey || info.key || `producer${i}Power`);
|
|
31246
31572
|
if (Number.isFinite(v)) this._nwSetHistorieValue(`historie.producers.p${i}.powerW`, Math.abs(v), now, 0);
|
|
31247
31573
|
}
|
|
31248
31574
|
}
|
|
@@ -31479,7 +31805,32 @@ return res.json(out);
|
|
|
31479
31805
|
* Zusammenhang: Teil von Adapterkern: Lifecycle, Webserver, API, States, EMS-Engine; Aufrufstellen und abhängige States/APIs beim Ändern mitprüfen.
|
|
31480
31806
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
31481
31807
|
*/
|
|
31808
|
+
_nwHistorySecretCodec() {
|
|
31809
|
+
return { encrypt: value => this._owner.encrypt(value), decrypt: value => this._owner.decrypt(value) };
|
|
31810
|
+
}
|
|
31811
|
+
|
|
31812
|
+
_nwConfigureHistory() {
|
|
31813
|
+
if (this._nwShuttingDown) return;
|
|
31814
|
+
if (!this._nwDirectHistory) this._nwDirectHistory = new InfluxHistoryRuntime(this.namespace);
|
|
31815
|
+
this._nwDirectHistory.configure(this.config?.history);
|
|
31816
|
+
if (this._nwHistoryProviderSignature !== JSON.stringify(this.config?.history || {})) {
|
|
31817
|
+
this._nwHistoryProviderSignature = JSON.stringify(this.config?.history || {});
|
|
31818
|
+
this._nwHistoryApiCache?.clear();
|
|
31819
|
+
this._nwPara14aInfluxProvision = null;
|
|
31820
|
+
}
|
|
31821
|
+
}
|
|
31822
|
+
|
|
31823
|
+
_nwDispatchHistory(instance, payload, callback) {
|
|
31824
|
+
if (this.config?.history?.provider !== 'influxdb2') return this.sendTo(instance, 'getHistory', payload, callback);
|
|
31825
|
+
this._nwConfigureHistory();
|
|
31826
|
+
return this._nwDirectHistory.query(payload.id, payload.options).then(
|
|
31827
|
+
result => callback(result),
|
|
31828
|
+
error => callback({ error: error.code || 'EOS_INFLUX_REQUEST_FAILED' })
|
|
31829
|
+
);
|
|
31830
|
+
}
|
|
31831
|
+
|
|
31482
31832
|
async _nwDetectInfluxInstance() {
|
|
31833
|
+
if (this.config?.history?.provider === 'influxdb2') return 'eos-direct-influxdb2';
|
|
31483
31834
|
try {
|
|
31484
31835
|
// If user did not specify a history instance, try to detect an installed influxdb.X instance.
|
|
31485
31836
|
if (this._nwTrimId((this.config && this.config.history && this.config.history.instance) || '')) return this._nwTrimId(this.config.history.instance);
|
|
@@ -31502,6 +31853,7 @@ return res.json(out);
|
|
|
31502
31853
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
31503
31854
|
*/
|
|
31504
31855
|
_nwGetHistoryInstance() {
|
|
31856
|
+
if (this.config?.history?.provider === 'influxdb2') return 'eos-direct-influxdb2';
|
|
31505
31857
|
const hcfg = (this.config && this.config.history) || {};
|
|
31506
31858
|
const inst = this._nwTrimId(hcfg.instance) || this._nwTrimId(this._nwDetectedInfluxInstance) || 'influxdb.0';
|
|
31507
31859
|
return inst;
|
|
@@ -31655,6 +32007,11 @@ return res.json(out);
|
|
|
31655
32007
|
* TypeScript: Parameter, Rückgabewert und verwendete Config-/State-Objekte später explizit typisieren.
|
|
31656
32008
|
*/
|
|
31657
32009
|
async _nwEnsurePara14aInfluxInstance(force = false) {
|
|
32010
|
+
if (this.config?.history?.provider === 'influxdb2') {
|
|
32011
|
+
this._nwConfigureHistory();
|
|
32012
|
+
const status = this._nwDirectHistory.status();
|
|
32013
|
+
return { instance: 'eos-direct-influxdb2', ready: status.state === 'ready', dedicated: false, autoProvisioned: false, provisionState: 'direct', provisionError: status.lastError };
|
|
32014
|
+
}
|
|
31658
32015
|
const now = Date.now();
|
|
31659
32016
|
const cached = this._nwPara14aInfluxProvision;
|
|
31660
32017
|
if (!force && cached && cached.result && (now - Number(cached.ts || 0) < 10 * 60 * 1000)) {
|
|
@@ -32974,7 +33331,7 @@ return res.json(out);
|
|
|
32974
33331
|
timer = setTimeout(() => finish(failure('EOS_HISTORY_TIMEOUT')), remainingMs);
|
|
32975
33332
|
timer.unref?.();
|
|
32976
33333
|
try {
|
|
32977
|
-
this.
|
|
33334
|
+
this._nwDispatchHistory(inst, { id: sid, options }, /** @param {unknown} resu */ (resu) => {
|
|
32978
33335
|
if (settled) return;
|
|
32979
33336
|
if (this._nwShuttingDown) return cancel();
|
|
32980
33337
|
// A delayed event loop must not accept a callback beyond the budget.
|
|
@@ -34017,6 +34374,8 @@ return res.json(out);
|
|
|
34017
34374
|
this._nwSmartHomeHydrating = false;
|
|
34018
34375
|
this._nwPreservedUiStates = null;
|
|
34019
34376
|
cleanup.capture(() => this._nwCancelHistoryRequests?.());
|
|
34377
|
+
cleanup.capture(() => this._nwDirectHistory?.drainAndClose(3000));
|
|
34378
|
+
cleanup.capture(() => this._nwHistoryCheckClient?.close());
|
|
34020
34379
|
cleanup.capture(() => this._nwHistoryApiCache?.clear());
|
|
34021
34380
|
cleanup.capture(() => this._nwShcfgDetectCache?.clear());
|
|
34022
34381
|
cleanup.capture(() => this._nwTypeDetectorObjectsCache?.close());
|
|
@@ -34190,7 +34549,7 @@ function createHostedRuntime(owner, bridge) {
|
|
|
34190
34549
|
revokeSessions() { runtime._nwCloseSseClients(); },
|
|
34191
34550
|
status() { return { ...(stopUnconfirmed ? { state: 'stop-unconfirmed', error: 'EOS_UI_STOP_UNCONFIRMED' }
|
|
34192
34551
|
: stopRequested ? { state: stopConfirmed ? 'stopped' : 'stopping', error: '' } : runtime._hostedStartup || { state: 'stopped', error: '' }),
|
|
34193
|
-
active: started && !stopRequested, emsReady: !stopRequested && runtime._hostedStartup?.state === 'ready' &&
|
|
34552
|
+
active: started && !stopRequested, emsReady: !stopRequested && runtime._hostedStartup?.state === 'ready' && runtime._nwIsEmsReady(), canWrite: guardedBridge.canWrite() === true }; },
|
|
34194
34553
|
stop() {
|
|
34195
34554
|
if (!stopping) {
|
|
34196
34555
|
// Sofortige, dauerhafte Sperre vor jedem await und jedem Cleanup-Callback.
|