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
@@ -654,8 +654,17 @@ function downloadTextFile(filename, text, mime) {
654
654
  }, 0);
655
655
  }
656
656
 
657
+ function printableDeviceConfiguration() {
658
+ const rows = (devices || []).map(device => {
659
+ if (!['heat.ovum.mira.hsm', 'heat.ovum.mira.wpm'].includes(device.templateId) || !device.connection?.writePassword) return device;
660
+ // Host-side secret placeholders survive importing into the same device.
661
+ return { ...device, connection: { ...device.connection, writePassword: '__EOS_SECRET_UNCHANGED__' } };
662
+ });
663
+ return JSON.stringify(rows, null, 2);
664
+ }
665
+
657
666
  function exportDevicesJsonToFile() {
658
- const text = JSON.stringify(devices || [], null, 2);
667
+ const text = printableDeviceConfiguration();
659
668
  downloadTextFile('nexowatt-devices.devices.json', text, 'application/json');
660
669
  }
661
670
 
@@ -829,6 +838,117 @@ function emsPresentation(device) {
829
838
  return window.EosDeviceEms.describe(device.id, device.ems, device.enabled);
830
839
  }
831
840
 
841
+ const MIRA_HSM = 'heat.ovum.mira.hsm';
842
+ const MIRA_WPM = 'heat.ovum.mira.wpm';
843
+
844
+ function sameMiraEndpoint(a, b) {
845
+ if (a.protocol !== b.protocol) return false;
846
+ const x = a.connection || {}, y = b.connection || {};
847
+ if (a.protocol === 'modbusTcp') {
848
+ const host = String(x.host || '').trim().toLowerCase();
849
+ return !!host && host === String(y.host || '').trim().toLowerCase() && Number(x.port || 502) === Number(y.port || 502);
850
+ }
851
+ return a.protocol === 'modbusRtu' && !!normalizeSerialPath(x.path) && normalizeSerialPath(x.path) === normalizeSerialPath(y.path);
852
+ }
853
+
854
+ function miraCanLink(hsm, wpm) {
855
+ const unit = Number(wpm.connection?.unitId);
856
+ if (wpm.templateId !== MIRA_WPM || !Number.isInteger(unit) || unit < 111 || unit > 118) return false;
857
+ if (hsm.protocol === 'modbusTcp') return sameMiraEndpoint(hsm, wpm);
858
+ // Two separately wired RTU ports can belong to one plant. Linking across
859
+ // ports requires an explicit choice of an existing WPM.
860
+ return hsm.protocol === 'modbusRtu' && wpm.protocol === 'modbusRtu';
861
+ }
862
+
863
+ function miraPairingForm(reset) {
864
+ const area = document.getElementById('mira_pair_settings');
865
+ area.hidden = $('#dev_template').val() !== MIRA_HSM;
866
+ if (area.hidden) return;
867
+ const select = document.getElementById('mira_wpm_choice');
868
+ const unitSelect = document.getElementById('mira_wpm_unit');
869
+ const previous = editIndex < 0 ? null : devices[editIndex];
870
+ const stored = previous?.templateId === MIRA_HSM ? previous.connection?.miraWpmDeviceId : undefined;
871
+ const protocol = $('#dev_protocol').val();
872
+ const expected = { protocol, connection: protocol === 'modbusTcp'
873
+ ? { host: $('#mb_host').val(), port: $('#mb_port').val() } : { path: $('#mb_path').val() } };
874
+ let choice = reset ? '' : select.value;
875
+ if (!choice) choice = stored ? 'id:' + stored : stored === '' ? 'none' : editIndex < 0 ? 'same' : 'legacy';
876
+ const option = (value, title) => {
877
+ const el = document.createElement('option'); el.value = value; el.textContent = title; return el;
878
+ };
879
+ select.replaceChildren();
880
+ if (editIndex < 0) select.appendChild(option('same', 'Wärmepumpenmodul mit anlegen oder vorhandenes verwenden'));
881
+ if (editIndex >= 0 && stored === undefined) select.appendChild(option('legacy', 'Eindeutiges Modul am gleichen Anschluss erkennen'));
882
+ select.appendChild(option('none', 'Kein Modul zuordnen'));
883
+ for (const item of devices) {
884
+ if (miraCanLink(expected, item)) select.appendChild(option('id:' + item.id, item.id + ' · ' + summarizeConnection(item) + (item.enabled === false ? ' · deaktiviert' : '')));
885
+ }
886
+ if (choice.startsWith('id:') && !Array.from(select.options).some(x => x.value === choice)) {
887
+ select.appendChild(option(choice, choice.slice(3) + ' · Zuordnung prüfen'));
888
+ }
889
+ select.value = choice;
890
+ if (!unitSelect.options.length) {
891
+ for (let n = 1; n <= 8; n++) unitSelect.appendChild(option(String(110 + n), 'WPM ' + n + ' · Unit ' + (110 + n)));
892
+ }
893
+ if (reset) unitSelect.value = '111';
894
+ document.getElementById('mira_wpm_unit_field').hidden = choice !== 'same';
895
+ let hint = '';
896
+ if (choice === 'same') hint = 'EOS verwendet den Anschluss des HSM und übernimmt vorhandene Module mit passender Unit-ID.';
897
+ if (protocol === 'modbusRtu') hint += ' Bei getrennten RS485-Leitungen das WPM an seinem Port anlegen und hier auswählen.';
898
+ if (choice === 'none') hint = 'Das HSM kann separat eingerichtet werden. Für die automatische Leistungsregelung später das Messmodul zuordnen.';
899
+ document.getElementById('mira_pair_hint').textContent = hint.trim();
900
+ }
901
+
902
+ // Resolve the complete change before the device list is modified. An existing
903
+ // WPM remains the same object, with its original login, settings and EMS mode.
904
+ function planMiraPair(device, inventory, index, choice, unit) {
905
+ if (![MIRA_HSM, MIRA_WPM].includes(device.templateId)) return null;
906
+ const others = inventory.filter((_item, i) => i !== index);
907
+ const atUnit = (address) => others.filter(item => sameMiraEndpoint(device, item) && Number(item.connection?.unitId) === address);
908
+ if (atUnit(Number(device.connection.unitId)).length) throw new Error('Diese Modbus-Unit ist an diesem Anschluss bereits als Gerät angelegt.');
909
+ if (device.templateId !== MIRA_HSM || choice === 'legacy') return null;
910
+ if (choice === 'none') return { id: '' };
911
+ let match;
912
+ if (choice === 'same' && index < 0) {
913
+ if (!Number.isInteger(unit) || unit < 111 || unit > 118) throw new Error('Ein Wärmepumpenmodul von WPM 1 bis 8 auswählen.');
914
+ const found = atUnit(unit);
915
+ if (found.length > 1 || (found.length && !miraCanLink(device, found[0]))) {
916
+ throw new Error('Die ausgewählte WPM-Unit ist am Anschluss bereits einem anderen Gerät zugeordnet.');
917
+ }
918
+ match = found[0];
919
+ if (!match) {
920
+ // Keep the generated ID within the device host's 80-character limit.
921
+ const prefix = device.id.slice(0, 70) + '_wpm' + (unit - 110);
922
+ const ids = new Set(inventory.map(item => item.id));
923
+ ids.add(device.id);
924
+ let id = prefix;
925
+ for (let n = 2; ids.has(id); n++) id = prefix + '_' + n;
926
+ if (inventory.length + 2 > 128) throw new Error('Für HSM und WPM werden zwei freie Geräteplätze benötigt.');
927
+ const connection = { unitId: unit };
928
+ for (const key of ['host','port','path','baudRate','parity','dataBits','stopBits','addressOffset','wordOrder','byteOrder','timeoutMs','writePassword']) {
929
+ if (device.connection[key] !== undefined) connection[key] = device.connection[key];
930
+ }
931
+ if (connection.writePassword === '__EOS_SECRET_UNCHANGED__') throw new Error('Den lokalen MIRA-Login-Code für das neue WPM eingeben.');
932
+ return { id, companion: { id, name: (device.name || device.id) + ' · WPM ' + (unit - 110),
933
+ templateId: MIRA_WPM, manufacturer: device.manufacturer, category: device.category, protocol: device.protocol,
934
+ enabled: device.enabled !== false, pollIntervalMs: device.pollIntervalMs, heartbeatTimeoutMs: device.heartbeatTimeoutMs,
935
+ ems: { mode: 'auto' }, connection } };
936
+ }
937
+ } else if (choice && choice.startsWith('id:')) {
938
+ const found = others.filter(item => item.id === choice.slice(3));
939
+ if (found.length === 1 && miraCanLink(device, found[0])) match = found[0];
940
+ }
941
+ if (!match) throw new Error('Ein passendes MIRA-WPM auswählen oder das HSM separat einrichten.');
942
+ if (others.some(item => item !== match && sameMiraEndpoint(match, item) && Number(item.connection?.unitId) === Number(match.connection.unitId))) {
943
+ throw new Error('Die ausgewählte WPM-Unit ist am Anschluss mehrfach angelegt.');
944
+ }
945
+ if (others.some(item => item.templateId === MIRA_HSM && (item.connection?.miraWpmDeviceId === match.id ||
946
+ (!Object.hasOwn(item.connection || {}, 'miraWpmDeviceId') && sameMiraEndpoint(item, match))))) {
947
+ throw new Error('Dieses WPM ist bereits einem anderen HSM zugeordnet.');
948
+ }
949
+ return { id: match.id };
950
+ }
951
+
832
952
  function updateEmsControls(settings) {
833
953
  const api = window.EosDeviceEms;
834
954
  const current = settings || {
@@ -848,8 +968,11 @@ function updateEmsControls(settings) {
848
968
  select.value = choices.some(choice => choice.value === desired.mode) ? desired.mode : 'auto';
849
969
  document.getElementById('dev_ems_scope').value = desired.scope || '';
850
970
  if (settings) {
851
- document.getElementById('dev_ems_requested').checked = desired.activation?.requested !== false;
971
+ const mira = $('#dev_template').val() === 'heat.ovum.mira.hsm';
972
+ document.getElementById('dev_ems_requested').checked = mira ? desired.activation?.requested === true : desired.activation?.requested !== false;
852
973
  const limits = desired.activation?.limits || {};
974
+ document.getElementById('dev_ems_miraSources').checked = mira && limits.miraSources === 'confirmed';
975
+ document.getElementById('dev_ems_miraMaxW').value = mira ? limits.maxPowerW ?? '' : '';
853
976
  for (const key of ['coupling', 'maxChargeW', 'maxDischargeW', 'capacityKWh', 'chargerType', 'phases', 'minCurrentA', 'maxCurrentA', 'minPowerW', 'maxPowerW']) {
854
977
  const control = document.getElementById('dev_ems_' + key);
855
978
  control.value = Object.hasOwn(limits, key) ? String(Reflect.get(limits, key)) : '';
@@ -883,16 +1006,18 @@ function updateEmsActivation() {
883
1006
  const category = String($('#dev_category').val() || '').toUpperCase();
884
1007
  const storage = ['singleStorage', 'storageFarm'].includes(mode);
885
1008
  const charger = mode === 'auto' && ['EVCS', 'EVSE'].includes(category);
886
- const applicable = storage || charger || ['gridMeter', 'generationMeter', 'consumptionMeter', 'pvInverter'].includes(mode);
1009
+ const mira = mode === 'auto' && $('#dev_template').val() === 'heat.ovum.mira.hsm';
1010
+ if (mira) document.getElementById('dev_ems_help').textContent = 'Die elektrische Aufnahmeleistung des Wärmepumpenmoduls erscheint im Energiefluss. Für PV-Regelung Quellenwahl bestätigen und die elektrische Leistungsgrenze der Anlage eintragen.';
1011
+ const applicable = storage || charger || mira || ['gridMeter', 'generationMeter', 'consumptionMeter', 'pvInverter'].includes(mode);
887
1012
  document.getElementById('dev_ems_activation_field').hidden = !applicable;
888
1013
  const requested = document.getElementById('dev_ems_requested').checked;
889
1014
  const type = document.getElementById('dev_ems_chargerType').value;
890
1015
  for (const field of document.querySelectorAll('[data-ems-limit]')) {
891
1016
  const group = field.dataset.emsLimit;
892
- field.hidden = !requested || !(group === 'storage' && storage || group === 'charger' && charger || group === type && charger);
1017
+ field.hidden = !requested || !(group === 'storage' && storage || group === 'charger' && charger || group === type && charger || group === 'mira' && mira);
893
1018
  }
894
- document.getElementById('dev_ems_limits_help').hidden = !requested || !(storage || charger);
895
- document.getElementById('dev_ems_limits_title').hidden = !requested || !(storage || charger);
1019
+ document.getElementById('dev_ems_limits_help').hidden = !requested || !(storage || charger || mira);
1020
+ document.getElementById('dev_ems_limits_title').hidden = !requested || !(storage || charger || mira);
896
1021
  }
897
1022
 
898
1023
  function collectEmsActivation(value, previous) {
@@ -900,7 +1025,21 @@ function collectEmsActivation(value, previous) {
900
1025
  const requested = document.getElementById('dev_ems_requested').checked;
901
1026
  const limits = { ...(previous?.activation?.limits || {}) };
902
1027
  const storage = ['singleStorage', 'storageFarm'].includes(value.mode);
903
- const charger = value.mode === 'auto';
1028
+ const charger = value.mode === 'auto' && ['EVCS','EVSE'].includes(String($('#dev_category').val()).toUpperCase());
1029
+ const mira = value.mode === 'auto' && $('#dev_template').val() === 'heat.ovum.mira.hsm';
1030
+ if (mira) {
1031
+ const maxPowerW = Number(document.getElementById('dev_ems_miraMaxW').value);
1032
+ const confirmed = document.getElementById('dev_ems_miraSources').checked;
1033
+ if (requested && (!confirmed || !Number.isSafeInteger(maxPowerW) || maxPowerW < 1 || maxPowerW > 10000000)) {
1034
+ throw new Error('Für die MIRA-Regelung die Quellenwahl am HSM bestätigen und eine gültige elektrische Leistungsgrenze in Watt eingeben.');
1035
+ }
1036
+ value.activation = { requested, limits: {
1037
+ ...(confirmed ? { miraSources: 'confirmed' } : {}),
1038
+ ...(Number.isSafeInteger(maxPowerW) && maxPowerW > 0 && maxPowerW <= 10000000 ? { maxPowerW } : {}),
1039
+ } };
1040
+ if (previous?.activation?.requestId) value.activation.requestId = previous.activation.requestId;
1041
+ return;
1042
+ }
904
1043
  const kind = document.getElementById('dev_ems_chargerType').value;
905
1044
  const fields = storage ? ['coupling', 'maxChargeW', 'maxDischargeW', 'capacityKWh']
906
1045
  : charger ? ['chargerType', ...(kind === 'dc' ? ['minPowerW', 'maxPowerW'] : ['phases', 'minCurrentA', 'maxCurrentA'])] : [];
@@ -1197,7 +1336,18 @@ function renderProfileCapabilities(template) {
1197
1336
  }
1198
1337
 
1199
1338
  function renderDatapoints(templateId) {
1339
+ const check = document.getElementById('dev_ems_requested');
1340
+ if (check.dataset.emsTemplate !== templateId) {
1341
+ if (templateId === 'heat.ovum.mira.hsm' && !(editIndex >= 0 && devices[editIndex]?.templateId === templateId)) {
1342
+ check.checked = false;
1343
+ document.getElementById('dev_ems_miraSources').checked = false;
1344
+ document.getElementById('dev_ems_miraMaxW').value = '';
1345
+ }
1346
+ check.dataset.emsTemplate = templateId;
1347
+ }
1348
+ updateEmsActivation();
1200
1349
  const tpl = templatesById[templateId];
1350
+ $('.mira-login-hint').toggle(!!tpl?.driverHints?.ovumMira);
1201
1351
  renderProfileCapabilities(tpl);
1202
1352
  renderVartaOptions(tpl);
1203
1353
  renderDeyeOptions(tpl);
@@ -1241,7 +1391,6 @@ function openDeviceModal(device, idx) {
1241
1391
  const cat = device.category || categories[0] || 'GENERIC';
1242
1392
  $('#dev_category').val(cat);
1243
1393
  refreshSelect($('#dev_category'));
1244
- updateEmsControls(device.ems || {});
1245
1394
 
1246
1395
  fillManufacturerSelect(cat);
1247
1396
  const manuList = manufacturersByCategory[cat] || [];
@@ -1254,6 +1403,7 @@ function openDeviceModal(device, idx) {
1254
1403
  const tpl = templatesById[tplId] || null;
1255
1404
  $('#dev_template').val(tplId);
1256
1405
  refreshSelect($('#dev_template'));
1406
+ updateEmsControls(device.ems || {});
1257
1407
 
1258
1408
  fillProtocolSelect(tplId, device.protocol);
1259
1409
 
@@ -1442,6 +1592,7 @@ function openDeviceModal(device, idx) {
1442
1592
  // Populate serial port datalist from the host (supports hotplug).
1443
1593
  refreshSerialPorts(true);
1444
1594
 
1595
+ miraPairingForm(true);
1445
1596
  updateTextFields();
1446
1597
  openModal();
1447
1598
  }
@@ -1699,7 +1850,7 @@ function collectDeviceFromModal() {
1699
1850
  }
1700
1851
 
1701
1852
  function updateJsonPreview() {
1702
- const jsonStr = JSON.stringify(devices || [], null, 2);
1853
+ const jsonStr = printableDeviceConfiguration();
1703
1854
  $('#devicesJson').val(jsonStr);
1704
1855
  $('#jsonPreview').text(jsonStr);
1705
1856
  }
@@ -1949,6 +2100,9 @@ function initEventHandlers() {
1949
2100
  }
1950
2101
  });
1951
2102
 
2103
+ $('#dev_category,#dev_manufacturer,#dev_template').on('change', () => miraPairingForm(true));
2104
+ $('#dev_protocol,#mb_path,#mb_host,#mb_port,#mira_wpm_choice').on('change', () => miraPairingForm(false));
2105
+
1952
2106
  // Save device
1953
2107
  $('#btnSaveDevice').on('click', () => {
1954
2108
  try {
@@ -1970,12 +2124,16 @@ function initEventHandlers() {
1970
2124
  );
1971
2125
  }
1972
2126
 
2127
+ const pair = planMiraPair(d, devices, editIndex, $('#mira_wpm_choice').val(), Number($('#mira_wpm_unit').val()));
2128
+ if (pair) d.connection.miraWpmDeviceId = pair.id;
1973
2129
  if (editIndex >= 0) {
1974
2130
  const previous = devices[editIndex];
1975
2131
  devices[editIndex] = { ...previous, ...d, connection: previous.protocol === d.protocol ? { ...previous.connection, ...d.connection } : d.connection };
1976
2132
  for (const key of ['insecureTls', 'insecureTLS', 'allowInsecureTls', 'rejectUnauthorized']) delete devices[editIndex].connection[key];
2133
+ if (d.templateId !== MIRA_HSM) delete devices[editIndex].connection.miraWpmDeviceId;
1977
2134
  } else {
1978
2135
  devices.push(d);
2136
+ if (pair?.companion) devices.push(pair.companion);
1979
2137
  }
1980
2138
 
1981
2139
  if (emsRenewalRequested) window.EosDeviceEms.requestRenewal(d.id);
@@ -1986,6 +2144,7 @@ function initEventHandlers() {
1986
2144
  setChanged(true);
1987
2145
 
1988
2146
  closeModal();
2147
+ if (pair?.id) toast((pair.companion ? 'Wärmepumpenmodul hinzugefügt: ' : 'Vorhandenes Wärmepumpenmodul zugeordnet: ') + pair.id);
1989
2148
  } catch (e) {
1990
2149
  toast('Fehler: ' + (e.message || e.toString()));
1991
2150
  }