iobroker.eos-admin 9.0.36 → 9.0.38
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 +10 -10
- package/README.md +15 -3
- package/adminWww/.vite/manifest.json +114 -114
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13759 -13759
- package/adminWww/assets/{AdapterUpdateDialog-D2nDWE_N.js → AdapterUpdateDialog-D4gUYZep.js} +1 -1
- package/adminWww/assets/{Adapters-D0sVqNBU.js → Adapters-DLxiJc3y.js} +1 -1
- package/adminWww/assets/{ConfigManager-Zm7UoaaN.js → ConfigManager-D_YTKUdP.js} +1 -1
- package/adminWww/assets/{Enums-BGL7pR-O.js → Enums-D79rON6b.js} +1 -1
- package/adminWww/assets/{Fields-A8J3u1yq.js → Fields-CTOv49EU.js} +1 -1
- package/adminWww/assets/{Files-CQPjCvW6.js → Files-DNLzjEG5.js} +1 -1
- package/adminWww/assets/{Hosts-CxzkkNBj.js → Hosts-DHNboUMq.js} +1 -1
- package/adminWww/assets/{Instances-eEbEukDh.js → Instances-BJxYNJAC.js} +1 -1
- package/adminWww/assets/{Intro-I_Tknp0E.js → Intro-8R-Q7CR_.js} +1 -1
- package/adminWww/assets/{Logs-C3GPz61Q.js → Logs-CjAPhWuK.js} +1 -1
- package/adminWww/assets/{Objects-DDnisxNB.js → Objects-cvdqooGe.js} +1 -1
- package/adminWww/assets/{Overview-BpZFdEmp.js → Overview-JPfBOuKv.js} +1 -1
- package/adminWww/assets/{State-DY6Nw0SB.js → State-CGnvMceJ.js} +1 -1
- package/adminWww/assets/{UsedResources-CtUpdP2b.js → UsedResources-FBd9jThR.js} +1 -1
- package/adminWww/assets/{Users-DcqlSfc5.js → Users-BbUu3hZj.js} +1 -1
- package/adminWww/assets/{bootstrap-Didkuj-F.js → bootstrap-Df_WTIJg.js} +3 -3
- package/adminWww/assets/{hostInit-Chrs-wsg.js → hostInit-BQCRqFay.js} +1 -1
- package/adminWww/assets/{icons-material-SqwOQW6y.js → icons-material-DS82xOs8.js} +1 -1
- package/adminWww/assets/{index-CpDo61Mz.js → index-BlBZd8r8.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-DZMZ3pJw.js → installSVGRenderer-BtlXF9y3.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-b0c4981a.js → mf-entry-bootstrap-0-8bb11ea2.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.36.js → remoteEntry-eos-9.0.38.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosLegacyMigration.js +351 -60
- package/build/lib/eosLegacyMigration.js.map +1 -1
- package/build/lib/eosLegacySource.js +172 -0
- package/build/lib/eosLegacySource.js.map +1 -0
- package/build/lib/eosModuleHost.js +38 -1
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +55 -8
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/eosRuntimeControl.js +3 -1
- package/build/lib/eosRuntimeControl.js.map +1 -1
- package/build/main.js +1 -1
- package/build/main.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/reports/unified-9.0.37/PRUEFBERICHT.md +59 -0
- package/docs/reports/unified-9.0.37/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.37/raw/INDEX.json +232 -0
- package/docs/reports/unified-9.0.37/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.37/raw/core-final-node22.log +1439 -0
- package/docs/reports/unified-9.0.37/raw/core-final-node24.log +1381 -0
- package/docs/reports/unified-9.0.37/raw/dashboard-935-screenshot.json +15 -0
- package/docs/reports/unified-9.0.37/raw/dashboard-de-en-nl.json +1059 -0
- package/docs/reports/unified-9.0.37/raw/ems-ui-nvp-integration.json +245 -0
- package/docs/reports/unified-9.0.37/raw/farm-and-dashboard-935.json +11 -0
- package/docs/reports/unified-9.0.37/raw/farm-tracking-source-tests.log +80 -0
- package/docs/reports/unified-9.0.37/raw/fixtures-verification.log +39 -0
- package/docs/reports/unified-9.0.37/raw/frontend.log +160 -0
- package/docs/reports/unified-9.0.37/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.37/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.37/raw/measure-storage-display.cjs +47 -0
- package/docs/reports/unified-9.0.37/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.37/raw/node22-isolated-start-deadlines.log +28 -0
- package/docs/reports/unified-9.0.37/raw/node22-migration.log +1329 -0
- package/docs/reports/unified-9.0.37/raw/node22-mira.log +222 -0
- package/docs/reports/unified-9.0.37/raw/node22-parallel-initial.log +13278 -0
- package/docs/reports/unified-9.0.37/raw/node22-startzeiten.json +21 -0
- package/docs/reports/unified-9.0.37/raw/node22-system-status.log +639 -0
- package/docs/reports/unified-9.0.37/raw/node22-tests-final.log +18494 -0
- package/docs/reports/unified-9.0.37/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.37/raw/node24-migration.log +1301 -0
- package/docs/reports/unified-9.0.37/raw/node24-mira.log +41 -0
- package/docs/reports/unified-9.0.37/raw/node24-system-status.log +111 -0
- package/docs/reports/unified-9.0.37/raw/node24-tests-final.log +3080 -0
- package/docs/reports/unified-9.0.37/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.37/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.37/raw/platform-acl-node22.log +98 -0
- package/docs/reports/unified-9.0.37/raw/platform-acl-node24.log +22 -0
- package/docs/reports/unified-9.0.37/raw/platform-nginx-node22.json +21 -0
- package/docs/reports/unified-9.0.37/raw/platform-nginx-node24.json +21 -0
- package/docs/reports/unified-9.0.37/raw/qa-source-check.log +2 -0
- package/docs/reports/unified-9.0.37/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.37/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.37/raw/speicher-warnschwelle-integration.json +172 -0
- package/docs/reports/unified-9.0.37/raw/sse-backpressure-9.0.35.log +1 -0
- package/docs/reports/unified-9.0.37/raw/sse-backpressure-9.0.37.log +1 -0
- package/docs/reports/unified-9.0.37/raw/storage-display-memory-node22.json +19 -0
- package/docs/reports/unified-9.0.37/raw/storage-display-memory-node24.json +19 -0
- package/docs/reports/unified-9.0.37/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.37/raw/ui-runtime.log +7 -0
- package/docs/reports/unified-9.0.38/PRUEFBERICHT.md +51 -0
- package/docs/reports/unified-9.0.38/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.38/raw/INDEX.json +272 -0
- package/docs/reports/unified-9.0.38/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.38/raw/core-final-node22.log +1439 -0
- package/docs/reports/unified-9.0.38/raw/core-final-node24.log +1381 -0
- package/docs/reports/unified-9.0.38/raw/dashboard-de-en-nl.json +1044 -0
- package/docs/reports/unified-9.0.38/raw/field-upgrade-936-node22.log +21 -0
- package/docs/reports/unified-9.0.38/raw/field-upgrade-936-node24.log +10 -0
- package/docs/reports/unified-9.0.38/raw/fixtures-verification.log +39 -0
- package/docs/reports/unified-9.0.38/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.38/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.38/raw/legacy-historian-provenance.json +44 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-built-influx.log +10 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-misbinding-937.log +1 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-providers-node22.log +326 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-providers-node24.log +58 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-real-influx.log +10 -0
- package/docs/reports/unified-9.0.38/raw/legacy-history-source-comparison.json +12 -0
- package/docs/reports/unified-9.0.38/raw/legacy-template-interfaces.json +21 -0
- package/docs/reports/unified-9.0.38/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.38/raw/migration-admin-browser-node22.log +86 -0
- package/docs/reports/unified-9.0.38/raw/migration-admin-browser-node24.log +84 -0
- package/docs/reports/unified-9.0.38/raw/migration-live-children-node22.log +20 -0
- package/docs/reports/unified-9.0.38/raw/migration-live-children-node24.log +9 -0
- package/docs/reports/unified-9.0.38/raw/migration-process-admin-node22.log +831 -0
- package/docs/reports/unified-9.0.38/raw/migration-process-admin-node24.log +144 -0
- package/docs/reports/unified-9.0.38/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.38/raw/node22-initial-destination-channel.log +13298 -0
- package/docs/reports/unified-9.0.38/raw/node22-migration.log +1443 -0
- package/docs/reports/unified-9.0.38/raw/node22-mira.log +222 -0
- package/docs/reports/unified-9.0.38/raw/node22-system-status.log +639 -0
- package/docs/reports/unified-9.0.38/raw/node22-tests-final.log +18620 -0
- package/docs/reports/unified-9.0.38/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.38/raw/node24-migration.log +1411 -0
- package/docs/reports/unified-9.0.38/raw/node24-mira.log +41 -0
- package/docs/reports/unified-9.0.38/raw/node24-system-status.log +111 -0
- package/docs/reports/unified-9.0.38/raw/node24-tests-final.log +3102 -0
- package/docs/reports/unified-9.0.38/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.38/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.38/raw/platform-acl-node22.log +98 -0
- package/docs/reports/unified-9.0.38/raw/platform-acl-node24.log +22 -0
- package/docs/reports/unified-9.0.38/raw/platform-nginx-node22.json +21 -0
- package/docs/reports/unified-9.0.38/raw/platform-nginx-node24.json +21 -0
- package/docs/reports/unified-9.0.38/raw/qa-source-check.log +2 -0
- package/docs/reports/unified-9.0.38/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.38/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.38/raw/source-shape-node22.log +438 -0
- package/docs/reports/unified-9.0.38/raw/source-shape-node24.log +78 -0
- package/docs/reports/unified-9.0.38/raw/target-owner-bootstrap-node22.log +509 -0
- package/docs/reports/unified-9.0.38/raw/target-owner-bootstrap-node24.log +92 -0
- package/docs/reports/unified-9.0.38/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.38/raw/ui-runtime.log +7 -0
- package/docs/start/START_HIER_9.0.37.md +38 -0
- package/docs/start/START_HIER_9.0.38.md +21 -0
- package/docs/unified/BESTANDSUEBERNAHME_9_0_7.md +2 -0
- package/docs/unified/DEVELOPMENT_FINDINGS.md +3 -1
- package/docs/unified/SECURITY_CRA.md +6 -0
- package/io-package.json +12 -12
- package/package.json +8 -4
- package/public/eos-migration/index.html +11 -4
- package/public/eos-migration/index.js +156 -18
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +229 -117
- 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 +166 -0
- package/release-manifests/unified/runtime.cdx.json +26 -26
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +1 -1
- package/ui/ems/modules/para14a.js +8 -3
- package/ui/ems/modules/storage-control.js +10 -5
- package/ui/io-package.json +9 -1
- package/ui/lib/notification-mail.js +95 -8
- package/ui/main.js +339 -21
- package/ui/package.json +1 -1
- package/ui/www/app.js +48 -18
- package/ui/www/i18n/en.json +15 -0
- package/ui/www/i18n/nl.json +15 -0
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/live-display.js +145 -27
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/storagefarm-dispatch.js +59 -8
- package/ui/www/storagefarm-summary.css +3 -1
- package/ui/www/storagefarm.html +2 -0
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:7c9927317c3f19ba2a761e5ade005ba6d705e4d24ebd17fe079ca2030ab94395
|
|
11
11
|
* Erzeugung: npm run sync:ts-runtime-executables
|
|
12
12
|
*
|
|
13
13
|
* Zweck:
|
|
@@ -57,6 +57,7 @@ const bodyParser = express.json({ limit: '5mb', inflate: false });
|
|
|
57
57
|
const crypto = require('crypto');
|
|
58
58
|
const { installerRevision, assertInstallerRevision, provisionInstallerObjects, assertDeviceAppActivations, numericMeasurement, activeDeviceProfileReferences, awaitEmsTransition } = require('./lib/installer-lifecycle');
|
|
59
59
|
const { buildFarmOverview } = require('./lib/storage-farm-overview');
|
|
60
|
+
const { compareFarmPower } = require('./www/live-display');
|
|
60
61
|
const { readFlowMeasurement, sumFlowMeasurements } = require('./lib/flow-measurement');
|
|
61
62
|
const nwDefaultFlowMappings = require('./io-package.json').native.datapoints;
|
|
62
63
|
const { tariffDisplayConfig, tariffPriceNumber } = require('./lib/tariff-price');
|
|
@@ -242,6 +243,15 @@ class NexoWattVis extends HostedAdapter {
|
|
|
242
243
|
});
|
|
243
244
|
|
|
244
245
|
this.stateCache = {};
|
|
246
|
+
// Read-only projection of the three EMS health reports. Keep producer evidence
|
|
247
|
+
// separate from normalized cache rows used by flow calculations and controls.
|
|
248
|
+
this._nwDashboardHealth = {
|
|
249
|
+
'ems.core.schedulerAlive': undefined,
|
|
250
|
+
'ems.core.schedulerHeartbeatAt': undefined,
|
|
251
|
+
'ems.gridMeasurementFresh': undefined,
|
|
252
|
+
};
|
|
253
|
+
this._nwDashboardHealthSent = Object.create(null);
|
|
254
|
+
this._nwFarmDisplay = Object.create(null);
|
|
245
255
|
// Public values may be normalized for UI/module safety (e.g. charge/discharge magnitudes).
|
|
246
256
|
// Keep the original signed input values as well so signed battery fallbacks can be split correctly.
|
|
247
257
|
this._nwRawValueCache = {};
|
|
@@ -278,7 +288,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
278
288
|
const snapshot = client?.internal
|
|
279
289
|
? adapter.stateCache
|
|
280
290
|
: publicBuilder(adapter.stateCache, true);
|
|
281
|
-
const chunk = `data: ${JSON.stringify({ type: 'init', payload: snapshot })}\n\n`;
|
|
291
|
+
const chunk = `data: ${JSON.stringify({ type: 'init', payload: Object.assign(client?.internal ? { ...snapshot, ...adapter._nwFarmDisplay } : snapshot, adapter._nwDashboardHealth) })}\n\n`;
|
|
282
292
|
cacheRoot[cacheKey] = { createdAt: now, chunk };
|
|
283
293
|
adapter._nwSseSnapshotBuilds = Number(adapter._nwSseSnapshotBuilds || 0) + 1;
|
|
284
294
|
return chunk;
|
|
@@ -6716,6 +6726,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6716
6726
|
const getUnit = async (id) => {
|
|
6717
6727
|
const sid = String(id || '').trim();
|
|
6718
6728
|
if (!sid) return '';
|
|
6729
|
+
if (this._sfTrackingLayout?.units.has(sid)) return this._sfTrackingLayout.units.get(sid);
|
|
6719
6730
|
if (_unitCache.has(sid)) return _unitCache.get(sid) || '';
|
|
6720
6731
|
|
|
6721
6732
|
let unit = '';
|
|
@@ -6851,6 +6862,29 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6851
6862
|
const statusRows = [];
|
|
6852
6863
|
const overviewMembers = [];
|
|
6853
6864
|
const overviewPvSources = [];
|
|
6865
|
+
// A shared actuator or meter cannot identify a single battery. Count owners
|
|
6866
|
+
// before inspecting live values so even the first duplicate is excluded.
|
|
6867
|
+
const trackingOwners = new Map();
|
|
6868
|
+
const trackingForbiddenMeters = new Set();
|
|
6869
|
+
const trackingRoutes = await this._sfTrackingRoutes(list, cfg);
|
|
6870
|
+
assertCurrent();
|
|
6871
|
+
for (const member of list.filter(entry => entry.enabled !== false)) {
|
|
6872
|
+
const actuators = [member.setSignedPowerId, member.setChargePowerId, member.setDischargePowerId, member.feneconGridSetpointId]
|
|
6873
|
+
.filter(Boolean).map(id => trackingRoutes.write.get(id));
|
|
6874
|
+
const meters = [member.batteryFlowPowerId, member.signedPowerId, member.feneconEssActualPowerId,
|
|
6875
|
+
member.chargePowerId, member.dischargePowerId].filter(Boolean).map(id => trackingRoutes.read.get(id));
|
|
6876
|
+
const foreignRoles = [member.pvPowerId, member.feneconPvDcId, member.feneconPvAcId, member.feneconPvTotalId,
|
|
6877
|
+
member.feneconNvpPowerId, member.feneconConsumptionTotalId, member.feneconActualSetpointId, member.socId];
|
|
6878
|
+
for (const id of [...actuators, ...foreignRoles.map(id => trackingRoutes.read.get(id))]) {
|
|
6879
|
+
if (id) trackingForbiddenMeters.add(id);
|
|
6880
|
+
}
|
|
6881
|
+
const hardware = member._eosDevice?.baseId;
|
|
6882
|
+
for (const id of new Set([...actuators, ...meters, ...(hardware ? [`device:${hardware}`] : [])].filter(Boolean))) {
|
|
6883
|
+
trackingOwners.set(id, (trackingOwners.get(id) || 0) + 1);
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
const trackingMaxAgeMs = Math.min(staleMs, 30000);
|
|
6887
|
+
const trackingBindings = [];
|
|
6854
6888
|
const farmWritableStorageCount = list.filter((row) => this._nwStorageFarmRowHasWritableDatapoint(row)).length;
|
|
6855
6889
|
|
|
6856
6890
|
const maxLicensedStorages = this._nwLicenseMaxStorages();
|
|
@@ -6877,6 +6911,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
6877
6911
|
dischargePowerId: String(row.dischargePowerId || '').trim(),
|
|
6878
6912
|
socId: String(row.socId || '').trim(),
|
|
6879
6913
|
soc: null,
|
|
6914
|
+
powerComparison: null,
|
|
6880
6915
|
chargePowerW: null,
|
|
6881
6916
|
dischargePowerW: null,
|
|
6882
6917
|
signedPowerW: null,
|
|
@@ -7515,10 +7550,44 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7515
7550
|
status.batteryFlowPowerW = physicalPower;
|
|
7516
7551
|
overviewMember.batteryPowerW = physicalPower;
|
|
7517
7552
|
if (duplicateBatteryFlow) status.batteryFlowDuplicate = true;
|
|
7553
|
+
|
|
7518
7554
|
} else {
|
|
7519
7555
|
status.batteryFlowMissing = true;
|
|
7520
7556
|
}
|
|
7521
7557
|
}
|
|
7558
|
+
// A direct Home ESS command addresses the AC converter (706 → 604).
|
|
7559
|
+
// Its battery-only channel 415 can differ substantially whenever DC PV runs.
|
|
7560
|
+
const essAc = feneconHybridRow && feneconMode.mode === 'direct-ess'
|
|
7561
|
+
&& this._sfHasHomeEssComparison(row, trackingRoutes) && signedFeedbackUsable;
|
|
7562
|
+
const domain = essAc ? 'ess-ac' : 'battery';
|
|
7563
|
+
const signedMeasurement = !!(essAc || batteryFlowId || signedFeedbackUsable);
|
|
7564
|
+
const observedIds = essAc ? [signedId] : batteryFlowId ? [batteryFlowId] : signedFeedbackUsable ? [signedId] : [chgId, dchgId];
|
|
7565
|
+
const observedKeys = observedIds.map(id => trackingRoutes.read.get(id));
|
|
7566
|
+
const targetKeys = targetPowerIds.map(id => trackingRoutes.write.get(id));
|
|
7567
|
+
const deviceKey = row._eosDevice?.baseId;
|
|
7568
|
+
const unique = [...targetKeys, ...observedKeys, ...(deviceKey ? [`device:${deviceKey}`] : [])]
|
|
7569
|
+
.every(key => !!key && trackingOwners.get(key) === 1);
|
|
7570
|
+
if (!status.licenseBlocked && status.dispatchAvailable && directTargetAvailable && (!feneconHybridRow || essAc)
|
|
7571
|
+
&& !['fems-grid', 'invalid'].includes(feneconMode.mode) && unique
|
|
7572
|
+
&& (signedMeasurement || (chargeFeedbackUsable && dischargeFeedbackUsable && observedKeys[0] !== observedKeys[1]))
|
|
7573
|
+
&& observedKeys.every(key => !trackingForbiddenMeters.has(key) && key !== trackingRoutes.read.get(pvId))) {
|
|
7574
|
+
const samples = observedIds.map(id => _stCache.get(id));
|
|
7575
|
+
const valid = samples.every(st => st?.ack === true && (st.q === undefined || st.q === 0)
|
|
7576
|
+
&& Number.isFinite(st.ts) && st.ts > 0 && st.ts <= now && now - st.ts <= trackingMaxAgeMs
|
|
7577
|
+
&& (typeof st.val === 'number' && Number.isFinite(st.val) || typeof st.val === 'string'
|
|
7578
|
+
&& /^[-+]?\d+(?:[.,]\d+)?(?:e[-+]?\d+)?\s*(?:[kmg]?w|(?:kilo|mega|giga)?watts?)?$/i.test(st.val.trim())));
|
|
7579
|
+
// Already read for this snapshot. Reject a direction/sign conflict
|
|
7580
|
+
// rather than inheriting display-only clamping of an invalid split.
|
|
7581
|
+
const charge = !signedMeasurement && valid ? parseNum(samples[0].val) * (invChg ? -1 : 1) : 0;
|
|
7582
|
+
const discharge = !signedMeasurement && valid ? parseNum(samples[1].val) * (invDchg ? -1 : 1) : 0;
|
|
7583
|
+
const measured = essAc ? await readNumber(signedId, 'power', { allowStale: false, display: true })
|
|
7584
|
+
: status.batteryFlowPowerW;
|
|
7585
|
+
if (valid && Number.isFinite(measured) && charge >= 0 && discharge >= 0 && !(charge > 0 && discharge > 0)) {
|
|
7586
|
+
const observedAt = Math.min(...samples.map(st => st.ts));
|
|
7587
|
+
status.trackingMeasurement = { signedW: measured, observedAt, domain };
|
|
7588
|
+
trackingBindings.push({ status, binding: this._sfPowerComparisonBinding(row), domain });
|
|
7589
|
+
}
|
|
7590
|
+
}
|
|
7522
7591
|
statusRows.push(status);
|
|
7523
7592
|
available++;
|
|
7524
7593
|
}
|
|
@@ -7569,6 +7638,17 @@ class NexoWattVis extends HostedAdapter {
|
|
|
7569
7638
|
const capacityWeightedSocOnlineState = Math.round(capacityWeightedSocOnline * 10) / 10;
|
|
7570
7639
|
const totalPowerState = Math.round(totalPower);
|
|
7571
7640
|
const farmOverview = buildFarmOverview(overviewMembers, overviewPvSources, now);
|
|
7641
|
+
// Join only the currently accepted command phase. All lookups are synchronous
|
|
7642
|
+
// and local; no new timers, physical reads or actuator writes are introduced.
|
|
7643
|
+
if (!runtimeInfo.dispatchActive || dynamicGridHasControl(this)) this._sfInvalidatePowerTracking();
|
|
7644
|
+
for (const { status, binding, domain } of trackingBindings) {
|
|
7645
|
+
const command = this._sfPowerTracking?.get(status.dispatchKey);
|
|
7646
|
+
if (!command || command.binding !== binding || command.config !== cfg) continue;
|
|
7647
|
+
const sample = status.trackingMeasurement;
|
|
7648
|
+
const validUntil = Math.min(command.acceptedAt, sample.observedAt) + trackingMaxAgeMs;
|
|
7649
|
+
status.powerComparison = compareFarmPower(command.signedW, sample.signedW, command.acceptedSince,
|
|
7650
|
+
sample.observedAt, validUntil, Date.now(), domain === 'ess-ac' ? domain : undefined);
|
|
7651
|
+
}
|
|
7572
7652
|
const farmOverviewJson = JSON.stringify(farmOverview);
|
|
7573
7653
|
const totalBatteryPowerState = farmOverview.battery.netW;
|
|
7574
7654
|
const totalChargeState = Math.round(totalCharge);
|
|
@@ -8061,7 +8141,116 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8061
8141
|
return { ok: false, skipped: false, changed: false, error: msg };
|
|
8062
8142
|
}
|
|
8063
8143
|
}
|
|
8144
|
+
_sfInvalidatePowerTracking() {
|
|
8145
|
+
this._sfPowerTracking?.clear();
|
|
8146
|
+
if (this._sfTrackingWriters) this._sfTrackingOverlap = true;
|
|
8147
|
+
}
|
|
8148
|
+
|
|
8149
|
+
async _sfTrackingRoutes(rows, config) {
|
|
8150
|
+
// Resolve the configured metadata graph once per layout. State observations
|
|
8151
|
+
// always come from the aggregation's existing per-tick cache.
|
|
8152
|
+
const inputs = new Set(), outputs = new Set();
|
|
8153
|
+
for (const row of rows) {
|
|
8154
|
+
if (!row.enabled) continue;
|
|
8155
|
+
for (const id of [row.setSignedPowerId, row.setChargePowerId, row.setDischargePowerId, row.feneconGridSetpointId]) if (id) outputs.add(id);
|
|
8156
|
+
for (const id of [row.batteryFlowPowerId, row.signedPowerId, row.feneconEssActualPowerId, row.chargePowerId,
|
|
8157
|
+
row.dischargePowerId, row.socId, row.pvPowerId, row.feneconPvDcId, row.feneconPvAcId,
|
|
8158
|
+
row.feneconPvTotalId, row.feneconNvpPowerId, row.feneconConsumptionTotalId, row.feneconActualSetpointId]) if (id) inputs.add(id);
|
|
8159
|
+
}
|
|
8160
|
+
const signature = JSON.stringify([[...inputs], [...outputs]]);
|
|
8161
|
+
const previous = this._sfTrackingLayout;
|
|
8162
|
+
if (previous?.signature === signature && previous.config === config && Date.now() < previous.retryAt) return previous;
|
|
8163
|
+
const layout = previous?.signature === signature && previous.config === config
|
|
8164
|
+
? { ...previous, retryAt: Infinity }
|
|
8165
|
+
: { config, signature, retryAt: Infinity, read: new Map(), write: new Map(), units: new Map(), homeIds: new Set() };
|
|
8166
|
+
const objects = new Map();
|
|
8167
|
+
const resolve = async (start, write) => {
|
|
8168
|
+
let id = start;
|
|
8169
|
+
const visited = new Set();
|
|
8170
|
+
while (id && !visited.has(id) && visited.size < 8) {
|
|
8171
|
+
visited.add(id);
|
|
8172
|
+
if (!objects.has(id)) objects.set(id, await this.getForeignObjectAsync(id).catch(() => null));
|
|
8173
|
+
const obj = objects.get(id);
|
|
8174
|
+
if (obj?.type !== 'state' || !obj.common) {
|
|
8175
|
+
layout.retryAt = Math.min(layout.retryAt, Date.now() + 30000);
|
|
8176
|
+
return null;
|
|
8177
|
+
}
|
|
8178
|
+
if (write ? obj.common.write === false : obj.common.read === false) return null;
|
|
8179
|
+
layout.units.set(id, String(obj.common.unit || '').trim());
|
|
8180
|
+
const native = obj.native || {};
|
|
8181
|
+
const alias = obj.common.alias;
|
|
8182
|
+
if (alias !== undefined && alias !== null) {
|
|
8183
|
+
const next = typeof alias.id === 'string' ? alias.id : alias.id?.[write ? 'write' : 'read'];
|
|
8184
|
+
if (typeof next !== 'string' || !next || alias[write ? 'write' : 'read']) return null;
|
|
8185
|
+
id = next;
|
|
8186
|
+
continue;
|
|
8187
|
+
}
|
|
8188
|
+
if (native.isAlias === true) {
|
|
8189
|
+
const base = id.split('.aliases.')[0];
|
|
8190
|
+
const dp = (write && native.writeDpId) || native.dpId;
|
|
8191
|
+
if (base === id || !native.deviceId || !base.endsWith(`.devices.${native.deviceId}`) || typeof dp !== 'string' || !dp) return null;
|
|
8192
|
+
id = `${base}.${dp}`;
|
|
8193
|
+
continue;
|
|
8194
|
+
}
|
|
8195
|
+
if (native.templateId === 'ess.fenecon.FeneconHomeEssImpl' && native.deviceId && native.datapointId
|
|
8196
|
+
&& id.endsWith(`.devices.${native.deviceId}.${native.datapointId}`)) layout.homeIds.add(id);
|
|
8197
|
+
return id;
|
|
8198
|
+
}
|
|
8199
|
+
return null;
|
|
8200
|
+
};
|
|
8201
|
+
for (const id of inputs) if (!layout.read.get(id)) layout.read.set(id, await resolve(id, false));
|
|
8202
|
+
for (const id of outputs) if (!layout.write.get(id)) layout.write.set(id, await resolve(id, true));
|
|
8203
|
+
this._sfTrackingLayout = layout;
|
|
8204
|
+
return layout;
|
|
8205
|
+
}
|
|
8206
|
+
|
|
8207
|
+
_sfHasHomeEssComparison(s, layout) {
|
|
8208
|
+
if (!layout || s.setChargePowerId && s.setDischargePowerId) return false;
|
|
8209
|
+
const actualDp = s.feneconEssActualPowerId || s.signedPowerId;
|
|
8210
|
+
const targetDp = s.setSignedPowerId;
|
|
8211
|
+
const actual = layout.read.get(actualDp);
|
|
8212
|
+
const target = layout.write.get(targetDp);
|
|
8213
|
+
if (!target?.endsWith('.sET_ACTIVE_POWER') || !layout.homeIds.has(target) || !layout.homeIds.has(actual)) return false;
|
|
8214
|
+
const base = s._eosDevice?.baseId || target.slice(0, -'.sET_ACTIVE_POWER'.length);
|
|
8215
|
+
const matches = (id, leaf, alias) => [`${base}.${leaf}`, `${base}.aliases.${alias}`, `${base}.aliases.v1.${alias}`].includes(id);
|
|
8216
|
+
return target === `${base}.sET_ACTIVE_POWER` && actual === `${base}.eSS0_ACTIVE_POWER`
|
|
8217
|
+
&& matches(targetDp, 'sET_ACTIVE_POWER', 'ctrl.powerSetpointW') && matches(actualDp, 'eSS0_ACTIVE_POWER', 'r.essActivePower')
|
|
8218
|
+
&& layout.units.get(targetDp) === 'W' && ['W', 'kW'].includes(layout.units.get(actualDp));
|
|
8219
|
+
|
|
8220
|
+
}
|
|
8221
|
+
|
|
8222
|
+
_sfPowerComparisonBinding(s) {
|
|
8223
|
+
// A retained name/command value is insufficient after replacing a meter, a
|
|
8224
|
+
// port, a wiring convention or the physical member.
|
|
8225
|
+
return JSON.stringify([s._eosDevice?.baseId, s._eosDevice?.devId, s.socId, s.vendorProfile, s.coupling, s.feneconControlMode,
|
|
8226
|
+
s.setSignedPowerId, s.setChargePowerId, s.setDischargePowerId, s.feneconGridSetpointId,
|
|
8227
|
+
s.batteryFlowPowerId, s.signedPowerId, s.feneconEssActualPowerId, s.chargePowerId, s.dischargePowerId,
|
|
8228
|
+
s.invertSignedPowerSign, s.invertSetSignedPowerSign, s.invertChargeSign, s.invertDischargeSign]);
|
|
8229
|
+
}
|
|
8230
|
+
|
|
8064
8231
|
async applyStorageFarmTargetW(targetW, meta = {}) {
|
|
8232
|
+
// Journal covers only the current dispatch and the current member list.
|
|
8233
|
+
// Overlap, early exits, handover and restart invalidate comparison evidence.
|
|
8234
|
+
const writesInFlight = this._sfTrackingWriters || 0;
|
|
8235
|
+
this._sfTrackingWriters = writesInFlight + 1;
|
|
8236
|
+
if (writesInFlight) {
|
|
8237
|
+
this._sfTrackingOverlap = true;
|
|
8238
|
+
this._sfPowerTracking?.clear();
|
|
8239
|
+
}
|
|
8240
|
+
const tracking = { next: new Map(), config: this.config };
|
|
8241
|
+
try {
|
|
8242
|
+
const result = await this._sfApplyStorageFarmTargetW(targetW, meta, tracking);
|
|
8243
|
+
if (!this._sfTrackingOverlap && this.config === tracking.config) this._sfPowerTracking = tracking.next;
|
|
8244
|
+
return result;
|
|
8245
|
+
} catch (error) {
|
|
8246
|
+
this._sfPowerTracking?.clear();
|
|
8247
|
+
throw error;
|
|
8248
|
+
} finally {
|
|
8249
|
+
if (!--this._sfTrackingWriters) this._sfTrackingOverlap = false;
|
|
8250
|
+
}
|
|
8251
|
+
}
|
|
8252
|
+
|
|
8253
|
+
async _sfApplyStorageFarmTargetW(targetW, meta, tracking) {
|
|
8065
8254
|
if (dynamicGridHasControl(this)) return { applied: false, reason: 'dynamic-grid-owns-storage' };
|
|
8066
8255
|
const w = Number.isFinite(Number(targetW)) ? Math.round(Number(targetW)) : 0;
|
|
8067
8256
|
const sf = this._sfGetNormalizedFarmConfig();
|
|
@@ -8940,6 +9129,14 @@ class NexoWattVis extends HostedAdapter {
|
|
|
8940
9129
|
writes: {},
|
|
8941
9130
|
};
|
|
8942
9131
|
|
|
9132
|
+
const signedAllocatedW = direction === 'charge' ? -Math.abs(alloc) : (direction === 'discharge' ? Math.abs(alloc) : 0);
|
|
9133
|
+
const homeEssAc = nwIsFeneconHybrid(s) && commandFamily === 'signed' && this._sfHasHomeEssComparison(s, this._sfTrackingLayout);
|
|
9134
|
+
const trackingSignedW = homeEssAc ? outSignedW : signedAllocatedW;
|
|
9135
|
+
const binding = this._sfPowerComparisonBinding(s);
|
|
9136
|
+
const previous = this._sfPowerTracking?.get(r.dispatchKey);
|
|
9137
|
+
const continuity = previous && previous.config === tracking.config && previous.binding === binding && previous.source === src
|
|
9138
|
+
&& previous.signedW === trackingSignedW && previous.acceptedAt <= now && now - previous.acceptedAt < 30000;
|
|
9139
|
+
if (!continuity) this._sfPowerTracking?.delete(r.dispatchKey);
|
|
8943
9140
|
const selectedIds = new Set();
|
|
8944
9141
|
if (commandFamily === 'signed' && signedId) selectedIds.add(signedId);
|
|
8945
9142
|
if (commandFamily === 'split') {
|
|
@@ -9008,7 +9205,6 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9008
9205
|
&& !r.writes.conflict
|
|
9009
9206
|
&& releaseAccepted
|
|
9010
9207
|
&& selectedAccepted;
|
|
9011
|
-
const signedAllocatedW = direction === 'charge' ? -Math.abs(alloc) : (direction === 'discharge' ? Math.abs(alloc) : 0);
|
|
9012
9208
|
r.commandRequired = commandRequired;
|
|
9013
9209
|
r.commandAccepted = commandAccepted;
|
|
9014
9210
|
r.releaseAccepted = releaseAccepted;
|
|
@@ -9017,6 +9213,22 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9017
9213
|
r.failedW = (commandRequired && commandAccepted !== true && direction !== 'idle') ? signedAllocatedW : 0;
|
|
9018
9214
|
r.stopAccepted = direction === 'idle' && commandRequired ? commandAccepted === true : null;
|
|
9019
9215
|
|
|
9216
|
+
// A skipped equal command alone cannot prove a new phase or extend its
|
|
9217
|
+
// lifetime. Keep its first acceptance only while the whole path is valid.
|
|
9218
|
+
const submitted = selectedWrites.every(write => write.submitted === true);
|
|
9219
|
+
const freshlySent = submitted && selectedWrites.every(write => write.changed === true);
|
|
9220
|
+
if (commandAccepted && submitted && (freshlySent || continuity) && !this._sfTrackingOverlap
|
|
9221
|
+
&& s.statusMatch === 'dispatch-key' && !s.licenseBlocked && s.dispatchAvailable && s.online
|
|
9222
|
+
&& (commandFamily === 'signed' || completeSplit) && !splitPairConflict
|
|
9223
|
+
&& [...selectedIds].every(id => this._sfTrackingLayout?.units.get(id) === 'W')
|
|
9224
|
+
&& (!nwIsFeneconHybrid(s) || homeEssAc)) {
|
|
9225
|
+
const acceptedAt = freshlySent ? Date.now() : previous.acceptedAt;
|
|
9226
|
+
const acceptedSince = continuity ? previous.acceptedSince : acceptedAt;
|
|
9227
|
+
r.trackingCommand = { signedW: trackingSignedW, acceptedSince, acceptedAt };
|
|
9228
|
+
tracking.next.set(r.dispatchKey, { ...r.trackingCommand, binding, source: src, config: tracking.config });
|
|
9229
|
+
} else {
|
|
9230
|
+
this._sfPowerTracking?.delete(r.dispatchKey);
|
|
9231
|
+
}
|
|
9020
9232
|
if (commandAccepted === true) this._sfRememberDispatchSnapshot(s, direction, alloc);
|
|
9021
9233
|
results.push(r);
|
|
9022
9234
|
}
|
|
@@ -9150,6 +9362,7 @@ class NexoWattVis extends HostedAdapter {
|
|
|
9150
9362
|
commandRequired: r.commandRequired === true,
|
|
9151
9363
|
commandAccepted: r.commandAccepted === true,
|
|
9152
9364
|
acceptedW: Number.isFinite(Number(r.acceptedW)) ? Math.round(Number(r.acceptedW)) : 0,
|
|
9365
|
+
...(r.trackingCommand ? { trackingCommand: r.trackingCommand } : {}),
|
|
9153
9366
|
failedW: Number.isFinite(Number(r.failedW)) ? Math.round(Number(r.failedW)) : 0,
|
|
9154
9367
|
stopAccepted: r.stopAccepted,
|
|
9155
9368
|
authorityBlocked: authorityBlocks.length > 0,
|
|
@@ -12587,6 +12800,16 @@ async onReady() {
|
|
|
12587
12800
|
try { await this.subscribeForeignStatesAsync(`${this.namespace}.chargingManagement.*`); } catch (_e) {}
|
|
12588
12801
|
try { await this.subscribeForeignStatesAsync(`${this.namespace}.ems.*`); } catch (_e2) {}
|
|
12589
12802
|
|
|
12803
|
+
// The subscription is live before the reads. A delayed read must never
|
|
12804
|
+
// resurrect a state that was changed or deleted during startup.
|
|
12805
|
+
await Promise.all(Object.keys(this._nwDashboardHealth).map(async key => {
|
|
12806
|
+
const before = this._nwDashboardHealth[key];
|
|
12807
|
+
try {
|
|
12808
|
+
const state = await this.getStateAsync(key);
|
|
12809
|
+
if (before === this._nwDashboardHealth[key] && (state || before)) this._nwObserveDashboardHealth(key, state);
|
|
12810
|
+
} catch (_ignored) {}
|
|
12811
|
+
}));
|
|
12812
|
+
|
|
12590
12813
|
// Prime a minimal subset that the UI uses on first render.
|
|
12591
12814
|
/**
|
|
12592
12815
|
* Code-Teil: primeKey
|
|
@@ -12940,10 +13163,32 @@ async onReady() {
|
|
|
12940
13163
|
|
|
12941
13164
|
/** Öffentlichen State-/SSE-Snapshot erzeugen; operative Leistungswerte bleiben unverändert. */
|
|
12942
13165
|
const nwBuildPublicStateSnapshot = (source, includeDerived = true) => {
|
|
12943
|
-
|
|
13166
|
+
// Apply canonical diagnostics before the public privacy filter, also on backpressure resync.
|
|
13167
|
+
const input = includeDerived && this._nwFarmDisplay
|
|
13168
|
+
? Object.assign({}, source, this._nwFarmDisplay) : (source || {});
|
|
12944
13169
|
const out = {};
|
|
12945
13170
|
for (const [key, entry] of Object.entries(input)) {
|
|
12946
13171
|
if (nwPublicStateKeyBlocked(key)) continue;
|
|
13172
|
+
if (key === 'speicher.regelung.dispatcherJson') {
|
|
13173
|
+
// Die Farmseite benötigt nur die Reglerentscheidung. Hersteller- und
|
|
13174
|
+
// Prüfdaten des internen Dispatchers gehören nicht in den Kundenfeed.
|
|
13175
|
+
let publicDecision = null;
|
|
13176
|
+
if (entry && typeof entry.value === 'string' && entry.value.length <= 262144) {
|
|
13177
|
+
try {
|
|
13178
|
+
const data = JSON.parse(entry.value);
|
|
13179
|
+
if (data && Number.isFinite(data.ts) && typeof data.active === 'boolean') {
|
|
13180
|
+
publicDecision = JSON.stringify({
|
|
13181
|
+
ts: data.ts, active: data.active, disabled: data.disabled === true,
|
|
13182
|
+
finalW: Number.isFinite(data.finalW) ? data.finalW : null,
|
|
13183
|
+
src: typeof data.src === 'string' ? data.src.slice(0, 180) : '',
|
|
13184
|
+
reason: typeof data.reason === 'string' ? data.reason.slice(0, 260) : '',
|
|
13185
|
+
});
|
|
13186
|
+
}
|
|
13187
|
+
} catch (_) { /* Ungültige Meldung ersetzt den vorherigen Kundenwert. */ }
|
|
13188
|
+
}
|
|
13189
|
+
out[key] = { value: publicDecision, ts: entry?.ts, q: entry?.q, ack: entry?.ack };
|
|
13190
|
+
continue;
|
|
13191
|
+
}
|
|
12947
13192
|
if (entry && typeof entry === 'object' && Object.prototype.hasOwnProperty.call(entry, 'value')) {
|
|
12948
13193
|
out[key] = Object.assign({}, entry, { value: nwRedactPublicValue(entry.value) });
|
|
12949
13194
|
} else {
|
|
@@ -24528,7 +24773,8 @@ settingsConfig: {
|
|
|
24528
24773
|
const source = tsStates || this.stateCache;
|
|
24529
24774
|
const access = authEnabled ? await resolveAccess(req) : null;
|
|
24530
24775
|
const installerAccess = !!(authEnabled && access && access.isInstaller);
|
|
24531
|
-
|
|
24776
|
+
const visible = installerAccess ? source : nwBuildPublicStateSnapshot(source, true);
|
|
24777
|
+
return res.json(Object.assign(installerAccess ? { ...visible, ...this._nwFarmDisplay } : visible, this._nwDashboardHealth));
|
|
24532
24778
|
});
|
|
24533
24779
|
|
|
24534
24780
|
// RFID-Kundendaten liegen bewusst nicht mehr im globalen State-/SSE-Snapshot.
|
|
@@ -26695,7 +26941,7 @@ return res.json(out);
|
|
|
26695
26941
|
const initialPayload = client.internal ? this.stateCache : nwBuildPublicStateSnapshot(this.stateCache, true);
|
|
26696
26942
|
this._nwSseGuard.write(
|
|
26697
26943
|
client,
|
|
26698
|
-
"retry: 3000\n" + "data: " + JSON.stringify({ type: 'init', payload: initialPayload }) + "\n\n",
|
|
26944
|
+
"retry: 3000\n" + "data: " + JSON.stringify({ type: 'init', payload: Object.assign(client.internal ? { ...initialPayload, ...this._nwFarmDisplay } : initialPayload, this._nwDashboardHealth) }) + "\n\n",
|
|
26699
26945
|
{ kind: 'init' },
|
|
26700
26946
|
);
|
|
26701
26947
|
});
|
|
@@ -27423,7 +27669,7 @@ return res.json(out);
|
|
|
27423
27669
|
// "Datenpunkte" gemappt wurden. Daher wird im Subscribe-Loop unten auf die lokalen
|
|
27424
27670
|
// Adapter-States (namespace + key) zurückgefallen.
|
|
27425
27671
|
const localUiKeys = [
|
|
27426
|
-
'speicher.dcPvPowerW',
|
|
27672
|
+
'speicher.dcPvPowerW', 'speicher.regelung.dispatcherJson',
|
|
27427
27673
|
'tarif.statusText', 'tarif.intentStatusText', 'tarif.intentSnapshotAgeMs', 'tarif.intentSnapshotFresh', 'tarif.statusJson',
|
|
27428
27674
|
'tarif.speicherIntentW', 'tarif.speicherIntentStatus', 'tarif.speicherIntentGrund',
|
|
27429
27675
|
'tarif.speicherRequestW', 'tarif.speicherRequestQuelle', 'tarif.speicherRequestGrund',
|
|
@@ -27483,13 +27729,20 @@ return res.json(out);
|
|
|
27483
27729
|
|
|
27484
27730
|
if (!id) continue;
|
|
27485
27731
|
|
|
27486
|
-
|
|
27487
|
-
this.
|
|
27732
|
+
const farmDisplay = this._nwIsFarmDisplayKey(key) && id === namespace + key;
|
|
27733
|
+
const before = farmDisplay ? this._nwFarmDisplay?.[key] : undefined;
|
|
27734
|
+
if (farmDisplay && typeof this.subscribeForeignStatesAsync === 'function') {
|
|
27735
|
+
try { await this.subscribeForeignStatesAsync(id); }
|
|
27736
|
+
catch (error) { this.log.warn(`Live-Diagnose ${key} konnte nicht abonniert werden: ${error.message}`); }
|
|
27737
|
+
} else this.subscribeForeignStates(id);
|
|
27488
27738
|
|
|
27489
27739
|
// get initial value
|
|
27490
27740
|
try {
|
|
27491
27741
|
await this._nwPrimeForeignPowerScale(id);
|
|
27492
27742
|
const state = await this.getForeignStateAsync(id);
|
|
27743
|
+
if (farmDisplay && before === this._nwFarmDisplay?.[key] && (state || before)) {
|
|
27744
|
+
this._nwObserveFarmDisplay(key, state);
|
|
27745
|
+
}
|
|
27493
27746
|
if (state && state.val !== undefined) {
|
|
27494
27747
|
this.updateValue(key, this._nwScaleMappedValue(key, id, state.val), state.ts, { q: state.q });
|
|
27495
27748
|
}
|
|
@@ -27609,6 +27862,11 @@ return res.json(out);
|
|
|
27609
27862
|
async onStateChange(id, state) {
|
|
27610
27863
|
if (this._nwShuttingDown) return;
|
|
27611
27864
|
this._ocppAutoDiscovery?.onStateChange(id, state);
|
|
27865
|
+
if (typeof id === 'string' && id.startsWith(this.namespace + '.')) {
|
|
27866
|
+
const key = id.slice(this.namespace.length + 1);
|
|
27867
|
+
if (Object.hasOwn(this._nwDashboardHealth || {}, key)) this._nwObserveDashboardHealth(key, state);
|
|
27868
|
+
else if (this._nwIsFarmDisplayKey(key)) this._nwObserveFarmDisplay(key, state);
|
|
27869
|
+
}
|
|
27612
27870
|
if (state && state.ack === false && String(id).startsWith(this.namespace + '.')
|
|
27613
27871
|
&& !centralLicenseSnapshot(this._bridge).ok) return;
|
|
27614
27872
|
// Ordinary ioBroker controls remain usable without a separate token or
|
|
@@ -32167,7 +32425,9 @@ return res.json(out);
|
|
|
32167
32425
|
}
|
|
32168
32426
|
const now = Date.now();
|
|
32169
32427
|
const cached = this._nwPara14aInfluxProvision;
|
|
32170
|
-
|
|
32428
|
+
const configured = this._nwTrimId(this.config && this.config.history && this.config.history.instance);
|
|
32429
|
+
const retainedHistorian = configured && this.namespace !== this.hostNamespace && /^nexowatt-ui\.\d+$/.test(this.namespace);
|
|
32430
|
+
if (!retainedHistorian && !force && cached && cached.result && (now - Number(cached.ts || 0) < 10 * 60 * 1000)) {
|
|
32171
32431
|
return cached.result;
|
|
32172
32432
|
}
|
|
32173
32433
|
|
|
@@ -32187,7 +32447,7 @@ return res.json(out);
|
|
|
32187
32447
|
provisionError: '',
|
|
32188
32448
|
}, partial || {});
|
|
32189
32449
|
out.instance = this._nwTrimId(out.instance);
|
|
32190
|
-
out.ready = !!out.instance && typeof this._nwEnsureInfluxCustom === 'function';
|
|
32450
|
+
out.ready = partial.ready !== false && !!out.instance && typeof this._nwEnsureInfluxCustom === 'function';
|
|
32191
32451
|
this._nwPara14aInfluxProvision = { ts: Date.now(), result: out };
|
|
32192
32452
|
return out;
|
|
32193
32453
|
};
|
|
@@ -32243,7 +32503,14 @@ return res.json(out);
|
|
|
32243
32503
|
};
|
|
32244
32504
|
|
|
32245
32505
|
try {
|
|
32246
|
-
|
|
32506
|
+
if (retainedHistorian) {
|
|
32507
|
+
// Der Bestand bleibt auch bei Lesefehlern an seinem gespeicherten Historiker.
|
|
32508
|
+
// Eine benachbarte Influx-Instanz kann eine andere Datenbank bedienen.
|
|
32509
|
+
const object = await this.getForeignObjectAsync(`system.adapter.${configured}`).catch(() => null);
|
|
32510
|
+
const available = object?.type === 'instance' && object.common?.enabled === true;
|
|
32511
|
+
return finish({ instance: configured, ready: available, provisionState: available ? 'shared_configured' : 'configured_unavailable',
|
|
32512
|
+
provisionError: available ? '' : `Übernommene History-Instanz ist nicht verfügbar: ${configured}` });
|
|
32513
|
+
}
|
|
32247
32514
|
const existingInfluxInstances = await this._nwListAdapterInstances('influxdb');
|
|
32248
32515
|
const sharedInflux = pickSharedInfluxInstance(existingInfluxInstances);
|
|
32249
32516
|
|
|
@@ -34310,6 +34577,49 @@ return res.json(out);
|
|
|
34310
34577
|
}
|
|
34311
34578
|
}
|
|
34312
34579
|
}
|
|
34580
|
+
_nwIsFarmDisplayKey(key) {
|
|
34581
|
+
return key === 'storageFarm.storagesStatusJson' || key === 'storageFarm.lastDispatchJson'
|
|
34582
|
+
|| key === 'storageFarm.overviewJson' || key === 'speicher.regelung.dispatcherJson';
|
|
34583
|
+
}
|
|
34584
|
+
|
|
34585
|
+
_nwObserveFarmDisplay(key, state) {
|
|
34586
|
+
// Preserve the source's observation across separate EMS and UI processes.
|
|
34587
|
+
// The regular control and history caches retain their existing semantics.
|
|
34588
|
+
const value = typeof state?.val === 'string' && state.val.length <= 262144 ? state.val : null;
|
|
34589
|
+
const ts = Number.isSafeInteger(state?.ts) && state.ts > 0 ? state.ts : 0;
|
|
34590
|
+
const q = state?.q === undefined ? undefined : Number.isSafeInteger(state.q) ? state.q : 128;
|
|
34591
|
+
const row = { value, ts, ack: state?.ack === true, ...(q === undefined ? {} : { q }) };
|
|
34592
|
+
this._nwFarmDisplay ??= Object.create(null);
|
|
34593
|
+
this._nwFarmDisplay[key] = row;
|
|
34594
|
+
this._nwSseSnapshotChunkCache = null;
|
|
34595
|
+
if (!this.sseClients?.size) return;
|
|
34596
|
+
(this._ssePendingPayload ??= Object.create(null))[key] = row;
|
|
34597
|
+
this._nwScheduleSseFlush();
|
|
34598
|
+
}
|
|
34599
|
+
|
|
34600
|
+
_nwObserveDashboardHealth(key, state) {
|
|
34601
|
+
const heartbeat = key === 'ems.core.schedulerHeartbeatAt';
|
|
34602
|
+
const raw = state?.val;
|
|
34603
|
+
const value = (heartbeat ? Number.isSafeInteger(raw) && raw > 0 : typeof raw === 'boolean') ? raw : null;
|
|
34604
|
+
const ts = Number.isSafeInteger(state?.ts) && state.ts > 0 ? state.ts : 0;
|
|
34605
|
+
const ack = state?.ack === true;
|
|
34606
|
+
const q = state?.q === undefined ? undefined : Number.isSafeInteger(state.q) ? state.q : 128;
|
|
34607
|
+
const row = { value, ts, ack, ...(q === undefined ? {} : { q }) };
|
|
34608
|
+
this._nwDashboardHealth[key] = row;
|
|
34609
|
+
this._nwSseSnapshotChunkCache = null;
|
|
34610
|
+
// No timers, serialization or broadcasts for an idle dashboard. Repeated
|
|
34611
|
+
// confirmations share the existing SSE batch; faults and recovery go at once.
|
|
34612
|
+
if (!this.sseClients?.size) return;
|
|
34613
|
+
const sent = this._nwDashboardHealthSent[key];
|
|
34614
|
+
const regularHeartbeat = heartbeat && value > 0 && sent?.value > 0 && value >= sent.value
|
|
34615
|
+
&& Math.abs(value - ts) < 4000 && Math.abs(sent.value - sent.ts) < 4000;
|
|
34616
|
+
if (sent && sent.ack === ack && sent.q === q && (sent.value === value || regularHeartbeat)
|
|
34617
|
+
&& ts >= sent.ts && ts - sent.ts < 4000) return;
|
|
34618
|
+
this._nwDashboardHealthSent[key] = row;
|
|
34619
|
+
(this._ssePendingPayload ??= Object.create(null))[key] = row;
|
|
34620
|
+
this._nwScheduleSseFlush();
|
|
34621
|
+
}
|
|
34622
|
+
|
|
34313
34623
|
updateValue(key, value, ts, opts = {}) {
|
|
34314
34624
|
// Nach Beginn des Unloads keine Cache-Kaskaden, abgeleiteten Berechnungen oder
|
|
34315
34625
|
// SSE-Batches mehr erzeugen. Laufende Hardware-/State-Schreibvorgänge werden durch
|
|
@@ -34339,9 +34649,16 @@ return res.json(out);
|
|
|
34339
34649
|
|
|
34340
34650
|
this.stateCache[key] = { value, ts, ...(opts.q !== undefined ? { q: opts.q } : {}) };
|
|
34341
34651
|
|
|
34652
|
+
// The admin overview periodically normalizes scheduler rows for its own cache.
|
|
34653
|
+
// Only the original producer observation may reach dashboard clients.
|
|
34654
|
+
if (this._nwDashboardHealth && Object.hasOwn(this._nwDashboardHealth, key)) return;
|
|
34655
|
+
// A synthetic local refresh must not replace the producer's ack/q/ts in the
|
|
34656
|
+
// outgoing batch. Other calculations below still see their original cache value.
|
|
34657
|
+
const authoritativeFarmRow = this._nwFarmDisplay?.[key];
|
|
34658
|
+
|
|
34342
34659
|
// Allocate one patch per delivery batch, and none while no dashboard is listening.
|
|
34343
34660
|
const payload = this.sseClients?.size ? (this._ssePendingPayload ??= Object.create(null)) : null;
|
|
34344
|
-
if (payload) payload[key] = this.stateCache[key];
|
|
34661
|
+
if (payload) payload[key] = authoritativeFarmRow || this.stateCache[key];
|
|
34345
34662
|
|
|
34346
34663
|
// derived EVCS aggregates
|
|
34347
34664
|
try {
|
|
@@ -34400,15 +34717,16 @@ return res.json(out);
|
|
|
34400
34717
|
if (isTrigger) this.scheduleDerivedFlowUpdate(`key:${key}`);
|
|
34401
34718
|
} catch (_e3) {}
|
|
34402
34719
|
|
|
34403
|
-
//
|
|
34720
|
+
// RC88_SSE_IDLE_ZERO_ALLOCATION: only schedule a batch for active dashboards.
|
|
34721
|
+
if (!payload) {
|
|
34722
|
+
this._ssePendingPayload = null;
|
|
34723
|
+
return;
|
|
34724
|
+
}
|
|
34725
|
+
this._nwScheduleSseFlush();
|
|
34726
|
+
}
|
|
34727
|
+
|
|
34728
|
+
_nwScheduleSseFlush() {
|
|
34404
34729
|
try {
|
|
34405
|
-
// RC88_SSE_IDLE_ZERO_ALLOCATION: without connected dashboards there is
|
|
34406
|
-
// nothing to batch or serialize. Avoid a permanent 120-ms timer/allocation
|
|
34407
|
-
// chain on headless customer systems.
|
|
34408
|
-
if (!payload) {
|
|
34409
|
-
this._ssePendingPayload = null;
|
|
34410
|
-
return;
|
|
34411
|
-
}
|
|
34412
34730
|
if (!this._sseFlushTimer) {
|
|
34413
34731
|
const batchMs = (this.config && Number(this.config.sseBatchMs)) || 120;
|
|
34414
34732
|
this._sseFlushTimer = this._nwSetTimeout(() => {
|
package/ui/package.json
CHANGED