iobroker.eos-admin 9.0.34 → 9.0.36
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 +16 -4
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +107 -107
- package/adminWww/assets/{AdapterUpdateDialog-5L75o18m.js → AdapterUpdateDialog-D2nDWE_N.js} +1 -1
- package/adminWww/assets/{Adapters-FcghjF7E.js → Adapters-D0sVqNBU.js} +1 -1
- package/adminWww/assets/{ConfigManager-BnHarBfH.js → ConfigManager-Zm7UoaaN.js} +1 -1
- package/adminWww/assets/{Enums-BjLbLLQL.js → Enums-BGL7pR-O.js} +1 -1
- package/adminWww/assets/{Fields-DDE1hVOa.js → Fields-A8J3u1yq.js} +1 -1
- package/adminWww/assets/{Files-CDjnR4q6.js → Files-CQPjCvW6.js} +1 -1
- package/adminWww/assets/{Hosts-CJKQaNrD.js → Hosts-CxzkkNBj.js} +1 -1
- package/adminWww/assets/{Instances-DZNl369k.js → Instances-eEbEukDh.js} +1 -1
- package/adminWww/assets/{Intro-CjAmMGDB.js → Intro-I_Tknp0E.js} +1 -1
- package/adminWww/assets/{Logs-rUAV7SwM.js → Logs-C3GPz61Q.js} +1 -1
- package/adminWww/assets/{Objects-CqOH6rT_.js → Objects-DDnisxNB.js} +1 -1
- package/adminWww/assets/{Overview-BOtXqsMy.js → Overview-BpZFdEmp.js} +1 -1
- package/adminWww/assets/{State-C8ncThop.js → State-DY6Nw0SB.js} +1 -1
- package/adminWww/assets/{UsedResources-lUYJqy4F.js → UsedResources-CtUpdP2b.js} +1 -1
- package/adminWww/assets/{Users-CK1Cax82.js → Users-DcqlSfc5.js} +1 -1
- package/adminWww/assets/{bootstrap-CC0Qr-kr.js → bootstrap-Didkuj-F.js} +3 -3
- package/adminWww/assets/{hostInit-DqGL6nY8.js → hostInit-Chrs-wsg.js} +1 -1
- package/adminWww/assets/{icons-material-07rWS63O.js → icons-material-SqwOQW6y.js} +1 -1
- package/adminWww/assets/{index-BhhkToP2.js → index-CpDo61Mz.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-B4-7lSQZ.js → installSVGRenderer-DZMZ3pJw.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-1afd2287.js → mf-entry-bootstrap-0-b0c4981a.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.34.js → remoteEntry-eos-9.0.36.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosDashboardProcessStatus.js +199 -0
- package/build/lib/eosDashboardProcessStatus.js.map +1 -0
- package/build/lib/eosKiosk.js +1 -0
- package/build/lib/eosKiosk.js.map +1 -1
- package/build/lib/eosLegacyMigration.js +142 -49
- package/build/lib/eosLegacyMigration.js.map +1 -1
- package/build/lib/eosLicenseService.js +9 -0
- package/build/lib/eosLicenseService.js.map +1 -1
- package/build/lib/eosModuleConfigStore.js +21 -8
- package/build/lib/eosModuleConfigStore.js.map +1 -1
- package/build/lib/eosModuleHost.js +284 -106
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +41 -8
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/eosModuleProcess.js +34 -6
- package/build/lib/eosModuleProcess.js.map +1 -1
- package/build/lib/eosModuleProcessWorker.js +56 -2
- package/build/lib/eosModuleProcessWorker.js.map +1 -1
- package/build/lib/eosRuntimeControl.js +54 -14
- package/build/lib/eosRuntimeControl.js.map +1 -1
- package/build/lib/eosRuntimeHealth.js +84 -7
- package/build/lib/eosRuntimeHealth.js.map +1 -1
- package/build/lib/eosSupervisorNotifications.js +169 -0
- package/build/lib/eosSupervisorNotifications.js.map +1 -0
- package/build/lib/eosUiProcess.js +43 -4
- package/build/lib/eosUiProcess.js.map +1 -1
- package/build/lib/eosUiProcessWorker.js +21 -0
- package/build/lib/eosUiProcessWorker.js.map +1 -1
- package/build/lib/eosUnifiedOwnership.js +10 -8
- package/build/lib/eosUnifiedOwnership.js.map +1 -1
- package/build/lib/web.js +33 -24
- package/build/lib/web.js.map +1 -1
- package/build/main.js +35 -0
- package/build/main.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/reports/unified-9.0.35/PRUEFBERICHT.md +51 -0
- package/docs/reports/unified-9.0.35/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.35/raw/INDEX.json +282 -0
- package/docs/reports/unified-9.0.35/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.35/raw/browser-lp-detail.log +1 -0
- package/docs/reports/unified-9.0.35/raw/browser-lp-feedback.log +1 -0
- package/docs/reports/unified-9.0.35/raw/cold-ocpp-22.log +108 -0
- package/docs/reports/unified-9.0.35/raw/cold-ocpp-24.log +24 -0
- package/docs/reports/unified-9.0.35/raw/core-final-node22.log +1439 -0
- package/docs/reports/unified-9.0.35/raw/core-final-node24.log +1381 -0
- package/docs/reports/unified-9.0.35/raw/dashboard-de-en-nl.json +716 -0
- package/docs/reports/unified-9.0.35/raw/device-chain-closed-fixed.json +98 -0
- package/docs/reports/unified-9.0.35/raw/device-chain-rst-fixed.json +98 -0
- package/docs/reports/unified-9.0.35/raw/device-chain.json +93 -0
- package/docs/reports/unified-9.0.35/raw/ee-fusion-final.log +12 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-browser.json +1 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-node22.log +206 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-node24.log +39 -0
- package/docs/reports/unified-9.0.35/raw/fixtures-verification.log +44 -0
- package/docs/reports/unified-9.0.35/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.35/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.35/raw/legacy-mail-setup-browser.log +1 -0
- package/docs/reports/unified-9.0.35/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.35/raw/live-ems-loss.log +10 -0
- package/docs/reports/unified-9.0.35/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.35/raw/node22-mira-reconnect-integrity.log +452 -0
- package/docs/reports/unified-9.0.35/raw/node22-mira.log +222 -0
- package/docs/reports/unified-9.0.35/raw/node22-system-status.log +213 -0
- package/docs/reports/unified-9.0.35/raw/node22-tests-final.log +18137 -0
- package/docs/reports/unified-9.0.35/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.35/raw/node24-mira-reconnect-integrity.log +79 -0
- package/docs/reports/unified-9.0.35/raw/node24-mira.log +41 -0
- package/docs/reports/unified-9.0.35/raw/node24-system-status.log +40 -0
- package/docs/reports/unified-9.0.35/raw/node24-tests-final.log +3019 -0
- package/docs/reports/unified-9.0.35/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-legacy-node22.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-legacy-node24.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-node22.log +67 -0
- package/docs/reports/unified-9.0.35/raw/notifications-node24.log +17 -0
- package/docs/reports/unified-9.0.35/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node22.log +110 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node24.log +106 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-history-node22.log +561 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-history-node24.log +98 -0
- package/docs/reports/unified-9.0.35/raw/poll-life-node22.log +38 -0
- package/docs/reports/unified-9.0.35/raw/poll-life-node24.log +12 -0
- package/docs/reports/unified-9.0.35/raw/qa-source-check.log +2 -0
- package/docs/reports/unified-9.0.35/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.35/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.35/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.35/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.35/raw/vergleich-9.0.33.json +29 -0
- package/docs/reports/unified-9.0.35/raw/vergleich-9.0.34.json +249 -0
- package/docs/reports/unified-9.0.35/raw/vorher-9.0.33-chromium.json +286 -0
- package/docs/reports/unified-9.0.35/raw/vorher-9.0.34-chromium.json +291 -0
- package/docs/reports/unified-9.0.36/MIGRATION.md +25 -0
- package/docs/reports/unified-9.0.36/PRUEFBERICHT.md +61 -0
- package/docs/reports/unified-9.0.36/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.36/raw/INDEX.json +262 -0
- package/docs/reports/unified-9.0.36/raw/admin-934-legacy-ui-reproduction.json +66 -0
- package/docs/reports/unified-9.0.36/raw/admin-936-legacy-ui-reproduction.json +64 -0
- package/docs/reports/unified-9.0.36/raw/admin-health-browser22.json +49 -0
- package/docs/reports/unified-9.0.36/raw/admin-health-browser24.json +49 -0
- package/docs/reports/unified-9.0.36/raw/admin-runtime-migration-browser22.json +80 -0
- package/docs/reports/unified-9.0.36/raw/admin-runtime-migration-browser24.json +80 -0
- package/docs/reports/unified-9.0.36/raw/backend.log +6 -0
- package/docs/reports/unified-9.0.36/raw/core-final-node22.log +1439 -0
- package/docs/reports/unified-9.0.36/raw/core-final-node24.log +1381 -0
- package/docs/reports/unified-9.0.36/raw/customer-934-node22-final.log +78 -0
- package/docs/reports/unified-9.0.36/raw/customer-934-node22-repeat.log +78 -0
- package/docs/reports/unified-9.0.36/raw/customer-935-node24-final.log +74 -0
- package/docs/reports/unified-9.0.36/raw/customer-935-node24-repeat.log +74 -0
- package/docs/reports/unified-9.0.36/raw/customer-admin-six-controls24.log +24 -0
- package/docs/reports/unified-9.0.36/raw/customer-earlier-pid-stop.log +22 -0
- package/docs/reports/unified-9.0.36/raw/customer-six-process-restart-node22.log +28 -0
- package/docs/reports/unified-9.0.36/raw/customer-six-process-restart-node24.log +24 -0
- package/docs/reports/unified-9.0.36/raw/dashboard-de-en-nl.json +728 -0
- package/docs/reports/unified-9.0.36/raw/fixtures-verification.log +44 -0
- package/docs/reports/unified-9.0.36/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.36/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.36/raw/legacy-migration-node22.log +630 -0
- package/docs/reports/unified-9.0.36/raw/legacy-migration-node24.log +109 -0
- package/docs/reports/unified-9.0.36/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.36/raw/module-standby-drain22.log +446 -0
- package/docs/reports/unified-9.0.36/raw/module-standby-drain24.log +80 -0
- package/docs/reports/unified-9.0.36/raw/module-standby-linux-memory.log +6 -0
- package/docs/reports/unified-9.0.36/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.36/raw/node22-migration.log +1329 -0
- package/docs/reports/unified-9.0.36/raw/node22-mira.log +222 -0
- package/docs/reports/unified-9.0.36/raw/node22-system-status.log +225 -0
- package/docs/reports/unified-9.0.36/raw/node22-tests-final.log +18358 -0
- package/docs/reports/unified-9.0.36/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.36/raw/node24-migration.log +1301 -0
- package/docs/reports/unified-9.0.36/raw/node24-mira.log +41 -0
- package/docs/reports/unified-9.0.36/raw/node24-system-status.log +42 -0
- package/docs/reports/unified-9.0.36/raw/node24-tests-final.log +3058 -0
- package/docs/reports/unified-9.0.36/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.36/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.36/raw/ocpp-owner-isolation22.log +109 -0
- package/docs/reports/unified-9.0.36/raw/ocpp-owner-isolation24.log +24 -0
- package/docs/reports/unified-9.0.36/raw/qa-source-check.log +2 -0
- package/docs/reports/unified-9.0.36/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.36/raw/sbom.log +9 -0
- package/docs/reports/unified-9.0.36/raw/standby-independent-drain.log +4 -0
- package/docs/reports/unified-9.0.36/raw/standby-independent-sockets.log +3 -0
- package/docs/reports/unified-9.0.36/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.36/raw/ui-runtime.log +8 -0
- package/docs/start/START_HIER_9.0.35.md +27 -0
- package/docs/start/START_HIER_9.0.36.md +32 -0
- package/docs/unified/ARCHITECTURE.md +6 -0
- package/io-package.json +12 -12
- package/modules/devices/contracts.d.ts +1 -0
- package/modules/devices/index.js +20 -1
- package/modules/devices/lib/deviceRuntime.js +19 -0
- package/modules/devices/lib/drivers/modbus.js +11 -6
- package/modules/devices/lib/drivers/ovumMira.js +7 -3
- package/modules/devices/test/ovumMiraTransport.test.js +40 -1
- package/modules/eebus/README.md +8 -0
- package/modules/eebus/admin/index.js +29 -2
- package/modules/eebus/build/index.js +28 -3
- package/modules/eebus/build/lib/eebusRuntime.js +17 -2
- package/modules/eebus/build/lib/partnerMonitor.js +160 -0
- package/modules/eebus/build/lib/shipEndpoint.js +4 -0
- package/modules/eebus/build/lib/stateDefinitions.js +1 -0
- package/modules/eebus/src/index.ts +23 -3
- package/modules/eebus/src/lib/eebusRuntime.ts +20 -2
- package/modules/eebus/src/lib/partnerMonitor.ts +127 -0
- package/modules/eebus/src/lib/shipEndpoint.ts +5 -0
- package/modules/eebus/src/lib/stateDefinitions.ts +1 -0
- package/modules/eebus/test/partner-monitor.test.js +82 -0
- package/modules/eebus/test/security.test.js +17 -0
- package/modules/ocpp/README.md +9 -1
- package/modules/ocpp/build/index.js +137 -10
- package/modules/ocpp/build/stationHistory.js +113 -0
- package/modules/ocpp/ocpp/freshness.d.ts +3 -0
- package/modules/ocpp/ocpp/freshness.js +6 -0
- package/modules/ocpp/provenance.json +3 -2
- package/modules/ocpp/runtime.d.ts +1 -0
- package/modules/ocpp/runtime.js +23 -1
- package/modules/ocpp/src/index.ts +163 -12
- package/modules/ocpp/src/stationHistory.ts +119 -0
- package/modules/ocpp/test/hosted.test.cjs +161 -0
- package/package.json +9 -5
- package/public/eos-migration/index.html +1 -1
- package/public/eos-migration/index.js +23 -7
- package/public/eos-runtime/index.js +82 -15
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +318 -181
- 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 +30 -30
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +1 -1
- package/ui/io-package.json +9 -1
- package/ui/lib/hosted-startup-status.js +2 -2
- package/ui/lib/notification-mail.js +235 -40
- package/ui/lib/notification-policy.js +41 -14
- package/ui/package.json +2 -1
- package/ui/www/app.js +91 -11
- package/ui/www/dashboard-lp-status.js +4 -11
- package/ui/www/dashboard-process-status.js +205 -0
- package/ui/www/i18n/en.json +24 -0
- package/ui/www/i18n/nl.json +21 -0
- package/ui/www/index.html +10 -5
- package/ui/www/live-display.js +106 -9
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/settings.html +2 -2
- package/ui/www/styles.css +4 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const objectId = 'pairing.monitoredPartners';
|
|
4
|
+
const startupGraceMs = 120_000;
|
|
5
|
+
type State = 'online' | 'offline' | 'unknown' | 'disabled';
|
|
6
|
+
type Partner = { id:string; key:string; name:string; pin:string; paused:boolean };
|
|
7
|
+
const pinValue = (v:unknown):string => typeof v === 'string' && /^[a-f0-9]{64}$/i.test(v.replace(/:/g,'')) ? v.replace(/:/g,'').toUpperCase() : '';
|
|
8
|
+
interface Store {
|
|
9
|
+
getStateAsync(id:string): Promise<{val:unknown;ack?:boolean} | null | undefined>;
|
|
10
|
+
setStateAsync(id:string, value:{val:string;ack:true}): Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
function friendlyName(value:unknown): value is string {
|
|
13
|
+
return typeof value === 'string' && value === value.trim() && value.length <= 64 &&
|
|
14
|
+
/\p{L}/u.test(value) && /^[\p{L}\p{M}\p{N} _()-]+$/u.test(value) &&
|
|
15
|
+
!/[a-f\d]{16,}|(?:[a-f\d]{2}-){5}[a-f\d]{2}/i.test(value) && !/\d{9,}/.test(value);
|
|
16
|
+
}
|
|
17
|
+
const safeId = (v:unknown):v is string => typeof v==='string' && /^[a-f\d]{40}$/i.test(v);
|
|
18
|
+
const key = (id:string) => createHash('sha256').update('eebus:'+id.toLowerCase()).digest('hex');
|
|
19
|
+
export function emptyReport(known:boolean) {
|
|
20
|
+
return {state:known?'ok':'unknown',offline:[] as {name:string}[],totalOffline:0,
|
|
21
|
+
tracked:[] as {key:string;name:string;state:State}[],complete:known};
|
|
22
|
+
}
|
|
23
|
+
/** Names are local installer input. Discovery metadata, peer addresses and certificates never feed the customer report. */
|
|
24
|
+
export class PartnerMonitor {
|
|
25
|
+
private partners = new Map<string,Partner>();
|
|
26
|
+
private confirmed = new Set<string>();
|
|
27
|
+
private suppressed = new Set<string>();
|
|
28
|
+
private known = false;
|
|
29
|
+
private startedAt = 0;
|
|
30
|
+
private pending:Promise<void> = Promise.resolve();
|
|
31
|
+
constructor(private store:Store, private live:(id:string)=>boolean, private now=()=>performance.now()) {}
|
|
32
|
+
|
|
33
|
+
async load(): Promise<void> {
|
|
34
|
+
this.startedAt = this.now();
|
|
35
|
+
try {
|
|
36
|
+
const state = await this.store.getStateAsync(objectId);
|
|
37
|
+
if (state?.ack === false) throw Error();
|
|
38
|
+
const rows:unknown = state?.val == null ? [] : JSON.parse(String(state.val));
|
|
39
|
+
if (!Array.isArray(rows) || rows.length>128) throw Error();
|
|
40
|
+
const restored = new Map<string,Partner>();
|
|
41
|
+
for (const item of rows) {
|
|
42
|
+
if (!item || !safeId(item.id) || !friendlyName(item.name) || !pinValue(item.pin) || typeof item.paused!=='boolean' || restored.has(item.id)) throw Error();
|
|
43
|
+
const row = {id:item.id.toUpperCase(), key:key(item.id), name:item.name, pin:pinValue(item.pin), paused:item.paused};
|
|
44
|
+
if (restored.has(row.id)) throw Error();
|
|
45
|
+
restored.set(row.id,row);
|
|
46
|
+
}
|
|
47
|
+
// Verify locally approved pairing on restart even when the peer is currently absent.
|
|
48
|
+
const monitored = Array.from(restored.values()).filter(row=>!row.paused);
|
|
49
|
+
let changed = false;
|
|
50
|
+
for (let start=0; start<monitored.length; start+=8) {
|
|
51
|
+
await Promise.all(monitored.slice(start,start+8).map(async row => {
|
|
52
|
+
if (await this.trustedPin(row.id) !== row.pin) { row.paused = true; changed = true; }
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
if (changed) await this.save(restored);
|
|
56
|
+
else this.partners = restored;
|
|
57
|
+
this.known = true;
|
|
58
|
+
} catch { this.known = false; }
|
|
59
|
+
}
|
|
60
|
+
private async trustedPin(id:string) {
|
|
61
|
+
const [trust,pin] = await Promise.all(['trusted','pinnedFingerprint'].map(field=>
|
|
62
|
+
this.store.getStateAsync('devices.'+id+'.pairing.'+field)));
|
|
63
|
+
return trust?.val===true && trust.ack!==false && pin?.ack!==false ? pinValue(pin?.val) : '';
|
|
64
|
+
}
|
|
65
|
+
private change(write:()=>Promise<void>):Promise<void> {
|
|
66
|
+
const op = this.pending.then(write);
|
|
67
|
+
this.pending = op.catch(()=>{});
|
|
68
|
+
return op;
|
|
69
|
+
}
|
|
70
|
+
private async save(next:Map<string,Partner>):Promise<void> {
|
|
71
|
+
await this.store.setStateAsync(objectId,{val:JSON.stringify(Array.from(next.values(), ({id,name,pin,paused})=>({id,name,pin,paused}))),ack:true});
|
|
72
|
+
this.partners = next;
|
|
73
|
+
}
|
|
74
|
+
async configure(id:string, name:unknown, enabled:boolean):Promise<void> {
|
|
75
|
+
if (!safeId(id)) throw new Error('EEBUS_MONITOR_DEVICE');
|
|
76
|
+
id=id.toUpperCase();
|
|
77
|
+
return this.change(async()=>{
|
|
78
|
+
if (!this.known) throw new Error('EEBUS_MONITOR_STORAGE_UNAVAILABLE');
|
|
79
|
+
const next = new Map(this.partners);
|
|
80
|
+
if (enabled) {
|
|
81
|
+
if (!friendlyName(name)) throw new Error('EEBUS_MONITOR_LOCAL_NAME');
|
|
82
|
+
const pin = this.live(id) ? await this.trustedPin(id) : '';
|
|
83
|
+
if (!pin || !this.live(id)) throw new Error('EEBUS_MONITOR_PAIRED_SESSION_REQUIRED');
|
|
84
|
+
if (!next.has(id) && next.size>=128) throw new Error('EEBUS_MONITOR_CAPACITY');
|
|
85
|
+
next.set(id,{id,key:key(id),name,pin,paused:false});
|
|
86
|
+
} else { next.delete(id); }
|
|
87
|
+
await this.save(next);
|
|
88
|
+
if (enabled) this.confirmed.add(id); else this.confirmed.delete(id);
|
|
89
|
+
this.suppressed.delete(id);
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
pinChanged(id:string, value:unknown):Promise<void> {
|
|
93
|
+
const row=this.partners.get(id.toUpperCase());
|
|
94
|
+
return row && !row.paused && row.pin!==pinValue(value) ? this.pause(id) : Promise.resolve();
|
|
95
|
+
}
|
|
96
|
+
pause(id:string):Promise<void> {
|
|
97
|
+
id=id.toUpperCase();
|
|
98
|
+
this.suppressed.add(id);
|
|
99
|
+
return this.change(async()=>{
|
|
100
|
+
const row=this.partners.get(id);
|
|
101
|
+
if (row && !row.paused) {
|
|
102
|
+
const next=new Map(this.partners); next.set(id,{...row,paused:true});
|
|
103
|
+
await this.save(next);
|
|
104
|
+
}
|
|
105
|
+
this.suppressed.delete(id);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
observed(id:string):void { if (this.partners.has(id.toUpperCase()) && this.live(id)) this.confirmed.add(id.toUpperCase()); }
|
|
109
|
+
list() {return Array.from(this.partners.values(),({id,name,paused})=>({id,name,paused}));}
|
|
110
|
+
report() {
|
|
111
|
+
const report=emptyReport(this.known);
|
|
112
|
+
if (!this.known) return report;
|
|
113
|
+
for (const row of this.partners.values()) {
|
|
114
|
+
const active=this.live(row.id);
|
|
115
|
+
const state:State=row.paused || this.suppressed.has(row.id)?'disabled':active?'online':
|
|
116
|
+
this.confirmed.has(row.id) || this.now()-this.startedAt>=startupGraceMs?'offline':'unknown';
|
|
117
|
+
if (state==='online') this.confirmed.add(row.id);
|
|
118
|
+
report.tracked.push({key:row.key,name:row.name,state});
|
|
119
|
+
if (state==='unknown' && report.state==='ok') report.state='unknown';
|
|
120
|
+
if (state==='offline') {
|
|
121
|
+
report.state='fault'; report.totalOffline++;
|
|
122
|
+
if (report.offline.length<12) report.offline.push({name:row.name});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return report;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -246,6 +246,11 @@ export class ShipEndpoint {
|
|
|
246
246
|
if (session && fingerprint !== session.remoteFingerprint) this.disconnect(deviceId);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
public hasAuthorizedExchange(deviceId: string): boolean {
|
|
250
|
+
const peer = this.sessions.get(deviceId);
|
|
251
|
+
return !!peer?.authorized && peer.dataExchangeReady && this.isSocketOpen(peer.socket) && !this.stopping;
|
|
252
|
+
}
|
|
253
|
+
|
|
249
254
|
public hasObservedPeer(deviceId: string): boolean {
|
|
250
255
|
const session = this.sessions.get(deviceId);
|
|
251
256
|
return !!session?.remoteFingerprint && this.isSocketOpen(session.socket);
|
|
@@ -41,6 +41,7 @@ export const discoveryStates: StateDefinition[] = [
|
|
|
41
41
|
];
|
|
42
42
|
|
|
43
43
|
export const globalPairingStates: StateDefinition[] = [
|
|
44
|
+
{ id: 'monitoredPartners', name: 'Installer-configured EEBus partner supervision', type: 'string', role: 'json', read: true, write: false, def: '[]' },
|
|
44
45
|
{
|
|
45
46
|
id: 'autoAcceptNewDevices',
|
|
46
47
|
name: 'Auto accept new devices for field testing',
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const test = require('node:test');
|
|
3
|
+
const assert = require('node:assert/strict');
|
|
4
|
+
const {PartnerMonitor} = require('../build/lib/partnerMonitor');
|
|
5
|
+
const {EebusRuntime} = require('../build/lib/eebusRuntime');
|
|
6
|
+
const testId='AB'.repeat(20), pin='EF'.repeat(32), name='Wärmepumpe West';
|
|
7
|
+
const roster='pairing.monitoredPartners';
|
|
8
|
+
|
|
9
|
+
function sample() {
|
|
10
|
+
let active=false, clock=0;
|
|
11
|
+
const values=new Map();
|
|
12
|
+
const store={getStateAsync:async k=>values.get(k), setStateAsync:async(k,v)=>{values.set(k,v);},
|
|
13
|
+
canOperate:()=>true, namespace:'eos-admin.0.eebus'};
|
|
14
|
+
function paired() {
|
|
15
|
+
values.set('devices.'+testId+'.pairing.trusted',{val:true,ack:true});
|
|
16
|
+
values.set('devices.'+testId+'.pairing.pinnedFingerprint',{val:pin,ack:true});
|
|
17
|
+
}
|
|
18
|
+
const open = () => new PartnerMonitor(store, id=>active && id===testId, ()=>clock);
|
|
19
|
+
return {store,values,paired,open,connected(x){active=x;},clock(x){clock=x;}};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
test('EEBus requires local intent, a trusted and pinned live data-exchange and a local display name', async()=>{
|
|
23
|
+
const f=sample(), m=f.open();await m.load();
|
|
24
|
+
assert.deepEqual(m.report(),{state:'ok',offline:[],totalOffline:0,tracked:[],complete:true});
|
|
25
|
+
f.paired(); m.observed(testId);
|
|
26
|
+
await assert.rejects(m.configure(testId,name,true),/PAIRED_SESSION/);
|
|
27
|
+
f.connected(true); f.values.delete('devices.'+testId+'.pairing.trusted');
|
|
28
|
+
await assert.rejects(m.configure(testId,name,true),/PAIRED_SESSION/);
|
|
29
|
+
f.paired(); f.values.delete('devices.'+testId+'.pairing.pinnedFingerprint');
|
|
30
|
+
await assert.rejects(m.configure(testId,name,true),/PAIRED_SESSION/); f.paired();
|
|
31
|
+
for (const label of [testId,'192.168.0.1','AA-BB-CC-DD-EE-FF','https://peer.local/','']) {
|
|
32
|
+
await assert.rejects(m.configure(testId,label,true),/LOCAL_NAME/);
|
|
33
|
+
}
|
|
34
|
+
assert.equal(f.values.has(roster),false);
|
|
35
|
+
await m.configure(testId,name,true);
|
|
36
|
+
assert.equal(m.report().tracked[0].state,'online');
|
|
37
|
+
f.connected(false);
|
|
38
|
+
const fault=m.report();
|
|
39
|
+
assert.deepEqual(fault.offline,[{name}]); assert.equal(fault.state,'fault');
|
|
40
|
+
assert.match(fault.tracked[0].key,/^[a-f0-9]{64}$/);
|
|
41
|
+
assert.ok(!JSON.stringify(fault).toLowerCase().includes(testId.toLowerCase()));
|
|
42
|
+
assert.ok(!JSON.stringify(fault).toLowerCase().includes(pin.toLowerCase()));
|
|
43
|
+
f.connected(true);
|
|
44
|
+
assert.equal(m.report().state,'ok');
|
|
45
|
+
assert.equal(m.report().tracked[0].key,fault.tracked[0].key);
|
|
46
|
+
});
|
|
47
|
+
test('EEBus opted-in partner survives reboot, allows time to reconnect, and remains paused after deliberate disconnect',async()=>{
|
|
48
|
+
const f=sample();f.paired();f.connected(true);
|
|
49
|
+
const before=f.open();await before.load();await before.configure(testId,name,true);
|
|
50
|
+
f.connected(false);const after=f.open();await after.load();
|
|
51
|
+
assert.equal(after.report().tracked[0].state,'unknown');
|
|
52
|
+
f.clock(119999);assert.equal(after.report().totalOffline,0);
|
|
53
|
+
f.clock(120000);assert.equal(after.report().tracked[0].state,'offline');
|
|
54
|
+
await after.pause(testId);assert.equal(after.report().tracked[0].state,'disabled');
|
|
55
|
+
const restart=f.open();await restart.load();f.clock(240001);assert.equal(restart.report().tracked[0].state,'disabled');
|
|
56
|
+
await restart.configure(testId,'',false); assert.equal(restart.report().tracked.length,0);
|
|
57
|
+
});
|
|
58
|
+
test('EEBus revocation and pin change disable monitoring persistently; invalid storage cannot generate an offline declaration',async()=>{
|
|
59
|
+
const f=sample();f.paired();f.connected(true);
|
|
60
|
+
const m=f.open();await m.load(); await m.configure(testId,name,true);
|
|
61
|
+
await m.pinChanged(testId,pin);assert.equal(m.report().tracked[0].state,'online');
|
|
62
|
+
await m.pinChanged(testId,'B1'.repeat(32));assert.equal(m.report().tracked[0].state,'disabled');
|
|
63
|
+
await m.configure(testId,name,true);f.values.set('devices.'+testId+'.pairing.trusted',{val:false,ack:true});
|
|
64
|
+
const next=f.open();await next.load();assert.equal(next.report().tracked[0].state,'disabled');
|
|
65
|
+
f.paired();const again=f.open();await again.load();assert.equal(again.report().tracked[0].state,'disabled');
|
|
66
|
+
f.values.set(roster,{val:'{}',ack:true});
|
|
67
|
+
const bad=f.open();await bad.load();assert.equal(bad.report().complete,false);assert.equal(bad.report().totalOffline,0);
|
|
68
|
+
await assert.rejects(bad.configure(testId,name,true),/STORAGE_UNAVAILABLE/);
|
|
69
|
+
assert.equal(f.values.get(roster).val,'{}');
|
|
70
|
+
});
|
|
71
|
+
test('the normal EEBus disconnect and trust-revocation entry points pause an active monitored partner', async()=>{
|
|
72
|
+
const f=sample();f.paired();let open=true,physicalCommands=0;
|
|
73
|
+
const runtime=new EebusRuntime(f.store,{}, {}, {});
|
|
74
|
+
runtime.endpoint={hasAuthorizedExchange:()=>open,disconnect(){physicalCommands++;open=false;}};
|
|
75
|
+
await runtime.partnerMonitor.load();
|
|
76
|
+
await runtime.partnerMonitor.configure(testId,name,true);assert.equal(physicalCommands,0);
|
|
77
|
+
await runtime.handleStateChange(f.store.namespace+'.devices.'+testId+'.control.disconnect',{val:true,ack:false});
|
|
78
|
+
assert.equal(runtime.partnerMonitor.report().tracked[0].state,'disabled');assert.equal(physicalCommands,1);
|
|
79
|
+
open=true; await runtime.partnerMonitor.configure(testId,name,true);
|
|
80
|
+
await runtime.handleStateChange(f.store.namespace+'.devices.'+testId+'.pairing.trusted',{val:false,ack:true});
|
|
81
|
+
assert.equal(runtime.partnerMonitor.report().tracked[0].state,'disabled');
|
|
82
|
+
});
|
|
@@ -339,3 +339,20 @@ test('EEBUS-SHIP-014: concurrent requests for the same peer cannot bypass the co
|
|
|
339
339
|
assert.equal(server.observed.length, 1, 'one connecting socket per peer, despite awaited diagnostics');
|
|
340
340
|
});
|
|
341
341
|
|
|
342
|
+
|
|
343
|
+
test('opted-in partner health follows a real local TLS/SHIP session; discovery and pairing alone do not create a dashboard alarm', async t=>{
|
|
344
|
+
const {PartnerMonitor}=require('../build/lib/partnerMonitor');
|
|
345
|
+
const f=await fixture(t);
|
|
346
|
+
const m=new PartnerMonitor(f.adapter,id=>f.endpoint.hasAuthorizedExchange(id));
|
|
347
|
+
await m.load(); f.trust();
|
|
348
|
+
f.states.set('devices.'+peer.ski+'.pairing.trusted',{val:true,ack:true});
|
|
349
|
+
const client=await f.connect();
|
|
350
|
+
assert.equal(m.report().tracked.length,0);
|
|
351
|
+
await assert.rejects(m.configure(peer.ski,'WP West',true),/PAIRED_SESSION/);
|
|
352
|
+
await handshake(f,client); assert.equal(m.report().tracked.length,0);
|
|
353
|
+
await m.configure(peer.ski,'WP West',true);
|
|
354
|
+
assert.equal(m.report().tracked[0].state,'online');
|
|
355
|
+
client.close(); await until(()=>m.report().state==='fault','confirmed partner goes offline on socket close');
|
|
356
|
+
assert.deepEqual(m.report().offline,[{name:'WP West'}]);
|
|
357
|
+
assert.equal(f.delivered.length,0,'enabling supervision issues no SPINE actuation');
|
|
358
|
+
});
|
package/modules/ocpp/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# Integriertes OCPP-Modul 0.4.4
|
|
2
2
|
|
|
3
|
-
Dieses Modul
|
|
3
|
+
Dieses Modul ist seit NexoWatt EOS 9.0.24 Teil der gemeinsamen Installation. Es enthält den gelieferten und geprüften OCPP-Kern 0.4.3 unter MIT-Lizenz sowie eine neue typisierte Prozessgrenze. Eine zweite Installation von `iobroker.ocpp21` ist für neue Anlagen nicht erforderlich. Herkunft, Originalprüfsummen und Änderungen stehen in `provenance.json`.
|
|
4
|
+
|
|
5
|
+
## Stationszustand im LIVE-Dashboard ab EOS 9.0.35
|
|
6
|
+
|
|
7
|
+
Ein Boot, Heartbeat oder empfangener Status- bzw. Messwert bestätigt die OCPP-Sitzung. Nach einem Verbindungsabbruch oder nach Ablauf des vorhandenen OCPP-Aktivitätsfensters meldet der Worker eine bestätigte Station als offline. Beim Wiederverbinden wartet er auf die erste Stationsmeldung. Eine betriebsbereite Station ohne Fahrzeug gilt als online.
|
|
8
|
+
|
|
9
|
+
Im Dashboard erscheinen fortlaufende Namen wie „Ladestation 1“. Ihre Reihenfolge richtet sich nach der Anmeldung im aktuellen Prozess. Die Anzahl ausgefallener Stationen umfasst auch Fälle über die ersten zwölf Namen hinaus. Für interne Benachrichtigungen liefert der Worker bis zu 256 pseudonyme Stationsschlüssel. Die OCPP-Zulassungsliste erlaubt Anmeldungen. Ein Eintrag allein macht eine Station noch nicht zu einem erwarteten Gerät. EOS merkt sich nach bestätigtem Boot, Heartbeat, Status oder Messwert einen pseudonymen Schlüssel im Stationskanal. Beim Neustart lädt es diese Nachweise aus dem verwendeten ioBroker-Namensraum. Bei älteren Ständen zählen ein durch Boot gesetztes Heartbeat-Intervall oder gespeicherte Boot-, Heartbeat- und Messwertzeiten zusammen mit der bestätigten Stationsidentität. Eine Socket-Anmeldung oder ein Eintrag in der Zulassungsliste genügt dafür nicht.
|
|
10
|
+
|
|
11
|
+
Vorher bestätigte Stationen erscheinen bis zur Wiederanmeldung als unbekannt. Liegt vor dem Neustart ein bestätigter Verbindungsabbruch vor, bleibt die Station offline. Nach Ablauf des regulären OCPP-Aktivitätsfensters gilt auch eine weiterhin ausbleibende Anmeldung als Ausfall. Mit den Standardwerten beträgt das Fenster 750 Sekunden. Erst eine neue OCPP-Aktivität bestätigt die Rückkehr. Beim Start werden höchstens 1.024 Stationswurzeln ausgewertet. Fehlende oder unvollständige historische Auskunft ergibt einen unbekannten Status. Die Datenbankabfrage läuft unabhängig vom Serverstart. Die laufende Dashboard-Abfrage liest ausschließlich aus dem Arbeitsspeicher.
|
|
4
12
|
|
|
5
13
|
## Laufzeit und Zuständigkeit
|
|
6
14
|
|
|
@@ -5,6 +5,7 @@ exports.validateConfig = validateConfig;
|
|
|
5
5
|
exports.preflightLegacyConfig = preflightLegacyConfig;
|
|
6
6
|
exports.createHostedModule = createHostedModule;
|
|
7
7
|
/** NexoWatt EOS OCPP hosting boundary. MIT; original station runtime remains attributed in provenance.json. */
|
|
8
|
+
const stationHistory_1 = require("./stationHistory");
|
|
8
9
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
9
10
|
const node_events_1 = require("node:events");
|
|
10
11
|
const node_module_1 = require("node:module");
|
|
@@ -253,6 +254,24 @@ function createHostedModule(options) {
|
|
|
253
254
|
})();
|
|
254
255
|
return stopping;
|
|
255
256
|
};
|
|
257
|
+
const dashboardKeys = new WeakMap();
|
|
258
|
+
const configuredIdentities = new Set(Array.isArray(settings.identityAllowlist) ? settings.identityAllowlist : []);
|
|
259
|
+
const allowedKeys = new Set([...configuredIdentities].map(id => (0, stationHistory_1.stationKey)(String(id))));
|
|
260
|
+
let knownStations = new Map();
|
|
261
|
+
let historyComplete = false;
|
|
262
|
+
let observationStarted = 0;
|
|
263
|
+
let retryHistoryAfter = 0;
|
|
264
|
+
const restoreHistory = async () => {
|
|
265
|
+
retryHistoryAfter = 0;
|
|
266
|
+
const token = generation;
|
|
267
|
+
const loaded = await (0, stationHistory_1.readStationHistory)(adapter.namespace, pattern => call('getStatesAsync', [pattern]), allowedKeys);
|
|
268
|
+
if (!allowed() || token !== generation) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
knownStations = loaded.complete ? loaded.known : new Map([...knownStations, ...loaded.known]);
|
|
272
|
+
historyComplete = loaded.complete;
|
|
273
|
+
retryHistoryAfter = loaded.readFailed ? Date.now() + 30000 : 0;
|
|
274
|
+
};
|
|
256
275
|
const start = () => {
|
|
257
276
|
if (starting) {
|
|
258
277
|
return starting;
|
|
@@ -302,7 +321,10 @@ function createHostedModule(options) {
|
|
|
302
321
|
]);
|
|
303
322
|
}
|
|
304
323
|
await call('setStateAsync', ['info.eosHostedRuntime', { val: true, ack: true }]);
|
|
324
|
+
// Inventory hydration cannot delay the WebSocket listener or physical control.
|
|
325
|
+
void restoreHistory();
|
|
305
326
|
await runtime.onReady();
|
|
327
|
+
observationStarted = Date.now();
|
|
306
328
|
assert();
|
|
307
329
|
started = true;
|
|
308
330
|
state = 'running';
|
|
@@ -312,6 +334,9 @@ function createHostedModule(options) {
|
|
|
312
334
|
if (publishing || !allowed() || !runtime?.server) {
|
|
313
335
|
return;
|
|
314
336
|
}
|
|
337
|
+
if (retryHistoryAfter && Date.now() >= retryHistoryAfter) {
|
|
338
|
+
void restoreHistory();
|
|
339
|
+
}
|
|
315
340
|
publishing = true;
|
|
316
341
|
void publishAlive(true)
|
|
317
342
|
.catch(() => {
|
|
@@ -332,6 +357,116 @@ function createHostedModule(options) {
|
|
|
332
357
|
});
|
|
333
358
|
return starting;
|
|
334
359
|
};
|
|
360
|
+
const connectionHealth = (entry, now) => (0, freshness_1.deriveConnectionHealth)({
|
|
361
|
+
now,
|
|
362
|
+
socketConnected: entry.socketConnected,
|
|
363
|
+
connectedAt: entry.connectedAt,
|
|
364
|
+
lastMessageAt: entry.lastMessageAt,
|
|
365
|
+
lastHeartbeatAt: entry.lastHeartbeatAt,
|
|
366
|
+
heartbeatIntervalSec: entry.heartbeatIntervalSec,
|
|
367
|
+
heartbeatTimeoutFactor: settings.heartbeatTimeoutFactor,
|
|
368
|
+
activityTimeoutSec: settings.activityTimeoutSec,
|
|
369
|
+
});
|
|
370
|
+
const getDashboardDeviceHealth = () => {
|
|
371
|
+
const result = {
|
|
372
|
+
state: 'ok',
|
|
373
|
+
offline: [],
|
|
374
|
+
totalOffline: 0,
|
|
375
|
+
tracked: [],
|
|
376
|
+
complete: false,
|
|
377
|
+
};
|
|
378
|
+
if (!settings.enabled) {
|
|
379
|
+
result.complete = true;
|
|
380
|
+
return result;
|
|
381
|
+
}
|
|
382
|
+
if (!started ||
|
|
383
|
+
!runtime ||
|
|
384
|
+
revoked ||
|
|
385
|
+
state !== 'running' ||
|
|
386
|
+
!options.canOperate() ||
|
|
387
|
+
(options.getAuthorityGeneration?.() ?? 0) !== authorityGeneration) {
|
|
388
|
+
result.state = 'unknown';
|
|
389
|
+
return result;
|
|
390
|
+
}
|
|
391
|
+
const now = Date.now();
|
|
392
|
+
if (!historyComplete) {
|
|
393
|
+
result.state = 'unknown';
|
|
394
|
+
}
|
|
395
|
+
const seen = new Set();
|
|
396
|
+
let ordinal = 0, eligible = 0, confirmedConfigured = 0;
|
|
397
|
+
for (const entry of runtime.runtimeIndex.values()) {
|
|
398
|
+
ordinal++;
|
|
399
|
+
let key = dashboardKeys.get(entry);
|
|
400
|
+
if (!key) {
|
|
401
|
+
key = (0, stationHistory_1.stationKey)(entry.rawIdentity);
|
|
402
|
+
dashboardKeys.set(entry, key);
|
|
403
|
+
}
|
|
404
|
+
const historical = knownStations.get(key);
|
|
405
|
+
const confirmed = (0, freshness_1.hasConfirmedSessionActivity)(entry);
|
|
406
|
+
if (!confirmed && !entry.dashboardPreviouslyConfirmed && !historical && !entry.socketConnected) {
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
seen.add(key);
|
|
410
|
+
eligible++;
|
|
411
|
+
if ((confirmed || entry.dashboardPreviouslyConfirmed) && configuredIdentities.has(entry.rawIdentity)) {
|
|
412
|
+
confirmedConfigured++;
|
|
413
|
+
}
|
|
414
|
+
let current = 'unknown';
|
|
415
|
+
if (confirmed) {
|
|
416
|
+
current = connectionHealth(entry, now).online ? 'online' : 'offline';
|
|
417
|
+
}
|
|
418
|
+
else if ((entry.dashboardPreviouslyConfirmed || historical) && !entry.socketConnected) {
|
|
419
|
+
current = 'offline';
|
|
420
|
+
}
|
|
421
|
+
// The native station object has an OCPP identity and no separate public display name.
|
|
422
|
+
const name = `Ladestation ${ordinal}`;
|
|
423
|
+
if (current === 'offline') {
|
|
424
|
+
result.state = 'fault';
|
|
425
|
+
result.totalOffline++;
|
|
426
|
+
if (result.offline.length < 12) {
|
|
427
|
+
result.offline.push({ name });
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
else if (current === 'unknown' && result.state !== 'fault') {
|
|
431
|
+
result.state = 'unknown';
|
|
432
|
+
}
|
|
433
|
+
if (result.tracked.length < 256) {
|
|
434
|
+
result.tracked.push({ key, name, state: current });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const windowMs = (0, freshness_1.activityTimeoutMs)(settings.heartbeatIntervalSec, settings.heartbeatTimeoutFactor, settings.activityTimeoutSec);
|
|
438
|
+
for (const old of knownStations.values()) {
|
|
439
|
+
if (seen.has(old.key)) {
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
const name = `Ladestation ${++ordinal}`;
|
|
443
|
+
const absent = old.offline || now - observationStarted > windowMs;
|
|
444
|
+
if (absent) {
|
|
445
|
+
result.state = 'fault';
|
|
446
|
+
result.totalOffline++;
|
|
447
|
+
if (result.offline.length < 12) {
|
|
448
|
+
result.offline.push({ name });
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
else if (result.state !== 'fault') {
|
|
452
|
+
result.state = 'unknown';
|
|
453
|
+
}
|
|
454
|
+
eligible++;
|
|
455
|
+
if (allowedKeys.has(old.key)) {
|
|
456
|
+
confirmedConfigured++;
|
|
457
|
+
}
|
|
458
|
+
if (result.tracked.length < 256) {
|
|
459
|
+
result.tracked.push({ key: old.key, name, state: absent ? 'offline' : 'unknown' });
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// With open admission, earlier sessions may be missing after a worker restart.
|
|
463
|
+
result.complete =
|
|
464
|
+
historyComplete &&
|
|
465
|
+
configuredIdentities.size > 0 &&
|
|
466
|
+
confirmedConfigured === configuredIdentities.size &&
|
|
467
|
+
eligible === result.tracked.length;
|
|
468
|
+
return result;
|
|
469
|
+
};
|
|
335
470
|
const getStatus = () => ({
|
|
336
471
|
started: started && allowed(),
|
|
337
472
|
state,
|
|
@@ -352,16 +487,7 @@ function createHostedModule(options) {
|
|
|
352
487
|
connected: entry.socketConnected,
|
|
353
488
|
status: entry.chargingState || '',
|
|
354
489
|
lastSeenMs: entry.lastMessageAt || 0,
|
|
355
|
-
dataFresh: (0, freshness_1.dataFreshForEos)((0,
|
|
356
|
-
now: Date.now(),
|
|
357
|
-
socketConnected: entry.socketConnected,
|
|
358
|
-
connectedAt: entry.connectedAt,
|
|
359
|
-
lastMessageAt: entry.lastMessageAt,
|
|
360
|
-
lastHeartbeatAt: entry.lastHeartbeatAt,
|
|
361
|
-
heartbeatIntervalSec: entry.heartbeatIntervalSec,
|
|
362
|
-
heartbeatTimeoutFactor: settings.heartbeatTimeoutFactor,
|
|
363
|
-
activityTimeoutSec: settings.activityTimeoutSec,
|
|
364
|
-
}).online, entry.lastPowerAt > 0 && Date.now() - entry.lastPowerAt <= Number(settings.telemetryMaxAgeSec) * 1000, entry.socketConnected && entry.safeZeroAt > 0),
|
|
490
|
+
dataFresh: (0, freshness_1.dataFreshForEos)(connectionHealth(entry, Date.now()).online, entry.lastPowerAt > 0 && Date.now() - entry.lastPowerAt <= Number(settings.telemetryMaxAgeSec) * 1000, entry.socketConnected && entry.safeZeroAt > 0),
|
|
365
491
|
leaseArmed: runtime?._eosLeases.get(id)?.armed === true,
|
|
366
492
|
leaseState: runtime?._eosLeases.get(id)?.active === true
|
|
367
493
|
? 'active'
|
|
@@ -389,6 +515,7 @@ function createHostedModule(options) {
|
|
|
389
515
|
start,
|
|
390
516
|
stop,
|
|
391
517
|
getStatus,
|
|
518
|
+
getDashboardDeviceHealth,
|
|
392
519
|
onStateChange,
|
|
393
520
|
command: (name) => {
|
|
394
521
|
assert();
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stationKey = void 0;
|
|
4
|
+
exports.readStationHistory = readStationHistory;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const record = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
const stationKey = (identity) => (0, node_crypto_1.createHash)('sha256').update(identity).digest('hex');
|
|
8
|
+
exports.stationKey = stationKey;
|
|
9
|
+
const fields = [
|
|
10
|
+
'health.staleReason',
|
|
11
|
+
'health.online',
|
|
12
|
+
'health.dashboardConfirmedKey',
|
|
13
|
+
'info.identity',
|
|
14
|
+
'info.heartbeatInterval',
|
|
15
|
+
'health.lastBoot',
|
|
16
|
+
'info.lastHeartbeat',
|
|
17
|
+
'health.lastMeterValue',
|
|
18
|
+
];
|
|
19
|
+
/**
|
|
20
|
+
* Only exact evidence suffixes in the module's own (possibly migrated) namespace.
|
|
21
|
+
* Object defaults, socket creation and a configuration allowlist do not prove a station exists.
|
|
22
|
+
*/
|
|
23
|
+
async function readStationHistory(namespace, read, allow) {
|
|
24
|
+
const rows = new Map();
|
|
25
|
+
let complete = true;
|
|
26
|
+
let readFailed = false;
|
|
27
|
+
const collect = async (field) => {
|
|
28
|
+
try {
|
|
29
|
+
const values = await read(`*.${field}`);
|
|
30
|
+
if (!record(values)) {
|
|
31
|
+
throw new Error('invalid controller response');
|
|
32
|
+
}
|
|
33
|
+
for (const [id, state] of Object.entries(values)) {
|
|
34
|
+
const rel = id.startsWith(`${namespace}.`) ? id.slice(namespace.length + 1) : id;
|
|
35
|
+
if (!rel.endsWith(`.${field}`)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const root = rel.slice(0, -(field.length + 1));
|
|
39
|
+
if (!/^[A-Za-z0-9_-]{1,256}$/.test(root) || !record(state)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (state.ack !== true || (state.q !== undefined && state.q !== 0)) {
|
|
43
|
+
// An unreadable positive marker is not proof of an empty station inventory.
|
|
44
|
+
if (field === 'health.dashboardConfirmedKey' && state.val) {
|
|
45
|
+
complete = false;
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
let row = rows.get(root);
|
|
50
|
+
if (!row) {
|
|
51
|
+
if (rows.size >= 1024) {
|
|
52
|
+
complete = false;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
row = {};
|
|
56
|
+
rows.set(root, row);
|
|
57
|
+
}
|
|
58
|
+
row[field] = state.val;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
complete = false;
|
|
63
|
+
readFailed = true;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
// Start with outage evidence before the normal runtime resets old session flags.
|
|
67
|
+
// At most two bounded controller requests in flight, independent of station count.
|
|
68
|
+
for (let i = 0; i < fields.length; i += 2) {
|
|
69
|
+
await Promise.all(fields.slice(i, i + 2).map(collect));
|
|
70
|
+
}
|
|
71
|
+
const known = new Map();
|
|
72
|
+
const now = Date.now();
|
|
73
|
+
for (const row of rows.values()) {
|
|
74
|
+
const raw = row['info.identity'], marker = row['health.dashboardConfirmedKey'];
|
|
75
|
+
const timestamp = (value) => typeof value === 'string' &&
|
|
76
|
+
Number.isFinite(Date.parse(value)) &&
|
|
77
|
+
Date.parse(value) > 0 &&
|
|
78
|
+
Date.parse(value) <= now;
|
|
79
|
+
const interval = row['info.heartbeatInterval']; // The native runtime writes this only after BootNotification.
|
|
80
|
+
const legacy = (typeof interval === 'number' && Number.isInteger(interval) && interval >= 10 && interval <= 86400) ||
|
|
81
|
+
timestamp(row['health.lastBoot']) ||
|
|
82
|
+
timestamp(row['info.lastHeartbeat']) ||
|
|
83
|
+
timestamp(row['health.lastMeterValue']);
|
|
84
|
+
const marked = typeof marker === 'string' && /^[a-f0-9]{64}$/.test(marker);
|
|
85
|
+
if (!marked && !legacy) {
|
|
86
|
+
if (marker) {
|
|
87
|
+
complete = false;
|
|
88
|
+
}
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const rawKey = typeof raw === 'string' && raw.length > 0 && raw.length <= 256 ? (0, exports.stationKey)(raw) : '';
|
|
92
|
+
if (marked && rawKey && rawKey !== marker) {
|
|
93
|
+
complete = false;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const key = marked ? marker : rawKey;
|
|
97
|
+
if (!key) {
|
|
98
|
+
complete = false;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (allow.size && !allow.has(key)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (known.has(key)) {
|
|
105
|
+
complete = false;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const reason = row['health.staleReason'];
|
|
109
|
+
const offline = row['health.online'] === false && (reason === 'socket-disconnected' || reason === 'no-ocpp-activity');
|
|
110
|
+
known.set(key, { key, offline });
|
|
111
|
+
}
|
|
112
|
+
return { known, complete, readFailed };
|
|
113
|
+
}
|
|
@@ -3,8 +3,11 @@ export interface ConnectionHealthOptions {
|
|
|
3
3
|
lastHeartbeatAt: number; heartbeatIntervalSec: number;
|
|
4
4
|
heartbeatTimeoutFactor: unknown; activityTimeoutSec: unknown;
|
|
5
5
|
}
|
|
6
|
+
export function hasConfirmedSessionActivity(entry: { lastBootAt?: number; lastHeartbeatAt?: number; lastStatusAt?: number; lastMeterAt?: number }): boolean;
|
|
6
7
|
export function deriveConnectionHealth(options: ConnectionHealthOptions): {
|
|
7
8
|
socketConnected: boolean; online: boolean; activityFresh: boolean; heartbeatAlive: boolean;
|
|
8
9
|
lastActivityAt: number; activityWindowMs: number; heartbeatWindowMs: number;
|
|
9
10
|
};
|
|
10
11
|
export function dataFreshForEos(online: boolean, powerFresh: boolean, safeZero: boolean): boolean;
|
|
12
|
+
|
|
13
|
+
export function activityTimeoutMs(intervalSec: unknown, heartbeatFactor: unknown, minimumSec: unknown): number;
|
|
@@ -42,6 +42,11 @@ function activityTimeoutMs(intervalSec, heartbeatFactor = 2.5, minimumSec = 90)
|
|
|
42
42
|
* disconnect. Any OCPP request/response can keep activityFresh true without
|
|
43
43
|
* falsifying heartbeatAlive.
|
|
44
44
|
*/
|
|
45
|
+
// Timestamps below are set by accepted OCPP activity. A WebSocket handshake alone has none.
|
|
46
|
+
function hasConfirmedSessionActivity(entry) {
|
|
47
|
+
return Boolean(entry && (entry.lastBootAt > 0 || entry.lastHeartbeatAt > 0 || entry.lastStatusAt > 0 || entry.lastMeterAt > 0));
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
function deriveConnectionHealth(options = {}) {
|
|
46
51
|
const now = Number.isFinite(Number(options.now)) ? Number(options.now) : Date.now();
|
|
47
52
|
const socketConnected = options.socketConnected === true;
|
|
@@ -253,6 +258,7 @@ module.exports = {
|
|
|
253
258
|
heartbeatTimeoutMs,
|
|
254
259
|
activityTimeoutMs,
|
|
255
260
|
deriveConnectionHealth,
|
|
261
|
+
hasConfirmedSessionActivity,
|
|
256
262
|
commandTimeoutMs,
|
|
257
263
|
isTriggerAccepted,
|
|
258
264
|
isTriggerUnsupported,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"component": "NexoWatt EOS embedded OCPP",
|
|
3
|
-
"integrationVersion": "9.0.
|
|
3
|
+
"integrationVersion": "9.0.35",
|
|
4
4
|
"moduleVersion": "0.4.4",
|
|
5
5
|
"name": "iobroker.ocpp21",
|
|
6
6
|
"version": "0.4.3",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"StrictTypeScript hosted lifecycle/configuration/dispatch boundary under MIT",
|
|
20
20
|
"Independent OCPP worker heartbeat and per-station EOS lease preserved",
|
|
21
21
|
"Bounded network admission/frames, authorization and generation fences, scoped aliases",
|
|
22
|
-
"Native configurations, units and station controls preserved; hosted namespaces plus legacy handover"
|
|
22
|
+
"Native configurations, units and station controls preserved; hosted namespaces plus legacy handover",
|
|
23
|
+
"Read-only dashboard view of confirmed station sessions with bounded output, pseudonymous keys and restoration of confirmed stations from native state history"
|
|
23
24
|
],
|
|
24
25
|
"excludedUpstreamFiles": [
|
|
25
26
|
"node_modules",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { EventEmitter } from 'node:events';
|
|
2
2
|
export interface RuntimeEntry {
|
|
3
3
|
client: unknown; socketConnected: boolean; proto: string; rawIdentity: string;
|
|
4
|
+
dashboardPreviouslyConfirmed: boolean; lastBootAt?: number; lastMeterAt?: number; lastStatusAt?: number;
|
|
4
5
|
connectedAt: number; lastHeartbeatAt: number; heartbeatIntervalSec: number; lastMessageAt: number; lastPowerAt: number; safeZeroAt: number; chargingState: string;
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|