iobroker.eos-admin 9.0.33 → 9.0.35

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 (260) hide show
  1. package/NEXOWATT_EOS_BUILD_INFO.json +13 -11
  2. package/README.md +12 -8
  3. package/adminWww/.vite/manifest.json +233 -224
  4. package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13897 -13887
  5. package/adminWww/assets/AccessTime-CuR73YC3.js +1 -0
  6. package/adminWww/assets/{AdapterUpdateDialog-DBUqmmyD.js → AdapterUpdateDialog-DH6S-kWX.js} +5 -5
  7. package/adminWww/assets/{Adapters-dDEp7o5h.js → Adapters-CIlqSF5B.js} +5 -5
  8. package/adminWww/assets/ConfigManager-BhVBfM-q.js +1 -0
  9. package/adminWww/assets/Enums-3H97czGs.js +92 -0
  10. package/adminWww/assets/Fields-vWLKiuvO.js +1 -0
  11. package/adminWww/assets/Files-wmjjMXYM.js +1 -0
  12. package/adminWww/assets/{Hosts-CwU1LujG.js → Hosts-Bk-xmI98.js} +6 -6
  13. package/adminWww/assets/Instances-Db6Vgh62.js +4 -0
  14. package/adminWww/assets/Intro-Dc3wAG9V.js +2 -0
  15. package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +1 -0
  16. package/adminWww/assets/{Logs-B5SpNqHq.js → Logs-CPbEGWNq.js} +2 -2
  17. package/adminWww/assets/MoreHoriz-CS7nODK8.js +1 -0
  18. package/adminWww/assets/{Objects-COg_cFkz.js → Objects-DJB-2468.js} +4 -4
  19. package/adminWww/assets/Overview-DdvghCLQ.js +3 -0
  20. package/adminWww/assets/Pageview-wzrLQZ-j.js +1 -0
  21. package/adminWww/assets/PersonOff-YtHcY0sV.js +1 -0
  22. package/adminWww/assets/Star-D8VNXawT.js +1 -0
  23. package/adminWww/assets/State-0UzpgKYj.js +1 -0
  24. package/adminWww/assets/UsedResources-Bcmo58YD.js +2 -0
  25. package/adminWww/assets/Users-BGHf3Rox.js +1 -0
  26. package/adminWww/assets/ViewCompact-D7bHgn99.js +1 -0
  27. package/adminWww/assets/ViewSidebar-CjClbCI5.js +1 -0
  28. package/adminWww/assets/WifiTethering-DJ9VO12W.js +1 -0
  29. package/adminWww/assets/{bootstrap-Dwfxhm2V.js → bootstrap-qkrk_CAn.js} +25 -25
  30. package/adminWww/assets/date-fns-BtR4dG_j.js +1 -0
  31. package/adminWww/assets/en-US-BjjaEI6N.js +1 -0
  32. package/adminWww/assets/{hostInit-3BbTwhaZ.js → hostInit-DlGqatlv.js} +1 -1
  33. package/adminWww/assets/icons-material-CUNq6tdT.js +1 -0
  34. package/adminWww/assets/{index-nddph2Sl.js → index-BrtKq3UN.js} +2 -2
  35. package/adminWww/assets/{installSVGRenderer-CPDIwFAL.js → installSVGRenderer-DujLjpXt.js} +1 -1
  36. package/adminWww/assets/isSameWeek-WMSJR5Qs.js +1 -0
  37. package/adminWww/assets/locale-DN6Bdkdt.js +1 -0
  38. package/adminWww/assets/{mf-entry-bootstrap-0-d1f0f40f.js → mf-entry-bootstrap-0-3e1cd85c.js} +2 -2
  39. package/adminWww/assets/sentry-CPzCHrwe.js +1 -0
  40. package/adminWww/assets/setYear-DDSuW45e.js +1 -0
  41. package/adminWww/index.html +23 -23
  42. package/adminWww/mf-manifest.json +1 -1
  43. package/adminWww/mf-stats.json +1 -1
  44. package/adminWww/{remoteEntry-eos-9.0.33.js → remoteEntry-eos-9.0.35.js} +1 -1
  45. package/adminWww/remoteEntry.js +1 -1
  46. package/build/lib/eosDashboardProcessStatus.js +191 -0
  47. package/build/lib/eosDashboardProcessStatus.js.map +1 -0
  48. package/build/lib/eosDeviceEmsPlan.js +285 -9
  49. package/build/lib/eosDeviceEmsPlan.js.map +1 -1
  50. package/build/lib/eosDeviceEmsService.js +29 -2
  51. package/build/lib/eosDeviceEmsService.js.map +1 -1
  52. package/build/lib/eosKiosk.js +1 -0
  53. package/build/lib/eosKiosk.js.map +1 -1
  54. package/build/lib/eosModuleHost.js +17 -6
  55. package/build/lib/eosModuleHost.js.map +1 -1
  56. package/build/lib/eosModuleHttp.js +18 -3
  57. package/build/lib/eosModuleHttp.js.map +1 -1
  58. package/build/lib/eosModuleProcess.js +17 -0
  59. package/build/lib/eosModuleProcess.js.map +1 -1
  60. package/build/lib/eosModuleProcessWorker.js +22 -1
  61. package/build/lib/eosModuleProcessWorker.js.map +1 -1
  62. package/build/lib/eosRuntimeControl.js +6 -0
  63. package/build/lib/eosRuntimeControl.js.map +1 -1
  64. package/build/lib/eosRuntimeHealth.js +50 -1
  65. package/build/lib/eosRuntimeHealth.js.map +1 -1
  66. package/build/lib/eosSupervisorNotifications.js +169 -0
  67. package/build/lib/eosSupervisorNotifications.js.map +1 -0
  68. package/build/lib/eosUiProcess.js +1 -0
  69. package/build/lib/eosUiProcess.js.map +1 -1
  70. package/build/lib/web.js +5 -0
  71. package/build/lib/web.js.map +1 -1
  72. package/docs/README.md +3 -2
  73. package/docs/reports/unified-9.0.34/PRUEFBERICHT.md +40 -0
  74. package/docs/reports/unified-9.0.34/PRUEFERGEBNISSE.json +112 -0
  75. package/docs/reports/unified-9.0.34/raw/INDEX.json +137 -0
  76. package/docs/reports/unified-9.0.34/raw/backend.log +5 -0
  77. package/docs/reports/unified-9.0.34/raw/dashboard-interval.json +108 -0
  78. package/docs/reports/unified-9.0.34/raw/fixtures-verification.log +44 -0
  79. package/docs/reports/unified-9.0.34/raw/frontend.log +152 -0
  80. package/docs/reports/unified-9.0.34/raw/installer.log +26 -0
  81. package/docs/reports/unified-9.0.34/raw/lint.log +45 -0
  82. package/docs/reports/unified-9.0.34/raw/mira-dashboard-browser.json +1 -0
  83. package/docs/reports/unified-9.0.34/raw/mira-devices-browser.log +9 -0
  84. package/docs/reports/unified-9.0.34/raw/mira-memory-process.json +379 -0
  85. package/docs/reports/unified-9.0.34/raw/modules.log +5 -0
  86. package/docs/reports/unified-9.0.34/raw/node22-mira.log +216 -0
  87. package/docs/reports/unified-9.0.34/raw/node22-protocol-to-ems.log +8 -0
  88. package/docs/reports/unified-9.0.34/raw/node22-tests-final.log +17850 -0
  89. package/docs/reports/unified-9.0.34/raw/node22-version.log +1 -0
  90. package/docs/reports/unified-9.0.34/raw/node24-mira.log +40 -0
  91. package/docs/reports/unified-9.0.34/raw/node24-protocol-to-ems.log +6 -0
  92. package/docs/reports/unified-9.0.34/raw/node24-tests-final.log +2973 -0
  93. package/docs/reports/unified-9.0.34/raw/node24-version.log +1 -0
  94. package/docs/reports/unified-9.0.34/raw/protocol-to-ems.cjs +364 -0
  95. package/docs/reports/unified-9.0.34/raw/release-metadata.log +13 -0
  96. package/docs/reports/unified-9.0.34/raw/sbom.log +8 -0
  97. package/docs/reports/unified-9.0.34/raw/typecheck.log +5 -0
  98. package/docs/reports/unified-9.0.34/raw/ui-runtime.log +8 -0
  99. package/docs/reports/unified-9.0.35/PRUEFBERICHT.md +51 -0
  100. package/docs/reports/unified-9.0.35/PRUEFERGEBNISSE.json +112 -0
  101. package/docs/reports/unified-9.0.35/raw/INDEX.json +282 -0
  102. package/docs/reports/unified-9.0.35/raw/backend.log +5 -0
  103. package/docs/reports/unified-9.0.35/raw/browser-lp-detail.log +1 -0
  104. package/docs/reports/unified-9.0.35/raw/browser-lp-feedback.log +1 -0
  105. package/docs/reports/unified-9.0.35/raw/cold-ocpp-22.log +108 -0
  106. package/docs/reports/unified-9.0.35/raw/cold-ocpp-24.log +24 -0
  107. package/docs/reports/unified-9.0.35/raw/core-final-node22.log +1439 -0
  108. package/docs/reports/unified-9.0.35/raw/core-final-node24.log +1381 -0
  109. package/docs/reports/unified-9.0.35/raw/dashboard-de-en-nl.json +716 -0
  110. package/docs/reports/unified-9.0.35/raw/device-chain-closed-fixed.json +98 -0
  111. package/docs/reports/unified-9.0.35/raw/device-chain-rst-fixed.json +98 -0
  112. package/docs/reports/unified-9.0.35/raw/device-chain.json +93 -0
  113. package/docs/reports/unified-9.0.35/raw/ee-fusion-final.log +12 -0
  114. package/docs/reports/unified-9.0.35/raw/eebus-monitor-browser.json +1 -0
  115. package/docs/reports/unified-9.0.35/raw/eebus-monitor-node22.log +206 -0
  116. package/docs/reports/unified-9.0.35/raw/eebus-monitor-node24.log +39 -0
  117. package/docs/reports/unified-9.0.35/raw/fixtures-verification.log +44 -0
  118. package/docs/reports/unified-9.0.35/raw/frontend.log +152 -0
  119. package/docs/reports/unified-9.0.35/raw/installer.log +26 -0
  120. package/docs/reports/unified-9.0.35/raw/legacy-mail-setup-browser.log +1 -0
  121. package/docs/reports/unified-9.0.35/raw/lint.log +45 -0
  122. package/docs/reports/unified-9.0.35/raw/live-ems-loss.log +10 -0
  123. package/docs/reports/unified-9.0.35/raw/modules.log +5 -0
  124. package/docs/reports/unified-9.0.35/raw/node22-mira-reconnect-integrity.log +452 -0
  125. package/docs/reports/unified-9.0.35/raw/node22-mira.log +222 -0
  126. package/docs/reports/unified-9.0.35/raw/node22-system-status.log +213 -0
  127. package/docs/reports/unified-9.0.35/raw/node22-tests-final.log +18137 -0
  128. package/docs/reports/unified-9.0.35/raw/node22-version.log +1 -0
  129. package/docs/reports/unified-9.0.35/raw/node24-mira-reconnect-integrity.log +79 -0
  130. package/docs/reports/unified-9.0.35/raw/node24-mira.log +41 -0
  131. package/docs/reports/unified-9.0.35/raw/node24-system-status.log +40 -0
  132. package/docs/reports/unified-9.0.35/raw/node24-tests-final.log +3019 -0
  133. package/docs/reports/unified-9.0.35/raw/node24-version.log +1 -0
  134. package/docs/reports/unified-9.0.35/raw/notifications-legacy-node22.log +1 -0
  135. package/docs/reports/unified-9.0.35/raw/notifications-legacy-node24.log +1 -0
  136. package/docs/reports/unified-9.0.35/raw/notifications-node22.log +67 -0
  137. package/docs/reports/unified-9.0.35/raw/notifications-node24.log +17 -0
  138. package/docs/reports/unified-9.0.35/raw/npm-runtime-audit.json +77 -0
  139. package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node22.log +110 -0
  140. package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node24.log +106 -0
  141. package/docs/reports/unified-9.0.35/raw/ocpp-history-node22.log +561 -0
  142. package/docs/reports/unified-9.0.35/raw/ocpp-history-node24.log +98 -0
  143. package/docs/reports/unified-9.0.35/raw/poll-life-node22.log +38 -0
  144. package/docs/reports/unified-9.0.35/raw/poll-life-node24.log +12 -0
  145. package/docs/reports/unified-9.0.35/raw/qa-source-check.log +2 -0
  146. package/docs/reports/unified-9.0.35/raw/release-metadata.log +13 -0
  147. package/docs/reports/unified-9.0.35/raw/sbom.log +8 -0
  148. package/docs/reports/unified-9.0.35/raw/typecheck.log +5 -0
  149. package/docs/reports/unified-9.0.35/raw/ui-runtime.log +8 -0
  150. package/docs/reports/unified-9.0.35/raw/vergleich-9.0.33.json +29 -0
  151. package/docs/reports/unified-9.0.35/raw/vergleich-9.0.34.json +249 -0
  152. package/docs/reports/unified-9.0.35/raw/vorher-9.0.33-chromium.json +286 -0
  153. package/docs/reports/unified-9.0.35/raw/vorher-9.0.34-chromium.json +291 -0
  154. package/docs/start/START_HIER_9.0.34.md +25 -0
  155. package/docs/start/START_HIER_9.0.35.md +27 -0
  156. package/io-package.json +12 -12
  157. package/modules/devices/admin/alias-contract-v1.json +22 -0
  158. package/modules/devices/admin/ems-assignment.js +6 -1
  159. package/modules/devices/admin/host-bridge.js +2 -0
  160. package/modules/devices/admin/index.html +16 -0
  161. package/modules/devices/admin/index_m.js +168 -9
  162. package/modules/devices/admin/templates.json +976 -0
  163. package/modules/devices/checks/emsAssignment.check.js +52 -2
  164. package/modules/devices/contracts.d.ts +1 -0
  165. package/modules/devices/index.js +25 -2
  166. package/modules/devices/lib/alias-contract-v1.json +22 -0
  167. package/modules/devices/lib/deviceRuntime.js +36 -7
  168. package/modules/devices/lib/drivers/modbus.js +12 -7
  169. package/modules/devices/lib/drivers/modbusRtuBus.js +7 -1
  170. package/modules/devices/lib/drivers/ovumMira.js +152 -0
  171. package/modules/devices/lib/ovumMiraAliases.js +61 -0
  172. package/modules/devices/lib/ovumMiraConnection.js +32 -0
  173. package/modules/devices/lib/templates.json +976 -0
  174. package/modules/devices/test/aliasContractV1.test.js +4 -4
  175. package/modules/devices/test/deviceAliasSemantics.test.js +2 -2
  176. package/modules/devices/test/fixtures/approved-additive-templates.json +3 -1
  177. package/modules/devices/test/ovumMiraPairing.test.js +76 -0
  178. package/modules/devices/test/ovumMiraTemplates.test.js +110 -0
  179. package/modules/devices/test/ovumMiraTransport.test.js +201 -0
  180. package/modules/eebus/README.md +8 -0
  181. package/modules/eebus/admin/index.js +29 -2
  182. package/modules/eebus/build/index.js +28 -3
  183. package/modules/eebus/build/lib/eebusRuntime.js +17 -2
  184. package/modules/eebus/build/lib/partnerMonitor.js +160 -0
  185. package/modules/eebus/build/lib/shipEndpoint.js +4 -0
  186. package/modules/eebus/build/lib/stateDefinitions.js +1 -0
  187. package/modules/eebus/src/index.ts +23 -3
  188. package/modules/eebus/src/lib/eebusRuntime.ts +20 -2
  189. package/modules/eebus/src/lib/partnerMonitor.ts +127 -0
  190. package/modules/eebus/src/lib/shipEndpoint.ts +5 -0
  191. package/modules/eebus/src/lib/stateDefinitions.ts +1 -0
  192. package/modules/eebus/test/partner-monitor.test.js +82 -0
  193. package/modules/eebus/test/security.test.js +17 -0
  194. package/modules/ocpp/README.md +9 -1
  195. package/modules/ocpp/build/index.js +137 -10
  196. package/modules/ocpp/build/stationHistory.js +113 -0
  197. package/modules/ocpp/ocpp/freshness.d.ts +3 -0
  198. package/modules/ocpp/ocpp/freshness.js +6 -0
  199. package/modules/ocpp/provenance.json +3 -2
  200. package/modules/ocpp/runtime.d.ts +1 -0
  201. package/modules/ocpp/runtime.js +23 -1
  202. package/modules/ocpp/src/index.ts +163 -12
  203. package/modules/ocpp/src/stationHistory.ts +119 -0
  204. package/modules/ocpp/test/hosted.test.cjs +161 -0
  205. package/package.json +9 -5
  206. package/release-manifests/unified/build-environment.cdx.json +6 -6
  207. package/release-manifests/unified/files.json +313 -190
  208. package/release-manifests/unified/frontend.cdx.json +6 -6
  209. package/release-manifests/unified/installer.cdx.json +6 -6
  210. package/release-manifests/unified/obsolete-admin-assets.json +166 -0
  211. package/release-manifests/unified/runtime.cdx.json +30 -30
  212. package/release-manifests/unified/validation.json +15 -15
  213. package/tools/eos-release-manifest.cjs +1 -1
  214. package/ui/ems/consumers/ovum-mira.js +164 -0
  215. package/ui/ems/modules/para14a.js +3 -2
  216. package/ui/ems/modules/stage-a-diagnostics.js +4 -2
  217. package/ui/ems/modules/thermal-control.js +91 -10
  218. package/ui/io-package.json +9 -1
  219. package/ui/lib/installer-lifecycle.js +11 -2
  220. package/ui/lib/notification-mail.js +235 -40
  221. package/ui/lib/notification-policy.js +41 -14
  222. package/ui/main.js +37 -7
  223. package/ui/package.json +2 -1
  224. package/ui/www/app.js +122 -24
  225. package/ui/www/dashboard-lp-status.js +4 -11
  226. package/ui/www/dashboard-process-status.js +202 -0
  227. package/ui/www/ems-apps.js +28 -9
  228. package/ui/www/i18n/en.json +23 -0
  229. package/ui/www/i18n/nl.json +20 -0
  230. package/ui/www/index.html +10 -5
  231. package/ui/www/licenses/smarthome-markdown-components.json +156 -156
  232. package/ui/www/live-display.js +101 -9
  233. package/ui/www/manifest.webmanifest +2 -2
  234. package/ui/www/settings.html +2 -2
  235. package/ui/www/styles.css +4 -0
  236. package/adminWww/assets/AddLink-0L0E-LsA.js +0 -1
  237. package/adminWww/assets/ColorLens-DA51K29x.js +0 -1
  238. package/adminWww/assets/ConfigManager-DbqTWi2N.js +0 -1
  239. package/adminWww/assets/Enums-DjldGElU.js +0 -92
  240. package/adminWww/assets/Fields-0GsPCJeU.js +0 -1
  241. package/adminWww/assets/FileCopy-B16lEuur.js +0 -1
  242. package/adminWww/assets/Files-COnUtEbg.js +0 -1
  243. package/adminWww/assets/Instances-CUX5mxMQ.js +0 -4
  244. package/adminWww/assets/Intro-BhQmHn3A.js +0 -2
  245. package/adminWww/assets/Lens-9lkeoWGk.js +0 -1
  246. package/adminWww/assets/LinearScale-Be5h2beh.js +0 -1
  247. package/adminWww/assets/North-C2whbHM-.js +0 -1
  248. package/adminWww/assets/Overview-CitzUjBF.js +0 -3
  249. package/adminWww/assets/PersonOff-DqBq0Fho.js +0 -1
  250. package/adminWww/assets/PlaylistAdd-O8k92YBd.js +0 -1
  251. package/adminWww/assets/State-D5ljzf-T.js +0 -1
  252. package/adminWww/assets/UsedResources-BY_NF2wB.js +0 -2
  253. package/adminWww/assets/Users-Cu93_-VF.js +0 -1
  254. package/adminWww/assets/date-fns-C1dqkno9.js +0 -1
  255. package/adminWww/assets/icons-material-DjqX0l_7.js +0 -1
  256. package/adminWww/assets/isSameWeek-Crh37s7U.js +0 -1
  257. package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +0 -1
  258. package/adminWww/assets/locale-hLcz_Xh2.js +0 -1
  259. package/adminWww/assets/sentry-DwQQLI7N.js +0 -1
  260. package/adminWww/assets/startOfWeek-DJph8SIW.js +0 -1
@@ -76,7 +76,11 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
76
76
  }, id);
77
77
  await page.waitForSelector('#dev_ems_mode', { visible: true });
78
78
  }
79
- async function keepDraft() { await page.click('#btnSaveDevice'); await page.waitForSelector('#modalDevice.open', { hidden: true }); }
79
+ async function keepDraft() {
80
+ await page.click('#btnSaveDevice');
81
+ await page.waitForSelector('#modalDevice', { hidden: true });
82
+ await page.waitForSelector('.modal-overlay', { hidden: true });
83
+ }
80
84
  await edit('evcs1');
81
85
  assert.equal(await page.$eval('#dev_ems_mode', e => e.value), 'auto');
82
86
  assert.match(await page.$eval('#dev_ems_help', e => e.textContent), /automatisch unter Ladepunkte/);
@@ -95,7 +99,9 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
95
99
  if (screenshots) { await fs.mkdir(screenshots, { recursive: true }); await page.screenshot({ path: path.join(screenshots, 'devices-ems-desktop.png') }); }
96
100
  await keepDraft();
97
101
  await page.click('#eosModuleSave');
98
- await page.waitForFunction(() => document.getElementById('eosEmsStatus').textContent.includes('4 Gerät(e) zugeordnet') && !document.getElementById('eosDeviceEditor').inert);
102
+ await page.waitForFunction(() => document.getElementById('eosEmsStatus').textContent.includes('4 Gerät(e) zugeordnet') && !document.getElementById('eosDeviceEditor').inert)
103
+ .catch(async error => { throw new Error(await page.$eval('#eosModuleStatus', e => e.textContent) + ' / ' +
104
+ await page.$eval('#eosEmsStatus', e => e.textContent) + ' / ' + errors.join(' '), { cause: error }); });
99
105
  assert.equal(received.filter(r => r.method === 'PUT').length, 1);
100
106
  const byId = Object.fromEntries(config.devices.map(d => [d.id, d]));
101
107
  assert.equal(byId.evcs1.ems.mode, 'auto'); assert.equal(byId.evcs1.ems.activation.limits.maxCurrentA, 16);
@@ -122,11 +128,55 @@ test('Devices EMS form: wallbox default, meter/PV targets, storage choice, durab
122
128
  await page.$eval('.modal-content', e => { e.scrollTop = 0; });
123
129
  if (screenshots) await page.screenshot({ path: path.join(screenshots, 'devices-ems-mobile.png') });
124
130
  await page.click('#btnCancelDevice');
131
+ await page.setViewport({ width: 1440, height: 1050 });
125
132
  await page.reload();
126
133
  await page.waitForFunction(() => !document.getElementById('eosDeviceEditor').inert);
127
134
  await page.click('a[href="#tabDevices"]'); await edit('meter1');
128
135
  assert.equal(await page.$eval('#dev_ems_mode', e => e.value), 'generationMeter');
129
136
  assert.equal(await page.$eval('#dev_ems_slot', e => e.value), '1');
130
137
  assert.equal(await page.$eval('#dev_name', e => e.value), 'meter1');
138
+ await page.click('#btnCancelDevice');
139
+ await page.waitForSelector('.modal-overlay', { hidden: true });
140
+ await page.click('#btnAddDevice');
141
+ await page.select('#dev_category', 'HEAT');
142
+ await page.select('#dev_manufacturer', 'OVUM');
143
+ await page.select('#dev_template', 'heat.ovum.mira.hsm');
144
+ await page.select('#dev_protocol', 'modbusTcp');
145
+ await page.waitForSelector('#mira_pair_settings', { visible: true });
146
+ assert.equal(await page.$eval('#mira_wpm_choice', e => e.value), 'same');
147
+ assert.equal(await page.$eval('#mira_wpm_unit', e => e.value), '111');
148
+ assert.equal(await page.$eval('#mb_unitId', e => e.value), '110');
149
+ assert.equal(await page.$eval('#dev_ems_requested', e => e.checked), false);
150
+ assert.equal(await page.$eval('#dev_ems_miraSources', e => e.checked), false);
151
+ const hsmId = await page.$eval('#dev_id', e => e.value);
152
+ await page.type('#mb_host', '192.0.2.77');
153
+ await keepDraft();
154
+ await page.click('#eosModuleSave');
155
+ await page.waitForFunction(() => !document.getElementById('eosDeviceEditor').inert &&
156
+ document.querySelectorAll('#devicesTable tbody tr').length === 6);
157
+ await page.waitForFunction(() => document.getElementById('eosModuleStatus').textContent.includes('Gerätekonfiguration geladen'));
158
+ const hsm = config.devices.find(d => d.id === hsmId);
159
+ const wpm = config.devices.find(d => d.id === hsm.connection.miraWpmDeviceId);
160
+ assert.equal(wpm.templateId, 'heat.ovum.mira.wpm');
161
+ assert.equal(wpm.connection.unitId, 111);
162
+ assert.equal(wpm.connection.host, hsm.connection.host);
163
+ await page.reload();
164
+ await page.waitForFunction(() => !document.getElementById('eosDeviceEditor').inert);
165
+ await page.click('a[href="#tabDevices"]'); await edit(hsmId);
166
+ assert.equal(await page.$eval('#mira_wpm_choice', e => e.value), 'id:' + wpm.id);
167
+ assert.equal(await page.$eval('#mira_wpm_unit_field', e => e.hidden), true);
168
+ assert.equal(hsm.ems.activation.requested, false);
169
+ await page.$eval('#dev_ems_requested', e => e.click());
170
+ await page.waitForSelector('#dev_ems_miraMaxW', { visible: true });
171
+ await page.$eval('#dev_ems_miraSources', e => e.click());
172
+ await page.type('#dev_ems_miraMaxW', '4500');
173
+ await keepDraft();
174
+ await page.click('#eosModuleSave');
175
+ await page.waitForFunction(() => document.getElementById('eosModuleStatus').textContent.includes('Gerätekonfiguration geladen'));
176
+ const consent = config.devices.find(d => d.id === hsmId).ems.activation;
177
+ assert.equal(consent.requested, true);
178
+ assert.equal(consent.limits.miraSources, 'confirmed');
179
+ assert.equal(consent.limits.maxPowerW, 4500);
180
+ assert.equal(config.devices.filter(d => d.id === wpm.id).length, 1);
131
181
  assert.deepEqual(errors, []);
132
182
  });
@@ -45,6 +45,7 @@ export interface Driver {
45
45
  export interface HostedRuntime {
46
46
  started: boolean;
47
47
  _hbOnline?: boolean;
48
+ getDashboardReachability?(now: number): 'online' | 'offline' | 'unknown';
48
49
  driver?: Driver | null;
49
50
  _writeQueue?: Map<unknown, unknown>;
50
51
  _stopWriteLoop?(): void;
@@ -12,6 +12,7 @@
12
12
  */
13
13
  const fs = require('node:fs/promises');
14
14
  const path = require('node:path');
15
+ const { createHash } = require('node:crypto');
15
16
  const { isDeepStrictEqual } = require('node:util');
16
17
  const { guardDriver } = require('./operation-guard');
17
18
  const SOURCE_VERSION = '0.5.176';
@@ -96,7 +97,7 @@ function validateConfig(input = {}) {
96
97
  if (activation.limits !== undefined) {
97
98
  const limits = activation.limits;
98
99
  const numbers = ['maxChargeW', 'maxDischargeW', 'capacityKWh', 'minCurrentA', 'maxCurrentA', 'minPowerW', 'maxPowerW'];
99
- if (!record(limits) || Object.keys(limits).some(key => ![...numbers, 'coupling', 'chargerType', 'phases'].includes(key))) throw failure('EOS_DEVICES_EMS_LIMITS');
100
+ if (!record(limits) || Object.keys(limits).some(key => ![...numbers, 'coupling', 'chargerType', 'phases', 'miraSources'].includes(key))) throw failure('EOS_DEVICES_EMS_LIMITS');
100
101
  for (const key of numbers) {
101
102
  const value = Reflect.get(limits, key);
102
103
  if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value) || value <= 0 || value > 10000000)) throw failure('EOS_DEVICES_EMS_LIMITS');
@@ -105,6 +106,7 @@ function validateConfig(input = {}) {
105
106
  const value = Reflect.get(limits, key);
106
107
  if (value !== undefined && (typeof value !== 'string' || !['ac', 'dc'].includes(value))) throw failure('EOS_DEVICES_EMS_LIMITS');
107
108
  }
109
+ if (limits.miraSources !== undefined && (device.templateId !== 'heat.ovum.mira.hsm' || limits.miraSources !== 'confirmed')) throw failure('EOS_DEVICES_EMS_LIMITS');
108
110
  if (limits.phases !== undefined && (typeof limits.phases !== 'number' || ![1, 3].includes(limits.phases))) throw failure('EOS_DEVICES_EMS_LIMITS');
109
111
  if (typeof limits.minCurrentA === 'number' && typeof limits.maxCurrentA === 'number' && limits.minCurrentA > limits.maxCurrentA
110
112
  || typeof limits.minPowerW === 'number' && typeof limits.maxPowerW === 'number' && limits.minPowerW > limits.maxPowerW) throw failure('EOS_DEVICES_EMS_LIMITS');
@@ -113,6 +115,9 @@ function validateConfig(input = {}) {
113
115
  }
114
116
  if (device.connection !== undefined && !record(device.connection)) throw failure('EOS_DEVICES_CONFIG_CONNECTION');
115
117
  const connection = device.connection || {};
118
+ if (device.templateId === 'heat.ovum.mira.hsm' || device.templateId === 'heat.ovum.mira.wpm') {
119
+ require('./lib/ovumMiraConnection').miraConnection(device.templateId.endsWith('.hsm') ? 'hsm' : 'wpm', device.protocol, connection);
120
+ }
116
121
  if (connection.insecureTls === true || connection.insecureTLS === true || connection.allowInsecureTls === true || connection.rejectUnauthorized === false) throw failure('EOS_DEVICES_TLS_VERIFICATION_REQUIRED');
117
122
  if (device.pollIntervalMs !== undefined && device.pollIntervalMs !== 0) device.pollIntervalMs = integer(device.pollIntervalMs, 5000, 250, 600000);
118
123
  for (const field of ['port', 'tcpPort', 'mqttPort']) {
@@ -238,6 +243,24 @@ function createHostedModule({ adapter, canOperate, config = {}, runtimeFactory }
238
243
  let lastConnection;
239
244
  /** @type {Map<string, HostedRuntime>} */
240
245
  const runtimes = new Map();
246
+ // Keep stable customer labels and opaque notification keys outside the hot polling loop.
247
+ const dashboardDevices = settings.devices.map((device, index) => {
248
+ const label = typeof device.name === 'string' ? device.name.trim() : '';
249
+ const endpoints = Object.values(device.connection || {}).filter(value => typeof value === 'string' && value.length >= 4);
250
+ const safeLabel = label.length <= 64 && /^[\p{L}\p{M}\p{N} ()_–·-]+$/u.test(label) && !/\d{6,}|[a-f\d]{16,}|(?:[a-f\d]{2}-){5}[a-f\d]{2}/i.test(label)
251
+ && label !== device.id && !endpoints.some(value => label.includes(String(value)));
252
+ return {id:device.id, enabled:device.enabled !== false, name:safeLabel ? label : `Gerät ${index + 1}`,
253
+ key:createHash('sha256').update(device.id).digest('hex')};
254
+ });
255
+ function getDashboardDeviceHealth() {
256
+ if (state !== 'running' || !permitted()) return {state:'unknown',offline:[],totalOffline:0,tracked:[],complete:false};
257
+ const now = Date.now();
258
+ const tracked = dashboardDevices.map(({id,enabled,name,key}) => ({key, name,
259
+ state: enabled ? runtimes.get(id)?.getDashboardReachability?.(now) || 'unknown' : 'disabled'}));
260
+ const lost = tracked.filter(entry => entry.state === 'offline');
261
+ return {state:lost.length ? 'fault' : tracked.some(entry => entry.state === 'unknown') ? 'unknown' : 'ok',
262
+ offline:lost.slice(0,12).map(({name}) => ({name})),totalOffline:lost.length,tracked,complete:true};
263
+ }
241
264
  function permitted() { try { return active && !stopping && canOperate() === true; } catch { return false; } }
242
265
  /** @param {boolean} connected */
243
266
  async function writeConnection(connected) {
@@ -372,6 +395,6 @@ function createHostedModule({ adapter, canOperate, config = {}, runtimeFactory }
372
395
  }
373
396
  }
374
397
  function getStatus() { return { state, sourceVersion: SOURCE_VERSION, configured: settings.devices.length, running: runtimes.size, connected: lastConnection === true, lastError }; }
375
- return { start, stop, onStateChange, getStatus, getCatalog, command };
398
+ return { start, stop, onStateChange, getStatus, getCatalog, command, getDashboardDeviceHealth };
376
399
  }
377
400
  module.exports = { createHostedModule, validateConfig, preflightLegacyConfig, migrateLegacyConfig: preflightLegacyConfig, normalizeConfig: validateConfig, DEFAULTS, SOURCE_VERSION, command, getCatalog };
@@ -1304,6 +1304,28 @@
1304
1304
  "role": "level.power",
1305
1305
  "unit": "W",
1306
1306
  "capability": "write.externalPower"
1307
+ },
1308
+ "r.pvStatus": {
1309
+ "type": "number",
1310
+ "role": "value",
1311
+ "capability": "read.pvStatus"
1312
+ },
1313
+ "ctrl.pvStatus": {
1314
+ "type": "number",
1315
+ "role": "level",
1316
+ "capability": "write.pvStatus"
1317
+ },
1318
+ "r.pvPowerTargetW": {
1319
+ "type": "number",
1320
+ "role": "value.power",
1321
+ "unit": "W",
1322
+ "capability": "read.pvPowerTargetW"
1323
+ },
1324
+ "ctrl.pvPowerTargetW": {
1325
+ "type": "number",
1326
+ "role": "level.power",
1327
+ "unit": "W",
1328
+ "capability": "write.pvPowerTargetW"
1307
1329
  }
1308
1330
  }
1309
1331
  },
@@ -13,6 +13,7 @@ const {
13
13
  buildManifest: buildAliasManifest,
14
14
  mergeStandardDefinition,
15
15
  } = require('./aliasContract');
16
+ const { miraUnit, buildMiraAliases, freshPaths: miraFreshnessPaths } = require('./ovumMiraAliases');
16
17
  const { getDeyeProfile, buildDeyeAliases } = require('./deyeProtocol');
17
18
  const { getVartaProfile, registersForProfile, buildVartaAliases } = require('./vartaProtocol');
18
19
  const { extendedRegistersForProfile, buildVartaExtendedAliases } = require('./vartaExtendedProtocol');
@@ -216,6 +217,8 @@ class DeviceRuntime {
216
217
  this._hbLastSeen = 0;
217
218
  this._hbOnline = false;
218
219
  this._hbTimeoutMs = 0;
220
+ this._dashboardMonitoringAt = 0;
221
+ this._dashboardTransportFailed = false;
219
222
  this._hbLastWriteAt = 0;
220
223
  this._hbCheckTimer = null;
221
224
  this._hbLastSourceStamp = 0;
@@ -696,7 +699,7 @@ class DeviceRuntime {
696
699
  }
697
700
 
698
701
  _computeLiveAliasRefreshMs({ fastIntervalMs, isEventDriven } = {}) {
699
- if (this.aliasDeviceClass !== 'evCharger' && !isEnergyFreshnessClass(this.aliasDeviceClass)) return 0;
702
+ if (this.aliasDeviceClass !== 'evCharger' && !isEnergyFreshnessClass(this.aliasDeviceClass) && !miraUnit(this.template)) return 0;
700
703
 
701
704
  const candidates = [
702
705
  this.cfg && this.cfg.liveStatusRefreshMs,
@@ -739,12 +742,13 @@ class DeviceRuntime {
739
742
 
740
743
  _liveAliasRefreshOptions(relId, values, ctx, sourceIds = []) {
741
744
  if (!(this._liveAliasRefreshMs > 0)) return undefined;
742
- const energyAlias = isEnergyFreshnessAlias(this.aliasDeviceClass, legacyAliasPath(relId));
745
+ const path = legacyAliasPath(relId);
746
+ const energyAlias = isEnergyFreshnessAlias(this.aliasDeviceClass, path) ||
747
+ (miraUnit(this.template) && miraFreshnessPaths.has(path));
743
748
  if (!this._isEvChargerFreshnessAlias(relId) && !energyAlias) return undefined;
744
749
  if (ctx && (ctx.connected === false || ctx.diagnosticsOnly === true)) return undefined;
745
750
  if (!values || typeof values !== 'object' || Object.keys(values).length === 0) return undefined;
746
751
  if (energyAlias) {
747
- const path = legacyAliasPath(relId);
748
752
  const connectionAlias = path === 'comm.connected' || path === 'alarm.offline';
749
753
  if (!hasNewAliasSample({
750
754
  protocol: String(this.cfg.protocol || '').toLowerCase(),
@@ -954,6 +958,18 @@ class DeviceRuntime {
954
958
  }
955
959
  }
956
960
 
961
+ // Only a physical sample clears a transport failure. The initial false heartbeat
962
+ // denotes an unobserved device until its configured reporting window expires.
963
+ getDashboardReachability(now = Date.now()) {
964
+ if (!this.started || !this._dashboardMonitoringAt) return 'unknown';
965
+ if (this._dashboardTransportFailed) return 'offline';
966
+ const seen = Number(this._hbLastSeen) || 0;
967
+ const age = now - (seen || this._dashboardMonitoringAt);
968
+ if (age < 0 || this._hbTimeoutMs <= 0) return 'unknown';
969
+ if (age > this._hbTimeoutMs) return 'offline';
970
+ return this._hbOnline && seen > 0 ? 'online' : 'unknown';
971
+ }
972
+
957
973
  async _setHeartbeatOnline(nextOnline, offlineReason) {
958
974
  const b = !!nextOnline;
959
975
  if (!b) await this._resetAblEmh1LiveMeasurements();
@@ -997,6 +1013,7 @@ class DeviceRuntime {
997
1013
  this._hbLastSeen = now;
998
1014
  }
999
1015
 
1016
+ this._dashboardTransportFailed = false;
1000
1017
  // Flip online immediately when we see the device alive
1001
1018
  if (!this._hbOnline) {
1002
1019
  await this._setHeartbeatOnline(true);
@@ -1164,7 +1181,8 @@ class DeviceRuntime {
1164
1181
  // --- Generic role-based aliases (best-effort) ---
1165
1182
  // Only use these for categories where roles are typically reliable and where "first match wins" is acceptable.
1166
1183
  // For meters, chargers, batteries and ESS we create dedicated alias mapping further below.
1167
- const allowGenericRoleAliases = !chargerCats.has(cat) && !['METER', 'BATTERY', 'ESS', 'BATTERY_INVERTER'].includes(cat);
1184
+ const mira = miraUnit(this.template);
1185
+ const allowGenericRoleAliases = !mira && !chargerCats.has(cat) && !['METER', 'BATTERY', 'ESS', 'BATTERY_INVERTER'].includes(cat);
1168
1186
 
1169
1187
  if (allowGenericRoleAliases) {
1170
1188
  const powerDp = getAnyById('W') || this._findFirstDatapoint(dp => dp.role === 'value.power' && dp.rw !== 'wo');
@@ -1214,7 +1232,9 @@ class DeviceRuntime {
1214
1232
  // --- HEAT aliases (heat pumps / heating systems) ---
1215
1233
  // Provide a stable API for heat pumps so that higher-level control adapters can link
1216
1234
  // against consistent alias names even if manufacturers label datapoints differently.
1217
- if (cat === 'HEAT') {
1235
+ if (mira) {
1236
+ for (const def of buildMiraAliases(this, mira)) addStandardSource(def);
1237
+ } else if (cat === 'HEAT') {
1218
1238
  const asNumber = (v) => {
1219
1239
  if (typeof v === 'number' && Number.isFinite(v)) return v;
1220
1240
  if (typeof v === 'string') {
@@ -6653,6 +6673,7 @@ class DeviceRuntime {
6653
6673
  return;
6654
6674
  }
6655
6675
 
6676
+ this._dashboardTransportFailed = true;
6656
6677
  const message = String(errorMessage || 'MQTT disconnected');
6657
6678
  await this._setStateCached(`${this.baseId}.info.connection`, false, true);
6658
6679
  await this._setStateCached(`${this.baseId}.info.lastError`, message, true);
@@ -6664,6 +6685,10 @@ class DeviceRuntime {
6664
6685
  const proto = this.cfg.protocol;
6665
6686
  // Load a transport only when a configured device selects it. CommonJS reuses
6666
6687
  // its module on later starts, while every device still gets its own driver.
6688
+ if (this.template?.driverHints?.ovumMira) {
6689
+ const { OvumMiraDriver } = require('./drivers/ovumMira');
6690
+ return new OvumMiraDriver(this.adapter, this.cfg, this.template, this.global);
6691
+ }
6667
6692
  if (getDeyeProfile(this.template)) {
6668
6693
  const { DeyeModbusDriver } = require('./drivers/deyeModbus');
6669
6694
  return new DeyeModbusDriver(this.adapter, this.cfg, this.template, this.global);
@@ -6773,6 +6798,8 @@ class DeviceRuntime {
6773
6798
  // (We still keep the counter monotonic across restarts.)
6774
6799
  await this._loadHeartbeatStateFromDb().catch(() => {});
6775
6800
  this._hbLastSeen = 0;
6801
+ this._dashboardMonitoringAt = Date.now();
6802
+ this._dashboardTransportFailed = false;
6776
6803
  this._hbLastSourceStamp = 0;
6777
6804
  this._hbLastWriteAt = 0;
6778
6805
  this._hbOnline = false;
@@ -7224,6 +7251,7 @@ class DeviceRuntime {
7224
7251
  // should not make a busy wallbox flap online/offline. Transport errors still mark the
7225
7252
  // device offline immediately, and repeated read failures go offline once the grace expires.
7226
7253
  if (!keepConnectionState) this._connOk = false;
7254
+ if (isTransport && !keepConnectionState) this._dashboardTransportFailed = true;
7227
7255
 
7228
7256
  const host = this.cfg?.connection?.host;
7229
7257
  const port = Number(this.cfg?.connection?.port || 502);
@@ -7989,6 +8017,7 @@ class DeviceRuntime {
7989
8017
  // to appear dead for the cooldown window.
7990
8018
  const toDev = (typeof aliasDef.toDevice === 'function') ? aliasDef.toDevice(state.val) : state.val;
7991
8019
  if (toDev === undefined || toDev === null) {
8020
+ if (miraUnit(this.template)) throw new Error('MIRA: Ungültiger EMS-Stellwert.');
7992
8021
  // Command-button aliases can intentionally ignore the inactive/false edge
7993
8022
  // (e.g. KEBA P40 fast charging can only be activated, not deactivated, via Modbus).
7994
8023
  await this._setStateCached(relId, state.val, true);
@@ -8020,7 +8049,7 @@ class DeviceRuntime {
8020
8049
  // For sensitive devices (e.g. SolaX), coalesce/throttle writes instead of sending them immediately.
8021
8050
  // VARTA and FENECON Home have no keepalive requiring an optimistic
8022
8051
  // command. Rejected writes must not later be acknowledged from polling.
8023
- if (!getVartaProfile(this.template) && !this._isFeneconHomeEssTemplate()) this._rememberCommandedValue(aliasTargetDp.id, toDev);
8052
+ if (!miraUnit(this.template) && !getVartaProfile(this.template) && !this._isFeneconHomeEssTemplate()) this._rememberCommandedValue(aliasTargetDp.id, toDev);
8024
8053
 
8025
8054
  if (this._isWriteQueueEnabled()) {
8026
8055
  this._enqueueWrite(relId, aliasTargetDp, toDev, state.val, { bypassUnsupportedCooldown: true, isUserCommand: true });
@@ -8092,7 +8121,7 @@ class DeviceRuntime {
8092
8121
  if (getVartaProfile(this.template) && await this._rejectUnavailableVartaWrite()) return;
8093
8122
  // Direct user/script writes must not be suppressed by a previous automatic
8094
8123
  // keepalive rejection. Let the actual device response decide.
8095
- if (!getVartaProfile(this.template) && !this._isFeneconHomeEssTemplate()) this._rememberCommandedValue(dp.id, state.val);
8124
+ if (!miraUnit(this.template) && !getVartaProfile(this.template) && !this._isFeneconHomeEssTemplate()) this._rememberCommandedValue(dp.id, state.val);
8096
8125
 
8097
8126
  // For sensitive devices (e.g. SolaX), coalesce/throttle writes instead of sending them immediately.
8098
8127
  if (this._isWriteQueueEnabled()) {
@@ -33,7 +33,7 @@ function _errMsg(err) {
33
33
  // They must abort the whole snapshot without marking valid optional registers
34
34
  // unsupported for the subsequent permitted poll.
35
35
  function isReadOperationBoundaryError(err) {
36
- return ['EOS_DEVICES_NOT_AUTHORIZED', 'EOS_DEVICES_STOPPED', 'EOS_MODULE_STOPPED', 'EOS_OWNERSHIP_REQUIRED', 'E_MODBUS_CONNECT_CANCELLED']
36
+ return ['EOS_DEVICES_NOT_AUTHORIZED', 'EOS_DEVICES_STOPPED', 'EOS_MODULE_STOPPED', 'EOS_OWNERSHIP_REQUIRED', 'E_MODBUS_CONNECT_CANCELLED', 'EOS_MIRA_LOGIN']
37
37
  .includes(_errCode(err) || _errMsg(err));
38
38
  }
39
39
 
@@ -2867,6 +2867,11 @@ async readDatapoints(datapoints) {
2867
2867
  this._busy = true;
2868
2868
  this._busySince = Date.now();
2869
2869
 
2870
+ // A MIRA session loss affects every register. Only a device response can
2871
+ // identify an unsupported register for the optional-group cooldown.
2872
+ const mustAbortPoll = error => isReadOperationBoundaryError(error) ||
2873
+ (this.abortPollOnTransportLoss === true && isTransportError(error));
2874
+
2870
2875
  const out = {};
2871
2876
 
2872
2877
  // Keep numeric raw values separate so we can apply dynamic scale factors after all reads.
@@ -2938,7 +2943,7 @@ async readDatapoints(datapoints) {
2938
2943
  };
2939
2944
 
2940
2945
  const handleGroupReadError = async (fc, g, e, unitId) => {
2941
- if (isReadOperationBoundaryError(e)) throw e;
2946
+ if (mustAbortPoll(e)) throw e;
2942
2947
  const isRequired = groupHasRequiredDp(g);
2943
2948
 
2944
2949
  if (isTransportError(e)) {
@@ -3077,7 +3082,7 @@ async readDatapoints(datapoints) {
3077
3082
  success += 1;
3078
3083
  }
3079
3084
  } catch (e) {
3080
- if (isReadOperationBoundaryError(e)) throw e;
3085
+ if (mustAbortPoll(e)) throw e;
3081
3086
  lastErr = e;
3082
3087
  if (groupHasRequiredDp(ig)) {
3083
3088
  requiredFailure = e;
@@ -3109,7 +3114,7 @@ async readDatapoints(datapoints) {
3109
3114
  return s && s.sunspecModel !== undefined && s.sunspecModel !== null;
3110
3115
  });
3111
3116
  if (needsSunSpec) {
3112
- try { await this._maybeScanSunSpecModels(); } catch (error) { if (isReadOperationBoundaryError(error)) throw error; }
3117
+ try { await this._maybeScanSunSpecModels(); } catch (error) { if (mustAbortPoll(error)) throw error; }
3113
3118
  }
3114
3119
 
3115
3120
  const readItems = (datapoints || []).map(dp => {
@@ -3209,7 +3214,7 @@ async readDatapoints(datapoints) {
3209
3214
  try {
3210
3215
  regs = await readRegisterGroupRaw(fc, g.start, len, unitId);
3211
3216
  } catch (e) {
3212
- if (isReadOperationBoundaryError(e)) throw e;
3217
+ if (mustAbortPoll(e)) throw e;
3213
3218
  let fallbackReadOk = false;
3214
3219
  if (isModbusIllegalAddressOrValue(e)) {
3215
3220
  for (const off of groupFallbackOffsets(g)) {
@@ -3221,7 +3226,7 @@ async readDatapoints(datapoints) {
3221
3226
  this._cacheAlfenReadVariantForGroup(g, unitId, off);
3222
3227
  break;
3223
3228
  } catch (fallbackError) {
3224
- if (isReadOperationBoundaryError(fallbackError)) throw fallbackError;
3229
+ if (mustAbortPoll(fallbackError)) throw fallbackError;
3225
3230
  // Try the next explicitly configured fallback offset, if any.
3226
3231
  }
3227
3232
  }
@@ -4466,4 +4471,4 @@ async readDatapoints(datapoints) {
4466
4471
  }
4467
4472
  }
4468
4473
 
4469
- module.exports = { ModbusDriver };
4474
+ module.exports = { ModbusDriver, isTransportError };
@@ -125,12 +125,18 @@ class ModbusRtuBus {
125
125
  return await fn(this.client);
126
126
  } catch (e) {
127
127
  // Mark as disconnected so next operation tries to reconnect
128
- this.connected = false;
128
+ if (!['EOS_MIRA_LOGIN', 'EOS_MIRA_READBACK', 'EOS_DEVICES_NOT_AUTHORIZED', 'E_MODBUS_CONNECT_CANCELLED'].includes(e?.code)) this.connected = false;
129
129
  throw e;
130
130
  }
131
131
  });
132
132
  }
133
133
 
134
+ // Keep dependent requests (login, command and readback) on the same Unit-ID
135
+ // and physical port reservation even when other units share this bus.
136
+ withUnitClient(unitId, timeoutMs, operation) {
137
+ return this._exec(unitId, timeoutMs, operation);
138
+ }
139
+
134
140
  // Read helpers
135
141
  readCoils(unitId, timeoutMs, addr, len) {
136
142
  return this._exec(unitId, timeoutMs, (c) => c.readCoils(addr, len));
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ const { ModbusDriver, isTransportError } = require('./modbus');
4
+ const { assertOperationAllowed } = require('../operationContext');
5
+
6
+ // OVUM MIRA 1.1.3 START, physical 0-based holding-register addresses.
7
+ // Only volatile EMS inputs are writable. P_ configuration words persist to flash.
8
+ const { miraConnection, rejectLogin, S32_MIN, S32_MAX } = require('../ovumMiraConnection');
9
+ const INPUTS = Object.freeze({
10
+ 'control.pvStatus': [55070, 1, 0, 2],
11
+ 'control.batterySocPct': [55071, 1, 0, 100],
12
+ 'control.gridPowerW': [55072, 2, S32_MIN, S32_MAX],
13
+ 'control.inverterPowerW': [55074, 2, S32_MIN, S32_MAX],
14
+ 'control.pvPowerTargetW': [55076, 2, 0, S32_MAX],
15
+ });
16
+
17
+ function exactWords(response, length) {
18
+ const words = response?.data;
19
+ if (!Array.isArray(words) || words.length !== length ||
20
+ !words.every(w => Number.isInteger(w) && w >= 0 && w <= 0xffff)) {
21
+ throw new Error('MIRA: Unvollständige Modbus-Rückmeldung.');
22
+ }
23
+ return words;
24
+ }
25
+
26
+ class OvumMiraDriver extends ModbusDriver {
27
+ constructor(adapter, cfg, template, global) {
28
+ super(adapter, cfg, template, global);
29
+ const role = template.driverHints.ovumMira.module;
30
+ const { unitId, code } = miraConnection(role, cfg.protocol, cfg.connection);
31
+ this.unitId = this.manualUnitId = unitId;
32
+ this.manualAddressOffset = this.autoAddressOffset = 0;
33
+ this._disableAddressFallbackOffsets = true;
34
+ this.wordOrder = this.byteOrder = 'be';
35
+ this.strictContiguousReads = true;
36
+ this.abortPollOnTransportLoss = true;
37
+ this.loginCode = code;
38
+ this.needStatus = true;
39
+ this.sessionClient = null;
40
+ this.loginRetryAt = 0;
41
+ this.epoch = 0;
42
+ }
43
+
44
+ _markDisconnected(error) {
45
+ this.epoch++;
46
+ this.sessionClient = null;
47
+ super._markDisconnected(error);
48
+ }
49
+
50
+ async disconnect() {
51
+ this.epoch++;
52
+ this.sessionClient = null;
53
+ return super.disconnect();
54
+ }
55
+
56
+ async readDatapoints(points) {
57
+ if (!this._busy) this.needStatus = true;
58
+ const values = await super.readDatapoints(points);
59
+ for (const key of Object.keys(values)) {
60
+ if (typeof values[key] === 'number' && !Number.isFinite(values[key])) values[key] = null;
61
+ }
62
+ return values;
63
+ }
64
+
65
+ async _checkLogin(client, current, firstAccess) {
66
+ const status = async () => {
67
+ current();
68
+ const words = (await client.readHoldingRegisters(100, 1))?.data;
69
+ if (!Array.isArray(words) || words.length !== 1 || ![0, 1].includes(words[0])) {
70
+ throw rejectLogin('MIRA: Ungültige Login-Status-Antwort.');
71
+ }
72
+ return words[0];
73
+ };
74
+ if (!(firstAccess && this.loginCode) && await status() === 1) return;
75
+ if (!this.loginCode) throw rejectLogin('MIRA: Anmeldung erforderlich. Modbus-Login-Code in der Geräteverbindung prüfen.');
76
+ if (Date.now() < this.loginRetryAt) throw rejectLogin('MIRA: Letzte Anmeldung abgewiesen. Modbus-Login-Code prüfen.');
77
+ current();
78
+ try {
79
+ await client.writeRegisters(101, this.loginCode.slice());
80
+ } catch (error) {
81
+ // Never propagate a library exception that may contain a request dump.
82
+ const safe = rejectLogin('MIRA: Übertragung der Anmeldung fehlgeschlagen.');
83
+ if (isTransportError(error)) {
84
+ safe.code = ['ETIMEDOUT', 'ECONNRESET', 'EPIPE', 'ERR_SOCKET_CLOSED'].includes(error?.code)
85
+ ? error.code : 'ERR_SOCKET_CLOSED';
86
+ }
87
+ throw safe;
88
+ }
89
+ if (await status() !== 1) {
90
+ this.loginRetryAt = Date.now() + 60000;
91
+ throw rejectLogin('MIRA: Anmeldung nicht bestätigt. Modbus-Login-Code in der Geräteverbindung prüfen.');
92
+ }
93
+ this.loginRetryAt = 0;
94
+ }
95
+
96
+ async _transaction(verify, action) {
97
+ const epoch = this.epoch;
98
+ const current = () => {
99
+ assertOperationAllowed();
100
+ if (this.epoch !== epoch || !this.connected) {
101
+ throw Object.assign(new Error('MIRA: Verbindung wurde beendet.'), { code: 'E_MODBUS_CONNECT_CANCELLED' });
102
+ }
103
+ };
104
+ return this._withIoLock(async () => {
105
+ current();
106
+ const run = async client => {
107
+ current();
108
+ const firstAccess = this.sessionClient !== client;
109
+ if (firstAccess || verify || this.needStatus) {
110
+ await this._checkLogin(client, current, firstAccess);
111
+ current();
112
+ this.sessionClient = client;
113
+ this.needStatus = false;
114
+ }
115
+ return action(client, current);
116
+ };
117
+ if (this.protocol === 'modbusRtu') return this.rtuBus.withUnitClient(this.unitId, this.timeoutMs, run);
118
+ this._setTcpRequestUnitId(this.unitId);
119
+ return run(this.client);
120
+ }, 'MIRA Modbus');
121
+ }
122
+
123
+ _mbReadHoldingRegisters(address, length, unitId) {
124
+ if (this._operationUnitId(unitId) !== this.unitId) throw new Error('MIRA: Fremde Unit-ID.');
125
+ // Addresses 101/102 hold the login code and are never measurement words.
126
+ if (address < 103 && address + length > 101) throw new Error('MIRA: Anmelderegister ist kein Messpunkt.');
127
+ return this._transaction(false, client => client.readHoldingRegisters(address, length));
128
+ }
129
+
130
+ async writeDatapoint(dp, value) {
131
+ const spec = Object.hasOwn(INPUTS, dp?.id) ? INPUTS[dp.id] : null;
132
+ if (this.unitId !== 110 || !spec || dp.rw !== 'rw') throw new Error('MIRA: Schreibzugriff für diesen Datenpunkt gesperrt.');
133
+ const [address, length, min, max] = spec;
134
+ const n = typeof value === 'string' && /^-?\d+$/.test(value.trim()) ? Number(value) : value;
135
+ if (!Number.isInteger(n) || n < min || n > max) throw new Error('MIRA: Ungültiger EMS-Stellwert.');
136
+ const words = length === 1 ? [n] : [n >>> 16, n & 0xffff];
137
+ await this.ensureConnected();
138
+ await this._transaction(true, async (client, current) => {
139
+ current();
140
+ if (length === 1) await client.writeRegister(address, words[0]);
141
+ else await client.writeRegisters(address, words);
142
+ current();
143
+ const actual = exactWords(await client.readHoldingRegisters(address, length), length);
144
+ current();
145
+ if (!actual.every((word, i) => word === words[i])) {
146
+ throw Object.assign(new Error('MIRA: Sollwert vom Gerät nicht bestätigt.'), { code: 'EOS_MIRA_READBACK' });
147
+ }
148
+ });
149
+ return { effectiveValue: n };
150
+ }
151
+ }
152
+ module.exports = { OvumMiraDriver };
@@ -0,0 +1,61 @@
1
+ 'use strict';
2
+
3
+ // These are different physical units. A hydraulic EMS target or thermal output
4
+ // cannot substitute for the WPM's electrical consumption in the energy flow.
5
+ const units = {
6
+ 'heat.ovum.mira.hsm': 'hsm',
7
+ 'heat.ovum.mira.wpm': 'wpm',
8
+ };
9
+ const hsmBindings = [
10
+ ['r.pvStatus', 'control.pvStatus', 55070, 'int16'],
11
+ ['ctrl.pvStatus', 'control.pvStatus', 55070, 'int16'],
12
+ ['r.pvPowerTargetW', 'control.pvPowerTargetW', 55076, 'int32', 'W'],
13
+ ['ctrl.pvPowerTargetW', 'control.pvPowerTargetW', 55076, 'int32', 'W'],
14
+ ['r.ambientTemp', 'ambient.actualAmbientTemp', 56048, 'float32', '°C'],
15
+ ['r.roomTemp', 'hc.roomTemp', 56152, 'float32', '°C'],
16
+ ['r.bufferTemp', 'buffer.lowerTemperature', 55028, 'float32', '°C'],
17
+ ];
18
+ const wpmBindings = [
19
+ ['r.power', 'measurement.electricalPowerW', 56021, 'float32', 'W'],
20
+ ['r.statusCode', 'status.operatingState', 56025, 'int16'],
21
+ ['r.returnTemp', 'measurement.waterInletTemperature', 56026, 'float32', '°C'],
22
+ ['r.flowTemp', 'measurement.waterOutletTemperature', 56028, 'float32', '°C'],
23
+ ];
24
+ const freshPaths = new Set(['r.power', 'r.pvStatus', 'r.pvPowerTargetW', 'comm.connected', 'alarm.offline']);
25
+
26
+ function miraUnit(template) {
27
+ const unit = units[template?.id];
28
+ return unit && unit === template.driverHints?.ovumMira?.module ? unit : undefined;
29
+ }
30
+
31
+ function buildMiraAliases(runtime, unit) {
32
+ const definitions = [];
33
+ for (const [path, dpId, address, dataType, unitName] of unit === 'hsm' ? hsmBindings : wpmBindings) {
34
+ const dp = runtime._getDpById(dpId);
35
+ const src = dp?.source;
36
+ const read = src?.read;
37
+ const write = path.startsWith('ctrl.');
38
+ const words = dataType === 'int16' ? 1 : 2;
39
+ if (dp?.type !== 'number' || dp.unit !== unitName || dp.rw === 'wo' || src?.kind !== 'modbus' ||
40
+ read?.fc !== 3 || read.address !== address || read.dataType !== dataType || read.length !== words ||
41
+ read.wordOrder !== 'be' || read.byteOrder !== 'be' || (src.scaleFactor ?? 0) !== (path === 'r.power' ? 3 : 0)) continue;
42
+ const target = src.write;
43
+ if (write && (dp.rw !== 'rw' || target?.address !== address || target.fc !== (words === 1 ? 6 : 16) ||
44
+ target.length !== words || target.dataType !== dataType || target.wordOrder !== 'be' || target.byteOrder !== 'be')) continue;
45
+
46
+ const definition = {
47
+ relId: runtime._aliasRelId(path), name: dp.name, type: 'number',
48
+ role: dp.role, rw: write ? 'rw' : 'ro', kind: 'dp', dpId,
49
+ };
50
+ if (unitName) definition.unit = unitName;
51
+ if (write) definition.writeDpId = dpId;
52
+ else {
53
+ definition.deviceReadOnly = true;
54
+ definition.fromDevice = value => typeof value === 'number' && Number.isFinite(value) ? value : null;
55
+ }
56
+ definitions.push(definition);
57
+ }
58
+ return definitions;
59
+ }
60
+
61
+ module.exports = { miraUnit, buildMiraAliases, freshPaths };