homebridge-config-ui-x 5.9.1-beta.0 → 5.9.1-beta.10

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 (385) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/TODO-MATTER.md +15 -0
  3. package/dist/app.controller.d.ts +1 -1
  4. package/dist/app.controller.js +14 -12
  5. package/dist/app.controller.js.map +1 -1
  6. package/dist/app.gateway.js +7 -10
  7. package/dist/app.gateway.js.map +1 -1
  8. package/dist/app.module.js +42 -43
  9. package/dist/app.module.js.map +1 -1
  10. package/dist/app.service.js +4 -7
  11. package/dist/app.service.js.map +1 -1
  12. package/dist/bin/base-platform.d.ts +1 -1
  13. package/dist/bin/base-platform.js +11 -17
  14. package/dist/bin/base-platform.js.map +1 -1
  15. package/dist/bin/fork.js +7 -45
  16. package/dist/bin/fork.js.map +1 -1
  17. package/dist/bin/hb-service.js +224 -243
  18. package/dist/bin/hb-service.js.map +1 -1
  19. package/dist/bin/platforms/darwin.d.ts +1 -1
  20. package/dist/bin/platforms/darwin.js +61 -65
  21. package/dist/bin/platforms/darwin.js.map +1 -1
  22. package/dist/bin/platforms/freebsd.d.ts +1 -1
  23. package/dist/bin/platforms/freebsd.js +42 -47
  24. package/dist/bin/platforms/freebsd.js.map +1 -1
  25. package/dist/bin/platforms/linux.d.ts +1 -1
  26. package/dist/bin/platforms/linux.js +127 -132
  27. package/dist/bin/platforms/linux.js.map +1 -1
  28. package/dist/bin/platforms/win32.d.ts +1 -1
  29. package/dist/bin/platforms/win32.js +30 -36
  30. package/dist/bin/platforms/win32.js.map +1 -1
  31. package/dist/bin/standalone.js +15 -53
  32. package/dist/bin/standalone.js.map +1 -1
  33. package/dist/core/auth/auth.controller.d.ts +5 -4
  34. package/dist/core/auth/auth.controller.js +40 -39
  35. package/dist/core/auth/auth.controller.js.map +1 -1
  36. package/dist/core/auth/auth.dto.js +17 -18
  37. package/dist/core/auth/auth.dto.js.map +1 -1
  38. package/dist/core/auth/auth.module.js +28 -31
  39. package/dist/core/auth/auth.module.js.map +1 -1
  40. package/dist/core/auth/auth.service.d.ts +3 -3
  41. package/dist/core/auth/auth.service.js +65 -62
  42. package/dist/core/auth/auth.service.js.map +1 -1
  43. package/dist/core/auth/guards/admin.guard.js +4 -7
  44. package/dist/core/auth/guards/admin.guard.js.map +1 -1
  45. package/dist/core/auth/guards/custom.guard.js +6 -9
  46. package/dist/core/auth/guards/custom.guard.js.map +1 -1
  47. package/dist/core/auth/guards/ws-admin-guard.d.ts +2 -2
  48. package/dist/core/auth/guards/ws-admin-guard.js +13 -11
  49. package/dist/core/auth/guards/ws-admin-guard.js.map +1 -1
  50. package/dist/core/auth/guards/ws.guard.d.ts +2 -2
  51. package/dist/core/auth/guards/ws.guard.js +13 -11
  52. package/dist/core/auth/guards/ws.guard.js.map +1 -1
  53. package/dist/core/auth/jwt.strategy.d.ts +3 -2
  54. package/dist/core/auth/jwt.strategy.js +21 -16
  55. package/dist/core/auth/jwt.strategy.js.map +1 -1
  56. package/dist/core/config/config.interfaces.d.ts +8 -1
  57. package/dist/core/config/config.interfaces.js +1 -2
  58. package/dist/core/config/config.module.js +8 -10
  59. package/dist/core/config/config.module.js.map +1 -1
  60. package/dist/core/config/config.service.d.ts +4 -3
  61. package/dist/core/config/config.service.js +90 -83
  62. package/dist/core/config/config.service.js.map +1 -1
  63. package/dist/core/config/config.startup.d.ts +1 -1
  64. package/dist/core/config/config.startup.js +23 -28
  65. package/dist/core/config/config.startup.js.map +1 -1
  66. package/dist/core/feature-flags/feature-flags.registry.js +2 -5
  67. package/dist/core/feature-flags/feature-flags.registry.js.map +1 -1
  68. package/dist/core/homebridge-ipc/homebridge-ipc.module.js +11 -14
  69. package/dist/core/homebridge-ipc/homebridge-ipc.module.js.map +1 -1
  70. package/dist/core/homebridge-ipc/homebridge-ipc.service.d.ts +4 -4
  71. package/dist/core/homebridge-ipc/homebridge-ipc.service.js +25 -19
  72. package/dist/core/homebridge-ipc/homebridge-ipc.service.js.map +1 -1
  73. package/dist/core/logger/logger.module.js +8 -10
  74. package/dist/core/logger/logger.module.js.map +1 -1
  75. package/dist/core/logger/logger.service.js +13 -23
  76. package/dist/core/logger/logger.service.js.map +1 -1
  77. package/dist/core/node-pty/node-pty.module.js +7 -10
  78. package/dist/core/node-pty/node-pty.module.js.map +1 -1
  79. package/dist/core/node-pty/node-pty.service.js +6 -11
  80. package/dist/core/node-pty/node-pty.service.js.map +1 -1
  81. package/dist/core/node-version.constants.js +4 -11
  82. package/dist/core/node-version.constants.js.map +1 -1
  83. package/dist/core/scheduler/scheduler.module.js +15 -10
  84. package/dist/core/scheduler/scheduler.module.js.map +1 -1
  85. package/dist/core/scheduler/scheduler.service.d.ts +12 -1
  86. package/dist/core/scheduler/scheduler.service.js +101 -13
  87. package/dist/core/scheduler/scheduler.service.js.map +1 -1
  88. package/dist/core/spa/spa-html.service.js +9 -15
  89. package/dist/core/spa/spa-html.service.js.map +1 -1
  90. package/dist/core/spa/spa.filter.d.ts +1 -1
  91. package/dist/core/spa/spa.filter.js +11 -16
  92. package/dist/core/spa/spa.filter.js.map +1 -1
  93. package/dist/core/ssl/ssl-cert-generator.service.d.ts +1 -1
  94. package/dist/core/ssl/ssl-cert-generator.service.js +34 -36
  95. package/dist/core/ssl/ssl-cert-generator.service.js.map +1 -1
  96. package/dist/env-setup.d.ts +1 -0
  97. package/dist/env-setup.js +7 -0
  98. package/dist/env-setup.js.map +1 -0
  99. package/dist/globalDefaults.d.ts +1 -0
  100. package/dist/globalDefaults.js +1 -0
  101. package/dist/index.d.ts +1 -1
  102. package/dist/index.js +16 -19
  103. package/dist/index.js.map +1 -1
  104. package/dist/main.d.ts +5 -3
  105. package/dist/main.js +44 -51
  106. package/dist/main.js.map +1 -1
  107. package/dist/modules/accessories/accessories.controller.d.ts +3 -3
  108. package/dist/modules/accessories/accessories.controller.js +28 -29
  109. package/dist/modules/accessories/accessories.controller.js.map +1 -1
  110. package/dist/modules/accessories/accessories.dto.js +11 -13
  111. package/dist/modules/accessories/accessories.dto.js.map +1 -1
  112. package/dist/modules/accessories/accessories.gateway.d.ts +2 -2
  113. package/dist/modules/accessories/accessories.gateway.js +18 -16
  114. package/dist/modules/accessories/accessories.gateway.js.map +1 -1
  115. package/dist/modules/accessories/accessories.interfaces.d.ts +94 -0
  116. package/dist/modules/accessories/accessories.interfaces.js +2 -0
  117. package/dist/modules/accessories/accessories.interfaces.js.map +1 -0
  118. package/dist/modules/accessories/accessories.module.js +19 -20
  119. package/dist/modules/accessories/accessories.module.js.map +1 -1
  120. package/dist/modules/accessories/accessories.service.d.ts +23 -5
  121. package/dist/modules/accessories/accessories.service.js +316 -51
  122. package/dist/modules/accessories/accessories.service.js.map +1 -1
  123. package/dist/modules/backup/backup.controller.d.ts +4 -4
  124. package/dist/modules/backup/backup.controller.js +68 -67
  125. package/dist/modules/backup/backup.controller.js.map +1 -1
  126. package/dist/modules/backup/backup.gateway.d.ts +4 -4
  127. package/dist/modules/backup/backup.gateway.js +25 -21
  128. package/dist/modules/backup/backup.gateway.js.map +1 -1
  129. package/dist/modules/backup/backup.module.js +22 -25
  130. package/dist/modules/backup/backup.module.js.map +1 -1
  131. package/dist/modules/backup/backup.service.d.ts +5 -5
  132. package/dist/modules/backup/backup.service.js +143 -133
  133. package/dist/modules/backup/backup.service.js.map +1 -1
  134. package/dist/modules/child-bridges/child-bridges.gateway.d.ts +3 -3
  135. package/dist/modules/child-bridges/child-bridges.gateway.js +23 -21
  136. package/dist/modules/child-bridges/child-bridges.gateway.js.map +1 -1
  137. package/dist/modules/child-bridges/child-bridges.interfaces.js +1 -2
  138. package/dist/modules/child-bridges/child-bridges.module.js +19 -22
  139. package/dist/modules/child-bridges/child-bridges.module.js.map +1 -1
  140. package/dist/modules/child-bridges/child-bridges.service.d.ts +3 -3
  141. package/dist/modules/child-bridges/child-bridges.service.js +15 -11
  142. package/dist/modules/child-bridges/child-bridges.service.js.map +1 -1
  143. package/dist/modules/config-editor/config-editor.controller.d.ts +13 -11
  144. package/dist/modules/config-editor/config-editor.controller.js +168 -103
  145. package/dist/modules/config-editor/config-editor.controller.js.map +1 -1
  146. package/dist/modules/config-editor/config-editor.dto.d.ts +6 -0
  147. package/dist/modules/config-editor/config-editor.dto.js +40 -0
  148. package/dist/modules/config-editor/config-editor.dto.js.map +1 -0
  149. package/dist/modules/config-editor/config-editor.module.js +21 -24
  150. package/dist/modules/config-editor/config-editor.module.js.map +1 -1
  151. package/dist/modules/config-editor/config-editor.service.d.ts +11 -8
  152. package/dist/modules/config-editor/config-editor.service.js +123 -66
  153. package/dist/modules/config-editor/config-editor.service.js.map +1 -1
  154. package/dist/modules/custom-plugins/custom-plugins.module.js +10 -13
  155. package/dist/modules/custom-plugins/custom-plugins.module.js.map +1 -1
  156. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.d.ts +2 -2
  157. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js +21 -19
  158. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.controller.js.map +1 -1
  159. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js +14 -17
  160. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.module.js.map +1 -1
  161. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.d.ts +2 -2
  162. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js +18 -15
  163. package/dist/modules/custom-plugins/homebridge-deconz/homebridge-deconz.service.js.map +1 -1
  164. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.d.ts +2 -2
  165. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js +21 -19
  166. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.controller.js.map +1 -1
  167. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js +14 -17
  168. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.module.js.map +1 -1
  169. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.d.ts +2 -2
  170. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js +18 -15
  171. package/dist/modules/custom-plugins/homebridge-hue/homebridge-hue.service.js.map +1 -1
  172. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.d.ts +2 -2
  173. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js +18 -19
  174. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.controller.js.map +1 -1
  175. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.d.ts +2 -2
  176. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js +15 -13
  177. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.gateway.js.map +1 -1
  178. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js +18 -21
  179. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.module.js.map +1 -1
  180. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.d.ts +8 -8
  181. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js +47 -41
  182. package/dist/modules/custom-plugins/plugins-settings-ui/plugins-settings-ui.service.js.map +1 -1
  183. package/dist/modules/log/log.gateway.d.ts +3 -3
  184. package/dist/modules/log/log.gateway.js +15 -13
  185. package/dist/modules/log/log.gateway.js.map +1 -1
  186. package/dist/modules/log/log.interfaces.js +1 -2
  187. package/dist/modules/log/log.module.js +14 -17
  188. package/dist/modules/log/log.module.js.map +1 -1
  189. package/dist/modules/log/log.service.d.ts +5 -5
  190. package/dist/modules/log/log.service.js +47 -43
  191. package/dist/modules/log/log.service.js.map +1 -1
  192. package/dist/modules/platform-tools/docker/docker.controller.d.ts +1 -1
  193. package/dist/modules/platform-tools/docker/docker.controller.js +24 -25
  194. package/dist/modules/platform-tools/docker/docker.controller.js.map +1 -1
  195. package/dist/modules/platform-tools/docker/docker.module.js +14 -17
  196. package/dist/modules/platform-tools/docker/docker.module.js.map +1 -1
  197. package/dist/modules/platform-tools/docker/docker.service.d.ts +2 -2
  198. package/dist/modules/platform-tools/docker/docker.service.js +20 -16
  199. package/dist/modules/platform-tools/docker/docker.service.js.map +1 -1
  200. package/dist/modules/platform-tools/hb-service/hb-service.controller.d.ts +2 -2
  201. package/dist/modules/platform-tools/hb-service/hb-service.controller.js +35 -36
  202. package/dist/modules/platform-tools/hb-service/hb-service.controller.js.map +1 -1
  203. package/dist/modules/platform-tools/hb-service/hb-service.dto.js +20 -19
  204. package/dist/modules/platform-tools/hb-service/hb-service.dto.js.map +1 -1
  205. package/dist/modules/platform-tools/hb-service/hb-service.module.js +14 -17
  206. package/dist/modules/platform-tools/hb-service/hb-service.module.js.map +1 -1
  207. package/dist/modules/platform-tools/hb-service/hb-service.service.d.ts +3 -3
  208. package/dist/modules/platform-tools/hb-service/hb-service.service.js +37 -30
  209. package/dist/modules/platform-tools/hb-service/hb-service.service.js.map +1 -1
  210. package/dist/modules/platform-tools/linux/linux.controller.d.ts +1 -1
  211. package/dist/modules/platform-tools/linux/linux.controller.js +23 -21
  212. package/dist/modules/platform-tools/linux/linux.controller.js.map +1 -1
  213. package/dist/modules/platform-tools/linux/linux.module.js +14 -17
  214. package/dist/modules/platform-tools/linux/linux.module.js.map +1 -1
  215. package/dist/modules/platform-tools/linux/linux.service.d.ts +2 -2
  216. package/dist/modules/platform-tools/linux/linux.service.js +18 -14
  217. package/dist/modules/platform-tools/linux/linux.service.js.map +1 -1
  218. package/dist/modules/platform-tools/platform-tools.module.js +12 -15
  219. package/dist/modules/platform-tools/platform-tools.module.js.map +1 -1
  220. package/dist/modules/platform-tools/terminal/terminal.controller.d.ts +1 -1
  221. package/dist/modules/platform-tools/terminal/terminal.controller.js +15 -13
  222. package/dist/modules/platform-tools/terminal/terminal.controller.js.map +1 -1
  223. package/dist/modules/platform-tools/terminal/terminal.gateway.d.ts +2 -2
  224. package/dist/modules/platform-tools/terminal/terminal.gateway.js +17 -15
  225. package/dist/modules/platform-tools/terminal/terminal.gateway.js.map +1 -1
  226. package/dist/modules/platform-tools/terminal/terminal.interfaces.js +1 -2
  227. package/dist/modules/platform-tools/terminal/terminal.module.js +18 -21
  228. package/dist/modules/platform-tools/terminal/terminal.module.js.map +1 -1
  229. package/dist/modules/platform-tools/terminal/terminal.service.d.ts +7 -7
  230. package/dist/modules/platform-tools/terminal/terminal.service.js +33 -28
  231. package/dist/modules/platform-tools/terminal/terminal.service.js.map +1 -1
  232. package/dist/modules/plugins/plugins.controller.d.ts +12 -7
  233. package/dist/modules/plugins/plugins.controller.js +100 -52
  234. package/dist/modules/plugins/plugins.controller.js.map +1 -1
  235. package/dist/modules/plugins/plugins.dto.js +26 -24
  236. package/dist/modules/plugins/plugins.dto.js.map +1 -1
  237. package/dist/modules/plugins/plugins.gateway.d.ts +5 -5
  238. package/dist/modules/plugins/plugins.gateway.js +38 -34
  239. package/dist/modules/plugins/plugins.gateway.js.map +1 -1
  240. package/dist/modules/plugins/plugins.interfaces.js +1 -2
  241. package/dist/modules/plugins/plugins.module.js +27 -26
  242. package/dist/modules/plugins/plugins.module.js.map +1 -1
  243. package/dist/modules/plugins/plugins.service.d.ts +26 -13
  244. package/dist/modules/plugins/plugins.service.js +366 -203
  245. package/dist/modules/plugins/plugins.service.js.map +1 -1
  246. package/dist/modules/server/server.controller.d.ts +37 -7
  247. package/dist/modules/server/server.controller.js +294 -177
  248. package/dist/modules/server/server.controller.js.map +1 -1
  249. package/dist/modules/server/server.dto.js +13 -16
  250. package/dist/modules/server/server.dto.js.map +1 -1
  251. package/dist/modules/server/server.module.js +23 -26
  252. package/dist/modules/server/server.module.js.map +1 -1
  253. package/dist/modules/server/server.service.d.ts +36 -6
  254. package/dist/modules/server/server.service.js +406 -150
  255. package/dist/modules/server/server.service.js.map +1 -1
  256. package/dist/modules/setup-wizard/setup-wizard.controller.d.ts +3 -3
  257. package/dist/modules/setup-wizard/setup-wizard.controller.js +19 -20
  258. package/dist/modules/setup-wizard/setup-wizard.controller.js.map +1 -1
  259. package/dist/modules/setup-wizard/setup-wizard.gateway.d.ts +4 -4
  260. package/dist/modules/setup-wizard/setup-wizard.gateway.js +25 -21
  261. package/dist/modules/setup-wizard/setup-wizard.gateway.js.map +1 -1
  262. package/dist/modules/setup-wizard/setup-wizard.guard.d.ts +2 -2
  263. package/dist/modules/setup-wizard/setup-wizard.guard.js +11 -9
  264. package/dist/modules/setup-wizard/setup-wizard.guard.js.map +1 -1
  265. package/dist/modules/setup-wizard/setup-wizard.module.js +12 -15
  266. package/dist/modules/setup-wizard/setup-wizard.module.js.map +1 -1
  267. package/dist/modules/status/status.controller.d.ts +5 -5
  268. package/dist/modules/status/status.controller.js +40 -36
  269. package/dist/modules/status/status.controller.js.map +1 -1
  270. package/dist/modules/status/status.gateway.d.ts +11 -11
  271. package/dist/modules/status/status.gateway.js +51 -47
  272. package/dist/modules/status/status.gateway.js.map +1 -1
  273. package/dist/modules/status/status.interfaces.js +2 -5
  274. package/dist/modules/status/status.interfaces.js.map +1 -1
  275. package/dist/modules/status/status.module.js +26 -29
  276. package/dist/modules/status/status.module.js.map +1 -1
  277. package/dist/modules/status/status.service.d.ts +13 -13
  278. package/dist/modules/status/status.service.js +100 -88
  279. package/dist/modules/status/status.service.js.map +1 -1
  280. package/dist/modules/users/users.controller.d.ts +3 -3
  281. package/dist/modules/users/users.controller.js +59 -60
  282. package/dist/modules/users/users.controller.js.map +1 -1
  283. package/dist/modules/users/users.dto.js +51 -45
  284. package/dist/modules/users/users.dto.js.map +1 -1
  285. package/dist/modules/users/users.module.js +14 -17
  286. package/dist/modules/users/users.module.js.map +1 -1
  287. package/dist/self-check.js +25 -25
  288. package/dist/self-check.js.map +1 -1
  289. package/docs/ssl-upload-pr.md +103 -0
  290. package/package.json +14 -12
  291. package/public/3rdpartylicenses.txt +26 -26
  292. package/public/{chunk-QJLKBB62.js → chunk-2UCXG3TD.js} +1 -1
  293. package/public/{chunk-W26VKO62.js → chunk-2VYE34OE.js} +1 -1
  294. package/public/{chunk-FGS4HIPD.js → chunk-4AG5CIDJ.js} +1 -1
  295. package/public/{chunk-ZF6W5Z5R.js → chunk-4H57TZAE.js} +1 -1
  296. package/public/{chunk-VFIOPF3O.js → chunk-5CCE4FIL.js} +1 -1
  297. package/public/{chunk-2UQL2OTF.js → chunk-5RBSMCFS.js} +1 -1
  298. package/public/{chunk-HVGUNGBB.js → chunk-6O32KEYY.js} +1 -1
  299. package/public/{chunk-NUCXRR5D.js → chunk-7K67C3PU.js} +1 -1
  300. package/public/{chunk-HERKNFLL.js → chunk-7PEOCUE2.js} +3 -3
  301. package/public/{chunk-5WTTTYNS.js → chunk-7RXQUWCY.js} +1 -1
  302. package/public/{chunk-RLWY3GD4.js → chunk-7SZF43OV.js} +1 -1
  303. package/public/chunk-AEYQANK4.js +68 -0
  304. package/public/{chunk-R2PMDKTD.js → chunk-AU2Q4PYM.js} +1 -1
  305. package/public/chunk-AZIULTML.js +1 -0
  306. package/public/chunk-B63E4PTS.js +19 -0
  307. package/public/{chunk-JWY7RFE6.js → chunk-CT6TS63V.js} +1 -1
  308. package/public/{chunk-TGX55EFG.js → chunk-DGS32J2V.js} +1 -1
  309. package/public/{chunk-TJEQFEML.js → chunk-DWAKEAKY.js} +1 -1
  310. package/public/chunk-DZVJNQPQ.js +1 -0
  311. package/public/chunk-E26RJWMZ.js +4 -0
  312. package/public/{chunk-E4ZKIFZH.js → chunk-H22EEHWT.js} +1 -1
  313. package/public/{chunk-PPA66JI2.js → chunk-HZFYCQBZ.js} +1 -1
  314. package/public/{chunk-SOA3BB36.js → chunk-I24Z7SXB.js} +1 -1
  315. package/public/{chunk-IEO2AG2N.js → chunk-IA43FDJ7.js} +1 -1
  316. package/public/{chunk-EYO3XCE2.js → chunk-IHMVNP7Y.js} +1 -1
  317. package/public/{chunk-FOSFENMV.js → chunk-IJNJ3FHH.js} +1 -1
  318. package/public/{chunk-5T6O4JCR.js → chunk-IM4LXJ36.js} +1 -1
  319. package/public/chunk-J4AYRIB4.js +1 -0
  320. package/public/{chunk-XS5JK2LY.js → chunk-JXJXX7ID.js} +1 -1
  321. package/public/chunk-K73OEMZP.js +1 -0
  322. package/public/chunk-KAZYWBPX.js +1 -0
  323. package/public/chunk-KGXF4YD5.js +1 -0
  324. package/public/chunk-KN2SQNGB.js +1 -0
  325. package/public/chunk-LN3BMCV4.js +1 -0
  326. package/public/{chunk-B5Z4M7ZJ.js → chunk-LOQEG2RD.js} +1 -1
  327. package/public/chunk-M3HVG4RQ.js +1 -0
  328. package/public/{chunk-WMGV3KS6.js → chunk-MNT5ZGV3.js} +1 -1
  329. package/public/{chunk-5W7EKO7F.js → chunk-NTFDKV64.js} +1 -1
  330. package/public/chunk-PF7M52WR.js +1 -0
  331. package/public/chunk-PFWD43QS.js +2 -0
  332. package/public/{chunk-E7S36RMO.js → chunk-PHND6FV5.js} +1 -1
  333. package/public/chunk-PSYU6RB3.js +1 -0
  334. package/public/{chunk-4H7ODI34.js → chunk-Q7T3F2Y7.js} +1 -1
  335. package/public/chunk-QKKTMQUU.js +1 -0
  336. package/public/chunk-QT6XPFQS.js +1 -0
  337. package/public/{chunk-5G7T74GR.js → chunk-R2WI5YTX.js} +1 -1
  338. package/public/chunk-R44T3ZI7.js +50 -0
  339. package/public/{chunk-Z6VQEXUS.js → chunk-R6KWC4OQ.js} +1 -1
  340. package/public/{chunk-NIERW5KT.js → chunk-RDOYYGV5.js} +1 -1
  341. package/public/chunk-RERUZJD4.js +5 -0
  342. package/public/chunk-S5IG2PNV.js +1 -0
  343. package/public/{chunk-LI4BZAUI.js → chunk-SVVZYE76.js} +1 -1
  344. package/public/{chunk-IKY3F7MM.js → chunk-T3SFHTRG.js} +1 -1
  345. package/public/{chunk-USXMCNIE.js → chunk-TJ6P7UCH.js} +1 -1
  346. package/public/{chunk-AOALMLGY.js → chunk-U3NNN7U4.js} +1 -1
  347. package/public/{chunk-7F6JT34E.js → chunk-UBLR5WZR.js} +1 -1
  348. package/public/{chunk-UKEKNQEJ.js → chunk-UZHUIPNT.js} +1 -1
  349. package/public/{chunk-EHHNHG6Q.js → chunk-VNXIDOPC.js} +1 -1
  350. package/public/{chunk-RON3LUMX.js → chunk-W6VJMRO6.js} +1 -1
  351. package/public/{chunk-BQTGMLQB.js → chunk-WFVVY4KI.js} +1 -1
  352. package/public/{chunk-Y2N6WV2O.js → chunk-WHSTHY5K.js} +1 -1
  353. package/public/chunk-XMBCOKOA.js +1 -0
  354. package/public/{chunk-VB4UAZWJ.js → chunk-XQACD65E.js} +1 -1
  355. package/public/{chunk-DIWD6B4C.js → chunk-XQCLQKCG.js} +2 -2
  356. package/public/{chunk-IXIZVUXX.js → chunk-XS55KH6X.js} +1 -1
  357. package/public/{chunk-AO7VT6PL.js → chunk-YFMEPI62.js} +1 -1
  358. package/public/chunk-Z4E6BJST.js +1 -0
  359. package/public/{chunk-OTOQR5Z2.js → chunk-ZSWIXPXA.js} +1 -1
  360. package/public/index.html +2 -2
  361. package/public/{main-QP5R7HI3.js → main-WFXBCXTF.js} +1 -1
  362. package/public/{styles-CSF457UW.css → styles-WNHDEKE4.css} +1 -1
  363. package/scripts/extract-plugin-alias.js +8 -4
  364. package/public/chunk-2ADAW5AD.js +0 -1
  365. package/public/chunk-2MFBHUTD.js +0 -1
  366. package/public/chunk-2Y63WBU6.js +0 -1
  367. package/public/chunk-4AWJ2PWG.js +0 -1
  368. package/public/chunk-4DVF333O.js +0 -1
  369. package/public/chunk-4E4YMHG4.js +0 -1
  370. package/public/chunk-BI2TS6NN.js +0 -4
  371. package/public/chunk-BVTPAZF3.js +0 -1
  372. package/public/chunk-CWTDHTPI.js +0 -1
  373. package/public/chunk-D4LRW76J.js +0 -1
  374. package/public/chunk-DL2QDFLD.js +0 -2
  375. package/public/chunk-I3QQTGGZ.js +0 -1
  376. package/public/chunk-IBO6BDNZ.js +0 -1
  377. package/public/chunk-ISV4M72Q.js +0 -1
  378. package/public/chunk-JWCVCB6V.js +0 -5
  379. package/public/chunk-JWHZQ7YI.js +0 -40
  380. package/public/chunk-LGE6SGDN.js +0 -1
  381. package/public/chunk-PZD3OMMY.js +0 -1
  382. package/public/chunk-QOSAHW73.js +0 -50
  383. package/public/chunk-QU4I4QSX.js +0 -1
  384. package/public/chunk-SXOLKD36.js +0 -19
  385. package/public/chunk-ZC3JEQZ5.js +0 -1
@@ -1,39 +1,38 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.AccessoriesModule = void 0;
10
- const common_1 = require("@nestjs/common");
11
- const passport_1 = require("@nestjs/passport");
12
- const config_module_1 = require("../../core/config/config.module");
13
- const logger_module_1 = require("../../core/logger/logger.module");
14
- const accessories_controller_1 = require("./accessories.controller");
15
- const accessories_gateway_1 = require("./accessories.gateway");
16
- const accessories_service_1 = require("./accessories.service");
7
+ import { Module } from '@nestjs/common';
8
+ import { PassportModule } from '@nestjs/passport';
9
+ import { ConfigModule } from '../../core/config/config.module.js';
10
+ import { HomebridgeIpcModule } from '../../core/homebridge-ipc/homebridge-ipc.module.js';
11
+ import { LoggerModule } from '../../core/logger/logger.module.js';
12
+ import { AccessoriesController } from './accessories.controller.js';
13
+ import { AccessoriesGateway } from './accessories.gateway.js';
14
+ import { AccessoriesService } from './accessories.service.js';
17
15
  let AccessoriesModule = class AccessoriesModule {
18
16
  };
19
- exports.AccessoriesModule = AccessoriesModule;
20
- exports.AccessoriesModule = AccessoriesModule = __decorate([
21
- (0, common_1.Module)({
17
+ AccessoriesModule = __decorate([
18
+ Module({
22
19
  imports: [
23
- passport_1.PassportModule.register({ defaultStrategy: 'jwt' }),
24
- config_module_1.ConfigModule,
25
- logger_module_1.LoggerModule,
20
+ PassportModule.register({ defaultStrategy: 'jwt' }),
21
+ ConfigModule,
22
+ LoggerModule,
23
+ HomebridgeIpcModule,
26
24
  ],
27
25
  providers: [
28
- accessories_service_1.AccessoriesService,
29
- accessories_gateway_1.AccessoriesGateway,
26
+ AccessoriesService,
27
+ AccessoriesGateway,
30
28
  ],
31
29
  exports: [
32
- accessories_service_1.AccessoriesService,
30
+ AccessoriesService,
33
31
  ],
34
32
  controllers: [
35
- accessories_controller_1.AccessoriesController,
33
+ AccessoriesController,
36
34
  ],
37
35
  })
38
36
  ], AccessoriesModule);
37
+ export { AccessoriesModule };
39
38
  //# sourceMappingURL=accessories.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessories.module.js","sourceRoot":"","sources":["../../../src/modules/accessories/accessories.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAuC;AACvC,+CAAiD;AAEjD,mEAA8D;AAC9D,mEAA8D;AAC9D,qEAAgE;AAChE,+DAA0D;AAC1D,+DAA0D;AAmBnD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAjB7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACnD,4BAAY;YACZ,4BAAY;SACb;QACD,SAAS,EAAE;YACT,wCAAkB;YAClB,wCAAkB;SACnB;QACD,OAAO,EAAE;YACP,wCAAkB;SACnB;QACD,WAAW,EAAE;YACX,8CAAqB;SACtB;KACF,CAAC;GACW,iBAAiB,CAAG"}
1
+ {"version":3,"file":"accessories.module.js","sourceRoot":"","sources":["../../../src/modules/accessories/accessories.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAA;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAoBtD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,iBAAiB;IAlB7B,MAAM,CAAC;QACN,OAAO,EAAE;YACP,cAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;YACnD,YAAY;YACZ,YAAY;YACZ,mBAAmB;SACpB;QACD,SAAS,EAAE;YACT,kBAAkB;YAClB,kBAAkB;SACnB;QACD,OAAO,EAAE;YACP,kBAAkB;SACnB;QACD,WAAW,EAAE;YACX,qBAAqB;SACtB;KACF,CAAC;GACW,iBAAiB,CAAG"}
@@ -1,20 +1,38 @@
1
1
  import type { ServiceType } from '@homebridge/hap-client';
2
+ import type { Socket } from 'socket.io';
3
+ import type { MatterService } from './accessories.interfaces.js';
2
4
  import { HapClient } from '@homebridge/hap-client';
3
5
  import NodeCache from 'node-cache';
4
- import { ConfigService } from '../../core/config/config.service';
5
- import { Logger } from '../../core/logger/logger.service';
6
+ import { ConfigService } from '../../core/config/config.service.js';
7
+ import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
8
+ import { Logger } from '../../core/logger/logger.service.js';
6
9
  export declare class AccessoriesService {
7
10
  private readonly configService;
8
11
  private readonly logger;
12
+ private readonly homebridgeIpcService;
9
13
  hapClient: HapClient;
10
14
  accessoriesCache: NodeCache;
11
- constructor(configService: ConfigService, logger: Logger);
12
- connect(client: any): Promise<void>;
15
+ private matterMonitoringActive;
16
+ private matterUpdateListener;
17
+ private activeClients;
18
+ private matterAccessories;
19
+ constructor(configService: ConfigService, logger: Logger, homebridgeIpcService: HomebridgeIpcService);
20
+ connect(client: Socket): Promise<void>;
13
21
  private refreshCharacteristics;
14
22
  loadAccessories(): Promise<ServiceType[]>;
15
- getAccessory(uniqueId: string): Promise<ServiceType>;
23
+ getAccessory(uniqueId: string): Promise<MatterService | ServiceType>;
24
+ private getMatterAccessory;
16
25
  setAccessoryCharacteristic(uniqueId: string, characteristicType: string, value: number | boolean | string): Promise<ServiceType>;
17
26
  getAccessoryLayout(username: string): Promise<any>;
18
27
  saveAccessoryLayout(user: string, layout: Record<string, unknown>): Promise<Record<string, unknown>>;
19
28
  resetInstancePool(): void;
29
+ private parseMatterUniqueId;
30
+ private buildMatterUniqueId;
31
+ private waitForMatterEvent;
32
+ private startMatterMonitoring;
33
+ private stopMatterMonitoring;
34
+ private loadMatterAccessories;
35
+ private transformMatterAccessory;
36
+ private handleMatterStateUpdate;
37
+ private handleMatterControl;
20
38
  }
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,25 +7,33 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
7
  var __metadata = (this && this.__metadata) || function (k, v) {
9
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
9
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
13
12
  };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AccessoriesService = void 0;
16
- const node_path_1 = require("node:path");
17
- const hap_client_1 = require("@homebridge/hap-client");
18
- const common_1 = require("@nestjs/common");
19
- const fs_extra_1 = require("fs-extra");
20
- const node_cache_1 = __importDefault(require("node-cache"));
21
- const config_service_1 = require("../../core/config/config.service");
22
- const logger_service_1 = require("../../core/logger/logger.service");
13
+ import { join } from 'node:path';
14
+ import { HapClient } from '@homebridge/hap-client';
15
+ import { BadRequestException, Inject, Injectable } from '@nestjs/common';
16
+ import { mkdirp, pathExists, readJson, writeJsonSync } from 'fs-extra/esm';
17
+ import NodeCache from 'node-cache';
18
+ import { ConfigService } from '../../core/config/config.service.js';
19
+ import { HomebridgeIpcService } from '../../core/homebridge-ipc/homebridge-ipc.service.js';
20
+ import { Logger } from '../../core/logger/logger.service.js';
23
21
  let AccessoriesService = class AccessoriesService {
24
- constructor(configService, logger) {
22
+ configService;
23
+ logger;
24
+ homebridgeIpcService;
25
+ hapClient;
26
+ accessoriesCache = new NodeCache({ stdTTL: 0 });
27
+ matterMonitoringActive = false;
28
+ matterUpdateListener = null;
29
+ activeClients = new Set();
30
+ matterAccessories = [];
31
+ constructor(configService, logger, homebridgeIpcService) {
25
32
  this.configService = configService;
26
33
  this.logger = logger;
27
- this.accessoriesCache = new node_cache_1.default({ stdTTL: 0 });
34
+ this.homebridgeIpcService = homebridgeIpcService;
28
35
  if (this.configService.homebridgeInsecureMode) {
29
- this.hapClient = new hap_client_1.HapClient({
36
+ this.hapClient = new HapClient({
30
37
  pin: this.configService.homebridgeConfig.bridge.pin,
31
38
  logger: this.logger,
32
39
  config: this.configService.ui.accessoryControl || {},
@@ -38,6 +45,10 @@ let AccessoriesService = class AccessoriesService {
38
45
  this.logger.error('Homebridge must be running in insecure mode to control accessories.');
39
46
  return;
40
47
  }
48
+ this.activeClients.add(client);
49
+ if (this.activeClients.size === 1) {
50
+ await this.startMatterMonitoring();
51
+ }
41
52
  let services;
42
53
  const loadAllAccessories = async (refresh) => {
43
54
  if (!refresh) {
@@ -46,26 +57,48 @@ let AccessoriesService = class AccessoriesService {
46
57
  client.emit('accessories-data', cached);
47
58
  }
48
59
  }
49
- services = await this.loadAccessories();
50
- this.refreshCharacteristics(services);
60
+ const hapServices = await this.loadAccessories();
61
+ this.refreshCharacteristics(hapServices);
62
+ client.emit('hap-accessories-ready-for-control');
63
+ client.emit('accessories-data', hapServices);
64
+ const matterServices = await this.loadMatterAccessories();
65
+ client.emit('matter-accessories-ready-for-control');
66
+ if (matterServices.length > 0) {
67
+ client.emit('accessories-data', matterServices);
68
+ }
69
+ services = [...hapServices, ...matterServices];
51
70
  client.emit('accessories-ready-for-control');
52
- client.emit('accessories-data', services);
53
71
  this.accessoriesCache.set('services', services);
54
72
  };
55
73
  await loadAllAccessories(false);
56
74
  const requestHandler = async (msg) => {
57
- if (msg.set) {
58
- const service = services.find(x => x.uniqueId === msg.set.uniqueId);
59
- if (service) {
60
- try {
61
- await service.setCharacteristic(msg.set.iid, msg.set.value);
62
- services = await this.loadAccessories();
63
- setTimeout(() => {
64
- this.refreshCharacteristics(services);
65
- }, 1500);
75
+ if (msg.refresh) {
76
+ await loadAllAccessories(true);
77
+ }
78
+ else if (msg.set) {
79
+ if (msg.set.uniqueId && msg.set.uniqueId.startsWith('matter:')) {
80
+ if (msg.set.cluster && msg.set.attributes) {
81
+ await this.handleMatterControl(client, {
82
+ uniqueId: msg.set.uniqueId,
83
+ cluster: msg.set.cluster,
84
+ attributes: msg.set.attributes,
85
+ });
66
86
  }
67
- catch (e) {
68
- client.emit('accessory-control-failure', e.message);
87
+ }
88
+ else {
89
+ const service = services.find(x => x.uniqueId === msg.set.uniqueId);
90
+ if (service && 'serviceCharacteristics' in service) {
91
+ try {
92
+ await service.setCharacteristic(msg.set.iid, msg.set.value);
93
+ const hapServices = await this.loadAccessories();
94
+ setTimeout(() => {
95
+ this.refreshCharacteristics(hapServices);
96
+ }, 1500);
97
+ services = [...hapServices, ...this.matterAccessories];
98
+ }
99
+ catch (e) {
100
+ client.emit('accessory-control-failure', e.message);
101
+ }
69
102
  }
70
103
  }
71
104
  }
@@ -76,7 +109,7 @@ let AccessoriesService = class AccessoriesService {
76
109
  client.emit('accessories-data', data);
77
110
  };
78
111
  monitor.on('service-update', updateHandler);
79
- const instanceUpdateHandler = async (data) => {
112
+ const instanceUpdateHandler = async () => {
80
113
  client.emit('accessories-reload-required', services);
81
114
  };
82
115
  this.hapClient.on('instance-discovered', instanceUpdateHandler);
@@ -91,6 +124,10 @@ let AccessoriesService = class AccessoriesService {
91
124
  monitor.removeAllListeners('service-update');
92
125
  monitor.finish();
93
126
  this.hapClient.removeListener('instance-discovered', instanceUpdateHandler);
127
+ this.activeClients.delete(client);
128
+ if (this.activeClients.size === 0) {
129
+ this.stopMatterMonitoring();
130
+ }
94
131
  };
95
132
  client.on('disconnect', onEnd.bind(this));
96
133
  client.on('end', onEnd.bind(this));
@@ -105,7 +142,7 @@ let AccessoriesService = class AccessoriesService {
105
142
  }
106
143
  async loadAccessories() {
107
144
  if (!this.configService.homebridgeInsecureMode) {
108
- throw new common_1.BadRequestException('Homebridge must be running in insecure mode to access accessories.');
145
+ throw new BadRequestException('Homebridge must be running in insecure mode to access accessories.');
109
146
  }
110
147
  try {
111
148
  return await this.hapClient.getAllServices();
@@ -121,46 +158,72 @@ let AccessoriesService = class AccessoriesService {
121
158
  }
122
159
  }
123
160
  async getAccessory(uniqueId) {
161
+ if (uniqueId.startsWith('matter:')) {
162
+ return this.getMatterAccessory(uniqueId);
163
+ }
124
164
  const services = await this.loadAccessories();
125
165
  const service = services.find(x => x.uniqueId === uniqueId);
126
166
  if (!service) {
127
- throw new common_1.BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
167
+ throw new BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
128
168
  }
129
169
  try {
130
170
  await service.refreshCharacteristics();
131
171
  return service;
132
172
  }
133
173
  catch (e) {
134
- throw new common_1.BadRequestException(e.message);
174
+ throw new BadRequestException(e.message);
175
+ }
176
+ }
177
+ async getMatterAccessory(uniqueId) {
178
+ try {
179
+ const { uuid, partId } = this.parseMatterUniqueId(uniqueId);
180
+ const response = await this.waitForMatterEvent('accessoryInfo', () => {
181
+ this.homebridgeIpcService.sendMessage('getMatterAccessoryInfo', { uuid });
182
+ });
183
+ if (response.error) {
184
+ throw new BadRequestException(response.error);
185
+ }
186
+ if (partId) {
187
+ const part = response.parts?.find((p) => p.id === partId);
188
+ if (part) {
189
+ return this.transformMatterAccessory(response, part);
190
+ }
191
+ throw new BadRequestException(`Part '${partId}' not found in accessory`);
192
+ }
193
+ return this.transformMatterAccessory(response);
194
+ }
195
+ catch (error) {
196
+ this.logger.error(`Failed to get Matter accessory info for ${uniqueId}:`, error);
197
+ throw new BadRequestException(error.message || 'Failed to get Matter accessory info');
135
198
  }
136
199
  }
137
200
  async setAccessoryCharacteristic(uniqueId, characteristicType, value) {
138
201
  const services = await this.loadAccessories();
139
202
  const service = services.find(x => x.uniqueId === uniqueId);
140
203
  if (!service) {
141
- throw new common_1.BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
204
+ throw new BadRequestException(`Service with uniqueId of '${uniqueId}' not found.`);
142
205
  }
143
206
  const characteristic = service.getCharacteristic(characteristicType);
144
207
  if (!characteristic || !characteristic.canWrite) {
145
208
  const types = service.serviceCharacteristics.filter(x => x.canWrite).map(x => `'${x.type}'`).join(', ');
146
- throw new common_1.BadRequestException(`Invalid characteristicType. Valid types are: ${types}.`);
209
+ throw new BadRequestException(`Invalid characteristicType. Valid types are: ${types}.`);
147
210
  }
148
211
  if (['uint8', 'uint16', 'uint32', 'uint64'].includes(characteristic.format)) {
149
212
  value = Number.parseInt(value, 10);
150
213
  if (characteristic.minValue !== undefined && value < characteristic.minValue) {
151
- throw new common_1.BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
214
+ throw new BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
152
215
  }
153
216
  if (characteristic.maxValue !== undefined && value > characteristic.maxValue) {
154
- throw new common_1.BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
217
+ throw new BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
155
218
  }
156
219
  }
157
220
  if (characteristic.format === 'float') {
158
221
  value = Number.parseFloat(value);
159
222
  if (characteristic.minValue !== undefined && value < characteristic.minValue) {
160
- throw new common_1.BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
223
+ throw new BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
161
224
  }
162
225
  if (characteristic.maxValue !== undefined && value > characteristic.maxValue) {
163
- throw new common_1.BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
226
+ throw new BadRequestException(`Invalid value. The value must be between ${characteristic.minValue} and ${characteristic.maxValue}.`);
164
227
  }
165
228
  }
166
229
  if (characteristic.format === 'bool') {
@@ -176,7 +239,7 @@ let AccessoriesService = class AccessoriesService {
176
239
  value = value === 1;
177
240
  }
178
241
  if (typeof value !== 'boolean') {
179
- throw new common_1.BadRequestException('Invalid value. The value must be a boolean (true or false).');
242
+ throw new BadRequestException('Invalid value. The value must be a boolean (true or false).');
180
243
  }
181
244
  }
182
245
  try {
@@ -185,12 +248,12 @@ let AccessoriesService = class AccessoriesService {
185
248
  return service;
186
249
  }
187
250
  catch (e) {
188
- throw new common_1.BadRequestException(e.message);
251
+ throw new BadRequestException(e.message);
189
252
  }
190
253
  }
191
254
  async getAccessoryLayout(username) {
192
255
  try {
193
- const accessoryLayout = await (0, fs_extra_1.readJson)(this.configService.accessoryLayoutPath);
256
+ const accessoryLayout = await readJson(this.configService.accessoryLayoutPath);
194
257
  if (username in accessoryLayout) {
195
258
  return accessoryLayout[username];
196
259
  }
@@ -210,16 +273,16 @@ let AccessoriesService = class AccessoriesService {
210
273
  async saveAccessoryLayout(user, layout) {
211
274
  let accessoryLayout;
212
275
  try {
213
- accessoryLayout = await (0, fs_extra_1.readJson)(this.configService.accessoryLayoutPath);
276
+ accessoryLayout = await readJson(this.configService.accessoryLayoutPath);
214
277
  }
215
278
  catch (e) {
216
279
  accessoryLayout = {};
217
280
  }
218
- if (!await (0, fs_extra_1.pathExists)((0, node_path_1.join)(this.configService.storagePath, 'accessories'))) {
219
- await (0, fs_extra_1.mkdirp)((0, node_path_1.join)(this.configService.storagePath, 'accessories'));
281
+ if (!await pathExists(join(this.configService.storagePath, 'accessories'))) {
282
+ await mkdirp(join(this.configService.storagePath, 'accessories'));
220
283
  }
221
284
  accessoryLayout[user] = layout;
222
- (0, fs_extra_1.writeJsonSync)(this.configService.accessoryLayoutPath, accessoryLayout);
285
+ writeJsonSync(this.configService.accessoryLayoutPath, accessoryLayout);
223
286
  this.logger.log(`Accessory layout changes saved for ${user}.`);
224
287
  return layout;
225
288
  }
@@ -228,11 +291,213 @@ let AccessoriesService = class AccessoriesService {
228
291
  this.hapClient.resetInstancePool();
229
292
  }
230
293
  }
294
+ parseMatterUniqueId(uniqueId) {
295
+ const parts = uniqueId.replace('matter:', '').split(':');
296
+ return {
297
+ uuid: parts[0],
298
+ partId: parts[1],
299
+ };
300
+ }
301
+ buildMatterUniqueId(uuid, partId) {
302
+ return partId ? `matter:${uuid}:${partId}` : `matter:${uuid}`;
303
+ }
304
+ async waitForMatterEvent(eventType, sendRequest) {
305
+ return new Promise((resolve, reject) => {
306
+ const actionTimeout = setTimeout(() => {
307
+ this.homebridgeIpcService.removeListener('matterEvent', listener);
308
+ reject(new Error('The Homebridge service did not respond'));
309
+ }, 3000);
310
+ const listener = (event) => {
311
+ if (event.type === eventType) {
312
+ clearTimeout(actionTimeout);
313
+ this.homebridgeIpcService.removeListener('matterEvent', listener);
314
+ resolve(event.data);
315
+ }
316
+ };
317
+ this.homebridgeIpcService.on('matterEvent', listener);
318
+ sendRequest();
319
+ });
320
+ }
321
+ async startMatterMonitoring() {
322
+ if (this.matterMonitoringActive) {
323
+ return;
324
+ }
325
+ try {
326
+ this.logger.debug('Starting Matter accessory monitoring');
327
+ this.homebridgeIpcService.sendMessage('startMatterMonitoring');
328
+ this.matterMonitoringActive = true;
329
+ this.matterUpdateListener = (event) => {
330
+ switch (event.type) {
331
+ case 'accessoryUpdate':
332
+ if (event.data && 'uuid' in event.data && 'cluster' in event.data) {
333
+ this.handleMatterStateUpdate(event.data);
334
+ }
335
+ break;
336
+ case 'accessoryAdded':
337
+ case 'accessoryRemoved':
338
+ if (event.data && 'uuid' in event.data) {
339
+ this.logger.debug(`Matter accessory ${event.type}: ${event.data.uuid} - triggering reload`);
340
+ }
341
+ for (const client of this.activeClients) {
342
+ client.emit('matter-accessories-reload-required');
343
+ }
344
+ break;
345
+ }
346
+ };
347
+ this.homebridgeIpcService.on('matterEvent', this.matterUpdateListener);
348
+ this.logger.debug('Matter monitoring started successfully');
349
+ }
350
+ catch (error) {
351
+ this.logger.error('Failed to start Matter monitoring:', error);
352
+ }
353
+ }
354
+ async stopMatterMonitoring() {
355
+ if (!this.matterMonitoringActive) {
356
+ return;
357
+ }
358
+ try {
359
+ this.logger.debug('Stopping Matter accessory monitoring');
360
+ if (this.matterUpdateListener) {
361
+ this.homebridgeIpcService.removeListener('matterEvent', this.matterUpdateListener);
362
+ this.matterUpdateListener = null;
363
+ }
364
+ this.homebridgeIpcService.sendMessage('stopMatterMonitoring');
365
+ this.matterMonitoringActive = false;
366
+ this.matterAccessories = [];
367
+ this.logger.debug('Matter monitoring stopped');
368
+ }
369
+ catch (error) {
370
+ this.logger.error('Failed to stop Matter monitoring:', error);
371
+ }
372
+ }
373
+ async loadMatterAccessories() {
374
+ if (!this.matterMonitoringActive) {
375
+ this.logger.warn('Matter monitoring not active, skipping accessory load');
376
+ return [];
377
+ }
378
+ try {
379
+ const response = await this.waitForMatterEvent('accessoriesData', () => {
380
+ this.homebridgeIpcService.sendMessage('getMatterAccessories', {});
381
+ });
382
+ if (response.error) {
383
+ throw new Error(response.error);
384
+ }
385
+ const accessories = response.accessories || [];
386
+ this.logger.debug(`Loaded ${accessories.length} Matter accessories from IPC`);
387
+ const matterServices = accessories.flatMap((accessory) => {
388
+ const services = [];
389
+ services.push({
390
+ ...this.transformMatterAccessory(accessory),
391
+ protocol: 'matter',
392
+ });
393
+ if (accessory.parts) {
394
+ for (const part of accessory.parts) {
395
+ services.push({
396
+ ...this.transformMatterAccessory(accessory, part),
397
+ protocol: 'matter',
398
+ });
399
+ }
400
+ }
401
+ return services;
402
+ });
403
+ this.logger.debug(`Transformed ${matterServices.length} Matter services (including parts)`);
404
+ this.matterAccessories = matterServices;
405
+ return matterServices;
406
+ }
407
+ catch (error) {
408
+ this.logger.error('Failed to load Matter accessories:', error);
409
+ return [];
410
+ }
411
+ }
412
+ transformMatterAccessory(accessory, part) {
413
+ const targetClusters = part?.clusters || accessory.clusters;
414
+ const displayName = part
415
+ ? `${accessory.displayName} - ${part.displayName}`
416
+ : accessory.displayName;
417
+ const uniqueId = part
418
+ ? `matter:${accessory.uuid}:${part.id}`
419
+ : `matter:${accessory.uuid}`;
420
+ const deviceType = part?.deviceType || accessory.deviceType;
421
+ const bridgeUsername = accessory.bridge?.username || 'unknown';
422
+ if (bridgeUsername === 'unknown') {
423
+ this.logger.warn(`Matter accessory '${displayName}' (${uniqueId}) has no bridge.username - layout may not persist correctly`);
424
+ }
425
+ return {
426
+ uniqueId,
427
+ uuid: accessory.uuid,
428
+ serviceName: displayName,
429
+ displayName,
430
+ deviceType,
431
+ clusters: targetClusters,
432
+ partId: part?.id,
433
+ protocol: 'matter',
434
+ instance: {
435
+ name: accessory.bridge?.name || 'Matter Bridge',
436
+ username: bridgeUsername,
437
+ },
438
+ accessoryInformation: {
439
+ 'Name': displayName,
440
+ 'Manufacturer': accessory.manufacturer || 'Unknown',
441
+ 'Model': accessory.model || deviceType,
442
+ 'Serial Number': accessory.serialNumber || accessory.uuid,
443
+ 'Firmware Revision': accessory.firmwareRevision || '1.0.0',
444
+ },
445
+ bridge: accessory.bridge,
446
+ plugin: accessory.plugin,
447
+ platform: accessory.platform,
448
+ commissioned: accessory.commissioned,
449
+ fabricCount: accessory.fabricCount,
450
+ fabrics: accessory.fabrics,
451
+ aid: 0,
452
+ iid: 0,
453
+ };
454
+ }
455
+ handleMatterStateUpdate(data) {
456
+ const uniqueId = this.buildMatterUniqueId(data.uuid, data.partId);
457
+ const service = this.matterAccessories.find(s => s.uniqueId === uniqueId);
458
+ if (!service) {
459
+ return;
460
+ }
461
+ service.clusters[data.cluster] = {
462
+ ...service.clusters[data.cluster],
463
+ ...data.state,
464
+ };
465
+ for (const client of this.activeClients) {
466
+ client.emit('accessories-data', [service]);
467
+ }
468
+ }
469
+ async handleMatterControl(client, control) {
470
+ try {
471
+ const { uuid, partId } = this.parseMatterUniqueId(control.uniqueId);
472
+ const accessory = this.matterAccessories.find(acc => acc.uuid === uuid);
473
+ const bridgeUsername = accessory?.bridge?.username;
474
+ const response = await this.waitForMatterEvent('accessoryControlResponse', () => {
475
+ this.homebridgeIpcService.sendMessage('matterAccessoryControl', {
476
+ uuid,
477
+ cluster: control.cluster,
478
+ attributes: control.attributes,
479
+ bridgeUsername,
480
+ partId,
481
+ });
482
+ });
483
+ if (!response.success) {
484
+ client.emit('accessory-control-failure', response.error || 'Matter control failed');
485
+ }
486
+ }
487
+ catch (error) {
488
+ this.logger.error('Matter control failed:', error);
489
+ client.emit('accessory-control-failure', error.message || 'Matter control failed');
490
+ }
491
+ }
231
492
  };
232
- exports.AccessoriesService = AccessoriesService;
233
- exports.AccessoriesService = AccessoriesService = __decorate([
234
- (0, common_1.Injectable)(),
235
- __metadata("design:paramtypes", [config_service_1.ConfigService,
236
- logger_service_1.Logger])
493
+ AccessoriesService = __decorate([
494
+ Injectable(),
495
+ __param(0, Inject(ConfigService)),
496
+ __param(1, Inject(Logger)),
497
+ __param(2, Inject(HomebridgeIpcService)),
498
+ __metadata("design:paramtypes", [ConfigService,
499
+ Logger,
500
+ HomebridgeIpcService])
237
501
  ], AccessoriesService);
502
+ export { AccessoriesService };
238
503
  //# sourceMappingURL=accessories.service.js.map