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.
Files changed (491) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +4 -4
  2. package/README.md +7 -3
  3. package/START_HIER_9.0.20.md +65 -0
  4. package/adminWww/.vite/manifest.json +39 -39
  5. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +110 -109
  6. package/adminWww/assets/{AdapterUpdateDialog-JOf2z4Vg.js → AdapterUpdateDialog-Dxl_b7Op.js} +1 -1
  7. package/adminWww/assets/{Adapters-C9fcSdWm.js → Adapters-CVKKhXmI.js} +1 -1
  8. package/adminWww/assets/{ConfigManager-BeeLlT6D.js → ConfigManager-Bf6nTAkL.js} +1 -1
  9. package/adminWww/assets/{Enums-FqnXWl8U.js → Enums-CJHVJY7t.js} +1 -1
  10. package/adminWww/assets/{Fields-DMgrt5Pi.js → Fields-DWHbZKvm.js} +1 -1
  11. package/adminWww/assets/{Files-CIHtt12g.js → Files-a6owMTXA.js} +1 -1
  12. package/adminWww/assets/{Hosts-fPLBzvTy.js → Hosts-LtEMeXpV.js} +1 -1
  13. package/adminWww/assets/{Instances-4XaVQlrT.js → Instances-DhChziA1.js} +1 -1
  14. package/adminWww/assets/{Intro-5TKriiLO.js → Intro-Cyq9gVDC.js} +1 -1
  15. package/adminWww/assets/{Logs-33zcIds-.js → Logs-wcramXsg.js} +1 -1
  16. package/adminWww/assets/{Objects-CNQPVbNG.js → Objects-DINVHd_e.js} +1 -1
  17. package/adminWww/assets/{Overview-BskXGOc8.js → Overview-DK4R41zR.js} +1 -1
  18. package/adminWww/assets/{State-C8SJ_Iqo.js → State-DcEACXzL.js} +1 -1
  19. package/adminWww/assets/{UsedResources-CgqRa9ei.js → UsedResources-C1LcM0Rb.js} +1 -1
  20. package/adminWww/assets/{Users-0JVYWR9u.js → Users-DvDdSyDY.js} +1 -1
  21. package/adminWww/assets/{bootstrap-D16lu6rd.js → bootstrap-Dbj_GbnP.js} +3 -3
  22. package/adminWww/assets/{hostInit-C8YZJuzi.js → hostInit-BNFIx0-f.js} +1 -1
  23. package/adminWww/assets/icons/nexowatt-180.png +0 -0
  24. package/adminWww/assets/{icons-material-CiNJ_6Ur.js → icons-material-DVbdXNgr.js} +1 -1
  25. package/adminWww/assets/{index-DA9Sphgh.js → index-CoKP1NSA.js} +2 -2
  26. package/adminWww/assets/{installSVGRenderer-DPdkRa_d.js → installSVGRenderer-CMvku1F1.js} +1 -1
  27. package/adminWww/assets/{mf-entry-bootstrap-0-a7ab91de.js → mf-entry-bootstrap-0-ac330bce.js} +2 -2
  28. package/adminWww/index.html +24 -24
  29. package/adminWww/mf-manifest.json +1 -1
  30. package/adminWww/mf-stats.json +1 -1
  31. package/adminWww/{remoteEntry-eos-9.0.19.js → remoteEntry-eos-9.0.21.js} +1 -1
  32. package/adminWww/remoteEntry.js +1 -1
  33. package/build/lib/eosCustomerUpdateHttp.js +203 -0
  34. package/build/lib/eosCustomerUpdateHttp.js.map +1 -0
  35. package/build/lib/eosCustomerUpdateTransport.js +472 -0
  36. package/build/lib/eosCustomerUpdateTransport.js.map +1 -0
  37. package/build/lib/eosCustomerUpdateWorker.js +567 -0
  38. package/build/lib/eosCustomerUpdateWorker.js.map +1 -0
  39. package/build/lib/eosCustomerUpdates.js +631 -0
  40. package/build/lib/eosCustomerUpdates.js.map +1 -0
  41. package/build/lib/eosDeviceEmsPlan.js +18 -5
  42. package/build/lib/eosDeviceEmsPlan.js.map +1 -1
  43. package/build/lib/eosDeviceEmsService.js +52 -2
  44. package/build/lib/eosDeviceEmsService.js.map +1 -1
  45. package/build/lib/eosLegacyMigration.js +26 -1
  46. package/build/lib/eosLegacyMigration.js.map +1 -1
  47. package/build/lib/eosModuleConfigStore.js +12 -1
  48. package/build/lib/eosModuleConfigStore.js.map +1 -1
  49. package/build/lib/eosModuleHost.js +81 -26
  50. package/build/lib/eosModuleHost.js.map +1 -1
  51. package/build/lib/eosModuleHttp.js +8 -2
  52. package/build/lib/eosModuleHttp.js.map +1 -1
  53. package/build/lib/eosStateSubscriptions.js +59 -2
  54. package/build/lib/eosStateSubscriptions.js.map +1 -1
  55. package/build/lib/eosUpdateSnapshot.js +290 -0
  56. package/build/lib/eosUpdateSnapshot.js.map +1 -0
  57. package/build/lib/eosUploadGuard.js +124 -81
  58. package/build/lib/eosUploadGuard.js.map +1 -1
  59. package/build/lib/web.js +83 -0
  60. package/build/lib/web.js.map +1 -1
  61. package/docs/reports/unified-9.0.20/ANFORDERUNGEN_UND_INBETRIEBNAHME.md +159 -0
  62. package/docs/reports/unified-9.0.20/DEVICE_COMMAND_DELIVERY_REVIEW.md +82 -0
  63. package/docs/reports/unified-9.0.20/DEVICE_LIFECYCLE_REVIEW.md +46 -0
  64. package/docs/reports/unified-9.0.20/DEVICE_PLAN_REVIEW.md +33 -0
  65. package/docs/reports/unified-9.0.20/DEVICE_POWER_CAPABILITY_REVIEW.md +25 -0
  66. package/docs/reports/unified-9.0.20/FARM_CONTROLLER_REVIEW.md +27 -0
  67. package/docs/reports/unified-9.0.20/FARM_DIAGNOSE_UI.md +81 -0
  68. package/docs/reports/unified-9.0.20/FARM_DISPATCH_REVIEW.md +47 -0
  69. package/docs/reports/unified-9.0.20/HISTORY_REVIEW.md +68 -0
  70. package/docs/reports/unified-9.0.20/INFLUXDB2_INSTALLER_UI.md +39 -0
  71. package/docs/reports/unified-9.0.20/INFLUX_CREDENTIAL_NETWORK_REVIEW.md +38 -0
  72. package/docs/reports/unified-9.0.20/INFLUX_DIRECT_UNABHAENGIGE_PRUEFUNG.md +64 -0
  73. package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_INTEGRATION_REVIEW.md +53 -0
  74. package/docs/reports/unified-9.0.20/INFLUX_RUNTIME_UNABHAENGIGE_PRUEFUNG.md +34 -0
  75. package/docs/reports/unified-9.0.20/INFLUX_TRANSPORT_ABSCHLUSSPRUEFUNG.md +55 -0
  76. package/docs/reports/unified-9.0.20/LOGIN_WEBAPP_LOGO.md +29 -0
  77. package/docs/reports/unified-9.0.20/MIGRATION_REVIEW.md +35 -0
  78. package/docs/reports/unified-9.0.20/PRUEFBERICHT.md +54 -0
  79. package/docs/reports/unified-9.0.20/PWA_ANONYMOUS_HTTPS_REVIEW.md +28 -0
  80. package/docs/reports/unified-9.0.20/PWA_ICON_UNABHAENGIGE_PRUEFUNG.md +60 -0
  81. package/docs/reports/unified-9.0.20/SERIAL_LIFECYCLE_REVIEW.md +37 -0
  82. package/docs/reports/unified-9.0.20/SOLAX_READBACK_REVIEW.md +43 -0
  83. package/docs/reports/unified-9.0.20/SOLAX_READBACK_UNABHAENGIGE_PRUEFUNG.md +34 -0
  84. package/docs/reports/unified-9.0.20/STATIC_REVIEW_DE.md +175 -0
  85. package/docs/reports/unified-9.0.20/STORAGE_COMMAND_ACK_REVIEW.md +36 -0
  86. package/docs/reports/unified-9.0.20/TARIFF_REPORT_REVIEW.md +29 -0
  87. package/docs/reports/unified-9.0.20/VISUALISIERUNG.md +64 -0
  88. package/docs/reports/unified-9.0.20/history-setup-navigation-proxy.txt +26 -0
  89. package/docs/reports/unified-9.0.20/history-setup-navigation-ssr.txt +7 -0
  90. package/docs/reports/unified-9.0.20/history-setup-ui-lint.txt +0 -0
  91. package/docs/reports/unified-9.0.20/history-setup-ui-node22.txt +102 -0
  92. package/docs/reports/unified-9.0.20/history-setup-ui-node24.txt +23 -0
  93. package/docs/reports/unified-9.0.20/history-setup-ui-security.txt +0 -0
  94. package/docs/reports/unified-9.0.20/history-setup-ui-typecheck.txt +0 -0
  95. package/docs/reports/unified-9.0.20/login-pwa-branding-hashes.txt +9 -0
  96. package/docs/reports/unified-9.0.20/login-pwa-branding-node22.txt +42 -0
  97. package/docs/reports/unified-9.0.20/login-pwa-branding-node24.txt +13 -0
  98. package/docs/reports/unified-9.0.20/raw/INDEX.json +1913 -0
  99. package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node22.log +16 -0
  100. package/docs/reports/unified-9.0.20/raw/additional-audit/device/baseline-node24.log +14 -0
  101. package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-after.json +1 -0
  102. package/docs/reports/unified-9.0.20/raw/additional-audit/device/lint-before.json +1 -0
  103. package/docs/reports/unified-9.0.20/raw/additional-audit/device/modbus-stop-backoff.cjs +22 -0
  104. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-control-review.log +29 -0
  105. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.json +18 -0
  106. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-final.log +325 -0
  107. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node22-modbus-review.log +278 -0
  108. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.json +18 -0
  109. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-final.log +58 -0
  110. package/docs/reports/unified-9.0.20/raw/additional-audit/device/node24-modbus-review.log +51 -0
  111. package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-gaps-before.log +64 -0
  112. package/docs/reports/unified-9.0.20/raw/additional-audit/history/api-negative-before.log +46 -0
  113. package/docs/reports/unified-9.0.20/raw/additional-audit/history/chart-gaps-before.log +127 -0
  114. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-after.log +67 -0
  115. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-before.log +61 -0
  116. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-js.log +0 -0
  117. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-eslint-ts.log +0 -0
  118. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node22.log +442 -0
  119. package/docs/reports/unified-9.0.20/raw/additional-audit/history/device-command-subscriptions-node24.log +78 -0
  120. package/docs/reports/unified-9.0.20/raw/additional-audit/history/fix.py +73 -0
  121. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-eslint-final.json +7 -0
  122. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node22.log +279 -0
  123. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-final-node24.log +52 -0
  124. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node22.log +223 -0
  125. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-followup-node24.log +43 -0
  126. package/docs/reports/unified-9.0.20/raw/additional-audit/history/history-own-cache.log +17 -0
  127. package/docs/reports/unified-9.0.20/raw/additional-audit/history/negative-pricing-before.log +96 -0
  128. package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-after.log +66 -0
  129. package/docs/reports/unified-9.0.20/raw/additional-audit/history/node22-repro.log +8 -0
  130. package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-after.log +17 -0
  131. package/docs/reports/unified-9.0.20/raw/additional-audit/history/node24-repro.log +8 -0
  132. package/docs/reports/unified-9.0.20/raw/additional-audit/history/repro.cjs +39 -0
  133. package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/chromium-probe.log +3 -0
  134. package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/patch-live.py +101 -0
  135. package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.cjs +26 -0
  136. package/docs/reports/unified-9.0.20/raw/additional-audit/visuals/repro-live-display.log +36 -0
  137. package/docs/reports/unified-9.0.20/raw/audit-full.log +345 -0
  138. package/docs/reports/unified-9.0.20/raw/audit-full.result.json +14 -0
  139. package/docs/reports/unified-9.0.20/raw/audit-runtime.log +23 -0
  140. package/docs/reports/unified-9.0.20/raw/audit-runtime.result.json +15 -0
  141. package/docs/reports/unified-9.0.20/raw/backend-final.log +5 -0
  142. package/docs/reports/unified-9.0.20/raw/backend-final.result.json +14 -0
  143. package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.result.json +20 -0
  144. package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node22.tap +721 -0
  145. package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.result.json +20 -0
  146. package/docs/reports/unified-9.0.20/raw/baseline-919-coverage-tests-node24.tap +127 -0
  147. package/docs/reports/unified-9.0.20/raw/commissioning-evidence.json +69 -0
  148. package/docs/reports/unified-9.0.20/raw/commissioning-failed-init-drain-919-before.log +14 -0
  149. package/docs/reports/unified-9.0.20/raw/commissioning-final-node22.log +882 -0
  150. package/docs/reports/unified-9.0.20/raw/commissioning-final-node24.log +149 -0
  151. package/docs/reports/unified-9.0.20/raw/commissioning-lint.log +0 -0
  152. package/docs/reports/unified-9.0.20/raw/commissioning-planner-919-before.log +70 -0
  153. package/docs/reports/unified-9.0.20/raw/commissioning-retained-readiness-before.log +34 -0
  154. package/docs/reports/unified-9.0.20/raw/commissioning-runtime-retry-919-before.log +46 -0
  155. package/docs/reports/unified-9.0.20/raw/commissioning-types-node24.log +0 -0
  156. package/docs/reports/unified-9.0.20/raw/device-farm-protocol/DEVICE_FARM_READONLY_REVIEW.md +66 -0
  157. package/docs/reports/unified-9.0.20/raw/device-farm-protocol/run-readback-tests.cjs +13 -0
  158. package/docs/reports/unified-9.0.20/raw/device-farm-protocol/solax-control-chain.test.cjs +58 -0
  159. package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node22.log +16 -0
  160. package/docs/reports/unified-9.0.20/raw/device-lifecycle-baseline-node24.log +14 -0
  161. package/docs/reports/unified-9.0.20/raw/device-lifecycle-evidence.json +55 -0
  162. package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-after.json +1 -0
  163. package/docs/reports/unified-9.0.20/raw/device-lifecycle-lint-before.json +1 -0
  164. package/docs/reports/unified-9.0.20/raw/device-lifecycle-modbus-stop-backoff.cjs +22 -0
  165. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-control-review.log +29 -0
  166. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.json +18 -0
  167. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-final.log +325 -0
  168. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node22-modbus-review.log +278 -0
  169. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.json +18 -0
  170. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-final.log +58 -0
  171. package/docs/reports/unified-9.0.20/raw/device-lifecycle-node24-modbus-review.log +51 -0
  172. package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.log +0 -0
  173. package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node22.result.json +15 -0
  174. package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.log +0 -0
  175. package/docs/reports/unified-9.0.20/raw/devices-hosted-typecheck-node24.result.json +15 -0
  176. package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node22.log +110 -0
  177. package/docs/reports/unified-9.0.20/raw/farm-controller/controller-node24.log +24 -0
  178. package/docs/reports/unified-9.0.20/raw/farm-controller/evidence.json +33 -0
  179. package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-lint.txt +0 -0
  180. package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node22.txt +113 -0
  181. package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-node24.txt +26 -0
  182. package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-security.txt +0 -0
  183. package/docs/reports/unified-9.0.20/raw/farm-diagnostics-ui-typecheck.txt +0 -0
  184. package/docs/reports/unified-9.0.20/raw/farm-dispatch/allocator-baseline.jsonl +6 -0
  185. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-before.log +138 -0
  186. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-delta.patch +77 -0
  187. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-main-lint.json +7 -0
  188. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.log +64 -0
  189. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node22.result.json +14 -0
  190. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.log +18 -0
  191. package/docs/reports/unified-9.0.20/raw/farm-dispatch/diagnostics-node24.result.json +14 -0
  192. package/docs/reports/unified-9.0.20/raw/final-ui-independent-review.json +194 -0
  193. package/docs/reports/unified-9.0.20/raw/frontend-build.log +152 -0
  194. package/docs/reports/unified-9.0.20/raw/frontend-build.result.json +14 -0
  195. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.json +35 -0
  196. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node22.result.json +17 -0
  197. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.json +31 -0
  198. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-after-node24.result.json +17 -0
  199. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-before.json +31 -0
  200. package/docs/reports/unified-9.0.20/raw/independent-influx/parser-reproducer.cjs +9 -0
  201. package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.result.json +18 -0
  202. package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node22.tap +34 -0
  203. package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.result.json +18 -0
  204. package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra-node24.tap +11 -0
  205. package/docs/reports/unified-9.0.20/raw/independent-influx/transport-extra.test.cjs +9 -0
  206. package/docs/reports/unified-9.0.20/raw/independent-solax/node22-focused.log +165 -0
  207. package/docs/reports/unified-9.0.20/raw/independent-solax/node24-focused.log +35 -0
  208. package/docs/reports/unified-9.0.20/raw/independent-solax/review-receipt.json +57 -0
  209. package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-after.log +1 -0
  210. package/docs/reports/unified-9.0.20/raw/independent-solax/split-response-before.log +1 -0
  211. package/docs/reports/unified-9.0.20/raw/independent-solax/split-response.cjs +16 -0
  212. package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race-generation-guard.log +1 -0
  213. package/docs/reports/unified-9.0.20/raw/independent-solax/stop-race.cjs +13 -0
  214. package/docs/reports/unified-9.0.20/raw/influx-direct/eslint.log +0 -0
  215. package/docs/reports/unified-9.0.20/raw/influx-direct/node22.log +112 -0
  216. package/docs/reports/unified-9.0.20/raw/influx-direct/node24.log +24 -0
  217. package/docs/reports/unified-9.0.20/raw/influx-direct/typecheck.log +0 -0
  218. package/docs/reports/unified-9.0.20/raw/influx-direct-review/hosted-module-history.test.cjs +85 -0
  219. package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.json +12 -0
  220. package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node22.log +100 -0
  221. package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.json +12 -0
  222. package/docs/reports/unified-9.0.20/raw/influx-direct-review/independent-node24.log +21 -0
  223. package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-after.test.cjs +15 -0
  224. package/docs/reports/unified-9.0.20/raw/influx-direct-review/runtime-loss-before.test.cjs +9 -0
  225. package/docs/reports/unified-9.0.20/raw/influx-direct-review/security-scan.cjs +15 -0
  226. package/docs/reports/unified-9.0.20/raw/influx-direct-review/transport-extra.test.cjs +9 -0
  227. package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.log +227 -0
  228. package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node22.result.json +11 -0
  229. package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.log +44 -0
  230. package/docs/reports/unified-9.0.20/raw/influx-independent/legacy-history-node24.result.json +11 -0
  231. package/docs/reports/unified-9.0.20/raw/influx-independent/node22.log +112 -0
  232. package/docs/reports/unified-9.0.20/raw/influx-independent/node22.result.json +12 -0
  233. package/docs/reports/unified-9.0.20/raw/influx-independent/node24.log +23 -0
  234. package/docs/reports/unified-9.0.20/raw/influx-independent/node24.result.json +12 -0
  235. package/docs/reports/unified-9.0.20/raw/influx-independent/runtime-after.test.cjs +15 -0
  236. package/docs/reports/unified-9.0.20/raw/influx-independent/transport-extra.test.cjs +9 -0
  237. package/docs/reports/unified-9.0.20/raw/influx-runtime/evidence.json +24 -0
  238. package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node22.log +326 -0
  239. package/docs/reports/unified-9.0.20/raw/influx-runtime/final-node24.log +59 -0
  240. package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node22.log +62 -0
  241. package/docs/reports/unified-9.0.20/raw/influx-runtime/runtime-node24.log +16 -0
  242. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.log +0 -0
  243. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-lint.result.json +17 -0
  244. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.log +112 -0
  245. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node22.result.json +15 -0
  246. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.log +106 -0
  247. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-node24.result.json +15 -0
  248. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.log +0 -0
  249. package/docs/reports/unified-9.0.20/raw/influx-security/security-influx-typecheck.result.json +15 -0
  250. package/docs/reports/unified-9.0.20/raw/influx-security/source-sha256.json +5 -0
  251. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.log +0 -0
  252. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-lint-final.result.json +16 -0
  253. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.log +124 -0
  254. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node22-final.result.json +14 -0
  255. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.log +26 -0
  256. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-node24-final.result.json +14 -0
  257. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.log +0 -0
  258. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node22-final.result.json +15 -0
  259. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.log +0 -0
  260. package/docs/reports/unified-9.0.20/raw/influx-transport-final/influx-transport-type-node24-final.result.json +15 -0
  261. package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-final.json +285 -0
  262. package/docs/reports/unified-9.0.20/raw/influx-ui-independent-review-intermediate.json +285 -0
  263. package/docs/reports/unified-9.0.20/raw/installer-build.log +26 -0
  264. package/docs/reports/unified-9.0.20/raw/installer-build.result.json +14 -0
  265. package/docs/reports/unified-9.0.20/raw/isolation/INDEX.json +332 -0
  266. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.log +3 -0
  267. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-final.result.json +13 -0
  268. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.log +6 -0
  269. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-hosted.result.json +13 -0
  270. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.log +1 -0
  271. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family-verified.result.json +13 -0
  272. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.log +11 -0
  273. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-family.result.json +13 -0
  274. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.log +3 -0
  275. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-final.result.json +13 -0
  276. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.log +3 -0
  277. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-hosted.result.json +13 -0
  278. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.log +1 -0
  279. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid-verified.result.json +13 -0
  280. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.log +11 -0
  281. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-fenecon-hybrid.result.json +13 -0
  282. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.log +296 -0
  283. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node22.result.json +16 -0
  284. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.log +56 -0
  285. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-final-node24.result.json +16 -0
  286. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.log +54 -0
  287. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-node24.result.json +16 -0
  288. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.log +1 -0
  289. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-output-modes.result.json +13 -0
  290. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.log +332 -0
  291. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node22.result.json +16 -0
  292. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.log +62 -0
  293. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-final-node24.result.json +16 -0
  294. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.log +342 -0
  295. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node22.result.json +16 -0
  296. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.log +72 -0
  297. package/docs/reports/unified-9.0.20/raw/isolation/command-ack-release-node24.result.json +16 -0
  298. package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.log +482 -0
  299. package/docs/reports/unified-9.0.20/raw/isolation/isolation-node22.result.json +19 -0
  300. package/docs/reports/unified-9.0.20/raw/isolation/isolation-node24.log +87 -0
  301. package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.log +0 -0
  302. package/docs/reports/unified-9.0.20/raw/isolation/migration-lint.result.json +16 -0
  303. package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.log +330 -0
  304. package/docs/reports/unified-9.0.20/raw/isolation/migration-node22.result.json +16 -0
  305. package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.log +72 -0
  306. package/docs/reports/unified-9.0.20/raw/isolation/migration-node24-before.result.json +16 -0
  307. package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.log +60 -0
  308. package/docs/reports/unified-9.0.20/raw/isolation/migration-node24.result.json +16 -0
  309. package/docs/reports/unified-9.0.20/raw/isolation/repro-migration-start-budget.cjs +49 -0
  310. package/docs/reports/unified-9.0.20/raw/isolation/repro-serial-release.cjs +21 -0
  311. package/docs/reports/unified-9.0.20/raw/isolation/repro-sunspec-discovery.cjs +11 -0
  312. package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.log +1 -0
  313. package/docs/reports/unified-9.0.20/raw/isolation/serial-before-repro.result.json +13 -0
  314. package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.log +32 -0
  315. package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node22.result.json +14 -0
  316. package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.log +11 -0
  317. package/docs/reports/unified-9.0.20/raw/isolation/serial-gates-node24.result.json +14 -0
  318. package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.log +0 -0
  319. package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck-final.result.json +28 -0
  320. package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.log +2 -0
  321. package/docs/reports/unified-9.0.20/raw/isolation/serial-helper-typecheck.result.json +26 -0
  322. package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.log +0 -0
  323. package/docs/reports/unified-9.0.20/raw/isolation/serial-lint.result.json +18 -0
  324. package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.log +344 -0
  325. package/docs/reports/unified-9.0.20/raw/isolation/serial-node22.result.json +17 -0
  326. package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.log +62 -0
  327. package/docs/reports/unified-9.0.20/raw/isolation/serial-node24.result.json +17 -0
  328. package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.log +3 -0
  329. package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-after.result.json +13 -0
  330. package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.log +3 -0
  331. package/docs/reports/unified-9.0.20/raw/isolation/sunspec-review-before.result.json +15 -0
  332. package/docs/reports/unified-9.0.20/raw/keygen-source.json +6 -0
  333. package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-919.log +70 -0
  334. package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/check-920.log +71 -0
  335. package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/diff.json +82 -0
  336. package/docs/reports/unified-9.0.20/raw/legacy-mirror-debt/receipt.json +48 -0
  337. package/docs/reports/unified-9.0.20/raw/lint-final.log +16 -0
  338. package/docs/reports/unified-9.0.20/raw/lint-final.result.json +14 -0
  339. package/docs/reports/unified-9.0.20/raw/main-individual-review-before-cache-boundary-fix.json +112 -0
  340. package/docs/reports/unified-9.0.20/raw/main-individual-review-before-capability-ack.json +103 -0
  341. package/docs/reports/unified-9.0.20/raw/main-individual-review-before-farm-diagnostics.json +102 -0
  342. package/docs/reports/unified-9.0.20/raw/main-individual-review-final.json +103 -0
  343. package/docs/reports/unified-9.0.20/raw/main-individual-review.json +93 -0
  344. package/docs/reports/unified-9.0.20/raw/modules-build.log +5 -0
  345. package/docs/reports/unified-9.0.20/raw/modules-build.result.json +14 -0
  346. package/docs/reports/unified-9.0.20/raw/node22-tests-final.log +12471 -0
  347. package/docs/reports/unified-9.0.20/raw/node22-tests-final.result.json +13 -0
  348. package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.log +7 -0
  349. package/docs/reports/unified-9.0.20/raw/node22-typecheck-final.result.json +14 -0
  350. package/docs/reports/unified-9.0.20/raw/node22-version.log +1 -0
  351. package/docs/reports/unified-9.0.20/raw/node24-tests-final.log +2093 -0
  352. package/docs/reports/unified-9.0.20/raw/node24-tests-final.result.json +13 -0
  353. package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.log +5 -0
  354. package/docs/reports/unified-9.0.20/raw/node24-typecheck-final.result.json +14 -0
  355. package/docs/reports/unified-9.0.20/raw/node24-version.log +1 -0
  356. package/docs/reports/unified-9.0.20/raw/power-capability/evidence.json +69 -0
  357. package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-existing-regressions-node24.log +94 -0
  358. package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-lint.log +0 -0
  359. package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node22.log +304 -0
  360. package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-node24.log +56 -0
  361. package/docs/reports/unified-9.0.20/raw/power-capability/power-capability-typecheck.log +0 -0
  362. package/docs/reports/unified-9.0.20/raw/pwa-https/evidence.json +45 -0
  363. package/docs/reports/unified-9.0.20/raw/pwa-https/node22-build.log +21 -0
  364. package/docs/reports/unified-9.0.20/raw/pwa-https/node22-source.log +23 -0
  365. package/docs/reports/unified-9.0.20/raw/pwa-https/node24-build.log +11 -0
  366. package/docs/reports/unified-9.0.20/raw/pwa-https/node24-source.log +11 -0
  367. package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-boundaries.test.cjs +45 -0
  368. package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-receipt.json +71 -0
  369. package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v22.23.4.tap +34 -0
  370. package/docs/reports/unified-9.0.20/raw/pwa-independent/policy-v24.22.3.tap +11 -0
  371. package/docs/reports/unified-9.0.20/raw/pwa-ui-independent-review-final.json +348 -0
  372. package/docs/reports/unified-9.0.20/raw/repro-failed-init-drain-before.cjs +15 -0
  373. package/docs/reports/unified-9.0.20/raw/repro-profile-replacement-after-unmapped.cjs +15 -0
  374. package/docs/reports/unified-9.0.20/raw/repro-runtime-retry-before.cjs +18 -0
  375. package/docs/reports/unified-9.0.20/raw/sbom-runtime.log +7 -0
  376. package/docs/reports/unified-9.0.20/raw/sbom-runtime.result.json +14 -0
  377. package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.log +1 -0
  378. package/docs/reports/unified-9.0.20/raw/sbom-vendor-check.result.json +14 -0
  379. package/docs/reports/unified-9.0.20/raw/solax-readback-node22.json +30 -0
  380. package/docs/reports/unified-9.0.20/raw/solax-readback-node22.log +542 -0
  381. package/docs/reports/unified-9.0.20/raw/solax-readback-node24.json +30 -0
  382. package/docs/reports/unified-9.0.20/raw/solax-readback-node24.log +97 -0
  383. package/docs/reports/unified-9.0.20/raw/tariff-report-before.log +147 -0
  384. package/docs/reports/unified-9.0.20/raw/tariff-report-evidence.json +48 -0
  385. package/docs/reports/unified-9.0.20/raw/tariff-report-final-node22.log +151 -0
  386. package/docs/reports/unified-9.0.20/raw/tariff-report-final-node24.log +32 -0
  387. package/docs/reports/unified-9.0.20/raw/ui-docs-check.log +6 -0
  388. package/docs/reports/unified-9.0.20/raw/ui-docs-check.result.json +14 -0
  389. package/docs/reports/unified-9.0.20/raw/ui-runtime-final.log +7 -0
  390. package/docs/reports/unified-9.0.20/raw/ui-runtime-final.result.json +14 -0
  391. package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.log +6 -0
  392. package/docs/reports/unified-9.0.20/raw/ui-runtime-sync.result.json +14 -0
  393. package/docs/reports/unified-9.0.20/raw/ui-sbom-check.log +6 -0
  394. package/docs/reports/unified-9.0.20/raw/ui-sbom-check.result.json +14 -0
  395. package/docs/reports/unified-9.0.20/raw/ui-sbom-final.log +6 -0
  396. package/docs/reports/unified-9.0.20/raw/ui-sbom-final.result.json +14 -0
  397. package/docs/reports/unified-9.0.20/raw/ui-secret-final.log +6 -0
  398. package/docs/reports/unified-9.0.20/raw/ui-secret-final.result.json +14 -0
  399. package/docs/reports/unified-9.0.20/raw/ui-security-final.log +8 -0
  400. package/docs/reports/unified-9.0.20/raw/ui-security-final.result.json +14 -0
  401. package/docs/reports/unified-9.0.20/raw/visuals-baseline-919.txt +36 -0
  402. package/docs/reports/unified-9.0.20/raw/visuals-browser-limit.txt +3 -0
  403. package/docs/reports/unified-9.0.20/raw/visuals-lint.txt +0 -0
  404. package/docs/reports/unified-9.0.20/raw/visuals-node22.txt +258 -0
  405. package/docs/reports/unified-9.0.20/raw/visuals-node24.txt +51 -0
  406. package/docs/reports/unified-9.0.20/raw/visuals-security.txt +0 -0
  407. package/docs/reports/unified-9.0.20/raw/visuals-typecheck.txt +0 -0
  408. package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.log +19 -0
  409. package/docs/reports/unified-9.0.20/raw/wallet-freshness-after.result.json +16 -0
  410. package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.log +31 -0
  411. package/docs/reports/unified-9.0.20/raw/wallet-freshness-before.result.json +14 -0
  412. package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.result.json +13 -0
  413. package/docs/reports/unified-9.0.20/raw/wallet-freshness-independent.tap +10 -0
  414. package/io-package.json +12 -12
  415. package/modules/backup/admin/index.js +4 -1
  416. package/modules/devices/admin/host-bridge.js +5 -1
  417. package/modules/devices/lib/device-alias-semantics-v1.json +22 -1
  418. package/modules/devices/lib/deviceAliasFreshness.js +1 -0
  419. package/modules/devices/lib/deviceAliasSemantics.js +13 -3
  420. package/modules/devices/lib/deviceRuntime.js +106 -12
  421. package/modules/devices/lib/drivers/modbus.js +90 -21
  422. package/modules/devices/lib/drivers/modbusAsciiBus.js +47 -31
  423. package/modules/devices/lib/drivers/modbusRtuBus.js +33 -9
  424. package/modules/devices/lib/drivers/modbusSerialLease.js +29 -0
  425. package/modules/devices/lib/drivers/mqtt.js +204 -82
  426. package/modules/devices/lib/drivers/mqttPendingOperations.js +119 -0
  427. package/modules/devices/lib/modbusReadEvidence.js +29 -0
  428. package/modules/devices/test/deviceAliasFreshness.test.js +7 -2
  429. package/modules/devices/test/modbusConnectLifecycle.test.js +148 -0
  430. package/modules/devices/test/modbusSerialLifecycle.test.js +91 -0
  431. package/modules/devices/test/mqttCommandLifecycle.test.js +255 -0
  432. package/modules/devices/test/mqttResourceBounds.test.js +98 -0
  433. package/modules/devices/test/mqttRuntimeSession.test.js +109 -0
  434. package/modules/devices/test/serialOperationGate.test.js +3 -3
  435. package/modules/devices/test/solaxReadbackContext.test.js +472 -0
  436. package/modules/devices/tsconfig.alias-semantics.json +1 -1
  437. package/modules/devices/tsconfig.mqtt-lifecycle.json +20 -0
  438. package/modules/devices/tsconfig.serial-lifecycle.json +18 -0
  439. package/modules/eebus/admin/index.js +6 -3
  440. package/package.json +9 -7
  441. package/release-manifests/unified/build-environment.cdx.json +6 -6
  442. package/release-manifests/unified/files.json +848 -169
  443. package/release-manifests/unified/frontend.cdx.json +6 -6
  444. package/release-manifests/unified/installer.cdx.json +6 -6
  445. package/release-manifests/unified/obsolete-admin-assets.json +154 -6
  446. package/release-manifests/unified/runtime.cdx.json +25 -25
  447. package/release-manifests/unified/validation.json +15 -15
  448. package/tools/eos-release-check.cjs +2 -2
  449. package/tools/eos-release-manifest.cjs +3 -3
  450. package/ui/admin/react/assets/index-BJO3q7oe.js +13 -0
  451. package/ui/admin/react/assets/{index-CuquHlsY.css → index-ofLP_Y7y.css} +1 -1
  452. package/ui/admin/react/index.html +2 -2
  453. package/ui/docs/security/eslint-reviewed-findings.json +91 -35
  454. package/ui/ems/engine.js +14 -3
  455. package/ui/ems/modules/energy-wallet.js +9 -3
  456. package/ui/ems/modules/storage-control.js +60 -19
  457. package/ui/ems/modules/tariff-provider.js +34 -10
  458. package/ui/ems/services/tariff-provider-registry.js +18 -8
  459. package/ui/io-package.json +1 -1
  460. package/ui/lib/influx-config.js +204 -0
  461. package/ui/lib/influx-direct.js +527 -0
  462. package/ui/lib/influx-history-runtime.js +326 -0
  463. package/ui/lib/influx-network-policy.js +112 -0
  464. package/ui/lib/ui-access-policy.js +2 -2
  465. package/ui/main.js +614 -255
  466. package/ui/package.json +12 -6
  467. package/ui/www/app.js +152 -203
  468. package/ui/www/ems-apps.html +2 -1
  469. package/ui/www/ems-apps.js +8 -1
  470. package/ui/www/energy-ledger.html +1 -1
  471. package/ui/www/eos-updates.css +15 -0
  472. package/ui/www/eos-updates.js +351 -0
  473. package/ui/www/evcs.html +1 -1
  474. package/ui/www/history.html +1 -1
  475. package/ui/www/history.js +114 -74
  476. package/ui/www/index.html +4 -1
  477. package/ui/www/live-display.js +115 -0
  478. package/ui/www/logic.html +1 -1
  479. package/ui/www/login.css +1 -0
  480. package/ui/www/login.html +2 -1
  481. package/ui/www/manifest.webmanifest +3 -3
  482. package/ui/www/settings.html +36 -1
  483. package/ui/www/simulation.html +1 -1
  484. package/ui/www/smarthome-config.html +1 -1
  485. package/ui/www/smarthome.html +1 -1
  486. package/ui/www/storagefarm-dispatch.js +287 -0
  487. package/ui/www/storagefarm-summary.css +15 -0
  488. package/ui/www/storagefarm.html +15 -1
  489. package/ui/www/storagefarm.js +8 -26
  490. package/ui/www/tariff-report.js +43 -25
  491. package/ui/admin/react/assets/index-Bq5IupDw.js +0 -13
@@ -1,11 +1,12 @@
1
1
  // @ts-check
2
2
  'use strict';
3
3
 
4
- /** @typedef {{dpId:string, type:string, unit:string, rw:string, source:Record<string, unknown>, transform:string}} Binding */
4
+ /** @typedef {{dpId:string, type:string, rw:string, source:Record<string, unknown>, value:number}} ReadContext */
5
+ /** @typedef {{dpId:string, type:string, unit:string, rw:string, source:Record<string, unknown>, transform:string, requiredReadContext?:ReadContext}} Binding */
5
6
  /** @typedef {{id?:string, type?:string, unit?:string, rw?:string, source?:Record<string, unknown>}} Datapoint */
6
7
  /** @typedef {{id?:string, category?:string, datapoints?:Datapoint[]}} Template */
7
8
  /** @typedef {{status:'available'|'unavailable', reason:string, dpId?:string}} Coverage */
8
- /** @typedef {{relId:string, name:string, role:string, type:string, unit:string, rw:string, kind:string, dpId:string, fromDevice:(value:unknown)=>number|null, semanticSource:string, deviceReadOnly:true}} SemanticDefinition */
9
+ /** @typedef {{relId:string, name:string, role:string, type:string, unit:string, rw:string, kind:string, dpId:string, fromDevice:(value:unknown)=>number|null, semanticSource:string, deviceReadOnly:true, requiredReadContext?:ReadContext}} SemanticDefinition */
9
10
 
10
11
  /** @type {{schemaVersion:number, aliases:Record<string,string>, profiles:Record<string,Record<string,Binding>>}} */
11
12
  const policy = require('./device-alias-semantics-v1.json');
@@ -83,7 +84,15 @@ function buildSemanticAliasDefinitions(options) {
83
84
  }
84
85
  const dp = typeof getDpById === 'function' ? getDpById(binding.dpId)
85
86
  : (template.datapoints || []).find(item => item.id === binding.dpId);
86
- const reason = unavailableReason(binding, dp, path);
87
+ let reason = unavailableReason(binding, dp, path);
88
+ const context = binding.requiredReadContext;
89
+ if (!reason && context) {
90
+ const modeDp = typeof getDpById === 'function' ? getDpById(context.dpId)
91
+ : (template.datapoints || []).find(item => item.id === context.dpId);
92
+ if (!modeDp || modeDp.type !== context.type || modeDp.rw !== context.rw ||
93
+ !Number.isFinite(context.value) || !hasDeviceRead(context.source) ||
94
+ !sameDescriptor(modeDp.source, context.source)) reason = 'readContextDescriptorChanged';
95
+ }
87
96
  if (reason) {
88
97
  coverage[path] = { status: 'unavailable', reason, dpId: binding.dpId };
89
98
  continue;
@@ -100,6 +109,7 @@ function buildSemanticAliasDefinitions(options) {
100
109
  fromDevice: value => transformValue(value, binding.transform),
101
110
  semanticSource: binding.dpId,
102
111
  deviceReadOnly: true,
112
+ ...(context ? { requiredReadContext: context } : {}),
103
113
  });
104
114
  coverage[path] = { status: 'available', reason: 'sourceDescriptorVerified', dpId: binding.dpId };
105
115
  }
@@ -20,6 +20,7 @@ const { getDeyeProfile, buildDeyeAliases } = require('./deyeProtocol');
20
20
  const { getVartaProfile, registersForProfile, buildVartaAliases } = require('./vartaProtocol');
21
21
  const { extendedRegistersForProfile, buildVartaExtendedAliases } = require('./vartaExtendedProtocol');
22
22
  const { MqttDriver } = require('./drivers/mqtt');
23
+ const { MqttCallbackQueue, assertMqttMessageSession } = require('./drivers/mqttPendingOperations');
23
24
  const { CanbusDriver } = require('./drivers/canbus');
24
25
  const { HttpDriver } = require('./drivers/http');
25
26
  const { UdpDriver } = require('./drivers/udp');
@@ -30,6 +31,7 @@ const { KostalTcpDriver } = require('./drivers/kostalTcp');
30
31
  const { KostalRs485Driver } = require('./drivers/kostalRs485');
31
32
  const { TaCmiDriver } = require('./drivers/taCmi');
32
33
  const { isEnergyFreshnessClass, isEnergyFreshnessAlias, captureAliasSources, hasNewAliasSample } = require('./deviceAliasFreshness');
34
+ const { hasSameReadResponse } = require('./modbusReadEvidence');
33
35
 
34
36
  const ABL_EMH1_LIVE_ALIAS_PATHS = new Set([
35
37
  'r.currentL1',
@@ -82,6 +84,7 @@ const MAX_EV_CHARGER_FRESHNESS_REFRESH_MS = 10000;
82
84
  class DeviceRuntime {
83
85
  constructor(adapter, deviceConfig, template, globalConfig) {
84
86
  this.adapter = adapter;
87
+ this._mqttCallbacks = new MqttCallbackQueue();
85
88
  this.cfg = deviceConfig;
86
89
  this.template = template;
87
90
  this.global = globalConfig || {};
@@ -95,6 +98,13 @@ class DeviceRuntime {
95
98
  // These are created under: devices.<id>.aliases.*
96
99
  this.aliasByStateRelId = new Map(); // relId -> aliasDef
97
100
  this.aliasDefs = []; // list of aliasDef
101
+ // Mode-dependent device readbacks never use command acknowledgements or
102
+ // cached mode objects as evidence. No additional polling or timer is needed.
103
+ this._qualifiedAliasSamples = new Map();
104
+ this._qualifiedAliasGeneration = 0;
105
+ this._qualifiedAliasPendingWrites = new Set();
106
+ this._qualifiedAliasMaxAgeMs = Math.max(1000,
107
+ (Number(this.template?.driverHints?.polling?.slowIntervalMs) || 5000) + 10000);
98
108
 
99
109
  // Alias Contract v1: versioned, manufacturer-independent interface for the
100
110
  // NexoWatt UI and future integration adapters. Legacy aliases remain available.
@@ -666,6 +676,7 @@ class DeviceRuntime {
666
676
  }
667
677
 
668
678
  async _setStateCached(relId, val, ack = true, options = undefined) {
679
+ assertMqttMessageSession();
669
680
  if (!relId) return false;
670
681
  const key = String(relId);
671
682
  const nextAck = !!ack;
@@ -687,10 +698,14 @@ class DeviceRuntime {
687
698
  try {
688
699
  await this.adapter.setStateAsync(key, { val: nextVal, ack: nextAck });
689
700
  this._stateCache.set(key, { val: nextVal, ack: nextAck, writtenAt: now });
690
- return true;
691
701
  } catch (_) {
702
+ assertMqttMessageSession();
692
703
  return false;
693
704
  }
705
+ // The DB write already submitted cannot be recalled. Stop this old callback
706
+ // here; the queued offline barrier follows its completion and wins last.
707
+ assertMqttMessageSession();
708
+ return true;
694
709
  }
695
710
 
696
711
  _computeLiveAliasRefreshMs({ fastIntervalMs, isEventDriven } = {}) {
@@ -975,6 +990,7 @@ class DeviceRuntime {
975
990
  }
976
991
 
977
992
  async _tickHeartbeatFromIncomingData(sourceStamp) {
993
+ assertMqttMessageSession();
978
994
  // sourceStamp: optional monotonic marker that only changes when *new* data arrived
979
995
  // (e.g., Speedwire lastSeen timestamp). If provided, we only tick when it changes.
980
996
  if (!this.started) return;
@@ -6449,6 +6465,7 @@ class DeviceRuntime {
6449
6465
  }
6450
6466
 
6451
6467
  async _updateAliases(values, ctx) {
6468
+ const readContextGeneration = this._qualifiedAliasGeneration;
6452
6469
  await this._updateVartaTableCapabilities(values).catch(error => {
6453
6470
  this.adapter.log.debug(`[${this.cfg.id}] VARTA table capability metadata update failed: ${error && error.message ? error.message : error}`);
6454
6471
  });
@@ -6481,7 +6498,7 @@ class DeviceRuntime {
6481
6498
  );
6482
6499
  continue;
6483
6500
  }
6484
- if (connectionOnlyUpdate && !isConnectionAlias(def.relId)) continue;
6501
+ if (connectionOnlyUpdate && !isConnectionAlias(def.relId) && !def.requiredReadContext) continue;
6485
6502
  // DEPower command memory is filled when a request is queued. Polling must
6486
6503
  // never turn an unsent/rejected request into a successful acknowledgement.
6487
6504
  if (this.template?.driverHints?.oemModbusV1003 && def.commandOnlyAlias === true) continue;
@@ -6489,6 +6506,35 @@ class DeviceRuntime {
6489
6506
  let outVal;
6490
6507
  let sampleSourceIds = [];
6491
6508
 
6509
+ if (def.requiredReadContext) {
6510
+ if (readContextGeneration !== this._qualifiedAliasGeneration) continue;
6511
+ const requirement = def.requiredReadContext;
6512
+ const hasTarget = Object.prototype.hasOwnProperty.call(v, def.dpId);
6513
+ const hasContext = Object.prototype.hasOwnProperty.call(v, requirement.dpId);
6514
+ const previousSampleAt = this._qualifiedAliasSamples.get(def.relId);
6515
+ const now = Date.now();
6516
+ const freshPair = c.connected !== false && c.diagnosticsOnly !== true &&
6517
+ String(this.cfg.protocol || '').startsWith('modbus') && hasTarget && hasContext &&
6518
+ hasSameReadResponse(v, def.dpId, requirement.dpId) &&
6519
+ typeof v[def.dpId] === 'number' && Number.isFinite(v[def.dpId]) &&
6520
+ typeof v[requirement.dpId] === 'number' && v[requirement.dpId] === requirement.value;
6521
+ if (freshPair) {
6522
+ this._qualifiedAliasSamples.set(def.relId, now);
6523
+ sampleSourceIds.push(requirement.dpId);
6524
+ } else {
6525
+ const incompletePair = (hasTarget || hasContext) && c.diagnosticsOnly !== true;
6526
+ const expired = previousSampleAt === undefined || now < previousSampleAt ||
6527
+ now - previousSampleAt > this._qualifiedAliasMaxAgeMs;
6528
+ if (c.connected === false || incompletePair || expired) {
6529
+ this._qualifiedAliasSamples.delete(def.relId);
6530
+ await this._setQualifiedAliasValue(def.relId, null, readContextGeneration);
6531
+ }
6532
+ // An unrelated fast poll keeps the previous timestamp until expiry;
6533
+ // it never lends fresh evidence to the last slow mode/target pair.
6534
+ continue;
6535
+ }
6536
+ }
6537
+
6492
6538
  if (def.kind === 'dp') {
6493
6539
  if (!def.dpId) continue;
6494
6540
 
@@ -6510,7 +6556,7 @@ class DeviceRuntime {
6510
6556
  continue;
6511
6557
  }
6512
6558
  raw = v[def.dpId];
6513
- sampleSourceIds = [def.dpId];
6559
+ sampleSourceIds.push(def.dpId);
6514
6560
  }
6515
6561
 
6516
6562
  if (typeof def.fromDevice === 'function') {
@@ -6546,16 +6592,40 @@ class DeviceRuntime {
6546
6592
  continue;
6547
6593
  }
6548
6594
 
6549
- await this._setStateCached(
6550
- def.relId,
6551
- outVal,
6552
- true,
6553
- this._liveAliasRefreshOptions(def.relId, v, c, sampleSourceIds),
6554
- );
6595
+ const refreshOptions = this._liveAliasRefreshOptions(def.relId, v, c, sampleSourceIds);
6596
+ if (def.requiredReadContext) {
6597
+ await this._setQualifiedAliasValue(def.relId, outVal, readContextGeneration, refreshOptions);
6598
+ } else {
6599
+ await this._setStateCached(def.relId, outVal, true, refreshOptions);
6600
+ }
6601
+ }
6602
+ }
6603
+
6604
+ async _invalidateQualifiedAliases() {
6605
+ const generation = ++this._qualifiedAliasGeneration;
6606
+ this._qualifiedAliasSamples.clear();
6607
+ // A confirmed stop must finish after an already submitted readback write;
6608
+ // otherwise its late completion could resurrect evidence from the old poll.
6609
+ await Promise.all([...this._qualifiedAliasPendingWrites]);
6610
+ if (generation !== this._qualifiedAliasGeneration) return;
6611
+ for (const def of this.aliasDefs || []) {
6612
+ if (def.requiredReadContext) await this._setStateCached(def.relId, null, true);
6555
6613
  }
6556
6614
  }
6557
6615
 
6558
- async _handleMqttSnapshot(values, meta) {
6616
+ async _setQualifiedAliasValue(relId, value, generation, options = undefined) {
6617
+ if (generation !== this._qualifiedAliasGeneration) return;
6618
+ const pending = this._setStateCached(relId, value, true, options);
6619
+ this._qualifiedAliasPendingWrites.add(pending);
6620
+ try { await pending; } finally { this._qualifiedAliasPendingWrites.delete(pending); }
6621
+ }
6622
+
6623
+ _handleMqttSnapshot(values, meta) {
6624
+ return this._mqttCallbacks.run(() => this._applyMqttSnapshot(values, meta));
6625
+ }
6626
+
6627
+ async _applyMqttSnapshot(values, meta) {
6628
+ assertMqttMessageSession();
6559
6629
  const context = meta || {};
6560
6630
  if (context.diagnosticsOnly === true) {
6561
6631
  // Metadata and error envelopes can change aliases without proving live
@@ -6581,7 +6651,11 @@ class DeviceRuntime {
6581
6651
  await this._updateAliases(values || {}, { connected, lastError }).catch(() => {});
6582
6652
  }
6583
6653
 
6584
- async _handleMqttConnectionState(connected, errorMessage) {
6654
+ _handleMqttConnectionState(connected, errorMessage) {
6655
+ return this._mqttCallbacks.run(() => this._applyMqttConnectionState(connected, errorMessage), 'barrier');
6656
+ }
6657
+
6658
+ async _applyMqttConnectionState(connected, errorMessage) {
6585
6659
  const isConnected = !!connected;
6586
6660
  if (isConnected) {
6587
6661
  await this._setStateCached(`${this.baseId}.info.connection`, true, true);
@@ -6626,7 +6700,7 @@ class DeviceRuntime {
6626
6700
  this.global,
6627
6701
  (dp) => this.relStateId(dp),
6628
6702
  (dp) => this._getRoundingDecimals(dp),
6629
- () => { this._tickHeartbeatFromIncomingData().catch(() => {}); },
6703
+ () => this._mqttCallbacks.run(() => this._tickHeartbeatFromIncomingData()),
6630
6704
  (values, meta) => this._handleMqttSnapshot(values, meta),
6631
6705
  (connected, errorMessage) => this._handleMqttConnectionState(connected, errorMessage)
6632
6706
  );
@@ -6669,6 +6743,7 @@ class DeviceRuntime {
6669
6743
  const lifecycleGeneration = ++this._lifecycleGeneration;
6670
6744
 
6671
6745
  if (this.cfg.enabled === false) {
6746
+ await this._invalidateQualifiedAliases();
6672
6747
  this.adapter.log.info(`[${this.cfg.id}] disabled - skipping`);
6673
6748
  return;
6674
6749
  }
@@ -6676,6 +6751,8 @@ class DeviceRuntime {
6676
6751
  this.driver = this._createDriver();
6677
6752
  const startupDriver = this.driver;
6678
6753
  const current = () => this.started && this._lifecycleGeneration === lifecycleGeneration && this.driver === startupDriver;
6754
+ await this._invalidateQualifiedAliases();
6755
+ if (!current()) return;
6679
6756
  /** @param {() => Promise<void>} operation */
6680
6757
  const runInitial = async operation => {
6681
6758
  if (!backgroundInitialPoll) { await operation(); return; }
@@ -6772,6 +6849,14 @@ class DeviceRuntime {
6772
6849
 
6773
6850
  if (tplPolling && Array.isArray(tplPolling.fastDpIds) && tplPolling.fastDpIds.length) {
6774
6851
  const idSet = new Set(tplPolling.fastDpIds.map(x => String(x)));
6852
+ // BMS numeric limits are live control inputs, not static metadata. Keep
6853
+ // their already mapped read sources on the existing fast schedule only.
6854
+ for (const def of this.aliasDefs || []) {
6855
+ if (def.kind === 'dp' && def.rw === 'ro' && def.dpId &&
6856
+ ['r.allowedChargePower', 'r.allowedDischargePower'].includes(legacyAliasPath(def.relId))) {
6857
+ idSet.add(String(def.dpId));
6858
+ }
6859
+ }
6775
6860
  fastDps = allDps.filter(dp => dp && idSet.has(String(dp.id)));
6776
6861
  useSplitPolling = (fastDps.length > 0) && (slowIntervalMs > 0);
6777
6862
  }
@@ -6792,6 +6877,8 @@ class DeviceRuntime {
6792
6877
  fastIntervalMs = clampInterval(fastIntervalMs);
6793
6878
  if (useSplitPolling) slowIntervalMs = clampInterval(slowIntervalMs);
6794
6879
  this._liveAliasRefreshMs = this._computeLiveAliasRefreshMs({ fastIntervalMs, isEventDriven: false });
6880
+ this._qualifiedAliasSamples.clear();
6881
+ this._qualifiedAliasMaxAgeMs = (useSplitPolling ? slowIntervalMs : fastIntervalMs) + 10000;
6795
6882
 
6796
6883
  // Heartbeat timeout derived from polling interval (unless overridden).
6797
6884
  this._hbTimeoutMs = this._computeHeartbeatTimeoutMs({ fastIntervalMs, isEventDriven: false });
@@ -7353,6 +7440,12 @@ class DeviceRuntime {
7353
7440
  try { clearTimeout(this._aliasMetadataRefreshTimer); } catch (_) {}
7354
7441
  this._aliasMetadataRefreshTimer = null;
7355
7442
  }
7443
+ // Invalidate the MQTT session before the final offline states. A submitted
7444
+ // DB write must settle first; an unresolved drain is not a confirmed stop.
7445
+ if (this.cfg.protocol === 'mqtt') {
7446
+ if (this.driver) await this.driver.disconnect();
7447
+ await this._mqttCallbacks.drain();
7448
+ }
7356
7449
  // Mark offline on stop (fail-safe)
7357
7450
  for (const relId of this._hbRelIds('online')) {
7358
7451
  await this._setStateCached(relId, false, true);
@@ -7360,6 +7453,7 @@ class DeviceRuntime {
7360
7453
  this._hbOnline = false;
7361
7454
 
7362
7455
  // Stop optional write loop and clear queued writes
7456
+ await this._invalidateQualifiedAliases();
7363
7457
  try {
7364
7458
  this._writeQueueEnabled = false;
7365
7459
  this._stopWriteLoop();
@@ -10,6 +10,8 @@
10
10
  */
11
11
 
12
12
  const ModbusRTU = require('modbus-serial');
13
+ const { assertOperationAllowed } = require('../operationContext');
14
+ const { recordReadResponse } = require('../modbusReadEvidence');
13
15
  const { acquireBus, releaseBus } = require('./modbusRtuBus');
14
16
  const { acquireBus: acquireAsciiBus, releaseBus: releaseAsciiBus } = require('./modbusAsciiBus');
15
17
  const { applyScale, removeScale, bigIntToNumberOrString } = require('../utils');
@@ -31,7 +33,7 @@ function _errMsg(err) {
31
33
  // They must abort the whole snapshot without marking valid optional registers
32
34
  // unsupported for the subsequent permitted poll.
33
35
  function isReadOperationBoundaryError(err) {
34
- return ['EOS_DEVICES_NOT_AUTHORIZED', 'EOS_DEVICES_STOPPED', 'EOS_MODULE_STOPPED', 'EOS_OWNERSHIP_REQUIRED']
36
+ return ['EOS_DEVICES_NOT_AUTHORIZED', 'EOS_DEVICES_STOPPED', 'EOS_MODULE_STOPPED', 'EOS_OWNERSHIP_REQUIRED', 'E_MODBUS_CONNECT_CANCELLED']
35
37
  .includes(_errCode(err) || _errMsg(err));
36
38
  }
37
39
 
@@ -581,6 +583,7 @@ class ModbusDriver {
581
583
  }
582
584
  this.connected = false;
583
585
  this.connecting = false;
586
+ this._connectGeneration = 0;
584
587
  this._busy = false;
585
588
 
586
589
  // Cache for dynamic scale factors (e.g. SunSpec *_SF registers)
@@ -783,6 +786,7 @@ class ModbusDriver {
783
786
  this._sunSpecScanUnitIds = Array.isArray(hints.sunSpecScanUnitIds) ? hints.sunSpecScanUnitIds.map(Number) : null;
784
787
  this._sunSpecScanFcs = Array.isArray(hints.sunSpecScanFunctionCodes) ? hints.sunSpecScanFunctionCodes.map(Number) : null;
785
788
  this._sunSpecDiscovered = false;
789
+ this._sunSpecDiscoveryPending = null;
786
790
  this._sunSpecFc = null; // FC used for SunSpec registers (3/4)
787
791
  this._sunSpecFoundBase = null; // discovered base register for 'SunS'
788
792
  this._sunSpecModelsById = new Map(); // modelId -> [{offset,len}]
@@ -1087,6 +1091,13 @@ class ModbusDriver {
1087
1091
  }
1088
1092
 
1089
1093
  async connect() {
1094
+ const generation = this._connectGeneration;
1095
+ const cancelled = () => Object.assign(new Error('Modbus connect cancelled after disconnect'), { code: 'E_MODBUS_CONNECT_CANCELLED' });
1096
+ const assertCurrent = () => {
1097
+ if (generation !== this._connectGeneration) throw cancelled();
1098
+ assertOperationAllowed();
1099
+ };
1100
+ assertCurrent();
1090
1101
  if (this.connected) return;
1091
1102
 
1092
1103
  // If another caller is already connecting, wait for it instead of returning early.
@@ -1097,7 +1108,9 @@ class ModbusDriver {
1097
1108
  const maxWait = Math.max(Number(this.connectTimeoutMs || 0), Number(this.operationTimeoutMs || 0), 5000);
1098
1109
  while (this.connecting && !this.connected && (Date.now() - started) < maxWait) {
1099
1110
  await sleep(50);
1111
+ assertCurrent();
1100
1112
  }
1113
+ assertCurrent();
1101
1114
  if (this.connected) return;
1102
1115
  if (this.connecting) {
1103
1116
  const err = this._makeTimeoutError('Modbus TCP connect wait', maxWait, 'E_MODBUS_CONNECT_TIMEOUT');
@@ -1118,8 +1131,12 @@ class ModbusDriver {
1118
1131
  // ignore
1119
1132
  }
1120
1133
 
1134
+ // A stop can complete while reconnect backoff is sleeping. Never create a
1135
+ // transport afterwards, even when a later session has become authorized.
1136
+ let connectingClient = null;
1121
1137
  const c = this.device.connection || {};
1122
1138
  try {
1139
+ assertCurrent();
1123
1140
  if (this.protocol === 'modbusTcp') {
1124
1141
  const host = c.host;
1125
1142
  const port = Number(c.port || 502);
@@ -1131,6 +1148,7 @@ class ModbusDriver {
1131
1148
  } catch (_) {}
1132
1149
 
1133
1150
  const tcpClient = new ModbusRTU();
1151
+ connectingClient = tcpClient;
1134
1152
  this.client = tcpClient;
1135
1153
 
1136
1154
  const connectPromise = new Promise((resolve, reject) => {
@@ -1147,6 +1165,7 @@ class ModbusDriver {
1147
1165
  }
1148
1166
  );
1149
1167
 
1168
+ assertCurrent();
1150
1169
  // The connection may have completed after a timeout and been replaced/closed.
1151
1170
  if (this.client !== tcpClient) {
1152
1171
  const err = new Error('Modbus TCP connect completed on stale client');
@@ -1197,6 +1216,7 @@ class ModbusDriver {
1197
1216
  throw new Error(`Unsupported Modbus protocol: ${this.protocol}`);
1198
1217
  }
1199
1218
 
1219
+ assertCurrent();
1200
1220
  this.connected = true;
1201
1221
  this._failStreak = 0;
1202
1222
  this._nextConnectAt = 0;
@@ -1206,24 +1226,28 @@ class ModbusDriver {
1206
1226
  try {
1207
1227
  await this._maybeDiscoverSunSpec();
1208
1228
  } catch (e) {
1209
- // Discovery must never break connectivity.
1229
+ if (isReadOperationBoundaryError(e)) throw e;
1230
+ // Discovery must never break connectivity for ordinary unsupported models.
1210
1231
  this.adapter.log.debug(`[${this.device.id}] SunSpec discovery error: ${e && e.message ? e.message : e}`);
1211
1232
  }
1233
+ assertCurrent();
1212
1234
  } catch (e) {
1213
- // Ensure we always reset the internal state and apply backoff on connect failures
1214
- if (isTransportError(e)) {
1215
- this._markDisconnected(e);
1216
- } else {
1217
- // still close any stale socket to avoid half-open sessions
1218
- this._markDisconnected(e);
1235
+ if (generation !== this._connectGeneration) {
1236
+ // Late completion belongs to the old attempt. Its cleanup must never
1237
+ // close or mark disconnected the replacement session's TCP client.
1238
+ if (connectingClient && connectingClient !== this.client) this._forceCloseTcpClient(connectingClient);
1239
+ throw cancelled();
1219
1240
  }
1241
+ // Ensure we always reset the internal state on this attempt's failure.
1242
+ this._markDisconnected(e);
1220
1243
  throw e;
1221
1244
  } finally {
1222
- this.connecting = false;
1245
+ if (generation === this._connectGeneration) this.connecting = false;
1223
1246
  }
1224
1247
  }
1225
1248
 
1226
1249
  async disconnect() {
1250
+ ++this._connectGeneration;
1227
1251
  try {
1228
1252
  if (this.protocol === 'modbusTcp') {
1229
1253
  if (this.client) {
@@ -1232,13 +1256,13 @@ class ModbusDriver {
1232
1256
  }
1233
1257
  } else if (this.protocol === 'modbusRtu') {
1234
1258
  if (this.rtuBusKey) {
1235
- releaseBus(this.rtuBusKey);
1259
+ await releaseBus(this.rtuBusKey);
1236
1260
  }
1237
1261
  this.rtuBus = null;
1238
1262
  this.rtuBusKey = null;
1239
1263
  } else if (this.protocol === 'modbusAscii') {
1240
1264
  if (this.asciiBusKey) {
1241
- releaseAsciiBus(this.asciiBusKey);
1265
+ await releaseAsciiBus(this.asciiBusKey);
1242
1266
  }
1243
1267
  this.asciiBus = null;
1244
1268
  this.asciiBusKey = null;
@@ -1252,6 +1276,7 @@ class ModbusDriver {
1252
1276
  }
1253
1277
 
1254
1278
  async ensureConnected() {
1279
+ const generation = this._connectGeneration;
1255
1280
  if (this.connected) {
1256
1281
  if (this.protocol === 'modbusTcp' && !this._isTcpOpen()) {
1257
1282
  this._markDisconnected(new Error('Port Not Open'));
@@ -1263,7 +1288,8 @@ class ModbusDriver {
1263
1288
  await this.connect();
1264
1289
  return this.connected;
1265
1290
  } catch (e) {
1266
- this.connected = false;
1291
+ // An older caller may finish after disconnect and successful replacement.
1292
+ if (generation === this._connectGeneration) this.connected = false;
1267
1293
  throw e;
1268
1294
  }
1269
1295
  }
@@ -2281,10 +2307,29 @@ class ModbusDriver {
2281
2307
 
2282
2308
  async _maybeDiscoverSunSpec() {
2283
2309
  if (!this._autoSunSpec) return false;
2310
+ assertOperationAllowed();
2284
2311
  if (this._sunSpecDiscovered) return true;
2312
+ const generation = this._connectGeneration;
2313
+ if (this._sunSpecDiscoveryPending?.generation === generation) return this._sunSpecDiscoveryPending.promise;
2314
+ const pending = { generation, promise: null };
2315
+ pending.promise = this._discoverSunSpec(generation).finally(() => {
2316
+ if (this._sunSpecDiscoveryPending === pending) this._sunSpecDiscoveryPending = null;
2317
+ });
2318
+ this._sunSpecDiscoveryPending = pending;
2319
+ return pending.promise;
2320
+ }
2285
2321
 
2286
- // Only do discovery once per runtime.
2287
- this._sunSpecDiscovered = true;
2322
+ async _discoverSunSpec(generation) {
2323
+ const client = this.client;
2324
+ const originalUnitId = this.unitId;
2325
+ const assertCurrent = () => {
2326
+ if (generation !== this._connectGeneration || (this.protocol === 'modbusTcp' && client !== this.client)) {
2327
+ throw Object.assign(new Error('Modbus discovery cancelled after disconnect'), { code: 'E_MODBUS_CONNECT_CANCELLED' });
2328
+ }
2329
+ assertOperationAllowed();
2330
+ };
2331
+ assertCurrent();
2332
+ // Cache only a completed scan. A cancelled scan remains retryable.
2288
2333
 
2289
2334
  // Candidates (kept intentionally small to avoid long connect delays)
2290
2335
  const templateBase = Number.isFinite(this._sunSpecTemplateBase) ? this._sunSpecTemplateBase : 40000;
@@ -2327,6 +2372,7 @@ class ModbusDriver {
2327
2372
  }
2328
2373
 
2329
2374
  for (const uid of unitCandidates) {
2375
+ assertCurrent();
2330
2376
  this._setUnitId(uid);
2331
2377
 
2332
2378
  for (const fc of fcCandidates) {
@@ -2337,6 +2383,7 @@ class ModbusDriver {
2337
2383
  if (testAddr < 0 || testAddr > 65535) continue;
2338
2384
 
2339
2385
  try {
2386
+ assertCurrent();
2340
2387
  let regs;
2341
2388
  if (fc === 3) {
2342
2389
  regs = (await this._mbReadHoldingRegisters(testAddr, 2)).data || [];
@@ -2346,10 +2393,12 @@ class ModbusDriver {
2346
2393
  continue;
2347
2394
  }
2348
2395
 
2396
+ assertCurrent();
2349
2397
  const sig = this._sunSpecSignatureInfo(regs);
2350
2398
  if (sig) {
2351
2399
  // Compute only the *additional* offset beyond the manual offset.
2352
2400
  const autoOff = b - templateBase - this.manualAddressOffset;
2401
+ this._sunSpecDiscovered = true;
2353
2402
  this.autoAddressOffset = autoOff;
2354
2403
  this.autoUnitId = uid;
2355
2404
  this._sunSpecFc = fc;
@@ -2385,15 +2434,20 @@ class ModbusDriver {
2385
2434
  }
2386
2435
  }
2387
2436
 
2437
+ assertCurrent();
2438
+ this._sunSpecDiscovered = true;
2388
2439
  this.adapter.log.debug(
2389
2440
  `[${this.device.id}] SunSpec discovery: signature not found. ` +
2390
2441
  `Keeping unitId=${this.unitId} and addressOffset(manual)=${this.manualAddressOffset}.`
2391
2442
  );
2392
2443
  return false;
2444
+ } catch (error) {
2445
+ if (generation === this._connectGeneration && this.client === client) this._setUnitId(originalUnitId);
2446
+ throw error;
2393
2447
  } finally {
2394
- // Restore timeout
2395
- if (this.protocol === 'modbusTcp' && this.client && typeof this.client.setTimeout === 'function') {
2396
- try { this.client.setTimeout(originalTimeout); } catch (_) {}
2448
+ // A late old scan must not change the replacement client's timeout.
2449
+ if (generation === this._connectGeneration && this.protocol === 'modbusTcp' && this.client === client && client && typeof client.setTimeout === 'function') {
2450
+ try { client.setTimeout(originalTimeout); } catch (_) {}
2397
2451
  }
2398
2452
  }
2399
2453
  }
@@ -2402,6 +2456,13 @@ class ModbusDriver {
2402
2456
 
2403
2457
  async _maybeScanSunSpecModels() {
2404
2458
  if (!this._autoSunSpec) return false;
2459
+ const generation = this._connectGeneration;
2460
+ const client = this.client;
2461
+ const assertCurrent = () => {
2462
+ if (generation !== this._connectGeneration || (this.protocol === 'modbusTcp' && client !== this.client)) throw Object.assign(new Error('Modbus model scan cancelled after disconnect'), { code: 'E_MODBUS_CONNECT_CANCELLED' });
2463
+ assertOperationAllowed();
2464
+ };
2465
+ assertCurrent();
2405
2466
  if (this._sunSpecModelsScanned) return true;
2406
2467
 
2407
2468
  // Ensure discovery has run so we know the correct unitId/base/fc/endian.
@@ -2419,8 +2480,10 @@ class ModbusDriver {
2419
2480
  if (!Number.isFinite(base) || base < 0 || base > 65535) return false;
2420
2481
 
2421
2482
  const readRegs = async (addr, len) => {
2422
- if (fc === 4) return (await this._mbReadInputRegisters(addr, len)).data || [];
2423
- return (await this._mbReadHoldingRegisters(addr, len)).data || [];
2483
+ assertCurrent();
2484
+ const result = fc === 4 ? await this._mbReadInputRegisters(addr, len) : await this._mbReadHoldingRegisters(addr, len);
2485
+ assertCurrent();
2486
+ return result.data || [];
2424
2487
  };
2425
2488
 
2426
2489
  const modelsById = new Map();
@@ -2456,6 +2519,7 @@ class ModbusDriver {
2456
2519
  off += 2 + len;
2457
2520
  }
2458
2521
 
2522
+ assertCurrent();
2459
2523
  this._sunSpecModelsById = modelsById;
2460
2524
  this._sunSpecModelsScanned = true;
2461
2525
 
@@ -3008,7 +3072,10 @@ async readDatapoints(datapoints) {
3008
3072
  if (shouldSkipGroup(fc, ig, unitId)) { skippedReadGroupCount += 1; continue; }
3009
3073
  try {
3010
3074
  const regs = await readRegisterGroupRaw(fc, item.addr, Number(item.len || item.src.length || 1), unitId);
3011
- if (storeRegisterItemValue(item, regs, item.addr)) success += 1;
3075
+ if (storeRegisterItemValue(item, regs, item.addr)) {
3076
+ recordReadResponse(out, [item.dp.id]);
3077
+ success += 1;
3078
+ }
3012
3079
  } catch (e) {
3013
3080
  if (isReadOperationBoundaryError(e)) throw e;
3014
3081
  lastErr = e;
@@ -3170,9 +3237,11 @@ async readDatapoints(datapoints) {
3170
3237
  }
3171
3238
  }
3172
3239
 
3240
+ const sampledIds = [];
3173
3241
  for (const item of g.items) {
3174
- storeRegisterItemValue(item, regs, g.start);
3242
+ if (storeRegisterItemValue(item, regs, g.start)) sampledIds.push(item.dp.id);
3175
3243
  }
3244
+ recordReadResponse(out, sampledIds);
3176
3245
  }
3177
3246
  }
3178
3247