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
|
@@ -31,8 +31,9 @@ async function endpoint(t) {
|
|
|
31
31
|
const words = fc === 16 ? Array.from({ length: arg }, (_, i) => frame.readUInt16BE(13 + 2*i)) : [];
|
|
32
32
|
trace.push({ uid, fc, addr, arg, words });
|
|
33
33
|
const unit = state.get(uid);
|
|
34
|
+
if (unit?.resetAt === addr) { socket.resetAndDestroy(); return; }
|
|
34
35
|
let reply;
|
|
35
|
-
if (!unit) reply = Buffer.from([fc | 128, 2]);
|
|
36
|
+
if (!unit || (fc === 3 && unit?.unsupported === addr)) reply = Buffer.from([fc | 128, 2]);
|
|
36
37
|
else if (fc === 3) {
|
|
37
38
|
const values = addr === 100 && arg === 1 ? [unit.open ? 1 : 0] :
|
|
38
39
|
unit.open ? Array.from({length: arg}, (_, i) => unit.values.get(addr+i) ?? 0) : null;
|
|
@@ -87,6 +88,44 @@ test('MIRA sends unit-specific login using FC16, reads real WPM power and confir
|
|
|
87
88
|
assert.equal(ep.trace.length,before);
|
|
88
89
|
});
|
|
89
90
|
|
|
91
|
+
test('MIRA retries the meter after a TCP reset while keeping a genuine illegal optional register on cooldown', async t => {
|
|
92
|
+
const ep = await endpoint(t);
|
|
93
|
+
const wpm = ep.unit(111, true);
|
|
94
|
+
const { driver, dp } = device('wpm', { ...ep.connection, unitId: 111, timeoutMs: 250, writePassword: '' });
|
|
95
|
+
t.after(() => driver.disconnect());
|
|
96
|
+
const meter = dp('measurement.electricalPowerW');
|
|
97
|
+
const name = dp('info.unitName');
|
|
98
|
+
const snapshot = [name, meter];
|
|
99
|
+
const watts = Buffer.alloc(4);
|
|
100
|
+
watts.writeFloatBE(1.75);
|
|
101
|
+
wpm.values.set(56021, watts.readUInt16BE(0));
|
|
102
|
+
wpm.values.set(56022, watts.readUInt16BE(2));
|
|
103
|
+
wpm.unsupported = 56000;
|
|
104
|
+
const count = addr => ep.trace.filter(r => r.fc === 3 && r.addr === addr).length;
|
|
105
|
+
|
|
106
|
+
assert.deepEqual(await driver.readDatapoints(snapshot), { [meter.id]: 1750 });
|
|
107
|
+
assert.equal(count(56000), 1);
|
|
108
|
+
|
|
109
|
+
wpm.resetAt = 56021;
|
|
110
|
+
await assert.rejects(driver.readDatapoints(snapshot));
|
|
111
|
+
assert.equal(count(56021), 2, 'one read, no in-poll retry');
|
|
112
|
+
wpm.resetAt = undefined;
|
|
113
|
+
assert.deepEqual(await driver.readDatapoints(snapshot), { [meter.id]: 1750 });
|
|
114
|
+
assert.equal(count(56021), 3, 'first subsequent poll reads the meter again');
|
|
115
|
+
assert.equal(count(56000), 1, 'the device explicitly rejected the optional register');
|
|
116
|
+
|
|
117
|
+
const secured = device('wpm', { ...ep.connection, unitId: 111, timeoutMs: 250 });
|
|
118
|
+
t.after(() => secured.driver.disconnect());
|
|
119
|
+
wpm.resetAt = 101;
|
|
120
|
+
await assert.rejects(secured.driver.readDatapoints([meter]), error => {
|
|
121
|
+
assert.ok(['ETIMEDOUT', 'ERR_SOCKET_CLOSED', 'EPIPE', 'ECONNRESET'].includes(error.code));
|
|
122
|
+
assert.doesNotMatch(error.message, /abcd|1234/i);
|
|
123
|
+
return true;
|
|
124
|
+
});
|
|
125
|
+
wpm.resetAt = undefined;
|
|
126
|
+
assert.deepEqual(await secured.driver.readDatapoints([meter]), { [meter.id]: 1750 });
|
|
127
|
+
});
|
|
128
|
+
|
|
90
129
|
test('MIRA requires each login to be confirmed, rate-limits rejection and suppresses writes after authorization loss or mismatched readback', async t => {
|
|
91
130
|
const ep=await endpoint(t), unit=ep.unit(110);
|
|
92
131
|
const bad=device('hsm',{...ep.connection,writePassword:'9876543'}), no=device('hsm',{...ep.connection,writePassword:''});
|
package/modules/eebus/README.md
CHANGED
|
@@ -11,3 +11,11 @@ Eine übernehmbare private Geräteidentität wird erst nach bestätigtem Stillst
|
|
|
11
11
|
Der manuelle Konfigurationsimport bleibt absichtlich deaktiviert, erzeugt neue IDs unter `eos-admin.N.eebus.*` und erfordert neue Kopplung. Er ist kein automatischer 1:1-Import. Nach abgeschlossener automatischer Migration nicht zusätzlich manuell importieren.
|
|
12
12
|
|
|
13
13
|
Ablauf, Journal, Fehlercodes, RPC-Grenzen, Sicherung und Rückfall: `docs/unified/BESTANDSUEBERNAHME_9_0_7.md` im Gesamt-Repository. Softwaretests prüfen tatsächliche Schlüsselpaare und lokale TLS-Verbindungen; reale Geräte-, Anlagen- und Serienabnahmen bleiben erforderlich. Diese Angaben sind keine EEBus-/CRA-Zertifizierung.
|
|
14
|
+
|
|
15
|
+
## Partner im Dashboard überwachen (ab EOS 9.0.35)
|
|
16
|
+
|
|
17
|
+
Unter **EEBus → Geräte** den Partner koppeln und den erfolgreichen SHIP-Datenaustausch abwarten. In seiner Karte einen lokalen Anzeigenamen wie „Wärmepumpe West“ eingeben und **Überwachung aktivieren** wählen. Anmeldung am Netzwerk, mDNS-Erkennung oder Kopplung alleine erzeugen keine Überwachungszuordnung. Die Aktivierung speichert eine lokale Einstellung. Sie sendet keinen Steuer- oder Verbindungsbefehl an den Partner.
|
|
18
|
+
|
|
19
|
+
Die Anzeige überwacht die autorisierte SHIP-Verbindung. Nach ihrem Verlust meldet EOS den lokal vergebenen Namen. Bei Neustart des EEBus-Moduls hat ein zuvor überwachter Partner 120 Sekunden zum Wiederverbinden. Bis dahin ist sein Verbindungsstatus unbekannt. Bei der tatsächlichen Rückkehr des Datenaustauschs bestätigt EOS die Verbindung erneut. „Trennen“, ein Widerruf der Freigabe oder eine geänderte Zertifikatsbindung pausiert die Überwachung auch über einen Neustart hinweg. Nach erneut bestätigter Kopplung mit **Überwachung aktivieren** fortsetzen. Über **Überwachung entfernen** lässt sich ein gespeicherter Partner auch ohne aktuelle Verbindung austragen.
|
|
20
|
+
|
|
21
|
+
Die Anzeige beschreibt den Verbindungszustand. Der lokale Betriebszustand des angeschlossenen Geräts kann davon abweichen.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/** @param {string} id @returns {HTMLInputElement} */
|
|
8
8
|
const inputElement = id => { const found = element(id); if (!(found instanceof HTMLInputElement)) throw new Error('EEBUS_UI_INPUT'); return found; };
|
|
9
9
|
/** @typedef {[string, string, 'checkbox'|'number'|'text'|'password', boolean|number|string, number?, number?]} Field */
|
|
10
|
-
/** @typedef {{id:string,name:string,ski:string,fingerprint:string,trusted:boolean,state:string}} Device */
|
|
10
|
+
/** @typedef {{id:string,name:string,ski:string,fingerprint:string,trusted:boolean,state:string,canMonitor:boolean,monitorPaused:boolean,monitorName:string}} Device */
|
|
11
11
|
/** @typedef {{running:boolean,shipPort:number|undefined,commandDryRun:boolean,localSki:string,certificateFingerprint:string,devices:Device[]}} Details */
|
|
12
12
|
/** @typedef {{csrfToken?:string,configurationRevision?:string,config:Record<string,unknown>,status:{reason:string,state:string,details:Details}}} ApiData */
|
|
13
13
|
/** @param {unknown} value @returns {value is Record<string,unknown>} */
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
const data = record(status.details) ? status.details : status;
|
|
22
22
|
const devices = (Array.isArray(data.devices) ? data.devices.slice(0, 128) : []).filter(record).map(device => ({
|
|
23
23
|
id: String(device.id || ''), name: String(device.name || ''), ski: String(device.ski || ''),
|
|
24
|
-
fingerprint: String(device.fingerprint || ''), trusted: device.trusted === true, state: String(device.state || '')
|
|
24
|
+
fingerprint: String(device.fingerprint || ''), trusted: device.trusted === true, state: String(device.state || ''),
|
|
25
|
+
canMonitor: device.canMonitor === true, monitorPaused: device.monitorPaused === true, monitorName: String(device.monitorName || '') }));
|
|
25
26
|
return { csrfToken: typeof raw.csrfToken === 'string' ? raw.csrfToken : undefined,
|
|
26
27
|
configurationRevision: typeof raw.configurationRevision === 'string' ? raw.configurationRevision : undefined,
|
|
27
28
|
config: record(raw.config) ? raw.config : {}, status: { reason: String(status.reason || ''), state: String(status.state || ''),
|
|
@@ -138,6 +139,32 @@
|
|
|
138
139
|
await render(); message('Geräteaktion verarbeitet.');
|
|
139
140
|
})); card.append(button);
|
|
140
141
|
}
|
|
142
|
+
const monitor = document.createElement('fieldset');
|
|
143
|
+
const legend = document.createElement('legend'); legend.textContent = 'Dauerhafte Verbindungsüberwachung'; monitor.append(legend);
|
|
144
|
+
const monitorState = document.createElement('p');
|
|
145
|
+
monitorState.textContent = device.monitorName
|
|
146
|
+
? (device.monitorPaused ? 'Überwachung pausiert. Nach dem Verbinden hier erneut aktivieren.' : 'Aktiv · ' + device.monitorName)
|
|
147
|
+
: 'Aus. Die Überwachung kann nach erfolgreichem, freigegebenem SHIP-Datenaustausch aktiviert werden.';
|
|
148
|
+
monitor.append(monitorState);
|
|
149
|
+
const label = document.createElement('label'); label.textContent = 'Anzeigename in Dashboard und Benachrichtigungen ';
|
|
150
|
+
const displayName = document.createElement('input'); displayName.type = 'text'; displayName.maxLength = 64;
|
|
151
|
+
displayName.value = device.monitorName; displayName.placeholder = 'z. B. Wärmepumpe West'; label.append(displayName); monitor.append(label);
|
|
152
|
+
const apply = document.createElement('button'); apply.type = 'button';
|
|
153
|
+
apply.disabled = !details.running || !device.canMonitor || !device.trusted;
|
|
154
|
+
apply.textContent = !device.monitorName || device.monitorPaused ? 'Überwachung aktivieren' : 'Anzeigenamen speichern';
|
|
155
|
+
apply.addEventListener('click', () => operation(async () => {
|
|
156
|
+
const name = displayName.value.trim(); if (!name) throw new Error('Bitte einen lokalen Anzeigenamen eingeben.');
|
|
157
|
+
await request('/command','POST',{command:'device.monitor',payload:{deviceId:device.id,enabled:true,name}});
|
|
158
|
+
await render(); message('Überwachung gespeichert.');
|
|
159
|
+
})); monitor.append(apply);
|
|
160
|
+
if (device.monitorName) {
|
|
161
|
+
const clear = document.createElement('button'); clear.type = 'button'; clear.textContent = 'Überwachung entfernen'; clear.disabled = !details.running;
|
|
162
|
+
clear.addEventListener('click', () => operation(async () => {
|
|
163
|
+
await request('/command','POST',{command:'device.monitor',payload:{deviceId:device.id,enabled:false}});
|
|
164
|
+
await render(); message('Überwachung entfernt.');
|
|
165
|
+
})); monitor.append(clear);
|
|
166
|
+
}
|
|
167
|
+
card.append(monitor);
|
|
141
168
|
list.append(card);
|
|
142
169
|
}
|
|
143
170
|
}
|
|
@@ -5,6 +5,7 @@ exports.validateConfig = validateConfig;
|
|
|
5
5
|
exports.migrateLegacyConfig = migrateLegacyConfig;
|
|
6
6
|
exports.preflightLegacyConfig = preflightLegacyConfig;
|
|
7
7
|
exports.createHostedModule = createHostedModule;
|
|
8
|
+
const partnerMonitor_1 = require("./lib/partnerMonitor");
|
|
8
9
|
const config_1 = require("./lib/config");
|
|
9
10
|
const eebusRuntime_1 = require("./lib/eebusRuntime");
|
|
10
11
|
const identityManager_1 = require("./lib/identityManager");
|
|
@@ -159,15 +160,25 @@ function createHostedModule(options) {
|
|
|
159
160
|
async command(name, payload) {
|
|
160
161
|
if (!running || !runtime || stopping || !options.canOperate())
|
|
161
162
|
throw new Error('EEBUS_NOT_RUNNING');
|
|
162
|
-
if (!actions
|
|
163
|
+
if ((!Object.hasOwn(actions, name) && name !== 'device.monitor') || !payload || typeof payload !== 'object' || Array.isArray(payload))
|
|
163
164
|
throw new Error('EEBUS_COMMAND_INVALID');
|
|
164
165
|
const deviceId = payload.deviceId;
|
|
165
|
-
if (typeof deviceId !== 'string' || !/^[A-Fa-f0-9]{40}$/.test(deviceId)
|
|
166
|
+
if (typeof deviceId !== 'string' || !/^[A-Fa-f0-9]{40}$/.test(deviceId))
|
|
167
|
+
throw new Error('EEBUS_DEVICE_UNKNOWN');
|
|
168
|
+
const observed = runtime.getNodes().some(node => node.safeId === deviceId);
|
|
169
|
+
if (!observed && !(name === 'device.monitor' && runtime.partnerMonitor.list().some(peer => peer.id === deviceId)))
|
|
166
170
|
throw new Error('EEBUS_DEVICE_UNKNOWN');
|
|
167
171
|
if (inFlight >= 16)
|
|
168
172
|
throw new Error('EEBUS_COMMAND_BUSY');
|
|
169
173
|
inFlight++;
|
|
170
174
|
try {
|
|
175
|
+
if (name === 'device.monitor') {
|
|
176
|
+
const data = payload;
|
|
177
|
+
if (typeof data.enabled !== 'boolean')
|
|
178
|
+
throw new Error('EEBUS_COMMAND_INVALID');
|
|
179
|
+
await runtime.partnerMonitor.configure(deviceId, data.name, data.enabled);
|
|
180
|
+
return { accepted: options.canOperate() && !stopping };
|
|
181
|
+
}
|
|
171
182
|
await runtime.handleStateChange(`${adapter.namespace}.devices.${deviceId}.${actions[name]}`, { val: true, ack: false, ts: Date.now(), lc: Date.now(), from: adapter.namespace });
|
|
172
183
|
return { accepted: options.canOperate() && !stopping };
|
|
173
184
|
}
|
|
@@ -175,7 +186,13 @@ function createHostedModule(options) {
|
|
|
175
186
|
inFlight--;
|
|
176
187
|
}
|
|
177
188
|
},
|
|
189
|
+
getDashboardDeviceHealth() {
|
|
190
|
+
if (!running || stopping || !runtime || !options.canOperate())
|
|
191
|
+
return (0, partnerMonitor_1.emptyReport)(selected.enabled === false);
|
|
192
|
+
return runtime.partnerMonitor.report();
|
|
193
|
+
},
|
|
178
194
|
async getStatus() {
|
|
195
|
+
const monitored = new Map((runtime?.partnerMonitor.list() || []).map(p => [p.id, p]));
|
|
179
196
|
const nodes = runtime?.getNodes() || [];
|
|
180
197
|
const devices = [];
|
|
181
198
|
for (const node of nodes.slice(0, 128)) {
|
|
@@ -184,9 +201,17 @@ function createHostedModule(options) {
|
|
|
184
201
|
adapter.getStateAsync(`devices.${node.safeId}.connection.shipState`),
|
|
185
202
|
adapter.getStateAsync(`devices.${node.safeId}.pairing.remoteFingerprint`),
|
|
186
203
|
]);
|
|
187
|
-
|
|
204
|
+
const entry = monitored.get(node.safeId);
|
|
205
|
+
monitored.delete(node.safeId);
|
|
206
|
+
devices.push({ monitorName: entry?.name || '', monitorPaused: entry?.paused === true, canMonitor: runtime?.canMonitorPartner(node.safeId) === true,
|
|
207
|
+
id: node.safeId, name: node.name.slice(0, 128), ski: node.ski, fingerprint: String(fingerprint?.val || ''),
|
|
188
208
|
trusted: trust?.val === true, connected: connection?.val === 'data-exchange', state: String(connection?.val || 'discovered') });
|
|
189
209
|
}
|
|
210
|
+
// A monitored peer can be removed here even before it advertises after a restart.
|
|
211
|
+
for (const entry of monitored.values())
|
|
212
|
+
devices.push({ id: entry.id, name: entry.name, ski: entry.id, fingerprint: '',
|
|
213
|
+
trusted: false, connected: false, state: 'Nicht verbunden', monitorName: entry.name, monitorPaused: entry.paused, canMonitor: false });
|
|
214
|
+
devices.sort((a, b) => Number(!!b.monitorName) - Number(!!a.monitorName));
|
|
190
215
|
return { running, localSki: identity?.localSki || '', certificateFingerprint: identity?.certificateFingerprint || '',
|
|
191
216
|
shipPort: config.shipPort, commandDryRun: config.commandDryRun, devices };
|
|
192
217
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EebusRuntime = void 0;
|
|
4
|
+
const partnerMonitor_1 = require("./partnerMonitor");
|
|
4
5
|
const discoveryService_1 = require("./discoveryService");
|
|
5
6
|
const shipEndpoint_1 = require("./shipEndpoint");
|
|
6
7
|
const spineParser_1 = require("./spineParser");
|
|
@@ -14,6 +15,7 @@ class EebusRuntime {
|
|
|
14
15
|
config;
|
|
15
16
|
identity;
|
|
16
17
|
objectFactory;
|
|
18
|
+
partnerMonitor;
|
|
17
19
|
nodes = new Map();
|
|
18
20
|
discovery;
|
|
19
21
|
endpoint;
|
|
@@ -34,9 +36,11 @@ class EebusRuntime {
|
|
|
34
36
|
this.identity = identity;
|
|
35
37
|
this.objectFactory = objectFactory;
|
|
36
38
|
this.autoAcceptNewDevices = config.autoAcceptNewDevices;
|
|
39
|
+
this.partnerMonitor = new partnerMonitor_1.PartnerMonitor(adapter, id => this.canMonitorPartner(id));
|
|
37
40
|
}
|
|
38
41
|
async start() {
|
|
39
42
|
this.stopping = false;
|
|
43
|
+
await this.partnerMonitor.load();
|
|
40
44
|
this.endpoint = new shipEndpoint_1.ShipEndpoint(this.adapter, { ...this.config, autoAcceptNewDevices: this.autoAcceptNewDevices }, this.identity, async (deviceId, message) => this.handleIncomingMessage(deviceId, message), async (node) => this.handleDiscoveredNode(node), async (deviceId, state, role, connected, error) => this.handleConnectionState(deviceId, state, role, connected, error), async (deviceId) => this.handleDataExchangeReady(deviceId), async (deviceId, request) => this.handlePairingRequest(deviceId, request), async (deviceId) => this.isTrusted(deviceId));
|
|
41
45
|
const endpointStarted = await this.endpoint.start();
|
|
42
46
|
if (this.config.shipServerEnabled && !endpointStarted)
|
|
@@ -108,11 +112,14 @@ class EebusRuntime {
|
|
|
108
112
|
async handleStateChange(id, state) {
|
|
109
113
|
if (id.endsWith('.pairing.trusted') || id.endsWith('.pairing.pinnedFingerprint')) {
|
|
110
114
|
const match = id.match(/devices\.([^.]+)\.pairing\./);
|
|
111
|
-
if (match && id.endsWith('.pinnedFingerprint'))
|
|
115
|
+
if (match && id.endsWith('.pinnedFingerprint')) {
|
|
112
116
|
this.endpoint?.invalidateCertificate(match[1], state?.val);
|
|
117
|
+
await this.partnerMonitor.pinChanged(match[1], state?.val);
|
|
118
|
+
}
|
|
113
119
|
if (match && (!state || (id.endsWith('.trusted') && state.val !== true))) {
|
|
114
120
|
this.trustCache.delete(match[1]);
|
|
115
121
|
this.endpoint?.disconnect(match[1]);
|
|
122
|
+
await this.partnerMonitor.pause(match[1]);
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
125
|
if (!state || state.ack || this.stopping || this.adapter.canOperate?.() === false)
|
|
@@ -134,8 +141,11 @@ class EebusRuntime {
|
|
|
134
141
|
return;
|
|
135
142
|
}
|
|
136
143
|
if (command.channel === 'control' && command.stateName === 'disconnect') {
|
|
137
|
-
if (Boolean(command.value))
|
|
144
|
+
if (Boolean(command.value)) {
|
|
145
|
+
const paused = this.partnerMonitor.pause(command.deviceId);
|
|
138
146
|
this.endpoint?.disconnect(command.deviceId);
|
|
147
|
+
await paused;
|
|
148
|
+
}
|
|
139
149
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.control.disconnect`, { val: false, ack: true });
|
|
140
150
|
return;
|
|
141
151
|
}
|
|
@@ -166,6 +176,7 @@ class EebusRuntime {
|
|
|
166
176
|
}
|
|
167
177
|
else {
|
|
168
178
|
this.endpoint?.rejectDevice(command.deviceId);
|
|
179
|
+
await this.partnerMonitor.pause(command.deviceId);
|
|
169
180
|
}
|
|
170
181
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.pairing.approve`, { val: false, ack: true });
|
|
171
182
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.pairing.reject`, { val: false, ack: true });
|
|
@@ -238,6 +249,7 @@ class EebusRuntime {
|
|
|
238
249
|
await this.objectFactory.publishGlobalPairingCounts(Array.from(this.nodes.keys()));
|
|
239
250
|
}
|
|
240
251
|
async handleDataExchangeReady(deviceId) {
|
|
252
|
+
this.partnerMonitor.observed(deviceId);
|
|
241
253
|
// Prime the trust decision before the first time-critical CLS write arrives.
|
|
242
254
|
// The control path can then use the in-memory cache without an object DB read.
|
|
243
255
|
if (!this.trustCache.has(deviceId)) {
|
|
@@ -840,6 +852,9 @@ class EebusRuntime {
|
|
|
840
852
|
},
|
|
841
853
|
};
|
|
842
854
|
}
|
|
855
|
+
canMonitorPartner(id) {
|
|
856
|
+
return !this.stopping && this.adapter.canOperate?.() !== false && this.endpoint?.hasAuthorizedExchange(id) === true;
|
|
857
|
+
}
|
|
843
858
|
getNodes() { return Array.from(this.nodes.values()).map(node => ({ ...node })); }
|
|
844
859
|
periodic(key, work) {
|
|
845
860
|
if (this.stopping || this.busy.has(key))
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PartnerMonitor = void 0;
|
|
4
|
+
exports.emptyReport = emptyReport;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const objectId = 'pairing.monitoredPartners';
|
|
7
|
+
const startupGraceMs = 120_000;
|
|
8
|
+
const pinValue = (v) => typeof v === 'string' && /^[a-f0-9]{64}$/i.test(v.replace(/:/g, '')) ? v.replace(/:/g, '').toUpperCase() : '';
|
|
9
|
+
function friendlyName(value) {
|
|
10
|
+
return typeof value === 'string' && value === value.trim() && value.length <= 64 &&
|
|
11
|
+
/\p{L}/u.test(value) && /^[\p{L}\p{M}\p{N} _()-]+$/u.test(value) &&
|
|
12
|
+
!/[a-f\d]{16,}|(?:[a-f\d]{2}-){5}[a-f\d]{2}/i.test(value) && !/\d{9,}/.test(value);
|
|
13
|
+
}
|
|
14
|
+
const safeId = (v) => typeof v === 'string' && /^[a-f\d]{40}$/i.test(v);
|
|
15
|
+
const key = (id) => (0, node_crypto_1.createHash)('sha256').update('eebus:' + id.toLowerCase()).digest('hex');
|
|
16
|
+
function emptyReport(known) {
|
|
17
|
+
return { state: known ? 'ok' : 'unknown', offline: [], totalOffline: 0,
|
|
18
|
+
tracked: [], complete: known };
|
|
19
|
+
}
|
|
20
|
+
/** Names are local installer input. Discovery metadata, peer addresses and certificates never feed the customer report. */
|
|
21
|
+
class PartnerMonitor {
|
|
22
|
+
store;
|
|
23
|
+
live;
|
|
24
|
+
now;
|
|
25
|
+
partners = new Map();
|
|
26
|
+
confirmed = new Set();
|
|
27
|
+
suppressed = new Set();
|
|
28
|
+
known = false;
|
|
29
|
+
startedAt = 0;
|
|
30
|
+
pending = Promise.resolve();
|
|
31
|
+
constructor(store, live, now = () => performance.now()) {
|
|
32
|
+
this.store = store;
|
|
33
|
+
this.live = live;
|
|
34
|
+
this.now = now;
|
|
35
|
+
}
|
|
36
|
+
async load() {
|
|
37
|
+
this.startedAt = this.now();
|
|
38
|
+
try {
|
|
39
|
+
const state = await this.store.getStateAsync(objectId);
|
|
40
|
+
if (state?.ack === false)
|
|
41
|
+
throw Error();
|
|
42
|
+
const rows = state?.val == null ? [] : JSON.parse(String(state.val));
|
|
43
|
+
if (!Array.isArray(rows) || rows.length > 128)
|
|
44
|
+
throw Error();
|
|
45
|
+
const restored = new Map();
|
|
46
|
+
for (const item of rows) {
|
|
47
|
+
if (!item || !safeId(item.id) || !friendlyName(item.name) || !pinValue(item.pin) || typeof item.paused !== 'boolean' || restored.has(item.id))
|
|
48
|
+
throw Error();
|
|
49
|
+
const row = { id: item.id.toUpperCase(), key: key(item.id), name: item.name, pin: pinValue(item.pin), paused: item.paused };
|
|
50
|
+
if (restored.has(row.id))
|
|
51
|
+
throw Error();
|
|
52
|
+
restored.set(row.id, row);
|
|
53
|
+
}
|
|
54
|
+
// Verify locally approved pairing on restart even when the peer is currently absent.
|
|
55
|
+
const monitored = Array.from(restored.values()).filter(row => !row.paused);
|
|
56
|
+
let changed = false;
|
|
57
|
+
for (let start = 0; start < monitored.length; start += 8) {
|
|
58
|
+
await Promise.all(monitored.slice(start, start + 8).map(async (row) => {
|
|
59
|
+
if (await this.trustedPin(row.id) !== row.pin) {
|
|
60
|
+
row.paused = true;
|
|
61
|
+
changed = true;
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (changed)
|
|
66
|
+
await this.save(restored);
|
|
67
|
+
else
|
|
68
|
+
this.partners = restored;
|
|
69
|
+
this.known = true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
this.known = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async trustedPin(id) {
|
|
76
|
+
const [trust, pin] = await Promise.all(['trusted', 'pinnedFingerprint'].map(field => this.store.getStateAsync('devices.' + id + '.pairing.' + field)));
|
|
77
|
+
return trust?.val === true && trust.ack !== false && pin?.ack !== false ? pinValue(pin?.val) : '';
|
|
78
|
+
}
|
|
79
|
+
change(write) {
|
|
80
|
+
const op = this.pending.then(write);
|
|
81
|
+
this.pending = op.catch(() => { });
|
|
82
|
+
return op;
|
|
83
|
+
}
|
|
84
|
+
async save(next) {
|
|
85
|
+
await this.store.setStateAsync(objectId, { val: JSON.stringify(Array.from(next.values(), ({ id, name, pin, paused }) => ({ id, name, pin, paused }))), ack: true });
|
|
86
|
+
this.partners = next;
|
|
87
|
+
}
|
|
88
|
+
async configure(id, name, enabled) {
|
|
89
|
+
if (!safeId(id))
|
|
90
|
+
throw new Error('EEBUS_MONITOR_DEVICE');
|
|
91
|
+
id = id.toUpperCase();
|
|
92
|
+
return this.change(async () => {
|
|
93
|
+
if (!this.known)
|
|
94
|
+
throw new Error('EEBUS_MONITOR_STORAGE_UNAVAILABLE');
|
|
95
|
+
const next = new Map(this.partners);
|
|
96
|
+
if (enabled) {
|
|
97
|
+
if (!friendlyName(name))
|
|
98
|
+
throw new Error('EEBUS_MONITOR_LOCAL_NAME');
|
|
99
|
+
const pin = this.live(id) ? await this.trustedPin(id) : '';
|
|
100
|
+
if (!pin || !this.live(id))
|
|
101
|
+
throw new Error('EEBUS_MONITOR_PAIRED_SESSION_REQUIRED');
|
|
102
|
+
if (!next.has(id) && next.size >= 128)
|
|
103
|
+
throw new Error('EEBUS_MONITOR_CAPACITY');
|
|
104
|
+
next.set(id, { id, key: key(id), name, pin, paused: false });
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
next.delete(id);
|
|
108
|
+
}
|
|
109
|
+
await this.save(next);
|
|
110
|
+
if (enabled)
|
|
111
|
+
this.confirmed.add(id);
|
|
112
|
+
else
|
|
113
|
+
this.confirmed.delete(id);
|
|
114
|
+
this.suppressed.delete(id);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
pinChanged(id, value) {
|
|
118
|
+
const row = this.partners.get(id.toUpperCase());
|
|
119
|
+
return row && !row.paused && row.pin !== pinValue(value) ? this.pause(id) : Promise.resolve();
|
|
120
|
+
}
|
|
121
|
+
pause(id) {
|
|
122
|
+
id = id.toUpperCase();
|
|
123
|
+
this.suppressed.add(id);
|
|
124
|
+
return this.change(async () => {
|
|
125
|
+
const row = this.partners.get(id);
|
|
126
|
+
if (row && !row.paused) {
|
|
127
|
+
const next = new Map(this.partners);
|
|
128
|
+
next.set(id, { ...row, paused: true });
|
|
129
|
+
await this.save(next);
|
|
130
|
+
}
|
|
131
|
+
this.suppressed.delete(id);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
observed(id) { if (this.partners.has(id.toUpperCase()) && this.live(id))
|
|
135
|
+
this.confirmed.add(id.toUpperCase()); }
|
|
136
|
+
list() { return Array.from(this.partners.values(), ({ id, name, paused }) => ({ id, name, paused })); }
|
|
137
|
+
report() {
|
|
138
|
+
const report = emptyReport(this.known);
|
|
139
|
+
if (!this.known)
|
|
140
|
+
return report;
|
|
141
|
+
for (const row of this.partners.values()) {
|
|
142
|
+
const active = this.live(row.id);
|
|
143
|
+
const state = row.paused || this.suppressed.has(row.id) ? 'disabled' : active ? 'online' :
|
|
144
|
+
this.confirmed.has(row.id) || this.now() - this.startedAt >= startupGraceMs ? 'offline' : 'unknown';
|
|
145
|
+
if (state === 'online')
|
|
146
|
+
this.confirmed.add(row.id);
|
|
147
|
+
report.tracked.push({ key: row.key, name: row.name, state });
|
|
148
|
+
if (state === 'unknown' && report.state === 'ok')
|
|
149
|
+
report.state = 'unknown';
|
|
150
|
+
if (state === 'offline') {
|
|
151
|
+
report.state = 'fault';
|
|
152
|
+
report.totalOffline++;
|
|
153
|
+
if (report.offline.length < 12)
|
|
154
|
+
report.offline.push({ name: row.name });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return report;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.PartnerMonitor = PartnerMonitor;
|
|
@@ -211,6 +211,10 @@ class ShipEndpoint {
|
|
|
211
211
|
if (session && fingerprint !== session.remoteFingerprint)
|
|
212
212
|
this.disconnect(deviceId);
|
|
213
213
|
}
|
|
214
|
+
hasAuthorizedExchange(deviceId) {
|
|
215
|
+
const peer = this.sessions.get(deviceId);
|
|
216
|
+
return !!peer?.authorized && peer.dataExchangeReady && this.isSocketOpen(peer.socket) && !this.stopping;
|
|
217
|
+
}
|
|
214
218
|
hasObservedPeer(deviceId) {
|
|
215
219
|
const session = this.sessions.get(deviceId);
|
|
216
220
|
return !!session?.remoteFingerprint && this.isSocketOpen(session.socket);
|
|
@@ -27,6 +27,7 @@ exports.discoveryStates = [
|
|
|
27
27
|
{ id: 'lastDiscovery', name: 'Last discovery event', type: 'string', role: 'json', read: true, write: false },
|
|
28
28
|
];
|
|
29
29
|
exports.globalPairingStates = [
|
|
30
|
+
{ id: 'monitoredPartners', name: 'Installer-configured EEBus partner supervision', type: 'string', role: 'json', read: true, write: false, def: '[]' },
|
|
30
31
|
{
|
|
31
32
|
id: 'autoAcceptNewDevices',
|
|
32
33
|
name: 'Auto accept new devices for field testing',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { emptyReport } from './lib/partnerMonitor';
|
|
1
2
|
import { EebusConfig, getConfig } from './lib/config';
|
|
2
3
|
import { EebusRuntime } from './lib/eebusRuntime';
|
|
3
4
|
import { IdentityManager } from './lib/identityManager';
|
|
@@ -130,17 +131,30 @@ export function createHostedModule(options: Options) {
|
|
|
130
131
|
},
|
|
131
132
|
async command(name: string, payload: unknown): Promise<{ accepted: boolean }> {
|
|
132
133
|
if (!running || !runtime || stopping || !options.canOperate()) throw new Error('EEBUS_NOT_RUNNING');
|
|
133
|
-
if (!actions
|
|
134
|
+
if ((!Object.hasOwn(actions,name) && name !== 'device.monitor') || !payload || typeof payload !== 'object' || Array.isArray(payload)) throw new Error('EEBUS_COMMAND_INVALID');
|
|
134
135
|
const deviceId = (payload as Record<string, unknown>).deviceId;
|
|
135
|
-
if (typeof deviceId !== 'string' || !/^[A-Fa-f0-9]{40}$/.test(deviceId)
|
|
136
|
+
if (typeof deviceId !== 'string' || !/^[A-Fa-f0-9]{40}$/.test(deviceId)) throw new Error('EEBUS_DEVICE_UNKNOWN');
|
|
137
|
+
const observed = runtime.getNodes().some(node => node.safeId === deviceId);
|
|
138
|
+
if (!observed && !(name === 'device.monitor' && runtime.partnerMonitor.list().some(peer => peer.id === deviceId))) throw new Error('EEBUS_DEVICE_UNKNOWN');
|
|
136
139
|
if (inFlight >= 16) throw new Error('EEBUS_COMMAND_BUSY');
|
|
137
140
|
inFlight++;
|
|
138
141
|
try {
|
|
142
|
+
if (name === 'device.monitor') {
|
|
143
|
+
const data = payload as Record<string,unknown>;
|
|
144
|
+
if (typeof data.enabled !== 'boolean') throw new Error('EEBUS_COMMAND_INVALID');
|
|
145
|
+
await runtime.partnerMonitor.configure(deviceId, data.name, data.enabled);
|
|
146
|
+
return { accepted: options.canOperate() && !stopping };
|
|
147
|
+
}
|
|
139
148
|
await runtime.handleStateChange(`${adapter.namespace}.devices.${deviceId}.${actions[name]}`, { val: true, ack: false, ts: Date.now(), lc: Date.now(), from: adapter.namespace });
|
|
140
149
|
return { accepted: options.canOperate() && !stopping };
|
|
141
150
|
} finally { inFlight--; }
|
|
142
151
|
},
|
|
152
|
+
getDashboardDeviceHealth() {
|
|
153
|
+
if (!running || stopping || !runtime || !options.canOperate()) return emptyReport(selected.enabled === false);
|
|
154
|
+
return runtime.partnerMonitor.report();
|
|
155
|
+
},
|
|
143
156
|
async getStatus() {
|
|
157
|
+
const monitored = new Map((runtime?.partnerMonitor.list() || []).map(p=>[p.id,p]));
|
|
144
158
|
const nodes = runtime?.getNodes() || [];
|
|
145
159
|
const devices = [];
|
|
146
160
|
for (const node of nodes.slice(0, 128)) {
|
|
@@ -149,9 +163,15 @@ export function createHostedModule(options: Options) {
|
|
|
149
163
|
adapter.getStateAsync(`devices.${node.safeId}.connection.shipState`),
|
|
150
164
|
adapter.getStateAsync(`devices.${node.safeId}.pairing.remoteFingerprint`),
|
|
151
165
|
]);
|
|
152
|
-
|
|
166
|
+
const entry=monitored.get(node.safeId); monitored.delete(node.safeId);
|
|
167
|
+
devices.push({ monitorName:entry?.name || '', monitorPaused:entry?.paused === true, canMonitor:runtime?.canMonitorPartner(node.safeId) === true,
|
|
168
|
+
id: node.safeId, name: node.name.slice(0, 128), ski: node.ski, fingerprint: String(fingerprint?.val || ''),
|
|
153
169
|
trusted: trust?.val === true, connected: connection?.val === 'data-exchange', state: String(connection?.val || 'discovered') });
|
|
154
170
|
}
|
|
171
|
+
// A monitored peer can be removed here even before it advertises after a restart.
|
|
172
|
+
for (const entry of monitored.values()) devices.push({ id:entry.id, name:entry.name, ski:entry.id, fingerprint:'',
|
|
173
|
+
trusted:false, connected:false, state:'Nicht verbunden', monitorName:entry.name, monitorPaused:entry.paused, canMonitor:false });
|
|
174
|
+
devices.sort((a,b)=>Number(!!b.monitorName)-Number(!!a.monitorName));
|
|
155
175
|
return { running, localSki: identity?.localSki || '', certificateFingerprint: identity?.certificateFingerprint || '',
|
|
156
176
|
shipPort: config.shipPort, commandDryRun: config.commandDryRun, devices };
|
|
157
177
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PartnerMonitor } from './partnerMonitor';
|
|
1
2
|
import { EebusConfig } from './config';
|
|
2
3
|
import { DiscoveryService } from './discoveryService';
|
|
3
4
|
import { DeviceClass, DeviceCommand, DiscoveredShipNode, EebusIdentity, ShipConnectionState } from './eebusTypes';
|
|
@@ -30,6 +31,7 @@ interface ClsSourceRuntimeState {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export class EebusRuntime {
|
|
34
|
+
public readonly partnerMonitor: PartnerMonitor;
|
|
33
35
|
private readonly nodes = new Map<string, DiscoveredShipNode>();
|
|
34
36
|
private discovery?: DiscoveryService;
|
|
35
37
|
private endpoint?: ShipEndpoint;
|
|
@@ -52,10 +54,12 @@ export class EebusRuntime {
|
|
|
52
54
|
private readonly objectFactory: ObjectFactory,
|
|
53
55
|
) {
|
|
54
56
|
this.autoAcceptNewDevices = config.autoAcceptNewDevices;
|
|
57
|
+
this.partnerMonitor = new PartnerMonitor(adapter, id => this.canMonitorPartner(id));
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
public async start(): Promise<void> {
|
|
58
61
|
this.stopping = false;
|
|
62
|
+
await this.partnerMonitor.load();
|
|
59
63
|
this.endpoint = new ShipEndpoint(
|
|
60
64
|
this.adapter,
|
|
61
65
|
{ ...this.config, autoAcceptNewDevices: this.autoAcceptNewDevices },
|
|
@@ -144,10 +148,14 @@ export class EebusRuntime {
|
|
|
144
148
|
public async handleStateChange(id: string, state: ioBroker.State | null | undefined): Promise<void> {
|
|
145
149
|
if (id.endsWith('.pairing.trusted') || id.endsWith('.pairing.pinnedFingerprint')) {
|
|
146
150
|
const match = id.match(/devices\.([^.]+)\.pairing\./);
|
|
147
|
-
if (match && id.endsWith('.pinnedFingerprint'))
|
|
151
|
+
if (match && id.endsWith('.pinnedFingerprint')) {
|
|
152
|
+
this.endpoint?.invalidateCertificate(match[1], state?.val);
|
|
153
|
+
await this.partnerMonitor.pinChanged(match[1], state?.val);
|
|
154
|
+
}
|
|
148
155
|
if (match && (!state || (id.endsWith('.trusted') && state.val !== true))) {
|
|
149
156
|
this.trustCache.delete(match[1]);
|
|
150
157
|
this.endpoint?.disconnect(match[1]);
|
|
158
|
+
await this.partnerMonitor.pause(match[1]);
|
|
151
159
|
}
|
|
152
160
|
}
|
|
153
161
|
if (!state || state.ack || this.stopping || this.adapter.canOperate?.() === false) return;
|
|
@@ -171,7 +179,11 @@ export class EebusRuntime {
|
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
if (command.channel === 'control' && command.stateName === 'disconnect') {
|
|
174
|
-
if (Boolean(command.value))
|
|
182
|
+
if (Boolean(command.value)) {
|
|
183
|
+
const paused = this.partnerMonitor.pause(command.deviceId);
|
|
184
|
+
this.endpoint?.disconnect(command.deviceId);
|
|
185
|
+
await paused;
|
|
186
|
+
}
|
|
175
187
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.control.disconnect`, { val: false, ack: true });
|
|
176
188
|
return;
|
|
177
189
|
}
|
|
@@ -198,6 +210,7 @@ export class EebusRuntime {
|
|
|
198
210
|
}
|
|
199
211
|
} else {
|
|
200
212
|
this.endpoint?.rejectDevice(command.deviceId);
|
|
213
|
+
await this.partnerMonitor.pause(command.deviceId);
|
|
201
214
|
}
|
|
202
215
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.pairing.approve`, { val: false, ack: true });
|
|
203
216
|
await this.adapter.setStateAsync(`devices.${command.deviceId}.pairing.reject`, { val: false, ack: true });
|
|
@@ -286,6 +299,7 @@ export class EebusRuntime {
|
|
|
286
299
|
}
|
|
287
300
|
|
|
288
301
|
private async handleDataExchangeReady(deviceId: string): Promise<void> {
|
|
302
|
+
this.partnerMonitor.observed(deviceId);
|
|
289
303
|
// Prime the trust decision before the first time-critical CLS write arrives.
|
|
290
304
|
// The control path can then use the in-memory cache without an object DB read.
|
|
291
305
|
if (!this.trustCache.has(deviceId)) {
|
|
@@ -979,6 +993,10 @@ export class EebusRuntime {
|
|
|
979
993
|
};
|
|
980
994
|
}
|
|
981
995
|
|
|
996
|
+
public canMonitorPartner(id:string): boolean {
|
|
997
|
+
return !this.stopping && this.adapter.canOperate?.() !== false && this.endpoint?.hasAuthorizedExchange(id) === true;
|
|
998
|
+
}
|
|
999
|
+
|
|
982
1000
|
public getNodes(): DiscoveredShipNode[] { return Array.from(this.nodes.values()).map(node => ({ ...node })); }
|
|
983
1001
|
|
|
984
1002
|
private periodic(key: string, work: () => Promise<void>): void {
|