@fastybird/smart-panel-backend 1.1.0-alpha.0 → 1.1.0-alpha.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 (315) hide show
  1. package/dist/app.module.js +14 -0
  2. package/dist/app.module.js.map +1 -1
  3. package/dist/common/filters/conflict-exception.filter.d.ts +6 -0
  4. package/dist/common/filters/conflict-exception.filter.js +59 -0
  5. package/dist/common/filters/conflict-exception.filter.js.map +1 -0
  6. package/dist/common/filters/global-error.filter.js +1 -4
  7. package/dist/common/filters/global-error.filter.js.map +1 -1
  8. package/dist/common/filters/global-filters.d.ts +3 -0
  9. package/dist/common/filters/global-filters.js +22 -0
  10. package/dist/common/filters/global-filters.js.map +1 -0
  11. package/dist/common/filters/unprocessable-entity-exception.filter.d.ts +1 -0
  12. package/dist/common/filters/unprocessable-entity-exception.filter.js +15 -3
  13. package/dist/common/filters/unprocessable-entity-exception.filter.js.map +1 -1
  14. package/dist/common/utils/transform.utils.js +3 -0
  15. package/dist/common/utils/transform.utils.js.map +1 -1
  16. package/dist/main.js +2 -7
  17. package/dist/main.js.map +1 -1
  18. package/dist/modules/devices/controllers/channels.properties.controller.js +16 -4
  19. package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
  20. package/dist/modules/devices/controllers/devices.channels.properties.controller.js +16 -4
  21. package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
  22. package/dist/modules/devices/devices.module.js +12 -0
  23. package/dist/modules/devices/devices.module.js.map +1 -1
  24. package/dist/modules/devices/services/channels.properties.service.d.ts +27 -3
  25. package/dist/modules/devices/services/channels.properties.service.js +304 -28
  26. package/dist/modules/devices/services/channels.properties.service.js.map +1 -1
  27. package/dist/modules/devices/services/channels.service.js +42 -38
  28. package/dist/modules/devices/services/channels.service.js.map +1 -1
  29. package/dist/modules/devices/services/command-latency-trace-collector.service.d.ts +101 -0
  30. package/dist/modules/devices/services/command-latency-trace-collector.service.js +451 -0
  31. package/dist/modules/devices/services/command-latency-trace-collector.service.js.map +1 -0
  32. package/dist/modules/devices/services/device-structure-lock.service.d.ts +10 -2
  33. package/dist/modules/devices/services/device-structure-lock.service.js +86 -7
  34. package/dist/modules/devices/services/device-structure-lock.service.js.map +1 -1
  35. package/dist/modules/devices/services/devices.service.js +37 -33
  36. package/dist/modules/devices/services/devices.service.js.map +1 -1
  37. package/dist/modules/devices/services/module-reset.service.d.ts +3 -1
  38. package/dist/modules/devices/services/module-reset.service.js +21 -16
  39. package/dist/modules/devices/services/module-reset.service.js.map +1 -1
  40. package/dist/modules/devices/services/property-command-dispatch.service.d.ts +45 -0
  41. package/dist/modules/devices/services/property-command-dispatch.service.js +227 -0
  42. package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -0
  43. package/dist/modules/devices/services/property-command-window.service.d.ts +71 -0
  44. package/dist/modules/devices/services/property-command-window.service.js +204 -0
  45. package/dist/modules/devices/services/property-command-window.service.js.map +1 -0
  46. package/dist/modules/devices/services/property-command.service.d.ts +28 -3
  47. package/dist/modules/devices/services/property-command.service.js +171 -10
  48. package/dist/modules/devices/services/property-command.service.js.map +1 -1
  49. package/dist/modules/devices/services/property-state-coordinator.service.d.ts +4 -0
  50. package/dist/modules/devices/services/property-state-coordinator.service.js +35 -0
  51. package/dist/modules/devices/services/property-state-coordinator.service.js.map +1 -0
  52. package/dist/modules/devices/services/property-value.service.d.ts +1 -0
  53. package/dist/modules/devices/services/property-value.service.js +4 -0
  54. package/dist/modules/devices/services/property-value.service.js.map +1 -1
  55. package/dist/modules/mcp/oauth/mcp-oauth-provider.factory.js.map +1 -1
  56. package/dist/modules/platform/services/platform.service.d.ts +13 -4
  57. package/dist/modules/platform/services/platform.service.js +57 -35
  58. package/dist/modules/platform/services/platform.service.js.map +1 -1
  59. package/dist/modules/remote-access/dto/update-config.dto.js +5 -0
  60. package/dist/modules/remote-access/dto/update-config.dto.js.map +1 -1
  61. package/dist/modules/remote-access/services/remote-access-proxy-contribution.service.js +4 -0
  62. package/dist/modules/remote-access/services/remote-access-proxy-contribution.service.js.map +1 -1
  63. package/dist/modules/remote-access/services/remote-access-status.service.d.ts +5 -1
  64. package/dist/modules/remote-access/services/remote-access-status.service.js +38 -4
  65. package/dist/modules/remote-access/services/remote-access-status.service.js.map +1 -1
  66. package/dist/modules/remote-access/services/remote-access-url.service.js +4 -0
  67. package/dist/modules/remote-access/services/remote-access-url.service.js.map +1 -1
  68. package/dist/modules/remote-access/validators/is-remote-access-url.validator.js +5 -2
  69. package/dist/modules/remote-access/validators/is-remote-access-url.validator.js.map +1 -1
  70. package/dist/modules/system/commands/command.utils.d.ts +2 -0
  71. package/dist/modules/system/commands/command.utils.js +14 -0
  72. package/dist/modules/system/commands/command.utils.js.map +1 -1
  73. package/dist/modules/system/commands/update-check.command.js +2 -3
  74. package/dist/modules/system/commands/update-check.command.js.map +1 -1
  75. package/dist/modules/system/commands/update-panel.command.js +2 -2
  76. package/dist/modules/system/commands/update-panel.command.js.map +1 -1
  77. package/dist/modules/system/commands/update-server.command.d.ts +1 -0
  78. package/dist/modules/system/commands/update-server.command.js +36 -11
  79. package/dist/modules/system/commands/update-server.command.js.map +1 -1
  80. package/dist/modules/system/dto/update-config.dto.d.ts +2 -1
  81. package/dist/modules/system/dto/update-config.dto.js +15 -0
  82. package/dist/modules/system/dto/update-config.dto.js.map +1 -1
  83. package/dist/modules/system/models/config.model.d.ts +2 -1
  84. package/dist/modules/system/models/config.model.js +13 -0
  85. package/dist/modules/system/models/config.model.js.map +1 -1
  86. package/dist/modules/system/services/privileged-worker.service.d.ts +10 -0
  87. package/dist/modules/system/services/privileged-worker.service.js +137 -11
  88. package/dist/modules/system/services/privileged-worker.service.js.map +1 -1
  89. package/dist/modules/system/services/update.service.d.ts +11 -1
  90. package/dist/modules/system/services/update.service.js +97 -35
  91. package/dist/modules/system/services/update.service.js.map +1 -1
  92. package/dist/modules/system/system.constants.d.ts +6 -0
  93. package/dist/modules/system/system.constants.js +8 -1
  94. package/dist/modules/system/system.constants.js.map +1 -1
  95. package/dist/modules/websocket/gateway/websocket.gateway.d.ts +7 -1
  96. package/dist/modules/websocket/gateway/websocket.gateway.js +67 -9
  97. package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
  98. package/dist/modules/websocket/services/command-acknowledgement-trace.service.d.ts +143 -0
  99. package/dist/modules/websocket/services/command-acknowledgement-trace.service.js +523 -0
  100. package/dist/modules/websocket/services/command-acknowledgement-trace.service.js.map +1 -0
  101. package/dist/modules/websocket/websocket.module.js +9 -1
  102. package/dist/modules/websocket/websocket.module.js.map +1 -1
  103. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +2 -1
  104. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
  105. package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js +2 -3
  106. package/dist/plugins/devices-home-assistant/services/state-changed.event.service.js.map +1 -1
  107. package/dist/plugins/devices-homekit/controllers/homekit-bridge.controller.d.ts +14 -0
  108. package/dist/plugins/devices-homekit/controllers/homekit-bridge.controller.js +125 -0
  109. package/dist/plugins/devices-homekit/controllers/homekit-bridge.controller.js.map +1 -0
  110. package/dist/plugins/devices-homekit/devices-homekit.constants.d.ts +16 -0
  111. package/dist/plugins/devices-homekit/devices-homekit.constants.js +57 -0
  112. package/dist/plugins/devices-homekit/devices-homekit.constants.js.map +1 -0
  113. package/dist/plugins/devices-homekit/devices-homekit.exceptions.d.ts +12 -0
  114. package/dist/plugins/devices-homekit/devices-homekit.exceptions.js +32 -0
  115. package/dist/plugins/devices-homekit/devices-homekit.exceptions.js.map +1 -0
  116. package/dist/plugins/devices-homekit/devices-homekit.openapi.d.ts +6 -0
  117. package/dist/plugins/devices-homekit/devices-homekit.openapi.js +19 -0
  118. package/dist/plugins/devices-homekit/devices-homekit.openapi.js.map +1 -0
  119. package/dist/plugins/devices-homekit/devices-homekit.plugin.d.ts +24 -0
  120. package/dist/plugins/devices-homekit/devices-homekit.plugin.js +183 -0
  121. package/dist/plugins/devices-homekit/devices-homekit.plugin.js.map +1 -0
  122. package/dist/plugins/devices-homekit/dto/bridge-map.dto.d.ts +6 -0
  123. package/dist/plugins/devices-homekit/dto/bridge-map.dto.js +50 -0
  124. package/dist/plugins/devices-homekit/dto/bridge-map.dto.js.map +1 -0
  125. package/dist/plugins/devices-homekit/dto/update-config.dto.d.ts +11 -0
  126. package/dist/plugins/devices-homekit/dto/update-config.dto.js +138 -0
  127. package/dist/plugins/devices-homekit/dto/update-config.dto.js.map +1 -0
  128. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.d.ts +8 -0
  129. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +77 -0
  130. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -0
  131. package/dist/plugins/devices-homekit/mappers/base.mapper.d.ts +15 -0
  132. package/dist/plugins/devices-homekit/mappers/base.mapper.js +97 -0
  133. package/dist/plugins/devices-homekit/mappers/base.mapper.js.map +1 -0
  134. package/dist/plugins/devices-homekit/mappers/battery.mapper.d.ts +6 -0
  135. package/dist/plugins/devices-homekit/mappers/battery.mapper.js +130 -0
  136. package/dist/plugins/devices-homekit/mappers/battery.mapper.js.map +1 -0
  137. package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +36 -0
  138. package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.js +3 -0
  139. package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.js.map +1 -0
  140. package/dist/plugins/devices-homekit/mappers/lightbulb.mapper.d.ts +9 -0
  141. package/dist/plugins/devices-homekit/mappers/lightbulb.mapper.js +115 -0
  142. package/dist/plugins/devices-homekit/mappers/lightbulb.mapper.js.map +1 -0
  143. package/dist/plugins/devices-homekit/mappers/lock.mapper.d.ts +10 -0
  144. package/dist/plugins/devices-homekit/mappers/lock.mapper.js +59 -0
  145. package/dist/plugins/devices-homekit/mappers/lock.mapper.js.map +1 -0
  146. package/dist/plugins/devices-homekit/mappers/outlet.mapper.d.ts +9 -0
  147. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js +44 -0
  148. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js.map +1 -0
  149. package/dist/plugins/devices-homekit/mappers/sensor.mapper.d.ts +10 -0
  150. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js +168 -0
  151. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js.map +1 -0
  152. package/dist/plugins/devices-homekit/mappers/switch.mapper.d.ts +9 -0
  153. package/dist/plugins/devices-homekit/mappers/switch.mapper.js +35 -0
  154. package/dist/plugins/devices-homekit/mappers/switch.mapper.js.map +1 -0
  155. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +50 -0
  156. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +441 -0
  157. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js.map +1 -0
  158. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.d.ts +11 -0
  159. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js +97 -0
  160. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js.map +1 -0
  161. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.d.ts +10 -0
  162. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js +94 -0
  163. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js.map +1 -0
  164. package/dist/plugins/devices-homekit/models/bridge-candidate.model.d.ts +15 -0
  165. package/dist/plugins/devices-homekit/models/bridge-candidate.model.js +150 -0
  166. package/dist/plugins/devices-homekit/models/bridge-candidate.model.js.map +1 -0
  167. package/dist/plugins/devices-homekit/models/bridge-status.model.d.ts +16 -0
  168. package/dist/plugins/devices-homekit/models/bridge-status.model.js +156 -0
  169. package/dist/plugins/devices-homekit/models/bridge-status.model.js.map +1 -0
  170. package/dist/plugins/devices-homekit/models/config.model.d.ts +12 -0
  171. package/dist/plugins/devices-homekit/models/config.model.js +134 -0
  172. package/dist/plugins/devices-homekit/models/config.model.js.map +1 -0
  173. package/dist/plugins/devices-homekit/services/homekit-actions.service.d.ts +14 -0
  174. package/dist/plugins/devices-homekit/services/homekit-actions.service.js +92 -0
  175. package/dist/plugins/devices-homekit/services/homekit-actions.service.js.map +1 -0
  176. package/dist/plugins/devices-homekit/services/homekit-bridge.service.d.ts +43 -0
  177. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js +497 -0
  178. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js.map +1 -0
  179. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.d.ts +11 -0
  180. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js +68 -0
  181. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js.map +1 -0
  182. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.d.ts +34 -0
  183. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js +179 -0
  184. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js.map +1 -0
  185. package/dist/plugins/devices-homekit/services/homekit-wizard.service.d.ts +15 -0
  186. package/dist/plugins/devices-homekit/services/homekit-wizard.service.js +75 -0
  187. package/dist/plugins/devices-homekit/services/homekit-wizard.service.js.map +1 -0
  188. package/dist/plugins/devices-homekit/validators/is-not-forbidden-homekit-pin.validator.d.ts +2 -0
  189. package/dist/plugins/devices-homekit/validators/is-not-forbidden-homekit-pin.validator.js +30 -0
  190. package/dist/plugins/devices-homekit/validators/is-not-forbidden-homekit-pin.validator.js.map +1 -0
  191. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +18 -1
  192. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +338 -119
  193. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js.map +1 -1
  194. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.d.ts +13 -1
  195. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +109 -10
  196. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js.map +1 -1
  197. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.constants.js +8 -11
  198. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.constants.js.map +1 -1
  199. package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js +4 -0
  200. package/dist/plugins/devices-shelly-ng/mappings/mapping-loader.service.js.map +1 -1
  201. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +5 -0
  202. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
  203. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +9 -1
  204. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +59 -24
  205. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
  206. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.d.ts +0 -1
  207. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +5 -12
  208. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js.map +1 -1
  209. package/dist/plugins/devices-shelly-ng/utils/transform.utils.d.ts +2 -0
  210. package/dist/plugins/devices-shelly-ng/utils/transform.utils.js +14 -1
  211. package/dist/plugins/devices-shelly-ng/utils/transform.utils.js.map +1 -1
  212. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.d.ts +17 -0
  213. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js +147 -0
  214. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js.map +1 -0
  215. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.d.ts +15 -0
  216. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js +98 -0
  217. package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js.map +1 -0
  218. package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.d.ts +9 -0
  219. package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.js +94 -0
  220. package/dist/plugins/remote-access-cloudflare-tunnel/dto/update-config.dto.js.map +1 -0
  221. package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.d.ts +9 -0
  222. package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.js +92 -0
  223. package/dist/plugins/remote-access-cloudflare-tunnel/models/config.model.js.map +1 -0
  224. package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.d.ts +7 -0
  225. package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.js +48 -0
  226. package/dist/plugins/remote-access-cloudflare-tunnel/models/install.model.js.map +1 -0
  227. package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.d.ts +42 -0
  228. package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js +352 -0
  229. package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js.map +1 -0
  230. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.d.ts +24 -0
  231. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.js +27 -0
  232. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.constants.js.map +1 -0
  233. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.d.ts +8 -0
  234. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.js +19 -0
  235. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.exceptions.js.map +1 -0
  236. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.d.ts +4 -0
  237. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.js +20 -0
  238. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.openapi.js.map +1 -0
  239. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.d.ts +21 -0
  240. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.js +135 -0
  241. package/dist/plugins/remote-access-cloudflare-tunnel/remote-access-cloudflare-tunnel.plugin.js.map +1 -0
  242. package/dist/plugins/remote-access-cloudflare-tunnel/scripts/cloudflared-setup.sh +185 -0
  243. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.d.ts +82 -0
  244. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js +507 -0
  245. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js.map +1 -0
  246. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.d.ts +10 -0
  247. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js +37 -0
  248. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js.map +1 -0
  249. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.d.ts +38 -0
  250. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.js +147 -0
  251. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-setup.service.js.map +1 -0
  252. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.d.ts +15 -0
  253. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js +67 -0
  254. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js.map +1 -0
  255. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.d.ts +8 -0
  256. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js +46 -0
  257. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js.map +1 -0
  258. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.d.ts +27 -0
  259. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.js +139 -0
  260. package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-process.service.js.map +1 -0
  261. package/dist/plugins/remote-access-tailscale/controllers/setup.controller.d.ts +1 -0
  262. package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js +26 -10
  263. package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js.map +1 -1
  264. package/dist/plugins/remote-access-tailscale/controllers/status.controller.d.ts +6 -1
  265. package/dist/plugins/remote-access-tailscale/controllers/status.controller.js +28 -3
  266. package/dist/plugins/remote-access-tailscale/controllers/status.controller.js.map +1 -1
  267. package/dist/plugins/remote-access-tailscale/models/status.model.d.ts +19 -0
  268. package/dist/plugins/remote-access-tailscale/models/status.model.js +158 -1
  269. package/dist/plugins/remote-access-tailscale/models/status.model.js.map +1 -1
  270. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.d.ts +2 -0
  271. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js +3 -1
  272. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js.map +1 -1
  273. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.d.ts +13 -0
  274. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js +27 -0
  275. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js.map +1 -0
  276. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.d.ts +2 -2
  277. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js +2 -0
  278. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js.map +1 -1
  279. package/dist/plugins/remote-access-tailscale/remote-access-tailscale.plugin.js +1 -1
  280. package/dist/plugins/remote-access-tailscale/scripts/tailscale-setup.sh +61 -0
  281. package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.d.ts +9 -0
  282. package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js +12 -0
  283. package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js.map +1 -1
  284. package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.d.ts +1 -0
  285. package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js +27 -2
  286. package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js.map +1 -1
  287. package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.d.ts +30 -1
  288. package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js +300 -30
  289. package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js.map +1 -1
  290. package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.d.ts +8 -3
  291. package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js +39 -12
  292. package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js.map +1 -1
  293. package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.d.ts +14 -5
  294. package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js +51 -16
  295. package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js.map +1 -1
  296. package/dist/plugins/scenes-local/platforms/local-scene.platform.d.ts +3 -1
  297. package/dist/plugins/scenes-local/platforms/local-scene.platform.js +12 -7
  298. package/dist/plugins/scenes-local/platforms/local-scene.platform.js.map +1 -1
  299. package/dist/plugins/spaces-home-control/services/climate-intent.service.d.ts +3 -1
  300. package/dist/plugins/spaces-home-control/services/climate-intent.service.js +6 -3
  301. package/dist/plugins/spaces-home-control/services/climate-intent.service.js.map +1 -1
  302. package/dist/plugins/spaces-home-control/services/covers-intent.service.d.ts +3 -1
  303. package/dist/plugins/spaces-home-control/services/covers-intent.service.js +6 -3
  304. package/dist/plugins/spaces-home-control/services/covers-intent.service.js.map +1 -1
  305. package/dist/plugins/spaces-home-control/services/lighting-intent.service.d.ts +3 -1
  306. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js +7 -4
  307. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js.map +1 -1
  308. package/dist/plugins/spaces-home-control/services/space-media-activity.service.d.ts +3 -1
  309. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js +11 -5
  310. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js.map +1 -1
  311. package/dist/plugins/spaces-home-control/services/space-undo-history.service.d.ts +3 -1
  312. package/dist/plugins/spaces-home-control/services/space-undo-history.service.js +8 -5
  313. package/dist/plugins/spaces-home-control/services/space-undo-history.service.js.map +1 -1
  314. package/dist/tsconfig.build.tsbuildinfo +1 -1
  315. package/package.json +5 -2
@@ -0,0 +1,441 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThermostatCoordinator = void 0;
4
+ const hap_nodejs_1 = require("@homebridge/hap-nodejs");
5
+ const devices_constants_1 = require("../../../modules/devices/devices.constants");
6
+ class ThermostatCoordinator {
7
+ constructor(config) {
8
+ this.config = config;
9
+ this.values = new Map();
10
+ this.revisions = new Map();
11
+ this.pendingWrites = new Map();
12
+ this.nextWriteToken = 0;
13
+ const { service } = config;
14
+ this.currentHeatingCoolingChar = service.getCharacteristic(hap_nodejs_1.Characteristic.CurrentHeatingCoolingState);
15
+ this.targetHeatingCoolingChar = service.getCharacteristic(hap_nodejs_1.Characteristic.TargetHeatingCoolingState);
16
+ this.currentTempChar = service.getCharacteristic(hap_nodejs_1.Characteristic.CurrentTemperature);
17
+ this.targetTempChar = service.getCharacteristic(hap_nodejs_1.Characteristic.TargetTemperature);
18
+ this.initValues();
19
+ this.configureValidValues();
20
+ this.setupGettersAndSetters();
21
+ this.registerEventListeners();
22
+ this.refreshCharacteristics();
23
+ }
24
+ initValues() {
25
+ const registerProp = (prop) => {
26
+ if (!prop)
27
+ return;
28
+ const unwrapped = prop.value !== null && typeof prop.value === 'object' && 'value' in prop.value
29
+ ? prop.value.value
30
+ : prop.value;
31
+ this.values.set(prop.id, unwrapped);
32
+ this.revisions.set(prop.id, 0);
33
+ };
34
+ registerProp(this.config.ambientTempProperty);
35
+ registerProp(this.config.heaterOnProperty);
36
+ registerProp(this.config.heaterTempProperty);
37
+ registerProp(this.config.heaterStatusProperty);
38
+ registerProp(this.config.coolerOnProperty);
39
+ registerProp(this.config.coolerTempProperty);
40
+ registerProp(this.config.coolerStatusProperty);
41
+ registerProp(this.config.lockedProperty);
42
+ }
43
+ configureValidValues() {
44
+ const validValues = [hap_nodejs_1.Characteristic.TargetHeatingCoolingState.OFF];
45
+ const hasHeater = !!this.config.heaterOnProperty;
46
+ const hasCooler = !!this.config.coolerOnProperty;
47
+ if (hasHeater) {
48
+ validValues.push(hap_nodejs_1.Characteristic.TargetHeatingCoolingState.HEAT);
49
+ }
50
+ if (hasCooler) {
51
+ validValues.push(hap_nodejs_1.Characteristic.TargetHeatingCoolingState.COOL);
52
+ }
53
+ if (hasHeater && hasCooler) {
54
+ validValues.push(hap_nodejs_1.Characteristic.TargetHeatingCoolingState.AUTO);
55
+ this.heatingThresholdChar = this.config.service.getCharacteristic(hap_nodejs_1.Characteristic.HeatingThresholdTemperature);
56
+ this.coolingThresholdChar = this.config.service.getCharacteristic(hap_nodejs_1.Characteristic.CoolingThresholdTemperature);
57
+ }
58
+ this.targetHeatingCoolingChar.setProps({
59
+ validValues,
60
+ });
61
+ }
62
+ isPropertyWritable(prop) {
63
+ if (!prop || !Array.isArray(prop.permissions))
64
+ return false;
65
+ return prop.permissions.some((p) => [devices_constants_1.PermissionType.READ_WRITE, devices_constants_1.PermissionType.WRITE_ONLY].includes(p));
66
+ }
67
+ setupGettersAndSetters() {
68
+ this.currentTempChar.onGet(() => this.getAmbientTemperature());
69
+ this.targetTempChar.onGet(() => this.getTargetTemperature());
70
+ const hasWritableTemp = this.isPropertyWritable(this.config.heaterTempProperty) ||
71
+ this.isPropertyWritable(this.config.coolerTempProperty);
72
+ if (hasWritableTemp && this.targetTempChar.props.perms.includes("pw")) {
73
+ this.targetTempChar.onSet(async (value) => {
74
+ const targetVal = Number(value);
75
+ const targetMode = this.deriveTargetHeatingCoolingState();
76
+ const commands = [];
77
+ if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.HEAT) {
78
+ if (this.config.heaterTempProperty && this.isPropertyWritable(this.config.heaterTempProperty)) {
79
+ commands.push({ propertyId: this.config.heaterTempProperty.id, value: targetVal });
80
+ }
81
+ }
82
+ else if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.COOL) {
83
+ if (this.config.coolerTempProperty && this.isPropertyWritable(this.config.coolerTempProperty)) {
84
+ commands.push({ propertyId: this.config.coolerTempProperty.id, value: targetVal });
85
+ }
86
+ }
87
+ else if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.AUTO) {
88
+ const heatProp = this.config.heaterTempProperty;
89
+ const coolProp = this.config.coolerTempProperty;
90
+ const heatRaw = heatProp ? this.values.get(heatProp.id) : null;
91
+ const coolRaw = coolProp ? this.values.get(coolProp.id) : null;
92
+ const currentHeat = heatRaw !== null && heatRaw !== undefined ? Number(heatRaw) : NaN;
93
+ const currentCool = coolRaw !== null && coolRaw !== undefined ? Number(coolRaw) : NaN;
94
+ const span = !isNaN(currentHeat) && !isNaN(currentCool) ? Math.max(0, currentCool - currentHeat) / 2 : 1;
95
+ if (heatProp && this.isPropertyWritable(heatProp)) {
96
+ commands.push({ propertyId: heatProp.id, value: targetVal - span });
97
+ }
98
+ if (coolProp && this.isPropertyWritable(coolProp)) {
99
+ commands.push({ propertyId: coolProp.id, value: targetVal + span });
100
+ }
101
+ }
102
+ else {
103
+ if (this.config.heaterTempProperty && this.isPropertyWritable(this.config.heaterTempProperty)) {
104
+ commands.push({ propertyId: this.config.heaterTempProperty.id, value: targetVal });
105
+ }
106
+ else if (this.config.coolerTempProperty && this.isPropertyWritable(this.config.coolerTempProperty)) {
107
+ commands.push({ propertyId: this.config.coolerTempProperty.id, value: targetVal });
108
+ }
109
+ }
110
+ if (commands.length > 0) {
111
+ await this.dispatchPendingBatch(commands);
112
+ }
113
+ });
114
+ }
115
+ this.currentHeatingCoolingChar.onGet(() => this.deriveCurrentHeatingCoolingState());
116
+ this.targetHeatingCoolingChar.onGet(() => this.deriveTargetHeatingCoolingState());
117
+ const hasWritableState = (this.config.heaterOnProperty && this.isPropertyWritable(this.config.heaterOnProperty)) ||
118
+ (this.config.coolerOnProperty && this.isPropertyWritable(this.config.coolerOnProperty));
119
+ if (hasWritableState && this.targetHeatingCoolingChar.props.perms.includes("pw")) {
120
+ this.targetHeatingCoolingChar.onSet(async (value) => {
121
+ const targetMode = Number(value);
122
+ const commands = [];
123
+ if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.OFF) {
124
+ if (this.config.heaterOnProperty && this.isPropertyWritable(this.config.heaterOnProperty)) {
125
+ commands.push({ propertyId: this.config.heaterOnProperty.id, value: false });
126
+ }
127
+ if (this.config.coolerOnProperty && this.isPropertyWritable(this.config.coolerOnProperty)) {
128
+ commands.push({ propertyId: this.config.coolerOnProperty.id, value: false });
129
+ }
130
+ }
131
+ else if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.HEAT) {
132
+ if (this.config.heaterOnProperty && this.isPropertyWritable(this.config.heaterOnProperty)) {
133
+ commands.push({ propertyId: this.config.heaterOnProperty.id, value: true });
134
+ }
135
+ if (this.config.coolerOnProperty && this.isPropertyWritable(this.config.coolerOnProperty)) {
136
+ commands.push({ propertyId: this.config.coolerOnProperty.id, value: false });
137
+ }
138
+ }
139
+ else if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.COOL) {
140
+ if (this.config.heaterOnProperty && this.isPropertyWritable(this.config.heaterOnProperty)) {
141
+ commands.push({ propertyId: this.config.heaterOnProperty.id, value: false });
142
+ }
143
+ if (this.config.coolerOnProperty && this.isPropertyWritable(this.config.coolerOnProperty)) {
144
+ commands.push({ propertyId: this.config.coolerOnProperty.id, value: true });
145
+ }
146
+ }
147
+ else if (targetMode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.AUTO) {
148
+ if (this.config.heaterOnProperty && this.isPropertyWritable(this.config.heaterOnProperty)) {
149
+ commands.push({ propertyId: this.config.heaterOnProperty.id, value: true });
150
+ }
151
+ if (this.config.coolerOnProperty && this.isPropertyWritable(this.config.coolerOnProperty)) {
152
+ commands.push({ propertyId: this.config.coolerOnProperty.id, value: true });
153
+ }
154
+ }
155
+ if (commands.length > 0) {
156
+ await this.dispatchPendingBatch(commands);
157
+ }
158
+ });
159
+ }
160
+ if (this.heatingThresholdChar && this.config.heaterTempProperty) {
161
+ const heaterTempProp = this.config.heaterTempProperty;
162
+ this.heatingThresholdChar.onGet(() => {
163
+ const val = this.values.get(heaterTempProp.id);
164
+ if (val !== null && val !== undefined) {
165
+ const num = Number(val);
166
+ return !isNaN(num) ? num : 20;
167
+ }
168
+ return 20;
169
+ });
170
+ if (this.isPropertyWritable(heaterTempProp) &&
171
+ this.heatingThresholdChar.props.perms.includes("pw")) {
172
+ this.heatingThresholdChar.onSet(async (value) => {
173
+ const target = Number(value);
174
+ await this.dispatchPending(heaterTempProp.id, target);
175
+ });
176
+ }
177
+ }
178
+ if (this.coolingThresholdChar && this.config.coolerTempProperty) {
179
+ const coolerTempProp = this.config.coolerTempProperty;
180
+ this.coolingThresholdChar.onGet(() => {
181
+ const val = this.values.get(coolerTempProp.id);
182
+ if (val !== null && val !== undefined) {
183
+ const num = Number(val);
184
+ return !isNaN(num) ? num : 25;
185
+ }
186
+ return 25;
187
+ });
188
+ if (this.isPropertyWritable(coolerTempProp) &&
189
+ this.coolingThresholdChar.props.perms.includes("pw")) {
190
+ this.coolingThresholdChar.onSet(async (value) => {
191
+ const target = Number(value);
192
+ await this.dispatchPending(coolerTempProp.id, target);
193
+ });
194
+ }
195
+ }
196
+ if (this.config.lockedProperty) {
197
+ const lockProp = this.config.lockedProperty;
198
+ this.lockPhysicalControlsChar = this.config.service.getCharacteristic(hap_nodejs_1.Characteristic.LockPhysicalControls);
199
+ this.lockPhysicalControlsChar.onGet(() => this.getLockPhysicalControls());
200
+ if (this.isPropertyWritable(lockProp) && this.lockPhysicalControlsChar.props.perms.includes("pw")) {
201
+ this.lockPhysicalControlsChar.onSet(async (value) => {
202
+ const isLocked = value === hap_nodejs_1.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED;
203
+ await this.dispatchPending(lockProp.id, isLocked);
204
+ });
205
+ }
206
+ }
207
+ }
208
+ registerEventListeners() {
209
+ const propsToListen = [
210
+ this.config.ambientTempProperty,
211
+ this.config.heaterOnProperty,
212
+ this.config.heaterTempProperty,
213
+ this.config.heaterStatusProperty,
214
+ this.config.coolerOnProperty,
215
+ this.config.coolerTempProperty,
216
+ this.config.coolerStatusProperty,
217
+ this.config.lockedProperty,
218
+ ].filter((p) => !!p);
219
+ for (const prop of propsToListen) {
220
+ const listener = {
221
+ deviceId: this.config.device.id,
222
+ propertyId: prop.id,
223
+ onPropertyChanged: (_property, rawValue) => {
224
+ const pending = this.pendingWrites.get(prop.id);
225
+ if (pending && Object.is(rawValue, pending.previousValue)) {
226
+ return;
227
+ }
228
+ this.revisions.set(prop.id, (this.revisions.get(prop.id) ?? 0) + 1);
229
+ this.values.set(prop.id, rawValue);
230
+ this.pendingWrites.delete(prop.id);
231
+ this.refreshCharacteristics();
232
+ },
233
+ };
234
+ this.config.context.registerPropertyListener(listener);
235
+ }
236
+ }
237
+ beginPendingWrite(propertyId, requestedValue) {
238
+ const startingRevision = this.revisions.get(propertyId) ?? 0;
239
+ const pending = {
240
+ token: ++this.nextWriteToken,
241
+ previousValue: this.values.get(propertyId),
242
+ requestedValue,
243
+ startingRevision,
244
+ };
245
+ this.revisions.set(propertyId, startingRevision + 1);
246
+ this.values.set(propertyId, requestedValue);
247
+ this.pendingWrites.set(propertyId, pending);
248
+ return pending;
249
+ }
250
+ ownsPendingWrite(propertyId, pending) {
251
+ return (this.pendingWrites.get(propertyId)?.token === pending.token &&
252
+ this.revisions.get(propertyId) === pending.startingRevision + 1 &&
253
+ Object.is(this.values.get(propertyId), pending.requestedValue));
254
+ }
255
+ async dispatchPending(propertyId, value) {
256
+ await this.dispatchPendingBatch([{ propertyId, value }], false);
257
+ }
258
+ async dispatchPendingBatch(commands, useBatch = true) {
259
+ const pendingWrites = new Map();
260
+ let failureHandled = false;
261
+ for (const command of commands) {
262
+ pendingWrites.set(command.propertyId, this.beginPendingWrite(command.propertyId, command.value));
263
+ }
264
+ this.refreshCharacteristics();
265
+ try {
266
+ if (useBatch) {
267
+ await this.config.context.commandDispatcher.dispatchBatch(commands);
268
+ }
269
+ else {
270
+ await this.config.context.commandDispatcher.dispatch(commands[0].propertyId, commands[0].value);
271
+ }
272
+ }
273
+ catch (error) {
274
+ failureHandled = true;
275
+ let hadConflict = false;
276
+ for (const [propertyId, pending] of pendingWrites) {
277
+ if (this.ownsPendingWrite(propertyId, pending)) {
278
+ this.values.set(propertyId, pending.previousValue);
279
+ this.pendingWrites.delete(propertyId);
280
+ }
281
+ else {
282
+ hadConflict = true;
283
+ }
284
+ }
285
+ this.refreshCharacteristics();
286
+ if (hadConflict) {
287
+ this.refreshFresherState();
288
+ }
289
+ throw error;
290
+ }
291
+ finally {
292
+ let hadConflict = false;
293
+ for (const [propertyId, pending] of pendingWrites) {
294
+ if (this.pendingWrites.get(propertyId)?.token === pending.token) {
295
+ this.pendingWrites.delete(propertyId);
296
+ }
297
+ else {
298
+ hadConflict = true;
299
+ }
300
+ }
301
+ if (!failureHandled && hadConflict) {
302
+ this.refreshFresherState();
303
+ }
304
+ }
305
+ }
306
+ refreshFresherState() {
307
+ process.nextTick(() => this.refreshCharacteristics());
308
+ }
309
+ refreshCharacteristics() {
310
+ this.currentTempChar.updateValue(this.getAmbientTemperature());
311
+ this.currentHeatingCoolingChar.updateValue(this.deriveCurrentHeatingCoolingState());
312
+ this.targetHeatingCoolingChar.updateValue(this.deriveTargetHeatingCoolingState());
313
+ this.targetTempChar.updateValue(this.getTargetTemperature());
314
+ if (this.heatingThresholdChar && this.config.heaterTempProperty) {
315
+ const val = this.values.get(this.config.heaterTempProperty.id);
316
+ if (val !== null && val !== undefined) {
317
+ const num = Number(val);
318
+ if (!isNaN(num)) {
319
+ this.heatingThresholdChar.updateValue(num);
320
+ }
321
+ }
322
+ }
323
+ if (this.coolingThresholdChar && this.config.coolerTempProperty) {
324
+ const val = this.values.get(this.config.coolerTempProperty.id);
325
+ if (val !== null && val !== undefined) {
326
+ const num = Number(val);
327
+ if (!isNaN(num)) {
328
+ this.coolingThresholdChar.updateValue(num);
329
+ }
330
+ }
331
+ }
332
+ if (this.lockPhysicalControlsChar && this.config.lockedProperty) {
333
+ this.lockPhysicalControlsChar.updateValue(this.getLockPhysicalControls());
334
+ }
335
+ }
336
+ getLockPhysicalControls() {
337
+ if (!this.config.lockedProperty) {
338
+ return hap_nodejs_1.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED;
339
+ }
340
+ const val = this.values.get(this.config.lockedProperty.id);
341
+ return val === true || val === 'true' || val === 1 || val === 'locked'
342
+ ? hap_nodejs_1.Characteristic.LockPhysicalControls.CONTROL_LOCK_ENABLED
343
+ : hap_nodejs_1.Characteristic.LockPhysicalControls.CONTROL_LOCK_DISABLED;
344
+ }
345
+ getAmbientTemperature() {
346
+ const val = this.values.get(this.config.ambientTempProperty.id);
347
+ if (val !== null && val !== undefined) {
348
+ const num = Number(val);
349
+ return !isNaN(num) ? num : 20;
350
+ }
351
+ return 20;
352
+ }
353
+ getTargetTemperature() {
354
+ const mode = this.deriveTargetHeatingCoolingState();
355
+ if (mode === hap_nodejs_1.Characteristic.TargetHeatingCoolingState.COOL && this.config.coolerTempProperty) {
356
+ const val = this.values.get(this.config.coolerTempProperty.id);
357
+ if (val !== null && val !== undefined) {
358
+ const num = Number(val);
359
+ return !isNaN(num) ? num : 25;
360
+ }
361
+ return 25;
362
+ }
363
+ if (this.config.heaterTempProperty) {
364
+ const val = this.values.get(this.config.heaterTempProperty.id);
365
+ if (val !== null && val !== undefined) {
366
+ const num = Number(val);
367
+ return !isNaN(num) ? num : 20;
368
+ }
369
+ return 20;
370
+ }
371
+ if (this.config.coolerTempProperty) {
372
+ const val = this.values.get(this.config.coolerTempProperty.id);
373
+ if (val !== null && val !== undefined) {
374
+ const num = Number(val);
375
+ return !isNaN(num) ? num : 25;
376
+ }
377
+ return 25;
378
+ }
379
+ return 20;
380
+ }
381
+ deriveCurrentHeatingCoolingState() {
382
+ const ambientTemp = this.getAmbientTemperature();
383
+ if (this.config.heaterOnProperty) {
384
+ const isOn = Boolean(this.values.get(this.config.heaterOnProperty.id));
385
+ if (isOn) {
386
+ const statusRaw = this.config.heaterStatusProperty
387
+ ? this.values.get(this.config.heaterStatusProperty.id)
388
+ : undefined;
389
+ if (statusRaw === true || statusRaw === 'heating') {
390
+ return hap_nodejs_1.Characteristic.CurrentHeatingCoolingState.HEAT;
391
+ }
392
+ if (statusRaw === false || statusRaw === 'idle' || statusRaw === 'off') {
393
+ }
394
+ else if (statusRaw === undefined || statusRaw === null) {
395
+ const targetRaw = this.config.heaterTempProperty ? this.values.get(this.config.heaterTempProperty.id) : null;
396
+ const targetTemp = targetRaw !== null && targetRaw !== undefined ? Number(targetRaw) : NaN;
397
+ if (!isNaN(targetTemp) && targetTemp > ambientTemp) {
398
+ return hap_nodejs_1.Characteristic.CurrentHeatingCoolingState.HEAT;
399
+ }
400
+ }
401
+ }
402
+ }
403
+ if (this.config.coolerOnProperty) {
404
+ const isOn = Boolean(this.values.get(this.config.coolerOnProperty.id));
405
+ if (isOn) {
406
+ const statusRaw = this.config.coolerStatusProperty
407
+ ? this.values.get(this.config.coolerStatusProperty.id)
408
+ : undefined;
409
+ if (statusRaw === true || statusRaw === 'cooling') {
410
+ return hap_nodejs_1.Characteristic.CurrentHeatingCoolingState.COOL;
411
+ }
412
+ if (statusRaw === false || statusRaw === 'idle' || statusRaw === 'off') {
413
+ }
414
+ else if (statusRaw === undefined || statusRaw === null) {
415
+ const targetRaw = this.config.coolerTempProperty ? this.values.get(this.config.coolerTempProperty.id) : null;
416
+ const targetTemp = targetRaw !== null && targetRaw !== undefined ? Number(targetRaw) : NaN;
417
+ if (!isNaN(targetTemp) && targetTemp < ambientTemp) {
418
+ return hap_nodejs_1.Characteristic.CurrentHeatingCoolingState.COOL;
419
+ }
420
+ }
421
+ }
422
+ }
423
+ return hap_nodejs_1.Characteristic.CurrentHeatingCoolingState.OFF;
424
+ }
425
+ deriveTargetHeatingCoolingState() {
426
+ const heaterOn = this.config.heaterOnProperty ? Boolean(this.values.get(this.config.heaterOnProperty.id)) : false;
427
+ const coolerOn = this.config.coolerOnProperty ? Boolean(this.values.get(this.config.coolerOnProperty.id)) : false;
428
+ if (heaterOn && coolerOn) {
429
+ return hap_nodejs_1.Characteristic.TargetHeatingCoolingState.AUTO;
430
+ }
431
+ if (heaterOn) {
432
+ return hap_nodejs_1.Characteristic.TargetHeatingCoolingState.HEAT;
433
+ }
434
+ if (coolerOn) {
435
+ return hap_nodejs_1.Characteristic.TargetHeatingCoolingState.COOL;
436
+ }
437
+ return hap_nodejs_1.Characteristic.TargetHeatingCoolingState.OFF;
438
+ }
439
+ }
440
+ exports.ThermostatCoordinator = ThermostatCoordinator;
441
+ //# sourceMappingURL=thermostat-coordinator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thermostat-coordinator.js","sourceRoot":"","sources":["../../../../src/plugins/devices-homekit/mappers/thermostat-coordinator.ts"],"names":[],"mappings":";;;AAAA,uDAA6F;AAE7F,kFAA4E;AA6B5E,MAAa,qBAAqB;IAcjC,YAA6B,MAAmC;QAAnC,WAAM,GAAN,MAAM,CAA6B;QAb/C,WAAM,GAAG,IAAI,GAAG,EAAmB,CAAC;QACpC,cAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QACtC,kBAAa,GAAG,IAAI,GAAG,EAAgC,CAAC;QACjE,mBAAc,GAAG,CAAC,CAAC;QAW1B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;QAE3B,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,2BAAc,CAAC,0BAA0B,CAAC,CAAC;QACtG,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,iBAAiB,CAAC,2BAAc,CAAC,yBAAyB,CAAC,CAAC;QACpG,IAAI,C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C;IAEO,+BAA+B;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAClH,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAElH,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAC1B,OAAO,2BAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC;QACtD,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,2BAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC;QACtD,CAAC;QACD,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,2BAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC;QACtD,CAAC;QACD,OAAO,2BAAc,CAAC,yBAAyB,CAAC,GAAG,CAAC;IACrD,CAAC;CACD;AA3fD,sDA2fC"}
@@ -0,0 +1,11 @@
1
+ import { Accessory } from '@homebridge/hap-nodejs';
2
+ import { DeviceEntity } from '../../../modules/devices/entities/devices.entity';
3
+ import { BaseHomeKitMapper } from './base.mapper';
4
+ import { HomeKitMapperContext } from './homekit-mapper.interface';
5
+ export declare class ThermostatMapper extends BaseHomeKitMapper {
6
+ canMap(device: DeviceEntity): boolean;
7
+ getSuggestedServiceType(_device: DeviceEntity): string;
8
+ buildAccessory(device: DeviceEntity, context: HomeKitMapperContext): Accessory | null;
9
+ private findAmbientTemperature;
10
+ private isValidHeaterOrCoolerChannel;
11
+ }
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ThermostatMapper = void 0;
4
+ const hap_nodejs_1 = require("@homebridge/hap-nodejs");
5
+ const devices_constants_1 = require("../../../modules/devices/devices.constants");
6
+ const base_mapper_1 = require("./base.mapper");
7
+ const thermostat_coordinator_1 = require("./thermostat-coordinator");
8
+ class ThermostatMapper extends base_mapper_1.BaseHomeKitMapper {
9
+ canMap(device) {
10
+ const ambient = this.findAmbientTemperature(device);
11
+ if (!ambient) {
12
+ return false;
13
+ }
14
+ const heaterChannel = this.findChannel(device, devices_constants_1.ChannelCategory.HEATER) ?? this.findChannel(device, devices_constants_1.ChannelCategory.THERMOSTAT);
15
+ const coolerChannel = this.findChannel(device, devices_constants_1.ChannelCategory.COOLER);
16
+ return this.isValidHeaterOrCoolerChannel(heaterChannel) || this.isValidHeaterOrCoolerChannel(coolerChannel);
17
+ }
18
+ getSuggestedServiceType(_device) {
19
+ return 'thermostat';
20
+ }
21
+ buildAccessory(device, context) {
22
+ const ambient = this.findAmbientTemperature(device);
23
+ if (!ambient) {
24
+ return null;
25
+ }
26
+ const heaterChannel = this.findChannel(device, devices_constants_1.ChannelCategory.HEATER) ?? this.findChannel(device, devices_constants_1.ChannelCategory.THERMOSTAT);
27
+ const coolerChannel = this.findChannel(device, devices_constants_1.ChannelCategory.COOLER);
28
+ const validHeater = this.isValidHeaterOrCoolerChannel(heaterChannel) ? heaterChannel : undefined;
29
+ const validCooler = this.isValidHeaterOrCoolerChannel(coolerChannel) ? coolerChannel : undefined;
30
+ if (!validHeater && !validCooler) {
31
+ return null;
32
+ }
33
+ const accessory = this.createBaseAccessory(device, 9);
34
+ const service = accessory.addService(hap_nodejs_1.Service.Thermostat, device.name);
35
+ service
36
+ .getCharacteristic(hap_nodejs_1.Characteristic.TemperatureDisplayUnits)
37
+ .onGet(() => hap_nodejs_1.Characteristic.TemperatureDisplayUnits.CELSIUS);
38
+ const thermostatChannel = this.findChannel(device, devices_constants_1.ChannelCategory.THERMOSTAT);
39
+ const lockedProp = (thermostatChannel && this.findProperty(thermostatChannel, devices_constants_1.PropertyCategory.LOCKED)) ??
40
+ (validHeater && this.findProperty(validHeater, devices_constants_1.PropertyCategory.LOCKED)) ??
41
+ (validCooler && this.findProperty(validCooler, devices_constants_1.PropertyCategory.LOCKED)) ??
42
+ (ambient.channel && this.findProperty(ambient.channel, devices_constants_1.PropertyCategory.LOCKED));
43
+ new thermostat_coordinator_1.ThermostatCoordinator({
44
+ device,
45
+ service,
46
+ context,
47
+ ambientTempChannel: ambient.channel,
48
+ ambientTempProperty: ambient.property,
49
+ heaterChannel: validHeater,
50
+ heaterOnProperty: validHeater ? this.findProperty(validHeater, devices_constants_1.PropertyCategory.ON) : undefined,
51
+ heaterTempProperty: validHeater ? this.findProperty(validHeater, devices_constants_1.PropertyCategory.TEMPERATURE) : undefined,
52
+ heaterStatusProperty: validHeater ? this.findProperty(validHeater, devices_constants_1.PropertyCategory.STATUS) : undefined,
53
+ coolerChannel: validCooler,
54
+ coolerOnProperty: validCooler ? this.findProperty(validCooler, devices_constants_1.PropertyCategory.ON) : undefined,
55
+ coolerTempProperty: validCooler ? this.findProperty(validCooler, devices_constants_1.PropertyCategory.TEMPERATURE) : undefined,
56
+ coolerStatusProperty: validCooler ? this.findProperty(validCooler, devices_constants_1.PropertyCategory.STATUS) : undefined,
57
+ lockedProperty: lockedProp,
58
+ });
59
+ return accessory;
60
+ }
61
+ findAmbientTemperature(device) {
62
+ const tempChannel = this.findChannel(device, devices_constants_1.ChannelCategory.TEMPERATURE);
63
+ if (tempChannel) {
64
+ const tempProp = this.findProperty(tempChannel, devices_constants_1.PropertyCategory.TEMPERATURE);
65
+ if (tempProp &&
66
+ tempProp.permissions.includes(devices_constants_1.PermissionType.READ_ONLY) &&
67
+ !tempProp.permissions.includes(devices_constants_1.PermissionType.READ_WRITE)) {
68
+ return { channel: tempChannel, property: tempProp };
69
+ }
70
+ }
71
+ for (const ch of device.channels ?? []) {
72
+ if (ch.category === devices_constants_1.ChannelCategory.HEATER ||
73
+ ch.category === devices_constants_1.ChannelCategory.COOLER ||
74
+ ch.category === devices_constants_1.ChannelCategory.THERMOSTAT) {
75
+ continue;
76
+ }
77
+ const prop = this.findProperty(ch, devices_constants_1.PropertyCategory.TEMPERATURE);
78
+ if (prop &&
79
+ prop.permissions.includes(devices_constants_1.PermissionType.READ_ONLY) &&
80
+ !prop.permissions.includes(devices_constants_1.PermissionType.READ_WRITE)) {
81
+ return { channel: ch, property: prop };
82
+ }
83
+ }
84
+ return null;
85
+ }
86
+ isValidHeaterOrCoolerChannel(channel) {
87
+ if (!channel) {
88
+ return false;
89
+ }
90
+ const onProp = this.findProperty(channel, devices_constants_1.PropertyCategory.ON);
91
+ const tempProp = this.findProperty(channel, devices_constants_1.PropertyCategory.TEMPERATURE);
92
+ const isWritable = (p) => !!p && p.permissions.some((perm) => [devices_constants_1.PermissionType.READ_WRITE, devices_constants_1.PermissionType.WRITE_ONLY].includes(perm));
93
+ return isWritable(onProp) && isWritable(tempProp);
94
+ }
95
+ }
96
+ exports.ThermostatMapper = ThermostatMapper;
97
+ //# sourceMappingURL=thermostat.mapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thermostat.mapper.js","sourceRoot":"","sources":["../../../../src/plugins/devices-homekit/mappers/thermostat.mapper.ts"],"names":[],"mappings":";;;AAAA,uDAAwF;AAExF,kFAA+G;AAG/G,+CAAkD;AAElD,qEAAiE;AAEjE,MAAa,gBAAiB,SAAQ,+BAAiB;IACtD,MAAM,CAAC,MAAoB;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,aAAa,GAClB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAe,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,mCAAe,CAAC,UAAU,CAAC,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AS;YACV,CAAC;YACD,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,oCAAgB,CAAC,WAAW,CAAC,CAAC;YACjE,IACC,IAAI;gBACJ,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,kCAAc,CAAC,SAAS,CAAC;gBACnD,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,kCAAc,CAAC,UAAU,CAAC,EACpD,CAAC;gBACF,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACxC,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;IAEO,4BAA4B,CAAC,OAAuB;QAC3D,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,KAAK,CAAC;QACd,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,oCAAgB,CAAC,EAAE,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,oCAAgB,CAAC,WAAW,CAAC,CAAC;QAC1E,MAAM,UAAU,GAAG,CAAC,CAAyB,EAAE,EAAE,CAChD,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,kCAAc,CAAC,UAAU,EAAE,kCAAc,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAE5G,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;CACD;AArHD,4CAqHC"}
@@ -0,0 +1,10 @@
1
+ import { Accessory } from '@homebridge/hap-nodejs';
2
+ import { DeviceEntity } from '../../../modules/devices/entities/devices.entity';
3
+ import { BaseHomeKitMapper } from './base.mapper';
4
+ import { HomeKitMapperContext } from './homekit-mapper.interface';
5
+ export declare class WindowCoveringMapper extends BaseHomeKitMapper {
6
+ canMap(device: DeviceEntity): boolean;
7
+ getSuggestedServiceType(_device: DeviceEntity): string;
8
+ buildAccessory(device: DeviceEntity, context: HomeKitMapperContext): Accessory | null;
9
+ private isValidCoveringChannel;
10
+ }