iobroker.eos-admin 9.0.19 → 9.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXOWATT_EOS_BUILD_INFO.json +4 -4
- package/README.md +7 -3
- package/START_HIER_9.0.20.md +65 -0
- package/adminWww/.vite/manifest.json +39 -39
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +110 -109
- package/adminWww/assets/{AdapterUpdateDialog-JOf2z4Vg.js → AdapterUpdateDialog-Dxl_b7Op.js} +1 -1
- package/adminWww/assets/{Adapters-C9fcSdWm.js → Adapters-CVKKhXmI.js} +1 -1
- package/adminWww/assets/{ConfigManager-BeeLlT6D.js → ConfigManager-Bf6nTAkL.js} +1 -1
- package/adminWww/assets/{Enums-FqnXWl8U.js → Enums-CJHVJY7t.js} +1 -1
- package/adminWww/assets/{Fields-DMgrt5Pi.js → Fields-DWHbZKvm.js} +1 -1
- package/adminWww/assets/{Files-CIHtt12g.js → Files-a6owMTXA.js} +1 -1
- package/adminWww/assets/{Hosts-fPLBzvTy.js → Hosts-LtEMeXpV.js} +1 -1
- package/adminWww/assets/{Instances-4XaVQlrT.js → Instances-DhChziA1.js} +1 -1
- package/adminWww/assets/{Intro-5TKriiLO.js → Intro-Cyq9gVDC.js} +1 -1
- package/adminWww/assets/{Logs-33zcIds-.js → Logs-wcramXsg.js} +1 -1
- package/adminWww/assets/{Objects-CNQPVbNG.js → Objects-DINVHd_e.js} +1 -1
- package/adminWww/assets/{Overview-BskXGOc8.js → Overview-DK4R41zR.js} +1 -1
- package/adminWww/assets/{State-C8SJ_Iqo.js → State-DcEACXzL.js} +1 -1
- package/adminWww/assets/{UsedResources-CgqRa9ei.js → UsedResources-C1LcM0Rb.js} +1 -1
- package/adminWww/assets/{Users-0JVYWR9u.js → Users-DvDdSyDY.js} +1 -1
- package/adminWww/assets/{bootstrap-D16lu6rd.js → bootstrap-Dbj_GbnP.js} +3 -3
- package/adminWww/assets/{hostInit-C8YZJuzi.js → hostInit-BNFIx0-f.js} +1 -1
- package/adminWww/assets/icons/nexowatt-180.png +0 -0
- package/adminWww/assets/{icons-material-CiNJ_6Ur.js → icons-material-DVbdXNgr.js} +1 -1
- package/adminWww/assets/{index-DA9Sphgh.js → index-CoKP1NSA.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-DPdkRa_d.js → installSVGRenderer-CMvku1F1.js} +1 -1
- package/adminWww/assets/{mf-entry-bootstrap-0-a7ab91de.js → mf-entry-bootstrap-0-ac330bce.js} +2 -2
- package/adminWww/index.html +24 -24
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-9.0.19.js → remoteEntry-eos-9.0.21.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosCustomerUpdateHttp.js +203 -0
- package/build/lib/eosCustomerUpdateHttp.js.map +1 -0
- package/build/lib/eosCustomerUpdateTransport.js +472 -0
- package/build/lib/eosCustomerUpdateTransport.js.map +1 -0
- package/build/lib/eosCustomerUpdateWorker.js +567 -0
- package/build/lib/eosCustomerUpdateWorker.js.map +1 -0
- package/build/lib/eosCustomerUpdates.js +631 -0
- package/build/lib/eosCustomerUpdates.js.map +1 -0
- package/build/lib/eosDeviceEmsPlan.js +18 -5
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosDeviceEmsService.js +52 -2
- package/build/lib/eosDeviceEmsService.js.map +1 -1
- package/build/lib/eosLegacyMigration.js +26 -1
- package/build/lib/eosLegacyMigration.js.map +1 -1
- package/build/lib/eosModuleConfigStore.js +12 -1
- package/build/lib/eosModuleConfigStore.js.map +1 -1
- package/build/lib/eosModuleHost.js +81 -26
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +8 -2
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/eosStateSubscriptions.js +59 -2
- package/build/lib/eosStateSubscriptions.js.map +1 -1
- package/build/lib/eosUpdateSnapshot.js +290 -0
- package/build/lib/eosUpdateSnapshot.js.map +1 -0
- package/build/lib/eosUploadGuard.js +124 -81
- package/build/lib/eosUploadGuard.js.map +1 -1
- package/build/lib/web.js +83 -0
- package/build/lib/web.js.map +1 -1
- package/docs/reports/unified-9.0.20/ANFORDERUNGEN_UND_INBETRIEBNAHME.md +159 -0
- package/docs/reports/unified-9.0.20/DEVICE_COMMAND_DELIVERY_REVIEW.md +82 -0
- package/docs/reports/unified-9.0.20/DEVICE_LIFECYCLE_REVIEW.md +46 -0
- package/docs/reports/unified-9.0.20/DEVICE_PLAN_REVIEW.md +33 -0
- package/docs/reports/unified-9.0.20/DEVICE_POWER_CAPABILITY_REVIEW.md +25 -0
- package/docs/reports/unified-9.0.20/FARM_CONTROLLER_REVIEW.md +27 -0
- package/docs/reports/unified-9.0.20/FARM_DIAGNOSE_UI.md +81 -0
- package/docs/reports/unified-9.0.20/FARM_DISPATCH_REVIEW.md +47 -0
- package/docs/reports/unified-9.0.20/HISTORY_REVIEW.md +68 -0
- package/docs/reports/unified-9.0.20/INFLUXDB2_INSTALLER_UI.md +39 -0
- package/docs/reports/unified-9.0.20/INFLUX_CREDENTIAL_NETWORK_REVIEW.md +38 -0
- package/docs/reports/unified-9.0.20/INFLUX_DIRECT_UNABHAENGIGE_PRUEFUNG.md +64 -0
- package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_INTEGRATION_REVIEW.md +53 -0
- package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_UNABHAENGIGE_PRUEFUNG.md +34 -0
- package/docs/reports/unified-9.0.20/INFLUX_TRANSPORT_ABSCHLUSSPRUEFUNG.md +55 -0
- package/docs/reports/unified-9.0.20/LOGIN_WEBAPP_LOGO.md +29 -0
- package/docs/reports/unified-9.0.20/MIGRATION_REVIEW.md +35 -0
- package/docs/reports/unified-9.0.20/PRUEFBERICHT.md +54 -0
- package/docs/reports/unified-9.0.20/PWA_ANONYMOUS_HTTPS_REVIEW.md +28 -0
- package/docs/reports/unified-9.0.20/PWA_ICON_UNABHAENGIGE_PRUEFUNG.md +60 -0
- package/docs/reports/unified-9.0.20/SERIAL_LIFECYCLE_REVIEW.md +37 -0
- package/docs/reports/unified-9.0.20/SOLAX_READBACK_REVIEW.md +43 -0
- package/docs/reports/unified-9.0.20/SOLAX_READBACK_UNABHAENGIGE_PRUEFUNG.md +34 -0
- package/docs/reports/unified-9.0.20/STATIC_REVIEW_DE.md +175 -0
- package/docs/reports/unified-9.0.20/STORAGE_COMMAND_ACK_REVIEW.md +36 -0
- package/docs/reports/unified-9.0.20/TARIFF_REPORT_REVIEW.md +29 -0
- package/docs/reports/unified-9.0.20/VISUALISIERUNG.md +64 -0
- package/docs/reports/unified-9.0.20/history-setup-navigation-proxy.txt +26 -0
- package/docs/reports/unified-9.0.20/history-setup-navigation-ssr.txt +7 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-node22.txt +102 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-node24.txt +23 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-security.txt +0 -0
- package/docs/reports/unified-9.0.20/history-setup-ui-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-hashes.txt +9 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-node22.txt +42 -0
- package/docs/reports/unified-9.0.20/login-pwa-branding-node24.txt +13 -0
- package/docs/reports/unified-9.0.20/raw/INDEX.json +1913 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node22.log +16 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node24.log +14 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-after.json +1 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-before.json +1 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/modbus-stop-backoff.cjs +22 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-control-review.log +29 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.log +325 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-review.log +278 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.log +58 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-review.log +51 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-gaps-before.log +64 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-negative-before.log +46 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/chart-gaps-before.log +127 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-after.log +67 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-before.log +61 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-js.log +0 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-ts.log +0 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node22.log +442 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node24.log +78 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/fix.py +73 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-eslint-final.json +7 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node22.log +279 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node24.log +52 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node22.log +223 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node24.log +43 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-own-cache.log +17 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/negative-pricing-before.log +96 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-after.log +66 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-repro.log +8 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-after.log +17 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-repro.log +8 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/history/repro.cjs +39 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/chromium-probe.log +3 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/patch-live.py +101 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.cjs +26 -0
- package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.log +36 -0
- package/docs/reports/unified-9.0.20/raw/audit-full.log +345 -0
- package/docs/reports/unified-9.0.20/raw/audit-full.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/audit-runtime.log +23 -0
- package/docs/reports/unified-9.0.20/raw/audit-runtime.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/backend-final.log +5 -0
- package/docs/reports/unified-9.0.20/raw/backend-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.result.json +20 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.tap +721 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.result.json +20 -0
- package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.tap +127 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-evidence.json +69 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-failed-init-drain-919-before.log +14 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-final-node22.log +882 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-final-node24.log +149 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-planner-919-before.log +70 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-retained-readiness-before.log +34 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-runtime-retry-919-before.log +46 -0
- package/docs/reports/unified-9.0.20/raw/commissioning-types-node24.log +0 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/DEVICE_FARM_READONLY_REVIEW.md +66 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/run-readback-tests.cjs +13 -0
- package/docs/reports/unified-9.0.20/raw/device-farm-protocol/solax-control-chain.test.cjs +58 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node22.log +16 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node24.log +14 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-evidence.json +55 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-after.json +1 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-before.json +1 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-modbus-stop-backoff.cjs +22 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-control-review.log +29 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.log +325 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-review.log +278 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.json +18 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.log +58 -0
- package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-review.log +51 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.log +0 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.log +0 -0
- package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node22.log +110 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node24.log +24 -0
- package/docs/reports/unified-9.0.20/raw/farm-controller/evidence.json +33 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node22.txt +113 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node24.txt +26 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-security.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/allocator-baseline.jsonl +6 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-before.log +138 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-delta.patch +77 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-lint.json +7 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.log +64 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.log +18 -0
- package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/final-ui-independent-review.json +194 -0
- package/docs/reports/unified-9.0.20/raw/frontend-build.log +152 -0
- package/docs/reports/unified-9.0.20/raw/frontend-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.json +35 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.json +31 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-before.json +31 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/parser-reproducer.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.tap +34 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.tap +11 -0
- package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/node22-focused.log +165 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/node24-focused.log +35 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/review-receipt.json +57 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-after.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-before.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/split-response.cjs +16 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race-generation-guard.log +1 -0
- package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race.cjs +13 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/eslint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/node24.log +24 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct/typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/hosted-module-history.test.cjs +85 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.log +100 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.log +21 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-after.test.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-loss-before.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/security-scan.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-direct-review/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.log +227 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.result.json +11 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.log +44 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.result.json +11 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node22.result.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node24.log +23 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/node24.result.json +12 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/runtime-after.test.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-independent/transport-extra.test.cjs +9 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/evidence.json +24 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node22.log +326 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node24.log +59 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node22.log +62 -0
- package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node24.log +16 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.log +112 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.log +106 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-security/source-sha256.json +5 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.log +124 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.log +26 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-final.json +285 -0
- package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-intermediate.json +285 -0
- package/docs/reports/unified-9.0.20/raw/installer-build.log +26 -0
- package/docs/reports/unified-9.0.20/raw/installer-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/INDEX.json +332 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.log +6 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.log +296 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.log +56 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.log +54 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.log +332 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.log +62 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.log +342 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.log +72 -0
- package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.log +482 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.result.json +19 -0
- package/docs/reports/unified-9.0.20/raw/isolation/isolation-node24.log +87 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.log +330 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.log +72 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.log +60 -0
- package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-migration-start-budget.cjs +49 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-serial-release.cjs +21 -0
- package/docs/reports/unified-9.0.20/raw/isolation/repro-sunspec-discovery.cjs +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.log +1 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.log +32 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.log +11 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.result.json +28 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.log +2 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.result.json +26 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.result.json +18 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.log +344 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.log +62 -0
- package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.result.json +17 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.log +3 -0
- package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.result.json +15 -0
- package/docs/reports/unified-9.0.20/raw/keygen-source.json +6 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-919.log +70 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-920.log +71 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/diff.json +82 -0
- package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/receipt.json +48 -0
- package/docs/reports/unified-9.0.20/raw/lint-final.log +16 -0
- package/docs/reports/unified-9.0.20/raw/lint-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-cache-boundary-fix.json +112 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-capability-ack.json +103 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-before-farm-diagnostics.json +102 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review-final.json +103 -0
- package/docs/reports/unified-9.0.20/raw/main-individual-review.json +93 -0
- package/docs/reports/unified-9.0.20/raw/modules-build.log +5 -0
- package/docs/reports/unified-9.0.20/raw/modules-build.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node22-tests-final.log +12471 -0
- package/docs/reports/unified-9.0.20/raw/node22-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.log +7 -0
- package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.20/raw/node24-tests-final.log +2093 -0
- package/docs/reports/unified-9.0.20/raw/node24-tests-final.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.log +5 -0
- package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/evidence.json +69 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-existing-regressions-node24.log +94 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-lint.log +0 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node22.log +304 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node24.log +56 -0
- package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-typecheck.log +0 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/evidence.json +45 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node22-build.log +21 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node22-source.log +23 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node24-build.log +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-https/node24-source.log +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-boundaries.test.cjs +45 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-receipt.json +71 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v22.23.4.tap +34 -0
- package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v24.22.3.tap +11 -0
- package/docs/reports/unified-9.0.20/raw/pwa-ui-independent-review-final.json +348 -0
- package/docs/reports/unified-9.0.20/raw/repro-failed-init-drain-before.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/repro-profile-replacement-after-unmapped.cjs +15 -0
- package/docs/reports/unified-9.0.20/raw/repro-runtime-retry-before.cjs +18 -0
- package/docs/reports/unified-9.0.20/raw/sbom-runtime.log +7 -0
- package/docs/reports/unified-9.0.20/raw/sbom-runtime.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.log +1 -0
- package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node22.json +30 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node22.log +542 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node24.json +30 -0
- package/docs/reports/unified-9.0.20/raw/solax-readback-node24.log +97 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-before.log +147 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-evidence.json +48 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-final-node22.log +151 -0
- package/docs/reports/unified-9.0.20/raw/tariff-report-final-node24.log +32 -0
- package/docs/reports/unified-9.0.20/raw/ui-docs-check.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-docs-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-final.log +7 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-check.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-check.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-final.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-sbom-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-secret-final.log +6 -0
- package/docs/reports/unified-9.0.20/raw/ui-secret-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/ui-security-final.log +8 -0
- package/docs/reports/unified-9.0.20/raw/ui-security-final.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/visuals-baseline-919.txt +36 -0
- package/docs/reports/unified-9.0.20/raw/visuals-browser-limit.txt +3 -0
- package/docs/reports/unified-9.0.20/raw/visuals-lint.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/visuals-node22.txt +258 -0
- package/docs/reports/unified-9.0.20/raw/visuals-node24.txt +51 -0
- package/docs/reports/unified-9.0.20/raw/visuals-security.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/visuals-typecheck.txt +0 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.log +19 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.result.json +16 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.log +31 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.result.json +14 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.result.json +13 -0
- package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.tap +10 -0
- package/io-package.json +12 -12
- package/modules/backup/admin/index.js +4 -1
- package/modules/devices/admin/host-bridge.js +5 -1
- package/modules/devices/lib/device-alias-semantics-v1.json +22 -1
- package/modules/devices/lib/deviceAliasFreshness.js +1 -0
- package/modules/devices/lib/deviceAliasSemantics.js +13 -3
- package/modules/devices/lib/deviceRuntime.js +106 -12
- package/modules/devices/lib/drivers/modbus.js +90 -21
- package/modules/devices/lib/drivers/modbusAsciiBus.js +47 -31
- package/modules/devices/lib/drivers/modbusRtuBus.js +33 -9
- package/modules/devices/lib/drivers/modbusSerialLease.js +29 -0
- package/modules/devices/lib/drivers/mqtt.js +204 -82
- package/modules/devices/lib/drivers/mqttPendingOperations.js +119 -0
- package/modules/devices/lib/modbusReadEvidence.js +29 -0
- package/modules/devices/test/deviceAliasFreshness.test.js +7 -2
- package/modules/devices/test/modbusConnectLifecycle.test.js +148 -0
- package/modules/devices/test/modbusSerialLifecycle.test.js +91 -0
- package/modules/devices/test/mqttCommandLifecycle.test.js +255 -0
- package/modules/devices/test/mqttResourceBounds.test.js +98 -0
- package/modules/devices/test/mqttRuntimeSession.test.js +109 -0
- package/modules/devices/test/serialOperationGate.test.js +3 -3
- package/modules/devices/test/solaxReadbackContext.test.js +472 -0
- package/modules/devices/tsconfig.alias-semantics.json +1 -1
- package/modules/devices/tsconfig.mqtt-lifecycle.json +20 -0
- package/modules/devices/tsconfig.serial-lifecycle.json +18 -0
- package/modules/eebus/admin/index.js +6 -3
- package/package.json +9 -7
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +848 -169
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +154 -6
- package/release-manifests/unified/runtime.cdx.json +25 -25
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-check.cjs +2 -2
- package/tools/eos-release-manifest.cjs +3 -3
- package/ui/admin/react/assets/index-BJO3q7oe.js +13 -0
- package/ui/admin/react/assets/{index-CuquHlsY.css → index-ofLP_Y7y.css} +1 -1
- package/ui/admin/react/index.html +2 -2
- package/ui/docs/security/eslint-reviewed-findings.json +91 -35
- package/ui/ems/engine.js +14 -3
- package/ui/ems/modules/energy-wallet.js +9 -3
- package/ui/ems/modules/storage-control.js +60 -19
- package/ui/ems/modules/tariff-provider.js +34 -10
- package/ui/ems/services/tariff-provider-registry.js +18 -8
- package/ui/io-package.json +1 -1
- package/ui/lib/influx-config.js +204 -0
- package/ui/lib/influx-direct.js +527 -0
- package/ui/lib/influx-history-runtime.js +326 -0
- package/ui/lib/influx-network-policy.js +112 -0
- package/ui/lib/ui-access-policy.js +2 -2
- package/ui/main.js +614 -255
- package/ui/package.json +12 -6
- package/ui/www/app.js +152 -203
- package/ui/www/ems-apps.html +2 -1
- package/ui/www/ems-apps.js +8 -1
- package/ui/www/energy-ledger.html +1 -1
- package/ui/www/eos-updates.css +15 -0
- package/ui/www/eos-updates.js +351 -0
- package/ui/www/evcs.html +1 -1
- package/ui/www/history.html +1 -1
- package/ui/www/history.js +114 -74
- package/ui/www/index.html +4 -1
- package/ui/www/live-display.js +115 -0
- package/ui/www/logic.html +1 -1
- package/ui/www/login.css +1 -0
- package/ui/www/login.html +2 -1
- package/ui/www/manifest.webmanifest +3 -3
- package/ui/www/settings.html +36 -1
- package/ui/www/simulation.html +1 -1
- package/ui/www/smarthome-config.html +1 -1
- package/ui/www/smarthome.html +1 -1
- package/ui/www/storagefarm-dispatch.js +287 -0
- package/ui/www/storagefarm-summary.css +15 -0
- package/ui/www/storagefarm.html +15 -1
- package/ui/www/storagefarm.js +8 -26
- package/ui/www/tariff-report.js +43 -25
- package/ui/admin/react/assets/index-Bq5IupDw.js +0 -13
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* NexoWatt Quellcode-Erklärung (DE)
|
|
5
|
+
* Aufgabe: Gerätewerte und freigegebene Befehle über MQTT transportieren.
|
|
6
|
+
* Daten und Wirkung: Jede Verbindung besitzt eigene offene Aufträge; alte Befehle werden nicht erneut gesendet.
|
|
7
|
+
* Bei Änderungen: Sitzungsgrenzen, Bestätigungen, Fristen und TESVOLT-Grenzwerte zusammen prüfen.
|
|
8
|
+
*/
|
|
9
|
+
|
|
3
10
|
const fs = require('node:fs');
|
|
11
|
+
const { performance } = require('node:perf_hooks');
|
|
4
12
|
const mqtt = require('mqtt');
|
|
13
|
+
const { MqttPendingOperations, MqttMessageBacklog, runMqttMessageSession, assertMqttMessageSession } = require('./mqttPendingOperations');
|
|
5
14
|
const { getByJsonPath, applyNumericTransforms, coerceBoolean } = require('../utils');
|
|
6
15
|
|
|
7
16
|
let ADAPTER_VERSION = 'unknown';
|
|
@@ -93,7 +102,6 @@ function mqttReasonLabel(reasonCode) {
|
|
|
93
102
|
|
|
94
103
|
function classifyMqttError(error) {
|
|
95
104
|
const originalMessage = error && error.message ? String(error.message) : String(error || 'Unknown MQTT error');
|
|
96
|
-
const lower = originalMessage.toLowerCase();
|
|
97
105
|
const reasonCode = numericMqttReasonCode(error);
|
|
98
106
|
const code = (error && typeof error.code === 'string') ? error.code : '';
|
|
99
107
|
const badCredentials = reasonCode === 4 || reasonCode === 134 ||
|
|
@@ -159,6 +167,7 @@ class MqttDriver {
|
|
|
159
167
|
: this.tesvoltTopicMode === 'v2' ? 'EMS/V2/' : '';
|
|
160
168
|
this._lastSelectedTesvoltPrefix = this.activeTopicPrefix;
|
|
161
169
|
this._messageQueue = Promise.resolve();
|
|
170
|
+
this._messageBacklog = new MqttMessageBacklog();
|
|
162
171
|
this._pendingTesvoltMessages = new Map();
|
|
163
172
|
this._pendingTesvoltRawPrefixes = new Map();
|
|
164
173
|
|
|
@@ -187,6 +196,12 @@ class MqttDriver {
|
|
|
187
196
|
this.writeGroupStates = new Map();
|
|
188
197
|
this.writeGroupTimers = new Map();
|
|
189
198
|
this._disconnecting = false;
|
|
199
|
+
this._disconnectPromise = null;
|
|
200
|
+
this._disconnectDeadline = 0;
|
|
201
|
+
this._transportEpoch = 0;
|
|
202
|
+
this._reconnectTimer = null;
|
|
203
|
+
this._reconnectDelayMs = 5000;
|
|
204
|
+
this._pendingOperations = new MqttPendingOperations();
|
|
190
205
|
|
|
191
206
|
// Connection diagnostics. TESVOLT gateways can restrict both credentials
|
|
192
207
|
// and MQTT Client-ID through their local broker ACL. Keep the effective
|
|
@@ -305,6 +320,7 @@ class MqttDriver {
|
|
|
305
320
|
}
|
|
306
321
|
|
|
307
322
|
async _setDiagnostic(dpId, value, forceWrite) {
|
|
323
|
+
assertMqttMessageSession();
|
|
308
324
|
const dp = this._diagnosticDatapoint(dpId);
|
|
309
325
|
if (!dp) return false;
|
|
310
326
|
return this._setDatapointValue(dp, value, Date.now(), {
|
|
@@ -399,34 +415,23 @@ class MqttDriver {
|
|
|
399
415
|
};
|
|
400
416
|
}
|
|
401
417
|
|
|
402
|
-
_subscribeOne(definition) {
|
|
418
|
+
async _subscribeOne(definition, client = this.client) {
|
|
403
419
|
const topic = String(definition && definition.topic || '');
|
|
404
420
|
const qos = Number.isFinite(Number(definition && definition.qos))
|
|
405
|
-
? Math.max(0, Math.min(2, Number(definition.qos)))
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
? String(error.message || error)
|
|
420
|
-
: `broker denied subscription${grant.code === null ? '' : ` (reason/qos=${grant.code})`}`;
|
|
421
|
-
resolve({ ...definition, qos, ok: false, error: message, grant });
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
resolve({ ...definition, qos, ok: true, grant });
|
|
425
|
-
});
|
|
426
|
-
} catch (error) {
|
|
427
|
-
resolve({ ...definition, qos, ok: false, error: String(error && error.message || error) });
|
|
428
|
-
}
|
|
429
|
-
});
|
|
421
|
+
? Math.max(0, Math.min(2, Number(definition.qos))) : 0;
|
|
422
|
+
if (!client || this.client !== client || !topic) {
|
|
423
|
+
return { ...definition, ok: false, error: 'MQTT client/topic missing' };
|
|
424
|
+
}
|
|
425
|
+
try {
|
|
426
|
+
const granted = await this._pendingOperations.run(client, 'subscribe', 5000,
|
|
427
|
+
finish => client.subscribe(topic, { qos }, finish),
|
|
428
|
+
() => this._retireTransport(client, 'E_MQTT_SUBSCRIBE_TIMEOUT'));
|
|
429
|
+
const grant = this._subscriptionGrant(granted, topic);
|
|
430
|
+
const message = grant.denied ? `broker denied subscription${grant.code === null ? '' : ` (reason/qos=${grant.code})`}` : '';
|
|
431
|
+
return { ...definition, qos, ok: !grant.denied, error: message, grant };
|
|
432
|
+
} catch (error) {
|
|
433
|
+
return { ...definition, qos, ok: false, error: String(error && error.message || error) };
|
|
434
|
+
}
|
|
430
435
|
}
|
|
431
436
|
|
|
432
437
|
async _setSubscriptionDiagnostics(results) {
|
|
@@ -530,7 +535,7 @@ class MqttDriver {
|
|
|
530
535
|
|
|
531
536
|
_stopNoDataWatch() {
|
|
532
537
|
if (!this._noDataTimer) return;
|
|
533
|
-
|
|
538
|
+
clearTimeout(this._noDataTimer);
|
|
534
539
|
this._noDataTimer = null;
|
|
535
540
|
}
|
|
536
541
|
|
|
@@ -573,6 +578,7 @@ class MqttDriver {
|
|
|
573
578
|
const normalized = String(topic || '');
|
|
574
579
|
const outboundOnly = this._isOutboundOnlyTopic(normalized);
|
|
575
580
|
const isNew = !this.discoveredTopics.has(normalized);
|
|
581
|
+
if (isNew && this.discoveredTopics.size >= 512) throw new Error('E_MQTT_DISCOVERED_TOPIC_LIMIT');
|
|
576
582
|
this.discoveredTopics.add(normalized);
|
|
577
583
|
this.messageCount += 1;
|
|
578
584
|
if (!outboundOnly) this.gatewayMessageCount += 1;
|
|
@@ -593,6 +599,11 @@ class MqttDriver {
|
|
|
593
599
|
}
|
|
594
600
|
|
|
595
601
|
async connect() {
|
|
602
|
+
if (this._disconnectPromise) await this._disconnectPromise;
|
|
603
|
+
if (this.client) return;
|
|
604
|
+
if (this._reconnectTimer) clearTimeout(this._reconnectTimer);
|
|
605
|
+
this._reconnectTimer = null;
|
|
606
|
+
this._disconnecting = false;
|
|
596
607
|
const connection = this.device.connection || {};
|
|
597
608
|
const url = String(connection.url || '').trim();
|
|
598
609
|
if (!url) throw new Error('Missing MQTT url');
|
|
@@ -616,6 +627,12 @@ class MqttDriver {
|
|
|
616
627
|
clean: connection.cleanSession !== false,
|
|
617
628
|
};
|
|
618
629
|
|
|
630
|
+
this._reconnectDelayMs = options.reconnectPeriod;
|
|
631
|
+
// A previous actuator command must never be replayed by MQTT.js after a
|
|
632
|
+
// reconnect. Each connection owns a new client and empty outgoing store.
|
|
633
|
+
options.reconnectPeriod = 0;
|
|
634
|
+
options.queueQoSZero = false;
|
|
635
|
+
|
|
619
636
|
// mqtts:// works with the normal mqtt package. Username/password provide
|
|
620
637
|
// authentication; transport encryption is provided only by mqtts/TLS.
|
|
621
638
|
if (connection.rejectUnauthorized !== undefined) {
|
|
@@ -644,13 +661,22 @@ class MqttDriver {
|
|
|
644
661
|
`verifyCertificate=${verifyCertificate}`,
|
|
645
662
|
);
|
|
646
663
|
|
|
647
|
-
|
|
664
|
+
const client = mqtt.connect(url, options);
|
|
665
|
+
this.client = client;
|
|
666
|
+
const epoch = ++this._transportEpoch;
|
|
667
|
+
const current = () => this.client === client && this._transportEpoch === epoch && !this._disconnecting;
|
|
648
668
|
|
|
649
|
-
|
|
669
|
+
client.on('connect', (connack) => {
|
|
670
|
+
if (!current()) return;
|
|
671
|
+
if (typeof this.canOperate === 'function' && this.canOperate() !== true) {
|
|
672
|
+
this._retireTransport(client, 'EOS_DEVICES_NOT_AUTHORIZED');
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
650
675
|
this.connected = true;
|
|
651
676
|
this._disconnecting = false;
|
|
652
677
|
this._offlineApplied = false;
|
|
653
678
|
this._clearPrimaryConnectionError();
|
|
679
|
+
this.discoveredTopics.clear();
|
|
654
680
|
if (this.isTesvolt) {
|
|
655
681
|
// Retained samples and capabilities from a previous session must not
|
|
656
682
|
// authorize a new command or mix two protocol namespaces.
|
|
@@ -667,30 +693,34 @@ class MqttDriver {
|
|
|
667
693
|
`[${this.device.id}] MQTT connected: broker=${this.safeConnectionUrl}; clientId="${this.effectiveClientId}"; ` +
|
|
668
694
|
`sessionPresent=${sessionPresent}`,
|
|
669
695
|
);
|
|
670
|
-
const subscriptionPromise = this._subscribeAll();
|
|
671
|
-
this._markWriteGroupsConnected();
|
|
696
|
+
const subscriptionPromise = runMqttMessageSession(current, () => this._subscribeAll());
|
|
697
|
+
runMqttMessageSession(current, () => this._markWriteGroupsConnected());
|
|
672
698
|
this._notifyConnection(true, '');
|
|
673
699
|
Promise.resolve(subscriptionPromise)
|
|
674
700
|
.then(async (subscriptionStatus) => {
|
|
675
|
-
|
|
701
|
+
if (!current()) return;
|
|
702
|
+
const bootstrapStatus = await runMqttMessageSession(current, () => this._publishBootstrapMessages());
|
|
676
703
|
// Do not replace a precise subscription/bootstrap error with the
|
|
677
704
|
// secondary generic no-data warning.
|
|
678
|
-
if (subscriptionStatus && subscriptionStatus.ok && (!bootstrapStatus || bootstrapStatus.ok !== false)) {
|
|
705
|
+
if (current() && subscriptionStatus && subscriptionStatus.ok && (!bootstrapStatus || bootstrapStatus.ok !== false)) {
|
|
679
706
|
this._startNoDataWatch();
|
|
680
707
|
}
|
|
681
708
|
})
|
|
682
709
|
.catch((error) => {
|
|
710
|
+
if (!current()) return;
|
|
683
711
|
const message = `MQTT subscription/bootstrap failed: ${error && error.message ? error.message : error}`;
|
|
684
712
|
this._logConnectionError(message);
|
|
685
713
|
this._notifyValues({ connected: true, error: message, subscriptionError: true }).catch(() => {});
|
|
686
714
|
});
|
|
687
715
|
});
|
|
688
716
|
|
|
689
|
-
|
|
717
|
+
client.on('reconnect', () => {
|
|
718
|
+
if (!current()) return;
|
|
690
719
|
this.adapter.log.debug(`[${this.device.id}] MQTT reconnecting`);
|
|
691
720
|
});
|
|
692
721
|
|
|
693
|
-
|
|
722
|
+
client.on('offline', () => {
|
|
723
|
+
if (!current()) return;
|
|
694
724
|
this.connected = false;
|
|
695
725
|
this._stopNoDataWatch();
|
|
696
726
|
const reason = this._effectiveOfflineReason('MQTT offline');
|
|
@@ -698,27 +728,39 @@ class MqttDriver {
|
|
|
698
728
|
this._notifyConnection(false, reason);
|
|
699
729
|
});
|
|
700
730
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this.
|
|
704
|
-
const reason = this._effectiveOfflineReason('MQTT connection closed');
|
|
705
|
-
if (!this._disconnecting) this._markWriteGroupsDisconnected(reason);
|
|
706
|
-
this._notifyConnection(false, reason);
|
|
731
|
+
client.on('close', () => {
|
|
732
|
+
if (!current()) return;
|
|
733
|
+
this._retireTransport(client, this._effectiveOfflineReason('MQTT connection closed'));
|
|
707
734
|
});
|
|
708
735
|
|
|
709
|
-
|
|
736
|
+
client.on('error', (error) => {
|
|
737
|
+
if (!current()) return;
|
|
710
738
|
const message = this._formatConnectionError(error);
|
|
711
739
|
if (!this.connected) this._rememberPrimaryConnectionError(message);
|
|
712
740
|
this._logConnectionError(message);
|
|
713
741
|
if (!this.connected) this._notifyConnection(false, message);
|
|
714
742
|
});
|
|
715
743
|
|
|
716
|
-
|
|
744
|
+
client.on('message', (topic, payload, packet) => {
|
|
745
|
+
if (!current()) return;
|
|
746
|
+
let release;
|
|
747
|
+
try { release = this._messageBacklog.reserve(payload.length); } catch (error) {
|
|
748
|
+
const reason = error.message || String(error);
|
|
749
|
+
this._rememberPrimaryConnectionError(reason);
|
|
750
|
+
this._logConnectionError(reason);
|
|
751
|
+
this._retireTransport(client, reason);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
717
754
|
// Preserve broker arrival order across asynchronous state writes.
|
|
718
|
-
this._messageQueue = this._messageQueue.then(() => this._handleMessage(topic, payload, packet)).catch((error) => {
|
|
755
|
+
this._messageQueue = this._messageQueue.then(() => current() ? runMqttMessageSession(current, () => this._handleMessage(topic, payload, packet)) : undefined).catch((error) => {
|
|
719
756
|
const message = error && error.message ? error.message : String(error);
|
|
757
|
+
if (message === 'E_MQTT_MESSAGE_SESSION_ENDED') return;
|
|
720
758
|
this.adapter.log.warn(`[${this.device.id}] MQTT message handling failed for ${topic}: ${message}`);
|
|
721
|
-
|
|
759
|
+
if (message === 'E_MQTT_DISCOVERED_TOPIC_LIMIT' && current()) {
|
|
760
|
+
this._rememberPrimaryConnectionError(message);
|
|
761
|
+
this._retireTransport(client, message);
|
|
762
|
+
}
|
|
763
|
+
}).finally(release);
|
|
722
764
|
});
|
|
723
765
|
}
|
|
724
766
|
|
|
@@ -729,14 +771,17 @@ class MqttDriver {
|
|
|
729
771
|
this._lastConnectionNotification = next;
|
|
730
772
|
try {
|
|
731
773
|
const result = this.onConnection(next, errorMessage || '');
|
|
732
|
-
if (result && typeof result.catch === 'function') result.catch(() => {
|
|
774
|
+
if (result && typeof result.catch === 'function') return result.catch((error) => {
|
|
775
|
+
this.adapter.log.debug(`[${this.device.id}] MQTT connection callback failed: ${error.message || error}`);
|
|
776
|
+
});
|
|
733
777
|
} catch (_) {
|
|
734
778
|
// Connection notifications must never crash the MQTT client.
|
|
735
779
|
}
|
|
736
780
|
}
|
|
737
781
|
|
|
738
782
|
async _subscribeAll() {
|
|
739
|
-
|
|
783
|
+
const client = this.client;
|
|
784
|
+
if (!client) return { ok: false, status: 'MQTT client missing' };
|
|
740
785
|
|
|
741
786
|
this.dpsByTopic.clear();
|
|
742
787
|
this.dpById.clear();
|
|
@@ -770,9 +815,11 @@ class MqttDriver {
|
|
|
770
815
|
// existing event-driven tests and runtimes.
|
|
771
816
|
this._initializeWriteGroupStates();
|
|
772
817
|
await this._updateTesvoltDiagnostics();
|
|
818
|
+
if (this.client !== client) return { ok: false, status: 'MQTT session ended' };
|
|
773
819
|
|
|
774
820
|
const definitions = this._subscriptionDefinitions();
|
|
775
|
-
const primaryResults = await Promise.all(definitions.map((definition) => this._subscribeOne(definition)));
|
|
821
|
+
const primaryResults = await Promise.all(definitions.map((definition) => this._subscribeOne(definition, client)));
|
|
822
|
+
if (this.client !== client) return { ok: false, status: 'MQTT session ended' };
|
|
776
823
|
const allResults = [...primaryResults];
|
|
777
824
|
|
|
778
825
|
// Some broker ACLs reject wildcard subscription filters even though the
|
|
@@ -790,7 +837,8 @@ class MqttDriver {
|
|
|
790
837
|
this.adapter.log.info(
|
|
791
838
|
`[${this.device.id}] MQTT wildcard subscription ${result.topic} was not granted; trying ${exactDefinitions.length} exact TESVOLT topics`,
|
|
792
839
|
);
|
|
793
|
-
const exactResults = await Promise.all(exactDefinitions.map((definition) => this._subscribeOne(definition)));
|
|
840
|
+
const exactResults = await Promise.all(exactDefinitions.map((definition) => this._subscribeOne(definition, client)));
|
|
841
|
+
if (this.client !== client) return { ok: false, status: 'MQTT session ended' };
|
|
794
842
|
allResults.push(...exactResults);
|
|
795
843
|
const fallbackOk = this.isTesvolt
|
|
796
844
|
? exactResults.some((entry) => entry.ok && /\/(?:Inverter|Battery)\//.test(entry.topic) && !entry.topic.endsWith('/Control'))
|
|
@@ -809,33 +857,93 @@ class MqttDriver {
|
|
|
809
857
|
return this._setSubscriptionDiagnostics(allResults);
|
|
810
858
|
}
|
|
811
859
|
|
|
860
|
+
_scheduleReconnect() {
|
|
861
|
+
if (this._disconnecting || this._reconnectTimer || this._reconnectDelayMs <= 0) return;
|
|
862
|
+
this._reconnectTimer = setTimeout(() => {
|
|
863
|
+
this._reconnectTimer = null;
|
|
864
|
+
if (this._disconnecting || this.client) return;
|
|
865
|
+
// The hosted connect wrapper checks the current ownership/license gate.
|
|
866
|
+
this.connect().catch(() => this._scheduleReconnect());
|
|
867
|
+
}, this._reconnectDelayMs);
|
|
868
|
+
this._reconnectTimer.unref?.();
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
_cancelOperations(client, reason) {
|
|
872
|
+
this._pendingOperations.cancel(client, reason);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
_retireTransport(client, reason) {
|
|
876
|
+
if (this.client !== client) return;
|
|
877
|
+
this.connected = false;
|
|
878
|
+
this.client = null;
|
|
879
|
+
this._transportEpoch += 1;
|
|
880
|
+
this._stopNoDataWatch();
|
|
881
|
+
this._stopWriteGroupTimers();
|
|
882
|
+
this._markWriteGroupsDisconnected(reason);
|
|
883
|
+
this._cancelOperations(client, reason);
|
|
884
|
+
// Force close also discards MQTT.js QoS stores; retries use a new client.
|
|
885
|
+
try { client.end(true); } catch (error) {
|
|
886
|
+
// Keep the unconfirmed client reachable for an explicit stop retry. A
|
|
887
|
+
// second client must not race an old transport whose closure is unknown.
|
|
888
|
+
this.client = client;
|
|
889
|
+
this._disconnecting = true;
|
|
890
|
+
const failure = `E_MQTT_STOP_UNCONFIRMED: ${error.message || error}`;
|
|
891
|
+
this._rememberPrimaryConnectionError(failure);
|
|
892
|
+
this.adapter.log.warn(`[${this.device.id}] ${failure}`);
|
|
893
|
+
this._notifyConnection(false, failure);
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
// Wait for runtime state/alias cleanup before opening a replacement. This
|
|
897
|
+
// also bounds connection barriers while a database operation is stalled.
|
|
898
|
+
this._messageQueue.then(() => this._notifyConnection(false, reason)).then(() => this._scheduleReconnect()).catch(() => {
|
|
899
|
+
this.adapter.log.warn(`[${this.device.id}] E_MQTT_STATE_DRAIN_FAILED: reconnect paused`);
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
|
|
812
903
|
async disconnect() {
|
|
904
|
+
if (this._disconnectPromise) return this._disconnectPromise;
|
|
813
905
|
this._disconnecting = true;
|
|
906
|
+
this._disconnectDeadline = performance.now() + 1000;
|
|
907
|
+
this._transportEpoch += 1;
|
|
908
|
+
if (this._reconnectTimer) clearTimeout(this._reconnectTimer);
|
|
909
|
+
this._reconnectTimer = null;
|
|
814
910
|
this._stopNoDataWatch();
|
|
815
|
-
// Always stop periodic writers and close transport, including when the central
|
|
816
|
-
// EOS operation gate rejects the source driver's optional final safe publish.
|
|
817
911
|
this._stopWriteGroupTimers();
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
912
|
+
const client = this.client;
|
|
913
|
+
this._cancelOperations(client, 'MQTT disconnected');
|
|
914
|
+
this._disconnectPromise = (async () => {
|
|
915
|
+
try {
|
|
916
|
+
if (client && this.connected) {
|
|
917
|
+
try { await this._sendSafeWriteGroupsOnDisconnect(); } catch (_) { /* Best effort; publish has its own deadline. */ }
|
|
918
|
+
}
|
|
919
|
+
if (client) {
|
|
920
|
+
await new Promise((resolve, reject) => {
|
|
921
|
+
let settled = false;
|
|
922
|
+
const finish = (error) => {
|
|
923
|
+
if (settled) return;
|
|
924
|
+
settled = true;
|
|
925
|
+
clearTimeout(timeout);
|
|
926
|
+
client.removeListener('close', closed);
|
|
927
|
+
if (error) reject(error); else resolve();
|
|
928
|
+
};
|
|
929
|
+
const closed = () => finish();
|
|
930
|
+
const timeout = setTimeout(() => finish(new Error('E_MQTT_STOP_TIMEOUT')), 2000);
|
|
931
|
+
client.once('close', closed);
|
|
932
|
+
try { client.end(true, {}, () => finish()); } catch (error) { finish(error); }
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
} finally {
|
|
936
|
+
this.connected = false;
|
|
937
|
+
if (this.client === client) this.client = null;
|
|
938
|
+
this._pendingTesvoltMessages.clear();
|
|
939
|
+
this._pendingTesvoltRawPrefixes.clear();
|
|
940
|
+
this._cancelOperations(client, 'MQTT disconnected');
|
|
941
|
+
await this._messageQueue;
|
|
942
|
+
await this._notifyConnection(false, 'MQTT disconnected');
|
|
830
943
|
}
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
this._pendingTesvoltMessages.clear();
|
|
835
|
-
this._pendingTesvoltRawPrefixes.clear();
|
|
836
|
-
this._disconnecting = false;
|
|
837
|
-
this._notifyConnection(false, 'MQTT disconnected');
|
|
838
|
-
}
|
|
944
|
+
})();
|
|
945
|
+
try { await this._disconnectPromise; }
|
|
946
|
+
finally { this._disconnectPromise = null; }
|
|
839
947
|
}
|
|
840
948
|
|
|
841
949
|
_extractSourceTimestamp(parsedJson) {
|
|
@@ -868,8 +976,10 @@ class MqttDriver {
|
|
|
868
976
|
}
|
|
869
977
|
|
|
870
978
|
async _handleMessage(topic, payload, packet, replay) {
|
|
979
|
+
assertMqttMessageSession();
|
|
871
980
|
const receivedAt = replay ? replay.receivedAt : Date.now();
|
|
872
981
|
const incoming = replay ? replay.incoming : await this._recordIncomingTopic(topic);
|
|
982
|
+
assertMqttMessageSession();
|
|
873
983
|
const datapoints = this.dpsByTopic.get(topic);
|
|
874
984
|
if (!datapoints || !datapoints.length) {
|
|
875
985
|
if (!incoming.outboundOnly) {
|
|
@@ -882,7 +992,9 @@ class MqttDriver {
|
|
|
882
992
|
try {
|
|
883
993
|
const alive = this.onAlive && this.onAlive();
|
|
884
994
|
if (alive && typeof alive.catch === 'function') alive.catch(() => {});
|
|
885
|
-
} catch (
|
|
995
|
+
} catch (error) {
|
|
996
|
+
this.adapter.log.debug(`[${this.device.id}] MQTT heartbeat callback failed: ${error.message || error}`);
|
|
997
|
+
}
|
|
886
998
|
}
|
|
887
999
|
await this._notifyValues({ connected: true, topic, receivedAt, unknownTopic: true, diagnosticsOnly: this.isTesvolt });
|
|
888
1000
|
}
|
|
@@ -1031,6 +1143,7 @@ class MqttDriver {
|
|
|
1031
1143
|
}
|
|
1032
1144
|
|
|
1033
1145
|
async _notifyValues(meta) {
|
|
1146
|
+
assertMqttMessageSession();
|
|
1034
1147
|
if (!this.onValues) return;
|
|
1035
1148
|
try {
|
|
1036
1149
|
await this.onValues({ ...this.valueCache }, meta || {});
|
|
@@ -1112,6 +1225,7 @@ class MqttDriver {
|
|
|
1112
1225
|
}
|
|
1113
1226
|
|
|
1114
1227
|
async _setDatapointValue(dp, value, timestamp, options) {
|
|
1228
|
+
assertMqttMessageSession();
|
|
1115
1229
|
if (!dp || !dp.id) return false;
|
|
1116
1230
|
const id = String(dp.id);
|
|
1117
1231
|
const opts = options || {};
|
|
@@ -1125,6 +1239,7 @@ class MqttDriver {
|
|
|
1125
1239
|
|
|
1126
1240
|
const stateId = this.relStateId ? this.relStateId(dp) : dp.id;
|
|
1127
1241
|
await this.adapter.setStateAsync(stateId, { val: value, ack: true }).catch(() => {});
|
|
1242
|
+
assertMqttMessageSession();
|
|
1128
1243
|
return true;
|
|
1129
1244
|
}
|
|
1130
1245
|
|
|
@@ -1288,7 +1403,7 @@ class MqttDriver {
|
|
|
1288
1403
|
}
|
|
1289
1404
|
}
|
|
1290
1405
|
|
|
1291
|
-
_scheduleWriteGroupRefresh(groupName, group,
|
|
1406
|
+
_scheduleWriteGroupRefresh(groupName, group, _state) {
|
|
1292
1407
|
const intervalMs = this._groupRefreshIntervalMs(group);
|
|
1293
1408
|
if (intervalMs <= 0 || this.writeGroupTimers.has(groupName)) return;
|
|
1294
1409
|
const timer = setInterval(() => {
|
|
@@ -1304,7 +1419,7 @@ class MqttDriver {
|
|
|
1304
1419
|
|
|
1305
1420
|
_stopWriteGroupTimers() {
|
|
1306
1421
|
for (const timer of this.writeGroupTimers.values()) {
|
|
1307
|
-
|
|
1422
|
+
clearInterval(timer);
|
|
1308
1423
|
}
|
|
1309
1424
|
this.writeGroupTimers.clear();
|
|
1310
1425
|
}
|
|
@@ -1349,6 +1464,7 @@ class MqttDriver {
|
|
|
1349
1464
|
|
|
1350
1465
|
async _sendSafeWriteGroupsOnDisconnect() {
|
|
1351
1466
|
for (const [groupName, state] of this.writeGroupStates.entries()) {
|
|
1467
|
+
if (this._disconnecting && performance.now() >= this._disconnectDeadline) break;
|
|
1352
1468
|
const group = this._writeGroups()[groupName] || {};
|
|
1353
1469
|
if (group.safeOnDisconnect !== true) continue;
|
|
1354
1470
|
try {
|
|
@@ -1422,7 +1538,7 @@ class MqttDriver {
|
|
|
1422
1538
|
if (!topic) throw new Error(`Missing MQTT write-group topic for ${state.groupName}`);
|
|
1423
1539
|
const qos = Number.isFinite(Number(group.qos)) ? Math.max(0, Math.min(2, Number(group.qos))) : 0;
|
|
1424
1540
|
const retain = group.retain === true;
|
|
1425
|
-
await this._publish(topic, JSON.stringify(payloadObject), { qos, retain }, true);
|
|
1541
|
+
await this._publish(topic, JSON.stringify(payloadObject), { qos, retain }, true, origin === 'safe_disconnect');
|
|
1426
1542
|
|
|
1427
1543
|
const now = Date.now();
|
|
1428
1544
|
const commandChanged = !sameStateValue(state.lastSentValue, effectiveValue);
|
|
@@ -1681,7 +1797,8 @@ class MqttDriver {
|
|
|
1681
1797
|
return payload;
|
|
1682
1798
|
}
|
|
1683
1799
|
|
|
1684
|
-
async _publish(topic, payload, options, requireConnected) {
|
|
1800
|
+
async _publish(topic, payload, options, requireConnected, allowDuringDisconnect = false) {
|
|
1801
|
+
assertMqttMessageSession();
|
|
1685
1802
|
if (this.isTesvolt) {
|
|
1686
1803
|
this._assertTesvoltWriteEnabled();
|
|
1687
1804
|
const controlTopic = this._resolveWriteTopic('EMS/V2/Inverter/Control');
|
|
@@ -1689,11 +1806,16 @@ class MqttDriver {
|
|
|
1689
1806
|
throw new Error(`TESVOLT publish topic is not enabled: ${topic}`);
|
|
1690
1807
|
}
|
|
1691
1808
|
}
|
|
1692
|
-
|
|
1693
|
-
if (
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1809
|
+
const client = this.client;
|
|
1810
|
+
if (!client || !this.connected || (this._disconnecting && !allowDuringDisconnect)) {
|
|
1811
|
+
throw new Error('MQTT not connected');
|
|
1812
|
+
}
|
|
1813
|
+
if (this._pendingOperations.count('publish') >= 64) throw new Error('E_MQTT_PENDING_LIMIT');
|
|
1814
|
+
const remainingMs = allowDuringDisconnect ? Math.floor(this._disconnectDeadline - performance.now()) : 5000;
|
|
1815
|
+
if (remainingMs <= 0) throw new Error('E_MQTT_SHUTDOWN_DEADLINE');
|
|
1816
|
+
await this._pendingOperations.run(client, 'publish', remainingMs,
|
|
1817
|
+
finish => client.publish(topic, payload, options, finish),
|
|
1818
|
+
() => this._retireTransport(client, 'E_MQTT_PUBLISH_TIMEOUT'));
|
|
1697
1819
|
}
|
|
1698
1820
|
|
|
1699
1821
|
async readDatapoints(/* datapoints */) {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
'use strict';
|
|
3
|
+
const { AsyncLocalStorage } = require('node:async_hooks');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* NexoWatt Quellcode-Erklärung (DE)
|
|
7
|
+
* Aufgabe: MQTT-Aufträge an eine konkrete Sitzung und eine Gesamtfrist binden.
|
|
8
|
+
* Daten und Wirkung: Bindet offene Callbacks und asynchrone Messwerte an die Sitzung; Abbruch entfernt Timer und Auftrag.
|
|
9
|
+
* Bei Änderungen: Nach Fristablauf muss der Besitzer den tatsächlichen Transport beenden.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** @typedef {{ owner: object, kind: 'publish' | 'subscribe', cancel: (error: Error) => void }} PendingOperation */
|
|
13
|
+
class MqttPendingOperations {
|
|
14
|
+
constructor() {
|
|
15
|
+
/** @type {Set<PendingOperation>} */
|
|
16
|
+
this.pending = new Set();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get size() { return this.pending.size; }
|
|
20
|
+
|
|
21
|
+
/** @param {'publish' | 'subscribe'} kind */
|
|
22
|
+
count(kind) {
|
|
23
|
+
let count = 0;
|
|
24
|
+
for (const operation of this.pending) if (operation.kind === kind) count += 1;
|
|
25
|
+
return count;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @param {object | null} owner @param {string} reason */
|
|
29
|
+
cancel(owner, reason) {
|
|
30
|
+
for (const operation of [...this.pending]) {
|
|
31
|
+
if (operation.owner === owner) operation.cancel(new Error(reason));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @template T
|
|
37
|
+
* @param {object} owner
|
|
38
|
+
* @param {'publish' | 'subscribe'} kind
|
|
39
|
+
* @param {number} deadlineMs
|
|
40
|
+
* @param {(done: (error?: unknown, value?: T) => void) => void} dispatch
|
|
41
|
+
* @param {() => void} abortTransport
|
|
42
|
+
* @returns {Promise<T | undefined>}
|
|
43
|
+
*/
|
|
44
|
+
run(owner, kind, deadlineMs, dispatch, abortTransport) {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
let settled = false;
|
|
47
|
+
/** @param {unknown} [error] @param {T} [value] */
|
|
48
|
+
const finish = (error, value) => {
|
|
49
|
+
if (settled) return;
|
|
50
|
+
settled = true;
|
|
51
|
+
clearTimeout(timeout);
|
|
52
|
+
this.pending.delete(operation);
|
|
53
|
+
if (error !== undefined && error !== null) reject(error); else resolve(value);
|
|
54
|
+
};
|
|
55
|
+
const operation = { owner, kind, cancel: finish };
|
|
56
|
+
const timeout = setTimeout(() => {
|
|
57
|
+
finish(new Error(kind === 'publish' ? 'E_MQTT_PUBLISH_TIMEOUT' : 'E_MQTT_SUBSCRIBE_TIMEOUT'));
|
|
58
|
+
messageSession.exit(abortTransport);
|
|
59
|
+
}, deadlineMs);
|
|
60
|
+
this.pending.add(operation);
|
|
61
|
+
try { dispatch(finish); } catch (error) { finish(error); }
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** @type {AsyncLocalStorage<() => boolean>} */
|
|
66
|
+
const messageSession = new AsyncLocalStorage();
|
|
67
|
+
/** @template T @param {() => boolean} current @param {() => T} action @returns {T} */
|
|
68
|
+
function runMqttMessageSession(current, action) { return messageSession.run(current, action); }
|
|
69
|
+
function assertMqttMessageSession() {
|
|
70
|
+
const current = messageSession.getStore();
|
|
71
|
+
if (current && !current()) throw new Error('E_MQTT_MESSAGE_SESSION_ENDED');
|
|
72
|
+
}
|
|
73
|
+
/** @type {AsyncLocalStorage<{ queue: object, active: boolean }>} */
|
|
74
|
+
const callbackQueueContext = new AsyncLocalStorage();
|
|
75
|
+
class MqttCallbackQueue {
|
|
76
|
+
constructor() {
|
|
77
|
+
/** @type {Promise<void>} */
|
|
78
|
+
this.tail = Promise.resolve();
|
|
79
|
+
this.pendingCount = 0;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @template T
|
|
83
|
+
* @param {() => Promise<T>} action
|
|
84
|
+
* @param {'telemetry' | 'barrier'} [kind]
|
|
85
|
+
* @returns {Promise<T>}
|
|
86
|
+
*/
|
|
87
|
+
run(action, kind = 'telemetry') {
|
|
88
|
+
const enclosing = callbackQueueContext.getStore();
|
|
89
|
+
if (enclosing?.queue === this && enclosing.active) return Promise.resolve().then(action);
|
|
90
|
+
if (kind === 'telemetry' && this.pendingCount >= 32) return Promise.reject(new Error('E_MQTT_CALLBACK_BACKLOG'));
|
|
91
|
+
this.pendingCount += 1;
|
|
92
|
+
const result = this.tail.then(async () => {
|
|
93
|
+
const token = { queue: this, active: true };
|
|
94
|
+
try { return await callbackQueueContext.run(token, action); }
|
|
95
|
+
finally { token.active = false; }
|
|
96
|
+
});
|
|
97
|
+
this.tail = result.then(() => undefined, () => undefined).finally(() => { this.pendingCount -= 1; });
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
drain() { return this.tail; }
|
|
101
|
+
}
|
|
102
|
+
class MqttMessageBacklog {
|
|
103
|
+
constructor() { this.count = 0; this.bytes = 0; }
|
|
104
|
+
/** @param {number} bytes @returns {() => void} */
|
|
105
|
+
reserve(bytes) {
|
|
106
|
+
if (!Number.isSafeInteger(bytes) || bytes < 0 || bytes > 1024 * 1024) throw new Error('E_MQTT_PAYLOAD_LIMIT');
|
|
107
|
+
if (this.count >= 256 || this.bytes + bytes > 4 * 1024 * 1024) throw new Error('E_MQTT_BACKLOG_LIMIT');
|
|
108
|
+
this.count += 1;
|
|
109
|
+
this.bytes += bytes;
|
|
110
|
+
let released = false;
|
|
111
|
+
return () => {
|
|
112
|
+
if (released) return;
|
|
113
|
+
released = true;
|
|
114
|
+
this.count -= 1;
|
|
115
|
+
this.bytes -= bytes;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
module.exports = { MqttPendingOperations, MqttCallbackQueue, MqttMessageBacklog, runMqttMessageSession, assertMqttMessageSession };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Keep proof local to the actual snapshot. It cannot survive JSON/cache copies,
|
|
5
|
+
// and does not add data points or change the enumerable measurement contract.
|
|
6
|
+
/** @type {WeakMap<object, Map<string, object>>} */
|
|
7
|
+
const responses = new WeakMap();
|
|
8
|
+
|
|
9
|
+
/** Record only decoded values from one completed, validated register response.
|
|
10
|
+
* @param {object} values @param {string[]} ids @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
function recordReadResponse(values, ids) {
|
|
13
|
+
let samples = responses.get(values);
|
|
14
|
+
if (!samples) { samples = new Map(); responses.set(values, samples); }
|
|
15
|
+
const response = {};
|
|
16
|
+
for (const id of ids) samples.set(id, response);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A poll can contain several replies, including adaptive split fallback.
|
|
20
|
+
* Context-sensitive registers must originate in the same actual response.
|
|
21
|
+
* @param {object} values @param {string} target @param {string} context @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
function hasSameReadResponse(values, target, context) {
|
|
24
|
+
const samples = responses.get(values);
|
|
25
|
+
const response = samples?.get(target);
|
|
26
|
+
return !!response && response === samples?.get(context);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { recordReadResponse, hasSameReadResponse };
|