iobroker.eos-admin 9.0.18 → 9.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +8 -9
- package/README.md +4 -2
- package/START_HIER_9.0.19.md +52 -0
- package/adminWww/.vite/manifest.json +114 -114
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
- package/adminWww/assets/{AdapterUpdateDialog-ByJk9Cxj.js → AdapterUpdateDialog-JOf2z4Vg.js} +1 -1
- package/adminWww/assets/{Adapters-V2JtEPZX.js → Adapters-C9fcSdWm.js} +1 -1
- package/adminWww/assets/{ConfigManager-BKcdyJnN.js → ConfigManager-BeeLlT6D.js} +1 -1
- package/adminWww/assets/{Enums-ChbfAWzp.js → Enums-FqnXWl8U.js} +1 -1
- package/adminWww/assets/{Fields-DzaVXEvg.js → Fields-DMgrt5Pi.js} +1 -1
- package/adminWww/assets/{Files-CRpIXj4X.js → Files-CIHtt12g.js} +1 -1
- package/adminWww/assets/{Hosts-rOgfd2wo.js → Hosts-fPLBzvTy.js} +1 -1
- package/adminWww/assets/{Instances-BxLhJ6Pb.js → Instances-4XaVQlrT.js} +1 -1
- package/adminWww/assets/{Intro-BOql527d.js → Intro-5TKriiLO.js} +1 -1
- package/adminWww/assets/{Logs-WUUDY7a4.js → Logs-33zcIds-.js} +1 -1
- package/adminWww/assets/{Objects-DYaZkCK7.js → Objects-CNQPVbNG.js} +1 -1
- package/adminWww/assets/{Overview-C6hiiPbm.js → Overview-BskXGOc8.js} +1 -1
- package/adminWww/assets/{State-AH43l7fG.js → State-C8SJ_Iqo.js} +1 -1
- package/adminWww/assets/{UsedResources-jhsRMH4X.js → UsedResources-CgqRa9ei.js} +1 -1
- package/adminWww/assets/{Users-D9wyLyJ1.js → Users-0JVYWR9u.js} +1 -1
- package/adminWww/assets/{bootstrap-gVLo1K_2.js → bootstrap-D16lu6rd.js} +3 -3
- package/adminWww/assets/{hostInit-Dt_M-NAC.js → hostInit-C8YZJuzi.js} +1 -1
- package/adminWww/assets/{icons-material-DuVW_EUA.js → icons-material-CiNJ_6Ur.js} +1 -1
- package/adminWww/assets/{index-B1cnPkSO.js → index-DA9Sphgh.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-GvgHjubR.js → installSVGRenderer-DPdkRa_d.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-6b32b635.js → mf-entry-bootstrap-0-a7ab91de.js} +2 -2
- package/adminWww/index.html +23 -23
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/remoteEntry-eos-9.0.19.js +12 -0
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosCookieNamespace.js +12 -2
- package/build/lib/eosCookieNamespace.js.map +1 -1
- package/build/lib/eosDeviceEmsPlan.js +432 -24
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosDeviceEmsService.js +106 -10
- package/build/lib/eosDeviceEmsService.js.map +1 -1
- package/build/lib/eosModuleHost.js +178 -53
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/web.js +19 -3
- package/build/lib/web.js.map +1 -1
- package/docs/reports/unified-9.0.19/ALIAS_MESSWERTFRISCHE.md +31 -0
- package/docs/reports/unified-9.0.19/COMMISSIONING_PLAN_REVIEW.md +56 -0
- package/docs/reports/unified-9.0.19/EMS_ABSCHLUSSREVIEW.md +43 -0
- package/docs/reports/unified-9.0.19/EMS_KATEGORIEN_ABDECKUNG.md +66 -0
- package/docs/reports/unified-9.0.19/EMS_VERGLEICH_UND_KOPPLUNG.md +25 -0
- package/docs/reports/unified-9.0.19/EVCS_STATE_OBJECTS.md +47 -0
- package/docs/reports/unified-9.0.19/GERAETE_EMS_EINRICHTUNG.md +100 -0
- package/docs/reports/unified-9.0.19/GERAETE_STARTAUSFALL.md +37 -0
- package/docs/reports/unified-9.0.19/INSTALLER_LIFECYCLE_REVIEW.md +59 -0
- package/docs/reports/unified-9.0.19/LEGACY_REGRESSION_REVIEW.md +42 -0
- package/docs/reports/unified-9.0.19/MODBUS_AUTHORIZATION_READS.md +25 -0
- package/docs/reports/unified-9.0.19/PRUEFBERICHT.md +56 -0
- package/docs/reports/unified-9.0.19/RUNTIME_START_UEBERNAHME.md +33 -0
- package/docs/reports/unified-9.0.19/SMA_RECEIVER_LIFECYCLE.md +42 -0
- package/docs/reports/unified-9.0.19/STATIC_REVIEW_DE.md +11 -0
- package/docs/reports/unified-9.0.19/TARIFF_PRICE_VALUES_REVIEW.md +31 -0
- package/docs/reports/unified-9.0.19/TARIF_VIERTELSTUNDEN_RUNTIME.md +17 -0
- package/docs/reports/unified-9.0.19/UNABHAENGIGER_REVIEW.md +49 -0
- package/docs/reports/unified-9.0.19/raw/INDEX.json +751 -0
- package/docs/reports/unified-9.0.19/raw/audit-full.log +345 -0
- package/docs/reports/unified-9.0.19/raw/audit-full.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/audit-runtime.log +23 -0
- package/docs/reports/unified-9.0.19/raw/audit-runtime.result.json +15 -0
- package/docs/reports/unified-9.0.19/raw/backend-final.log +5 -0
- package/docs/reports/unified-9.0.19/raw/backend-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.log +0 -0
- package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node22.result.json +15 -0
- package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.log +0 -0
- package/docs/reports/unified-9.0.19/raw/devices-hosted-typecheck-node24.result.json +15 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-build.log +5 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-host-final.log +70 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-lease-918-before.log +26 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-lease-after.log +9 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-after.log +11 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-metadata-before.log +28 -0
- package/docs/reports/unified-9.0.19/raw/devices-incident-web-pipeline.log +22 -0
- package/docs/reports/unified-9.0.19/raw/frontend-build.log +152 -0
- package/docs/reports/unified-9.0.19/raw/frontend-build.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/installer-build.log +26 -0
- package/docs/reports/unified-9.0.19/raw/installer-build.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/keygen-source.json +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-auto-pv.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-clamp.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-grid-cap-safe.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.log +539 -0
- package/docs/reports/unified-9.0.19/raw/legacy-charging-mode-recovery.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase1.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-phase2.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-core-limits-tariff-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-energy-wallet-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.log +2 -0
- package/docs/reports/unified-9.0.19/raw/legacy-farm-dispatch-loader-current.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-final-write-envelope.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-history-http.log +39 -0
- package/docs/reports/unified-9.0.19/raw/legacy-history-http.result.json +15 -0
- package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.log +30 -0
- package/docs/reports/unified-9.0.19/raw/legacy-import-grid-budget.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.log +2 -0
- package/docs/reports/unified-9.0.19/raw/legacy-import-grid-contract-current.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.log +203 -0
- package/docs/reports/unified-9.0.19/raw/legacy-live-mode-loader-current.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-load-grid-sanity.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-ocpp-stability.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-ocpp21-storage-safety.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.log +18 -0
- package/docs/reports/unified-9.0.19/raw/legacy-permanent-grid-protection.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-dp-persistence.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.log +16 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-farm-dispatch-recovery.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.log +6 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-functional-safety.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.log +2 -0
- package/docs/reports/unified-9.0.19/raw/legacy-storage-topology-loader-current.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/legacy-test-loader.cjs +47 -0
- package/docs/reports/unified-9.0.19/raw/lint-final.log +16 -0
- package/docs/reports/unified-9.0.19/raw/lint-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/modules-build.log +5 -0
- package/docs/reports/unified-9.0.19/raw/modules-build.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/node22-tests-final.log +10719 -0
- package/docs/reports/unified-9.0.19/raw/node22-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.log +7 -0
- package/docs/reports/unified-9.0.19/raw/node22-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.19/raw/node24-tests-final.log +1805 -0
- package/docs/reports/unified-9.0.19/raw/node24-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.19/raw/node24-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.19/raw/sbom-runtime.log +7 -0
- package/docs/reports/unified-9.0.19/raw/sbom-runtime.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.log +1 -0
- package/docs/reports/unified-9.0.19/raw/sbom-vendor-check.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.log +11 -0
- package/docs/reports/unified-9.0.19/raw/tariff-price-chain-919.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.log +68 -0
- package/docs/reports/unified-9.0.19/raw/tariff-price-chain-old-918.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-docs-check.log +6 -0
- package/docs/reports/unified-9.0.19/raw/ui-docs-check.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-runtime-final.log +7 -0
- package/docs/reports/unified-9.0.19/raw/ui-runtime-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.log +6 -0
- package/docs/reports/unified-9.0.19/raw/ui-runtime-sync.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-sbom-check.log +6 -0
- package/docs/reports/unified-9.0.19/raw/ui-sbom-check.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-sbom-final.log +6 -0
- package/docs/reports/unified-9.0.19/raw/ui-sbom-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-secret-final.log +6 -0
- package/docs/reports/unified-9.0.19/raw/ui-secret-final.result.json +14 -0
- package/docs/reports/unified-9.0.19/raw/ui-security-final.log +8 -0
- package/docs/reports/unified-9.0.19/raw/ui-security-final.result.json +14 -0
- package/io-package.json +8 -8
- package/modules/devices/admin/ems-assignment.d.ts +8 -2
- package/modules/devices/admin/ems-assignment.js +192 -30
- package/modules/devices/admin/host-bridge.js +36 -11
- package/modules/devices/admin/index.html +26 -5
- package/modules/devices/admin/index_m.js +87 -3
- package/modules/devices/admin/style.css +17 -4
- package/modules/devices/checks/emsAssignment.check.js +10 -6
- package/modules/devices/contracts.d.ts +1 -1
- package/modules/devices/index.js +54 -17
- package/modules/devices/lib/deviceAliasFreshness.js +65 -0
- package/modules/devices/lib/deviceRuntime.js +201 -127
- package/modules/devices/lib/drivers/modbus.js +18 -3
- package/modules/devices/lib/drivers/speedwire.js +42 -22
- package/modules/devices/test/deviceAliasFreshness.test.js +149 -0
- package/modules/devices/test/emsAssignmentUi.test.js +119 -11
- package/modules/devices/test/modbusAuthorizationReads.test.js +112 -0
- package/modules/devices/test/runtimeLiveness.test.js +1 -1
- package/modules/devices/test/speedwireLifecycle.test.js +118 -0
- package/modules/devices/tsconfig.alias-semantics.json +1 -1
- package/modules/devices/tsconfig.hosted.json +1 -1
- package/package.json +9 -7
- package/release-manifests/unified/build-environment.cdx.json +1483 -7370
- package/release-manifests/unified/files.json +295 -133
- package/release-manifests/unified/frontend.cdx.json +2688 -5952
- package/release-manifests/unified/installer.cdx.json +2053 -821
- package/release-manifests/unified/obsolete-admin-assets.json +88 -6
- package/release-manifests/unified/runtime.cdx.json +40 -3283
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +3 -3
- package/ui/docs/security/eslint-reviewed-findings.json +20 -20
- package/ui/ems/engine.js +54 -7
- package/ui/ems/module-manager.js +44 -21
- package/ui/ems/modules/core-limits.js +5 -3
- package/ui/ems/modules/energy-wallet.js +31 -32
- package/ui/ems/modules/storage-control.js +5 -4
- package/ui/ems/modules/tarif-vis.js +36 -24
- package/ui/ems/modules/tariff-provider.js +28 -6
- package/ui/ems/services/tariff-provider-registry.js +11 -8
- package/ui/io-package.json +1 -1
- package/ui/lib/customer-tariff.js +5 -1
- package/ui/lib/installer-lifecycle.js +134 -1
- package/ui/lib/storage-farm-overview.js +115 -0
- package/ui/lib/tariff-price.js +115 -0
- package/ui/main.js +202 -51
- package/ui/package.json +8 -2
- package/ui/www/app.js +47 -134
- package/ui/www/ems-apps.html +2 -0
- package/ui/www/ems-apps.js +14 -2
- package/ui/www/index.html +2 -0
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/power-measurements.js +62 -0
- package/ui/www/settings.html +2 -0
- package/ui/www/storagefarm-summary.css +17 -0
- package/ui/www/storagefarm-summary.js +136 -0
- package/ui/www/storagefarm.html +16 -1
- package/ui/www/storagefarm.js +10 -22
- package/ui/www/tariff-display.js +161 -0
- package/adminWww/remoteEntry-eos-9.0.18.js +0 -12
|
@@ -13,6 +13,7 @@ let manufacturersByCategory = {}; // cat -> [manu]
|
|
|
13
13
|
let templatesByCatManu = {}; // cat -> manu -> [template]
|
|
14
14
|
let devices = [];
|
|
15
15
|
let editIndex = -1;
|
|
16
|
+
let emsRenewalRequested = false;
|
|
16
17
|
let onChangeGlobal = null;
|
|
17
18
|
let uiInitialized = false;
|
|
18
19
|
let lastSuggestedId = '';
|
|
@@ -846,6 +847,14 @@ function updateEmsControls(settings) {
|
|
|
846
847
|
}
|
|
847
848
|
select.value = choices.some(choice => choice.value === desired.mode) ? desired.mode : 'auto';
|
|
848
849
|
document.getElementById('dev_ems_scope').value = desired.scope || '';
|
|
850
|
+
if (settings) {
|
|
851
|
+
document.getElementById('dev_ems_requested').checked = desired.activation?.requested !== false;
|
|
852
|
+
const limits = desired.activation?.limits || {};
|
|
853
|
+
for (const key of ['coupling', 'maxChargeW', 'maxDischargeW', 'capacityKWh', 'chargerType', 'phases', 'minCurrentA', 'maxCurrentA', 'minPowerW', 'maxPowerW']) {
|
|
854
|
+
const control = document.getElementById('dev_ems_' + key);
|
|
855
|
+
control.value = Object.hasOwn(limits, key) ? String(Reflect.get(limits, key)) : '';
|
|
856
|
+
}
|
|
857
|
+
}
|
|
849
858
|
updateEmsTargets(settings ? (desired.flowSlot ?? '') : undefined);
|
|
850
859
|
}
|
|
851
860
|
|
|
@@ -866,6 +875,52 @@ function updateEmsTargets(savedSlot) {
|
|
|
866
875
|
field.hidden = targets.length === 0;
|
|
867
876
|
document.getElementById('dev_ems_scope_field').hidden = !['singleStorage', 'storageFarm', 'gridMeter'].includes(mode);
|
|
868
877
|
document.getElementById('dev_ems_help').textContent = window.EosDeviceEms.help(String($('#dev_category').val() || ''), mode, scope);
|
|
878
|
+
updateEmsActivation();
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function updateEmsActivation() {
|
|
882
|
+
const mode = document.getElementById('dev_ems_mode').value;
|
|
883
|
+
const category = String($('#dev_category').val() || '').toUpperCase();
|
|
884
|
+
const storage = ['singleStorage', 'storageFarm'].includes(mode);
|
|
885
|
+
const charger = mode === 'auto' && ['EVCS', 'EVSE'].includes(category);
|
|
886
|
+
const applicable = storage || charger || ['gridMeter', 'generationMeter', 'consumptionMeter', 'pvInverter'].includes(mode);
|
|
887
|
+
document.getElementById('dev_ems_activation_field').hidden = !applicable;
|
|
888
|
+
const requested = document.getElementById('dev_ems_requested').checked;
|
|
889
|
+
const type = document.getElementById('dev_ems_chargerType').value;
|
|
890
|
+
for (const field of document.querySelectorAll('[data-ems-limit]')) {
|
|
891
|
+
const group = field.dataset.emsLimit;
|
|
892
|
+
field.hidden = !requested || !(group === 'storage' && storage || group === 'charger' && charger || group === type && charger);
|
|
893
|
+
}
|
|
894
|
+
document.getElementById('dev_ems_limits_help').hidden = !requested || !(storage || charger);
|
|
895
|
+
document.getElementById('dev_ems_limits_title').hidden = !requested || !(storage || charger);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function collectEmsActivation(value, previous) {
|
|
899
|
+
if (document.getElementById('dev_ems_activation_field').hidden) return;
|
|
900
|
+
const requested = document.getElementById('dev_ems_requested').checked;
|
|
901
|
+
const limits = { ...(previous?.activation?.limits || {}) };
|
|
902
|
+
const storage = ['singleStorage', 'storageFarm'].includes(value.mode);
|
|
903
|
+
const charger = value.mode === 'auto';
|
|
904
|
+
const kind = document.getElementById('dev_ems_chargerType').value;
|
|
905
|
+
const fields = storage ? ['coupling', 'maxChargeW', 'maxDischargeW', 'capacityKWh']
|
|
906
|
+
: charger ? ['chargerType', ...(kind === 'dc' ? ['minPowerW', 'maxPowerW'] : ['phases', 'minCurrentA', 'maxCurrentA'])] : [];
|
|
907
|
+
for (const key of fields) {
|
|
908
|
+
const raw = document.getElementById('dev_ems_' + key).value.trim();
|
|
909
|
+
if (!raw) continue; // Existing App-Center limits are resolved on the server.
|
|
910
|
+
if (['coupling', 'chargerType'].includes(key)) {
|
|
911
|
+
if (!['ac', 'dc'].includes(raw)) throw new Error('Bitte eine gültige Anbindung auswählen.');
|
|
912
|
+
Reflect.set(limits, key, raw);
|
|
913
|
+
} else {
|
|
914
|
+
const numeric = Number(raw);
|
|
915
|
+
if (!Number.isFinite(numeric) || numeric <= 0 || numeric > 10000000 || key === 'phases' && ![1, 3].includes(numeric)) throw new Error('Bitte positive, gültige EMS-Grenzen eingeben.');
|
|
916
|
+
Reflect.set(limits, key, numeric);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
if (requested && limits.minCurrentA > limits.maxCurrentA || requested && limits.minPowerW > limits.maxPowerW) throw new Error('Die minimale Ladegrenze darf die maximale Grenze nicht überschreiten.');
|
|
920
|
+
if (requested && editIndex < 0 && storage && (!limits.maxChargeW || !limits.maxDischargeW)) throw new Error('Für den neuen Speicher maximale Lade- und Entladeleistung angeben.');
|
|
921
|
+
if (requested && editIndex < 0 && charger && (!limits.chargerType || kind === 'ac' && (!limits.phases || !limits.minCurrentA || !limits.maxCurrentA) || kind === 'dc' && (!limits.minPowerW || !limits.maxPowerW))) throw new Error('Für den neuen Ladepunkt Ladeart und zugehörige Grenzen angeben.');
|
|
922
|
+
value.activation = { requested, limits };
|
|
923
|
+
if (previous?.activation?.requestId) value.activation.requestId = previous.activation.requestId;
|
|
869
924
|
}
|
|
870
925
|
|
|
871
926
|
function collectEmsIntent() {
|
|
@@ -886,6 +941,7 @@ function collectEmsIntent() {
|
|
|
886
941
|
if (!chosen) throw new Error('Ziel für die Zuordnung im Energiefluss auswählen');
|
|
887
942
|
value.flowSlot = chosen.value;
|
|
888
943
|
}
|
|
944
|
+
collectEmsActivation(value, previous);
|
|
889
945
|
return value;
|
|
890
946
|
}
|
|
891
947
|
|
|
@@ -905,16 +961,17 @@ function renderDevicesTable() {
|
|
|
905
961
|
const tplName = tpl ? (tpl.name || tpl.id) : (d.templateId || '');
|
|
906
962
|
|
|
907
963
|
const ems = emsPresentation(d);
|
|
964
|
+
const capabilities = window.EosDeviceEms.capabilities(tpl);
|
|
908
965
|
const row = $(`
|
|
909
966
|
<tr>
|
|
910
967
|
<td>${d.enabled ? '✓' : ''}</td>
|
|
911
968
|
<td><code>${escapeHtml(d.id)}</code></td>
|
|
912
|
-
<td>${escapeHtml(d.name || '')}</td>
|
|
969
|
+
<td>${escapeHtml(d.name || '')}${capabilities.length ? `<details class="nexo-ems-notes"><summary>Profilfunktionen</summary><div class="nexo-capability-chips">${capabilities.map(item => `<span>${escapeHtml(item)}</span>`).join('')}</div><p>Profilangaben · Betriebsfreigabe siehe EMS-Status.</p></details>` : ''}</td>
|
|
913
970
|
<td>${escapeHtml(d.category || '')}</td>
|
|
914
971
|
<td>${escapeHtml(manufacturer)}</td>
|
|
915
972
|
<td>${escapeHtml(tplName)}</td>
|
|
916
973
|
<td>${escapeHtml(d.protocol || '')}</td>
|
|
917
|
-
<td class="nexo-ems-cell"><span data-eos-ems-id="${escapeHtml(d.id)}" data-eos-ems-mode="${escapeHtml(window.EosDeviceEms.intent(d.ems).mode)}" data-eos-ems-enabled="${d.enabled !== false}" data-state="${escapeHtml(ems.status)}">${escapeHtml(ems.label)} · ${escapeHtml(ems.detail)}</span></td>
|
|
974
|
+
<td class="nexo-ems-cell"><span data-eos-ems-id="${escapeHtml(d.id)}" data-eos-ems-mode="${escapeHtml(window.EosDeviceEms.intent(d.ems).mode)}" data-eos-ems-enabled="${d.enabled !== false}" data-state="${escapeHtml(ems.status)}">${escapeHtml(ems.label)} · ${escapeHtml(ems.detail)}</span><details class="nexo-ems-notes"${ems.optionalDetail ? '' : ' hidden'}><summary>Profilhinweise</summary><p>${escapeHtml(ems.optionalDetail || '')}</p></details></td>
|
|
918
975
|
<td class="actions">
|
|
919
976
|
<a href="#!" class="btn-small waves-effect" data-action="edit" data-idx="${idx}">${escapeHtml('Gerät bearbeiten')}</a>
|
|
920
977
|
<a href="#!" class="btn-small red waves-effect" data-action="delete" data-idx="${idx}">${escapeHtml('Löschen')}</a>
|
|
@@ -1121,8 +1178,27 @@ function collectFeneconControllerOffset() {
|
|
|
1121
1178
|
return offset;
|
|
1122
1179
|
}
|
|
1123
1180
|
|
|
1181
|
+
function renderProfileCapabilities(template) {
|
|
1182
|
+
const container = document.getElementById('dev_profile_capabilities');
|
|
1183
|
+
container.replaceChildren();
|
|
1184
|
+
const title = document.createElement('p');
|
|
1185
|
+
title.textContent = 'Im Geräteprofil vorgesehen';
|
|
1186
|
+
title.className = 'nexo-muted'; container.appendChild(title);
|
|
1187
|
+
const capabilities = window.EosDeviceEms.capabilities(template);
|
|
1188
|
+
const list = document.createElement('div'); list.className = 'nexo-capability-chips';
|
|
1189
|
+
for (const capability of capabilities) {
|
|
1190
|
+
const chip = document.createElement('span'); chip.textContent = capability; list.appendChild(chip);
|
|
1191
|
+
}
|
|
1192
|
+
if (!capabilities.length) list.textContent = 'Keine eindeutigen Funktionsangaben im geladenen Profil.';
|
|
1193
|
+
container.appendChild(list);
|
|
1194
|
+
const hint = document.createElement('p'); hint.className = 'nexo-muted nexo-capability-hint';
|
|
1195
|
+
hint.textContent = 'Die tatsächliche EMS-Verwendbarkeit wird anhand der Alias-Datenpunkte geprüft und im Gerätestatus angezeigt.';
|
|
1196
|
+
container.appendChild(hint);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1124
1199
|
function renderDatapoints(templateId) {
|
|
1125
1200
|
const tpl = templatesById[templateId];
|
|
1201
|
+
renderProfileCapabilities(tpl);
|
|
1126
1202
|
renderVartaOptions(tpl);
|
|
1127
1203
|
renderDeyeOptions(tpl);
|
|
1128
1204
|
renderFeneconOptions(tpl);
|
|
@@ -1151,6 +1227,7 @@ function renderDatapoints(templateId) {
|
|
|
1151
1227
|
}
|
|
1152
1228
|
|
|
1153
1229
|
function openDeviceModal(device, idx) {
|
|
1230
|
+
emsRenewalRequested = false;
|
|
1154
1231
|
editIndex = (typeof idx === 'number') ? idx : -1;
|
|
1155
1232
|
$('#modalTitle').text(editIndex >= 0 ? 'Gerät bearbeiten' : 'Gerät hinzufügen');
|
|
1156
1233
|
|
|
@@ -1229,6 +1306,7 @@ function openDeviceModal(device, idx) {
|
|
|
1229
1306
|
refreshSelect($('#mb_wordOrder'));
|
|
1230
1307
|
refreshSelect($('#mb_byteOrder'));
|
|
1231
1308
|
applyTemplateModbusTcpDefaultsToForm(tpl, proto, c);
|
|
1309
|
+
renderProfileCapabilities(tpl);
|
|
1232
1310
|
renderVartaOptions(tpl);
|
|
1233
1311
|
$('#varta_allow_sf_writes').prop('checked', device.vartaAllowScaleFactorWrites === true && !!(tpl && tpl.driverHints && tpl.driverHints.vartaModbus && ['pulseNeo', 'flexStorage'].includes(tpl.driverHints.vartaModbus.product)));
|
|
1234
1312
|
$('#varta_extended_enabled').prop('checked', device.vartaExtendedEnabled !== false);
|
|
@@ -1627,7 +1705,12 @@ function updateJsonPreview() {
|
|
|
1627
1705
|
}
|
|
1628
1706
|
|
|
1629
1707
|
function initEventHandlers() {
|
|
1630
|
-
$('#dev_ems_mode').on('change', () => updateEmsTargets());
|
|
1708
|
+
$('#dev_ems_mode').on('change', () => { document.getElementById('dev_ems_requested').checked = true; updateEmsTargets(); });
|
|
1709
|
+
$('#dev_ems_requested').on('change', () => {
|
|
1710
|
+
if (document.getElementById('dev_ems_requested').checked && editIndex >= 0) emsRenewalRequested = true;
|
|
1711
|
+
updateEmsActivation();
|
|
1712
|
+
});
|
|
1713
|
+
$('#dev_ems_chargerType').on('change', updateEmsActivation);
|
|
1631
1714
|
$('#dev_ems_scope').on('change', () => updateEmsTargets());
|
|
1632
1715
|
$('#fenecon_ctrl_profile').on('change', function () {
|
|
1633
1716
|
const profile = $('#fenecon_ctrl_profile').val();
|
|
@@ -1895,6 +1978,7 @@ function initEventHandlers() {
|
|
|
1895
1978
|
devices.push(d);
|
|
1896
1979
|
}
|
|
1897
1980
|
|
|
1981
|
+
if (emsRenewalRequested) window.EosDeviceEms.requestRenewal(d.id);
|
|
1898
1982
|
devices.sort((a, b) => (a.id || '').localeCompare(b.id || ''));
|
|
1899
1983
|
|
|
1900
1984
|
renderDevicesTable();
|
|
@@ -513,8 +513,8 @@ code {
|
|
|
513
513
|
.eos-host-links { margin-bottom: 12px; }
|
|
514
514
|
.eos-host-actions label { color: #e6edf3; padding-right: 12px; }
|
|
515
515
|
.eos-host-actions .btn-flat { color: #bce9dc; border: 1px solid #45685f; }
|
|
516
|
-
#eosModuleStatus { margin: 10px 0 0; }
|
|
517
|
-
#eosModuleStatus[data-error="true"] { color: #ffaaa1; }
|
|
516
|
+
#eosModuleStatus, #eosModuleRuntimeStatus { margin: 10px 0 0; }
|
|
517
|
+
#eosModuleStatus[data-error="true"], #eosModuleRuntimeStatus[data-error="true"] { color: #ffaaa1; }
|
|
518
518
|
.eos-host-import { margin-top: 12px; }
|
|
519
519
|
.eos-host-import summary { cursor: pointer; color: #a3d5c6; }
|
|
520
520
|
.eos-host-import input { max-width: 280px; }
|
|
@@ -556,8 +556,8 @@ body.eos-module-page {
|
|
|
556
556
|
.m .eos-host-actions input[type="checkbox"] { appearance: auto; -webkit-appearance: checkbox; opacity: 1; pointer-events: auto; position: static; width: 20px; height: 20px; margin: 0; }
|
|
557
557
|
.m .eos-host-actions input[type="checkbox"] + span { padding-left: 0; line-height: 1.5; height: auto; }
|
|
558
558
|
.m .eos-host-actions input[type="checkbox"] + span::before, .m .eos-host-actions input[type="checkbox"] + span::after { display: none; }
|
|
559
|
-
.m #eosModuleStatus { margin: 14px 0 0; color: #b7d9cd; font-size: 14px; }
|
|
560
|
-
.m #eosModuleStatus[data-error="true"] { color: #ffadb8; }
|
|
559
|
+
.m #eosModuleStatus, .m #eosModuleRuntimeStatus { margin: 14px 0 0; color: #b7d9cd; font-size: 14px; }
|
|
560
|
+
.m #eosModuleStatus[data-error="true"], .m #eosModuleRuntimeStatus[data-error="true"] { color: #ffadb8; }
|
|
561
561
|
.m #eosModuleStatus a { display: inline-block; margin-left: 8px; text-decoration: underline; color: #baffdf; }
|
|
562
562
|
.m .eos-host-import { border-top: 1px solid var(--eos-border); margin-top: 16px; padding-top: 14px; }
|
|
563
563
|
.m .eos-host-import p { color: var(--eos-muted); font-size: 14px; max-width: 1000px; }
|
|
@@ -662,3 +662,16 @@ body.eos-module-page {
|
|
|
662
662
|
.nexo-ems-cell [data-state="mapped"], #eosEmsStatus[data-state="mapped"] { color: #6fe4bc; }
|
|
663
663
|
.nexo-ems-cell [data-state="conflict"], #eosEmsStatus[data-state="conflict"] { color: #ffb0a5; }
|
|
664
664
|
.nexo-ems-cell [data-state="pending"] { color: #f0d594; }
|
|
665
|
+
|
|
666
|
+
.nexo-ems-config [hidden] { display: none !important; }
|
|
667
|
+
.nexo-ems-check { display: flex; align-items: center; gap: 10px; margin: 20px 0 10px; }
|
|
668
|
+
.nexo-ems-fields input { box-sizing: border-box; width: 100%; }
|
|
669
|
+
.nexo-ems-step { font-size: .8rem; color: #65dfba; letter-spacing: .04em; font-weight: 700; margin: 20px 0 12px; }
|
|
670
|
+
.nexo-ems-notes { margin-top: 8px; color: #b0c5d1; }
|
|
671
|
+
.nexo-ems-notes[hidden] { display: none; }
|
|
672
|
+
.nexo-ems-notes summary { cursor: pointer; font-size: .8rem; }
|
|
673
|
+
|
|
674
|
+
.nexo-profile-capabilities { border-bottom: 1px solid var(--eos-border); padding-bottom: 12px; }
|
|
675
|
+
.nexo-capability-chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
676
|
+
.nexo-capability-chips span { border: 1px solid #24585c; border-radius: 999px; padding: 4px 9px; color: #a7ead9; background: #0a2b31; font-size: .77rem; }
|
|
677
|
+
.nexo-capability-hint { font-size: .8rem; margin-bottom: 0; }
|
|
@@ -49,7 +49,7 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
|
|
|
49
49
|
if (url.pathname.endsWith('/command')) { res.end(JSON.stringify({ result: [] })); return; }
|
|
50
50
|
res.end(JSON.stringify({ config, csrfToken: 'fixture-csrf', configurationReady: true,
|
|
51
51
|
status: { active: true, reason: 'RUNNING' }, emsCommissioning: { state: ready ? 'ready' : 'pending',
|
|
52
|
-
statuses: config.devices.map(d => ({ deviceId: d.id, status: ready ? 'mapped' : 'pending', code: ready ? '
|
|
52
|
+
statuses: config.devices.map(d => ({ deviceId: d.id, status: ready ? 'mapped' : 'pending', code: ready ? 'ACTIVATION_APPLIED' : 'ALIASES_PENDING', activationApplied: ready, activationRequestId: d.ems?.activation?.requestId })) } })); return;
|
|
53
53
|
}
|
|
54
54
|
if (url.pathname === '/eos-session-idle.js') { res.setHeader('Content-Type', 'text/javascript'); res.end('/* idle lifecycle separately tested */'); return; }
|
|
55
55
|
const asset = assets[url.pathname];
|
|
@@ -80,6 +80,8 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
|
|
|
80
80
|
await edit('evcs1');
|
|
81
81
|
assert.equal(await page.$eval('#dev_ems_mode', e => e.value), 'auto');
|
|
82
82
|
assert.match(await page.$eval('#dev_ems_help', e => e.textContent), /automatisch unter Ladepunkte/);
|
|
83
|
+
await page.select('#dev_ems_chargerType', 'ac'); await page.select('#dev_ems_phases', '3');
|
|
84
|
+
await page.type('#dev_ems_minCurrentA', '6'); await page.type('#dev_ems_maxCurrentA', '16');
|
|
83
85
|
await keepDraft();
|
|
84
86
|
await edit('meter1');
|
|
85
87
|
await page.select('#dev_ems_mode', 'generationMeter');
|
|
@@ -89,19 +91,21 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
|
|
|
89
91
|
await keepDraft();
|
|
90
92
|
await edit('pv1'); await page.select('#dev_ems_mode', 'pvInverter'); await page.select('#dev_ems_slot', '2'); await keepDraft();
|
|
91
93
|
await edit('storage1'); await page.select('#dev_ems_mode', 'storageFarm'); await page.select('#dev_ems_scope', 'M0');
|
|
94
|
+
await page.select('#dev_ems_coupling', 'dc'); await page.type('#dev_ems_maxChargeW', '10000'); await page.type('#dev_ems_maxDischargeW', '10000'); await page.type('#dev_ems_capacityKWh', '20');
|
|
92
95
|
if (screenshots) { await fs.mkdir(screenshots, { recursive: true }); await page.screenshot({ path: path.join(screenshots, 'devices-ems-desktop.png') }); }
|
|
93
96
|
await keepDraft();
|
|
94
97
|
await page.click('#eosModuleSave');
|
|
95
98
|
await page.waitForFunction(() => document.getElementById('eosEmsStatus').textContent.includes('4 Gerät(e) zugeordnet') && !document.getElementById('eosDeviceEditor').inert);
|
|
96
99
|
assert.equal(received.filter(r => r.method === 'PUT').length, 1);
|
|
97
100
|
const byId = Object.fromEntries(config.devices.map(d => [d.id, d]));
|
|
98
|
-
assert.
|
|
99
|
-
assert.
|
|
100
|
-
assert.
|
|
101
|
-
assert.
|
|
101
|
+
assert.equal(byId.evcs1.ems.mode, 'auto'); assert.equal(byId.evcs1.ems.activation.limits.maxCurrentA, 16);
|
|
102
|
+
assert.equal(byId.meter1.ems.mode, 'generationMeter'); assert.equal(byId.meter1.ems.flowSlot, 1);
|
|
103
|
+
assert.equal(byId.pv1.ems.mode, 'pvInverter'); assert.equal(byId.pv1.ems.flowSlot, 2);
|
|
104
|
+
assert.equal(byId.storage1.ems.mode, 'storageFarm'); assert.equal(byId.storage1.ems.scope, 'M0'); assert.equal(byId.storage1.ems.activation.limits.capacityKWh, 20);
|
|
105
|
+
for (const device of config.devices) { assert.equal(device.ems.activation.requested, true); assert.match(device.ems.activation.requestId, /^[0-9a-f-]{36}$/); }
|
|
102
106
|
assert.deepEqual(config.futureModuleSetting, { retain: true });
|
|
103
107
|
for (const d of config.devices) { assert.equal(d.futureSetting, 'keep'); assert.equal(d.connection.password, '__EOS_SECRET_UNCHANGED__'); assert.equal(d.connection.customRetained, 9); }
|
|
104
|
-
assert.match(await page.$eval('[data-eos-ems-id="evcs1"]', e => e.textContent), /
|
|
108
|
+
assert.match(await page.$eval('[data-eos-ems-id="evcs1"]', e => e.textContent), /EMS eingerichtet/);
|
|
105
109
|
assert.equal(await page.$eval('a[href*="tab=evcs"]', e => e.target), '');
|
|
106
110
|
await edit('meter1');
|
|
107
111
|
await page.$eval('#dev_name', e => { e.value = 'Unsaved customer name'; e.dispatchEvent(new Event('input', { bubbles: true })); });
|
|
@@ -50,7 +50,7 @@ export interface HostedRuntime {
|
|
|
50
50
|
_stopWriteLoop?(): void;
|
|
51
51
|
_createDriver(): Driver;
|
|
52
52
|
initObjects(): Promise<unknown>;
|
|
53
|
-
start(): Promise<unknown>;
|
|
53
|
+
start(options?: { backgroundInitialPoll?: boolean }): Promise<unknown>;
|
|
54
54
|
stop(): Promise<unknown>;
|
|
55
55
|
handleStateChange(id: string, state: State): Promise<unknown>;
|
|
56
56
|
}
|
package/modules/devices/index.js
CHANGED
|
@@ -79,7 +79,7 @@ function validateConfig(input = {}) {
|
|
|
79
79
|
if (!PROTOCOLS.includes(device.protocol)) throw failure('EOS_DEVICES_CONFIG_PROTOCOL');
|
|
80
80
|
if (device.enabled !== undefined && typeof device.enabled !== 'boolean') throw failure('EOS_DEVICES_CONFIG_ENABLED');
|
|
81
81
|
if (device.ems !== undefined) {
|
|
82
|
-
if (!record(device.ems) || Object.keys(device.ems).some(key => !['mode', 'scope', 'flowSlot', 'group'].includes(key))) throw failure('EOS_DEVICES_EMS_INTENT');
|
|
82
|
+
if (!record(device.ems) || Object.keys(device.ems).some(key => !['mode', 'scope', 'flowSlot', 'group', 'activation'].includes(key))) throw failure('EOS_DEVICES_EMS_INTENT');
|
|
83
83
|
const intent = device.ems;
|
|
84
84
|
if (typeof intent.mode !== 'string' || !['auto', 'monitor', 'manual', 'singleStorage', 'storageFarm', 'gridMeter', 'generationMeter', 'consumptionMeter', 'pvInverter'].includes(intent.mode)) throw failure('EOS_DEVICES_EMS_INTENT');
|
|
85
85
|
if (intent.scope !== undefined && (typeof intent.scope !== 'string' || !['M0', 'M1'].includes(intent.scope))) throw failure('EOS_DEVICES_EMS_SCOPE');
|
|
@@ -88,6 +88,28 @@ function validateConfig(input = {}) {
|
|
|
88
88
|
if (['generationMeter', 'pvInverter'].includes(intent.mode) && (typeof intent.flowSlot !== 'number' || intent.flowSlot < 0 || intent.flowSlot > 5)) throw failure('EOS_DEVICES_EMS_SLOT');
|
|
89
89
|
if (intent.mode === 'consumptionMeter' && (typeof intent.flowSlot !== 'number' || intent.flowSlot < 1 || intent.flowSlot > 10)) throw failure('EOS_DEVICES_EMS_SLOT');
|
|
90
90
|
if (['singleStorage', 'storageFarm', 'gridMeter'].includes(intent.mode) && intent.scope === undefined) throw failure('EOS_DEVICES_EMS_SCOPE');
|
|
91
|
+
if (intent.activation !== undefined) {
|
|
92
|
+
const activation = intent.activation;
|
|
93
|
+
if (!record(activation) || Object.keys(activation).some(key => !['requested', 'requestId', 'limits'].includes(key))
|
|
94
|
+
|| typeof activation.requested !== 'boolean' || typeof activation.requestId !== 'string'
|
|
95
|
+
|| !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(activation.requestId)) throw failure('EOS_DEVICES_EMS_ACTIVATION');
|
|
96
|
+
if (activation.limits !== undefined) {
|
|
97
|
+
const limits = activation.limits;
|
|
98
|
+
const numbers = ['maxChargeW', 'maxDischargeW', 'capacityKWh', 'minCurrentA', 'maxCurrentA', 'minPowerW', 'maxPowerW'];
|
|
99
|
+
if (!record(limits) || Object.keys(limits).some(key => ![...numbers, 'coupling', 'chargerType', 'phases'].includes(key))) throw failure('EOS_DEVICES_EMS_LIMITS');
|
|
100
|
+
for (const key of numbers) {
|
|
101
|
+
const value = Reflect.get(limits, key);
|
|
102
|
+
if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value) || value <= 0 || value > 10000000)) throw failure('EOS_DEVICES_EMS_LIMITS');
|
|
103
|
+
}
|
|
104
|
+
for (const key of ['coupling', 'chargerType']) {
|
|
105
|
+
const value = Reflect.get(limits, key);
|
|
106
|
+
if (value !== undefined && (typeof value !== 'string' || !['ac', 'dc'].includes(value))) throw failure('EOS_DEVICES_EMS_LIMITS');
|
|
107
|
+
}
|
|
108
|
+
if (limits.phases !== undefined && (typeof limits.phases !== 'number' || ![1, 3].includes(limits.phases))) throw failure('EOS_DEVICES_EMS_LIMITS');
|
|
109
|
+
if (typeof limits.minCurrentA === 'number' && typeof limits.maxCurrentA === 'number' && limits.minCurrentA > limits.maxCurrentA
|
|
110
|
+
|| typeof limits.minPowerW === 'number' && typeof limits.maxPowerW === 'number' && limits.minPowerW > limits.maxPowerW) throw failure('EOS_DEVICES_EMS_LIMITS');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
91
113
|
}
|
|
92
114
|
if (device.connection !== undefined && !record(device.connection)) throw failure('EOS_DEVICES_CONFIG_CONNECTION');
|
|
93
115
|
const connection = device.connection || {};
|
|
@@ -227,8 +249,13 @@ function createHostedModule({ adapter, canOperate, config = {}, runtimeFactory }
|
|
|
227
249
|
if (statusBusy || stopping) return;
|
|
228
250
|
statusBusy = true;
|
|
229
251
|
try {
|
|
230
|
-
|
|
231
|
-
|
|
252
|
+
// The host owns shutdown and its confirmation. A temporarily expired
|
|
253
|
+
// lease must not stop this module behind the host's back and leave a
|
|
254
|
+
// permanently inactive runtime labelled RUNNING after lease renewal.
|
|
255
|
+
// Every driver operation remains synchronously gated by permitted().
|
|
256
|
+
const allowed = permitted();
|
|
257
|
+
if (active) state = allowed ? 'running' : 'blocked';
|
|
258
|
+
await writeConnection(allowed && [...runtimes.values()].some(runtime => runtime.started && runtime._hbOnline === true));
|
|
232
259
|
} finally { statusBusy = false; }
|
|
233
260
|
}
|
|
234
261
|
async function start() {
|
|
@@ -260,20 +287,30 @@ function createHostedModule({ adapter, canOperate, config = {}, runtimeFactory }
|
|
|
260
287
|
const { DeviceRuntime } = require('./lib/deviceRuntime');
|
|
261
288
|
factory = (device, template) => /** @type {HostedRuntime} */ (/** @type {unknown} */ (new DeviceRuntime(adapter, device, template, settings)));
|
|
262
289
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
290
|
+
const pendingDevices = settings.devices.filter(device => device.enabled !== false);
|
|
291
|
+
let nextDevice = 0;
|
|
292
|
+
const startDevice = async () => {
|
|
293
|
+
while (nextDevice < pendingDevices.length) {
|
|
294
|
+
const device = pendingDevices[nextDevice++];
|
|
295
|
+
if (device.enabled === false) continue;
|
|
296
|
+
if (!permitted() || epoch !== generation) throw failure('EOS_DEVICES_STOPPED');
|
|
297
|
+
const template = structuredClone(catalog.byId.get(device.templateId));
|
|
298
|
+
if (!factory || !template) throw failure('EOS_DEVICES_RUNTIME_UNAVAILABLE');
|
|
299
|
+
const runtime = factory(structuredClone(device), template);
|
|
300
|
+
const createDriver = runtime._createDriver;
|
|
301
|
+
runtime._createDriver = function hostedDriver() { return guardDriver(createDriver.call(this), permitted); };
|
|
302
|
+
runtimes.set(device.id, runtime); // Include partially initialized runtimes in cleanup.
|
|
303
|
+
await runtime.initObjects();
|
|
304
|
+
if (!permitted() || epoch !== generation) throw failure('EOS_DEVICES_STOPPED');
|
|
305
|
+
await runtime.start({ backgroundInitialPoll: true });
|
|
306
|
+
if (!permitted() || epoch !== generation) { await runtime.stop(); throw failure('EOS_DEVICES_STOPPED'); }
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
// Bound object provisioning to four workers. Initial network reads
|
|
310
|
+
// remain owned by each runtime and never serialize all other devices.
|
|
311
|
+
const results = await Promise.allSettled(Array.from({ length: Math.min(4, pendingDevices.length) }, startDevice));
|
|
312
|
+
const failed = results.find(result => result.status === 'rejected');
|
|
313
|
+
if (failed?.status === 'rejected') throw failed.reason;
|
|
277
314
|
if (!permitted() || epoch !== generation) throw failure('EOS_DEVICES_STOPPED');
|
|
278
315
|
state = 'running';
|
|
279
316
|
timer = setInterval(() => { void refresh().catch(() => { lastError = 'EOS_DEVICES_STATUS_FAILED'; }); }, 1000);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const ENERGY_CLASSES = new Set(['meter', 'storageSystem', 'battery', 'batteryInverter', 'pvInverter', 'solarCharger']);
|
|
5
|
+
const LIVE_PATHS = new Set([
|
|
6
|
+
'comm.connected', 'alarm.offline', 'alarm.fault', 'alarm.warning',
|
|
7
|
+
'r.power', 'r.powerAc', 'r.powerCharge', 'r.powerDischarge', 'r.essActivePower',
|
|
8
|
+
'r.soc', 'r.available', 'r.allowCharge', 'r.allowDischarge',
|
|
9
|
+
'r.gridPower', 'r.nvpPower', 'r.consumptionTotal',
|
|
10
|
+
'r.pvPower', 'r.pvPowerDc', 'r.pvPowerAc', 'r.pvPowerTotal',
|
|
11
|
+
'r.minPowerSetpointW', 'r.maxPowerSetpointW', 'r.powerSetpointReadbackW',
|
|
12
|
+
'r.current', 'r.currentL1', 'r.currentL2', 'r.currentL3',
|
|
13
|
+
'r.voltage', 'r.voltageL1', 'r.voltageL2', 'r.voltageL3',
|
|
14
|
+
'r.powerL1', 'r.powerL2', 'r.powerL3',
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
/** @param {string} deviceClass @returns {boolean} */
|
|
18
|
+
function isEnergyFreshnessClass(deviceClass) { return ENERGY_CLASSES.has(deviceClass); }
|
|
19
|
+
|
|
20
|
+
/** Commands, counters, metadata and other device classes stay change-only.
|
|
21
|
+
* @param {string} deviceClass @param {string|null|undefined} path @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
function isEnergyFreshnessAlias(deviceClass, path) {
|
|
24
|
+
return ENERGY_CLASSES.has(deviceClass) && typeof path === 'string' && LIVE_PATHS.has(path);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Computed aliases must prove which real values they used. An unrelated MQTT
|
|
28
|
+
* packet or a cached source must not make an old computed measurement look fresh.
|
|
29
|
+
* @template T
|
|
30
|
+
* @param {Record<string, unknown>} values
|
|
31
|
+
* @param {(values:Record<string, unknown>)=>T} read
|
|
32
|
+
* @returns {{value:T, sourceIds:string[]}}
|
|
33
|
+
*/
|
|
34
|
+
function captureAliasSources(values, read) {
|
|
35
|
+
const sources = new Set();
|
|
36
|
+
const observed = new Proxy(values, {
|
|
37
|
+
get(target, property, receiver) {
|
|
38
|
+
if (typeof property === 'string' && Object.prototype.hasOwnProperty.call(target, property)) sources.add(property);
|
|
39
|
+
return Reflect.get(target, property, receiver);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return { value: read(observed), sourceIds: Array.from(sources) };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @param {{protocol:string, sourceIds:string[], values:Record<string,unknown>, lastWriteMs:number, sampleTimestamp?:number, sourceTimestamps?:Map<string,number>}} input @returns {boolean} */
|
|
46
|
+
function hasNewAliasSample(input) {
|
|
47
|
+
if (!input.sourceIds.length || !input.sourceIds.every(id => {
|
|
48
|
+
const value = input.values[id];
|
|
49
|
+
return value !== null && value !== undefined && (typeof value !== 'number' || Number.isFinite(value));
|
|
50
|
+
})) return false;
|
|
51
|
+
if (input.protocol === 'speedwire') {
|
|
52
|
+
return Number.isFinite(input.sampleTimestamp) && Number(input.sampleTimestamp) > input.lastWriteMs;
|
|
53
|
+
}
|
|
54
|
+
if (input.protocol === 'mqtt') {
|
|
55
|
+
return !!input.sourceTimestamps && input.sourceIds.every(id => {
|
|
56
|
+
const stamp = input.sourceTimestamps?.get(id);
|
|
57
|
+
return typeof stamp === 'number' && Number.isFinite(stamp) && stamp > input.lastWriteMs;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// CAN currently exposes no per-alias sample evidence to this runtime. Do not
|
|
61
|
+
// assert freshness from a transport connection or a cached value there.
|
|
62
|
+
return input.protocol !== 'canbus';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { isEnergyFreshnessClass, isEnergyFreshnessAlias, captureAliasSources, hasNewAliasSample };
|