@fastybird/smart-panel-backend 1.1.0-alpha.64 → 1.1.0-alpha.66

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 (1108) hide show
  1. package/dist/app.module.d.ts +3 -1
  2. package/dist/app.module.js +5 -1
  3. package/dist/app.module.js.map +1 -1
  4. package/dist/cli.js +1 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/common/database/sqlite-data-source.d.ts +37 -0
  7. package/dist/common/database/sqlite-data-source.js +2131 -0
  8. package/dist/common/database/sqlite-data-source.js.map +1 -0
  9. package/dist/dataSource.d.ts +3 -1
  10. package/dist/dataSource.js +3 -3
  11. package/dist/dataSource.js.map +1 -1
  12. package/dist/main.js +1 -0
  13. package/dist/main.js.map +1 -1
  14. package/dist/migrations/1000000000002-AddTokenLastUsedAt.js +1 -0
  15. package/dist/migrations/1000000000002-AddTokenLastUsedAt.js.map +1 -1
  16. package/dist/migrations/1000000000027-AddVirtualProducerBindings.d.ts +7 -0
  17. package/dist/migrations/1000000000027-AddVirtualProducerBindings.js +87 -0
  18. package/dist/migrations/1000000000027-AddVirtualProducerBindings.js.map +1 -0
  19. package/dist/migrations/1000000000028-AddShellySampleSources.d.ts +6 -0
  20. package/dist/migrations/1000000000028-AddShellySampleSources.js +29 -0
  21. package/dist/migrations/1000000000028-AddShellySampleSources.js.map +1 -0
  22. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.d.ts +6 -0
  23. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js +31 -0
  24. package/dist/migrations/1000000000029-AddVirtualNumericTransforms.js.map +1 -0
  25. package/dist/migrations/1000000000030-AddZigbeeSampleSources.d.ts +6 -0
  26. package/dist/migrations/1000000000030-AddZigbeeSampleSources.js +33 -0
  27. package/dist/migrations/1000000000030-AddZigbeeSampleSources.js.map +1 -0
  28. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.d.ts +6 -0
  29. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js +62 -0
  30. package/dist/migrations/1000000000031-AddVirtualThermostatClaims.js.map +1 -0
  31. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.d.ts +6 -0
  32. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js +39 -0
  33. package/dist/migrations/1000000000032-AddVirtualThermostatRuntime.js.map +1 -0
  34. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.d.ts +6 -0
  35. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js +28 -0
  36. package/dist/migrations/1000000000033-AddThermostatInstallationProfiles.js.map +1 -0
  37. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.d.ts +6 -0
  38. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js +26 -0
  39. package/dist/migrations/1000000000034-AddVirtualThermostatRecoveries.js.map +1 -0
  40. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.d.ts +6 -0
  41. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js +35 -0
  42. package/dist/migrations/1000000000035-IndexVirtualThermostatCommands.js.map +1 -0
  43. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.d.ts +6 -0
  44. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js +18 -0
  45. package/dist/migrations/1000000000036-AddVirtualAggregatePolicies.js.map +1 -0
  46. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.d.ts +6 -0
  47. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js +16 -0
  48. package/dist/migrations/1000000000037-AddVirtualAggregateProfiles.js.map +1 -0
  49. package/dist/migrations/1000000000038-AddShellyCoverOrdering.d.ts +6 -0
  50. package/dist/migrations/1000000000038-AddShellyCoverOrdering.js +19 -0
  51. package/dist/migrations/1000000000038-AddShellyCoverOrdering.js.map +1 -0
  52. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.d.ts +6 -0
  53. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js +16 -0
  54. package/dist/migrations/1000000000039-AddVirtualThermostatComfort.js.map +1 -0
  55. package/dist/migrations/1000000000040-AddThermostatBranchGroups.d.ts +6 -0
  56. package/dist/migrations/1000000000040-AddThermostatBranchGroups.js +32 -0
  57. package/dist/migrations/1000000000040-AddThermostatBranchGroups.js.map +1 -0
  58. package/dist/migrations/1000000000041-AddThermostatMemberProtection.d.ts +6 -0
  59. package/dist/migrations/1000000000041-AddThermostatMemberProtection.js +39 -0
  60. package/dist/migrations/1000000000041-AddThermostatMemberProtection.js.map +1 -0
  61. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.d.ts +6 -0
  62. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js +19 -0
  63. package/dist/migrations/1000000000042-AddShellyCoverRecoveries.js.map +1 -0
  64. package/dist/migrations/1000000000044-AddVirtualDewPoint.d.ts +6 -0
  65. package/dist/migrations/1000000000044-AddVirtualDewPoint.js +36 -0
  66. package/dist/migrations/1000000000044-AddVirtualDewPoint.js.map +1 -0
  67. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.d.ts +6 -0
  68. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js +32 -0
  69. package/dist/migrations/1000000000045-AddThermostatCoolingDependencies.js.map +1 -0
  70. package/dist/migrations/1000000000046-AddSpaceActivityModes.d.ts +7 -0
  71. package/dist/migrations/1000000000046-AddSpaceActivityModes.js +54 -0
  72. package/dist/migrations/1000000000046-AddSpaceActivityModes.js.map +1 -0
  73. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.d.ts +6 -0
  74. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js +60 -0
  75. package/dist/migrations/1000000000047-AddClimateAutomationOwnership.js.map +1 -0
  76. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.d.ts +6 -0
  77. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js +208 -0
  78. package/dist/migrations/1000000000048-AddThermostatCreationCatalogBirths.js.map +1 -0
  79. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.d.ts +6 -0
  80. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js +40 -0
  81. package/dist/migrations/1000000000049-FenceClimateAutomationLifecycle.js.map +1 -0
  82. package/dist/migrations/1000000000050-AddSpaceModeSchedules.d.ts +6 -0
  83. package/dist/migrations/1000000000050-AddSpaceModeSchedules.js +36 -0
  84. package/dist/migrations/1000000000050-AddSpaceModeSchedules.js.map +1 -0
  85. package/dist/migrations/1000000000051-AddSpaceOccupancy.d.ts +6 -0
  86. package/dist/migrations/1000000000051-AddSpaceOccupancy.js +34 -0
  87. package/dist/migrations/1000000000051-AddSpaceOccupancy.js.map +1 -0
  88. package/dist/migrations/1000000000052-AddNativeThermostats.d.ts +6 -0
  89. package/dist/migrations/1000000000052-AddNativeThermostats.js +39 -0
  90. package/dist/migrations/1000000000052-AddNativeThermostats.js.map +1 -0
  91. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.d.ts +6 -0
  92. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js +35 -0
  93. package/dist/migrations/1000000000053-AddThermostatOverrideClocks.js.map +1 -0
  94. package/dist/modules/buddy/buddy.utils.d.ts +1 -1
  95. package/dist/modules/buddy/buddy.utils.js +10 -11
  96. package/dist/modules/buddy/buddy.utils.js.map +1 -1
  97. package/dist/modules/buddy/services/buddy-context.service.js +2 -1
  98. package/dist/modules/buddy/services/buddy-context.service.js.map +1 -1
  99. package/dist/modules/buddy/services/home-context-tool-provider.service.d.ts +1 -1
  100. package/dist/modules/devices/contracts/climate-automation.contract.d.ts +111 -0
  101. package/dist/modules/devices/contracts/climate-automation.contract.js +3 -0
  102. package/dist/modules/devices/contracts/climate-automation.contract.js.map +1 -0
  103. package/dist/modules/devices/controllers/channels.properties.controller.d.ts +1 -1
  104. package/dist/modules/devices/controllers/channels.properties.controller.js +11 -4
  105. package/dist/modules/devices/controllers/channels.properties.controller.js.map +1 -1
  106. package/dist/modules/devices/controllers/devices.channels.properties.controller.d.ts +1 -1
  107. package/dist/modules/devices/controllers/devices.channels.properties.controller.js +11 -4
  108. package/dist/modules/devices/controllers/devices.channels.properties.controller.js.map +1 -1
  109. package/dist/modules/devices/controllers/property-command.controller.d.ts +9 -0
  110. package/dist/modules/devices/controllers/property-command.controller.js +88 -0
  111. package/dist/modules/devices/controllers/property-command.controller.js.map +1 -0
  112. package/dist/modules/devices/devices.constants.d.ts +4 -0
  113. package/dist/modules/devices/devices.constants.js +4 -0
  114. package/dist/modules/devices/devices.constants.js.map +1 -1
  115. package/dist/modules/devices/devices.module.js +22 -0
  116. package/dist/modules/devices/devices.module.js.map +1 -1
  117. package/dist/modules/devices/devices.openapi.d.ts +3 -1
  118. package/dist/modules/devices/devices.openapi.js +39 -0
  119. package/dist/modules/devices/devices.openapi.js.map +1 -1
  120. package/dist/modules/devices/dto/property-command.dto.js +20 -6
  121. package/dist/modules/devices/dto/property-command.dto.js.map +1 -1
  122. package/dist/modules/devices/dto/update-device.dto.d.ts +1 -1
  123. package/dist/modules/devices/dto/update-device.dto.js +4 -3
  124. package/dist/modules/devices/dto/update-device.dto.js.map +1 -1
  125. package/dist/modules/devices/entities/climate-automation.entity.d.ts +56 -0
  126. package/dist/modules/devices/entities/climate-automation.entity.js +231 -0
  127. package/dist/modules/devices/entities/climate-automation.entity.js.map +1 -0
  128. package/dist/modules/devices/entities/devices.entity.d.ts +4 -0
  129. package/dist/modules/devices/entities/devices.entity.js +27 -3
  130. package/dist/modules/devices/entities/devices.entity.js.map +1 -1
  131. package/dist/modules/devices/interceptors/property-command-entry.interceptor.d.ts +10 -0
  132. package/dist/modules/devices/interceptors/property-command-entry.interceptor.js +50 -0
  133. package/dist/modules/devices/interceptors/property-command-entry.interceptor.js.map +1 -0
  134. package/dist/modules/devices/models/composite-command.model.d.ts +16 -0
  135. package/dist/modules/devices/models/composite-command.model.js +99 -0
  136. package/dist/modules/devices/models/composite-command.model.js.map +1 -0
  137. package/dist/modules/devices/models/property-command-response.model.d.ts +18 -0
  138. package/dist/modules/devices/models/property-command-response.model.js +90 -0
  139. package/dist/modules/devices/models/property-command-response.model.js.map +1 -0
  140. package/dist/modules/devices/models/property-read-policy.model.d.ts +4 -0
  141. package/dist/modules/devices/models/property-read-policy.model.js +57 -0
  142. package/dist/modules/devices/models/property-read-policy.model.js.map +1 -0
  143. package/dist/modules/devices/models/property-sample.model.d.ts +50 -0
  144. package/dist/modules/devices/models/property-sample.model.js +3 -0
  145. package/dist/modules/devices/models/property-sample.model.js.map +1 -0
  146. package/dist/modules/devices/models/property-value-state.model.d.ts +11 -0
  147. package/dist/modules/devices/models/property-value-state.model.js +55 -1
  148. package/dist/modules/devices/models/property-value-state.model.js.map +1 -1
  149. package/dist/modules/devices/platforms/device.platform.d.ts +43 -0
  150. package/dist/modules/devices/platforms/native-climate.contract.d.ts +50 -0
  151. package/dist/modules/devices/platforms/native-climate.contract.js +3 -0
  152. package/dist/modules/devices/platforms/native-climate.contract.js.map +1 -0
  153. package/dist/modules/devices/services/channels-type-mapper.service.d.ts +3 -0
  154. package/dist/modules/devices/services/channels-type-mapper.service.js +21 -1
  155. package/dist/modules/devices/services/channels-type-mapper.service.js.map +1 -1
  156. package/dist/modules/devices/services/channels.properties-type-mapper.service.d.ts +7 -2
  157. package/dist/modules/devices/services/channels.properties-type-mapper.service.js +21 -1
  158. package/dist/modules/devices/services/channels.properties-type-mapper.service.js.map +1 -1
  159. package/dist/modules/devices/services/channels.properties.service.d.ts +11 -2
  160. package/dist/modules/devices/services/channels.properties.service.js +219 -64
  161. package/dist/modules/devices/services/channels.properties.service.js.map +1 -1
  162. package/dist/modules/devices/services/channels.service.d.ts +12 -5
  163. package/dist/modules/devices/services/channels.service.js +148 -55
  164. package/dist/modules/devices/services/channels.service.js.map +1 -1
  165. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.d.ts +47 -0
  166. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js +242 -0
  167. package/dist/modules/devices/services/climate-automation-ledger-lifecycle.js.map +1 -0
  168. package/dist/modules/devices/services/climate-automation-ledger.service.d.ts +68 -0
  169. package/dist/modules/devices/services/climate-automation-ledger.service.js +1061 -0
  170. package/dist/modules/devices/services/climate-automation-ledger.service.js.map +1 -0
  171. package/dist/modules/devices/services/climate-automation-ledger.utils.d.ts +8 -0
  172. package/dist/modules/devices/services/climate-automation-ledger.utils.js +54 -0
  173. package/dist/modules/devices/services/climate-automation-ledger.utils.js.map +1 -0
  174. package/dist/modules/devices/services/climate-automation.registry.service.d.ts +15 -0
  175. package/dist/modules/devices/services/climate-automation.registry.service.js +71 -0
  176. package/dist/modules/devices/services/climate-automation.registry.service.js.map +1 -0
  177. package/dist/modules/devices/services/composite-property-command.registry.service.d.ts +48 -0
  178. package/dist/modules/devices/services/composite-property-command.registry.service.js +65 -0
  179. package/dist/modules/devices/services/composite-property-command.registry.service.js.map +1 -0
  180. package/dist/modules/devices/services/controller-publication-context.d.ts +27 -0
  181. package/dist/modules/devices/services/controller-publication-context.js +148 -0
  182. package/dist/modules/devices/services/controller-publication-context.js.map +1 -0
  183. package/dist/modules/devices/services/cover-action-proof.d.ts +7 -0
  184. package/dist/modules/devices/services/cover-action-proof.js +142 -0
  185. package/dist/modules/devices/services/cover-action-proof.js.map +1 -0
  186. package/dist/modules/devices/services/creation-capture.d.ts +19 -0
  187. package/dist/modules/devices/services/creation-capture.js +85 -0
  188. package/dist/modules/devices/services/creation-capture.js.map +1 -0
  189. package/dist/modules/devices/services/device-command-graph.service.js +1 -1
  190. package/dist/modules/devices/services/device-command-graph.service.js.map +1 -1
  191. package/dist/modules/devices/services/device-connection-state.service.d.ts +1 -0
  192. package/dist/modules/devices/services/device-connection-state.service.js +64 -18
  193. package/dist/modules/devices/services/device-connection-state.service.js.map +1 -1
  194. package/dist/modules/devices/services/device-connectivity.service.js +96 -51
  195. package/dist/modules/devices/services/device-connectivity.service.js.map +1 -1
  196. package/dist/modules/devices/services/device-contribution.registry.service.d.ts +50 -0
  197. package/dist/modules/devices/services/device-contribution.registry.service.js +45 -0
  198. package/dist/modules/devices/services/device-contribution.registry.service.js.map +1 -0
  199. package/dist/modules/devices/services/device-creation-context.d.ts +57 -0
  200. package/dist/modules/devices/services/device-creation-context.js +315 -0
  201. package/dist/modules/devices/services/device-creation-context.js.map +1 -0
  202. package/dist/modules/devices/services/device-structure-lock.service.d.ts +5 -0
  203. package/dist/modules/devices/services/device-structure-lock.service.js +64 -12
  204. package/dist/modules/devices/services/device-structure-lock.service.js.map +1 -1
  205. package/dist/modules/devices/services/device-validation.service.d.ts +0 -1
  206. package/dist/modules/devices/services/device-validation.service.js +3 -14
  207. package/dist/modules/devices/services/device-validation.service.js.map +1 -1
  208. package/dist/modules/devices/services/device-zones.service.d.ts +3 -1
  209. package/dist/modules/devices/services/device-zones.service.js +30 -6
  210. package/dist/modules/devices/services/device-zones.service.js.map +1 -1
  211. package/dist/modules/devices/services/devices-type-mapper.service.d.ts +3 -0
  212. package/dist/modules/devices/services/devices-type-mapper.service.js +21 -1
  213. package/dist/modules/devices/services/devices-type-mapper.service.js.map +1 -1
  214. package/dist/modules/devices/services/devices.service.d.ts +8 -2
  215. package/dist/modules/devices/services/devices.service.js +194 -49
  216. package/dist/modules/devices/services/devices.service.js.map +1 -1
  217. package/dist/modules/devices/services/platform.registry.service.d.ts +11 -1
  218. package/dist/modules/devices/services/platform.registry.service.js +42 -5
  219. package/dist/modules/devices/services/platform.registry.service.js.map +1 -1
  220. package/dist/modules/devices/services/property-command-admission.registry.service.d.ts +28 -0
  221. package/dist/modules/devices/services/property-command-admission.registry.service.js +70 -0
  222. package/dist/modules/devices/services/property-command-admission.registry.service.js.map +1 -0
  223. package/dist/modules/devices/services/property-command-dispatch.service.d.ts +28 -2
  224. package/dist/modules/devices/services/property-command-dispatch.service.js +704 -10
  225. package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -1
  226. package/dist/modules/devices/services/property-command-entry-snapshot.d.ts +25 -0
  227. package/dist/modules/devices/services/property-command-entry-snapshot.js +87 -0
  228. package/dist/modules/devices/services/property-command-entry-snapshot.js.map +1 -0
  229. package/dist/modules/devices/services/property-command-window.service.d.ts +22 -0
  230. package/dist/modules/devices/services/property-command-window.service.js +81 -0
  231. package/dist/modules/devices/services/property-command-window.service.js.map +1 -1
  232. package/dist/modules/devices/services/property-command.service.d.ts +24 -3
  233. package/dist/modules/devices/services/property-command.service.js +180 -18
  234. package/dist/modules/devices/services/property-command.service.js.map +1 -1
  235. package/dist/modules/devices/services/property-metadata.service.js +1 -1
  236. package/dist/modules/devices/services/property-metadata.service.js.map +1 -1
  237. package/dist/modules/devices/services/property-producer.registry.service.d.ts +98 -0
  238. package/dist/modules/devices/services/property-producer.registry.service.js +636 -0
  239. package/dist/modules/devices/services/property-producer.registry.service.js.map +1 -0
  240. package/dist/modules/devices/services/property-value-source.registry.service.d.ts +18 -0
  241. package/dist/modules/devices/services/property-value-source.registry.service.js +291 -2
  242. package/dist/modules/devices/services/property-value-source.registry.service.js.map +1 -1
  243. package/dist/modules/devices/services/property-value.service.d.ts +40 -3
  244. package/dist/modules/devices/services/property-value.service.js +744 -193
  245. package/dist/modules/devices/services/property-value.service.js.map +1 -1
  246. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.d.ts +5 -0
  247. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js +25 -0
  248. package/dist/modules/devices/subscribers/channel-property-entity.subscriber.js.map +1 -1
  249. package/dist/modules/devices/utils/property-metadata.utils.d.ts +1 -0
  250. package/dist/modules/devices/utils/property-metadata.utils.js +10 -0
  251. package/dist/modules/devices/utils/property-metadata.utils.js.map +1 -1
  252. package/dist/modules/devices/utils/property-permissions.utils.d.ts +2 -0
  253. package/dist/modules/devices/utils/property-permissions.utils.js +10 -0
  254. package/dist/modules/devices/utils/property-permissions.utils.js.map +1 -0
  255. package/dist/modules/extensions/services/discovered-backend.module.d.ts +6 -0
  256. package/dist/modules/extensions/services/discovered-backend.module.js +32 -0
  257. package/dist/modules/extensions/services/discovered-backend.module.js.map +1 -0
  258. package/dist/modules/extensions/services/extensions-discovery.js +15 -0
  259. package/dist/modules/extensions/services/extensions-discovery.js.map +1 -1
  260. package/dist/modules/extensions/services/extensions.service.d.ts +4 -0
  261. package/dist/modules/extensions/services/extensions.service.js +13 -0
  262. package/dist/modules/extensions/services/extensions.service.js.map +1 -1
  263. package/dist/modules/extensions/services/managed-extension-service.interface.d.ts +1 -0
  264. package/dist/modules/extensions/services/managed-service-manager.service.d.ts +15 -0
  265. package/dist/modules/extensions/services/managed-service-manager.service.js +242 -72
  266. package/dist/modules/extensions/services/managed-service-manager.service.js.map +1 -1
  267. package/dist/modules/home-context/schemas/home-search-input.schemas.d.ts +1 -1
  268. package/dist/modules/intents/models/intent.model.d.ts +2 -0
  269. package/dist/modules/intents/models/intent.model.js +14 -0
  270. package/dist/modules/intents/models/intent.model.js.map +1 -1
  271. package/dist/modules/intents/services/intents.service.d.ts +2 -1
  272. package/dist/modules/intents/services/intents.service.js +18 -2
  273. package/dist/modules/intents/services/intents.service.js.map +1 -1
  274. package/dist/modules/scenes/listeners/websocket-exchange.listener.js +4 -0
  275. package/dist/modules/scenes/listeners/websocket-exchange.listener.js.map +1 -1
  276. package/dist/modules/scenes/models/scenes.model.d.ts +2 -0
  277. package/dist/modules/scenes/models/scenes.model.js +10 -0
  278. package/dist/modules/scenes/models/scenes.model.js.map +1 -1
  279. package/dist/modules/scenes/services/scene-executor.service.d.ts +6 -1
  280. package/dist/modules/scenes/services/scene-executor.service.js +33 -22
  281. package/dist/modules/scenes/services/scene-executor.service.js.map +1 -1
  282. package/dist/modules/security/providers/alarm-security.provider.d.ts +3 -1
  283. package/dist/modules/security/providers/alarm-security.provider.js +83 -8
  284. package/dist/modules/security/providers/alarm-security.provider.js.map +1 -1
  285. package/dist/modules/spaces/services/space-lifecycle-registry.service.d.ts +19 -0
  286. package/dist/modules/spaces/services/space-lifecycle-registry.service.js +121 -0
  287. package/dist/modules/spaces/services/space-lifecycle-registry.service.js.map +1 -0
  288. package/dist/modules/spaces/services/spaces.service.d.ts +5 -1
  289. package/dist/modules/spaces/services/spaces.service.js +34 -6
  290. package/dist/modules/spaces/services/spaces.service.js.map +1 -1
  291. package/dist/modules/spaces/spaces.constants.d.ts +3 -1
  292. package/dist/modules/spaces/spaces.constants.js +2 -0
  293. package/dist/modules/spaces/spaces.constants.js.map +1 -1
  294. package/dist/modules/spaces/spaces.module.js +13 -1
  295. package/dist/modules/spaces/spaces.module.js.map +1 -1
  296. package/dist/modules/storage/services/storage.service.d.ts +8 -0
  297. package/dist/modules/storage/services/storage.service.js +225 -0
  298. package/dist/modules/storage/services/storage.service.js.map +1 -1
  299. package/dist/modules/swagger/decorators/api-documentation.decorator.d.ts +1 -0
  300. package/dist/modules/swagger/decorators/api-documentation.decorator.js +9 -1
  301. package/dist/modules/swagger/decorators/api-documentation.decorator.js.map +1 -1
  302. package/dist/modules/swagger/services/swagger-document.service.d.ts +1 -0
  303. package/dist/modules/swagger/services/swagger-document.service.js +71 -1
  304. package/dist/modules/swagger/services/swagger-document.service.js.map +1 -1
  305. package/dist/modules/system/services/backup.service.js +3 -5
  306. package/dist/modules/system/services/backup.service.js.map +1 -1
  307. package/dist/modules/system/utils/timezone.utils.d.ts +2 -0
  308. package/dist/modules/system/utils/timezone.utils.js +9 -0
  309. package/dist/modules/system/utils/timezone.utils.js.map +1 -0
  310. package/dist/modules/websocket/gateway/websocket.gateway.js +1 -0
  311. package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
  312. package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js +2 -0
  313. package/dist/plugins/devices-home-assistant/devices-home-assistant.plugin.js.map +1 -1
  314. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.d.ts +3 -3
  315. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js +3 -3
  316. package/dist/plugins/devices-home-assistant/dto/update-channel-property.dto.js.map +1 -1
  317. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.d.ts +11 -1
  318. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js +82 -2
  319. package/dist/plugins/devices-home-assistant/platforms/home-assistant.device.platform.js.map +1 -1
  320. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.d.ts +22 -0
  321. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js +409 -0
  322. package/dist/plugins/devices-home-assistant/services/home-assistant-native-climate.service.js.map +1 -0
  323. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.d.ts +14 -0
  324. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js +93 -3
  325. package/dist/plugins/devices-home-assistant/services/home-assistant.ws.service.js.map +1 -1
  326. package/dist/plugins/devices-homekit/devices-homekit.plugin.js +28 -2
  327. package/dist/plugins/devices-homekit/devices-homekit.plugin.js.map +1 -1
  328. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.d.ts +26 -3
  329. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js +183 -5
  330. package/dist/plugins/devices-homekit/listeners/homekit-event.listener.js.map +1 -1
  331. package/dist/plugins/devices-homekit/mappers/base.mapper.d.ts +2 -1
  332. package/dist/plugins/devices-homekit/mappers/base.mapper.js +38 -10
  333. package/dist/plugins/devices-homekit/mappers/base.mapper.js.map +1 -1
  334. package/dist/plugins/devices-homekit/mappers/battery.mapper.js +4 -3
  335. package/dist/plugins/devices-homekit/mappers/battery.mapper.js.map +1 -1
  336. package/dist/plugins/devices-homekit/mappers/button.mapper.js +21 -2
  337. package/dist/plugins/devices-homekit/mappers/button.mapper.js.map +1 -1
  338. package/dist/plugins/devices-homekit/mappers/characteristic-get.d.ts +3 -0
  339. package/dist/plugins/devices-homekit/mappers/characteristic-get.js +10 -0
  340. package/dist/plugins/devices-homekit/mappers/characteristic-get.js.map +1 -0
  341. package/dist/plugins/devices-homekit/mappers/characteristic-write.d.ts +1 -1
  342. package/dist/plugins/devices-homekit/mappers/characteristic-write.js +2 -1
  343. package/dist/plugins/devices-homekit/mappers/characteristic-write.js.map +1 -1
  344. package/dist/plugins/devices-homekit/mappers/fan.mapper.d.ts +12 -0
  345. package/dist/plugins/devices-homekit/mappers/fan.mapper.js +126 -0
  346. package/dist/plugins/devices-homekit/mappers/fan.mapper.js.map +1 -0
  347. package/dist/plugins/devices-homekit/mappers/homekit-mapper.interface.d.ts +8 -0
  348. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js +4 -0
  349. package/dist/plugins/devices-homekit/mappers/outlet.mapper.js.map +1 -1
  350. package/dist/plugins/devices-homekit/mappers/property-read.d.ts +7 -0
  351. package/dist/plugins/devices-homekit/mappers/property-read.js +64 -0
  352. package/dist/plugins/devices-homekit/mappers/property-read.js.map +1 -0
  353. package/dist/plugins/devices-homekit/mappers/semantic-conversion.d.ts +2 -0
  354. package/dist/plugins/devices-homekit/mappers/semantic-conversion.js +15 -0
  355. package/dist/plugins/devices-homekit/mappers/semantic-conversion.js.map +1 -0
  356. package/dist/plugins/devices-homekit/mappers/sensor.mapper.d.ts +3 -0
  357. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js +63 -11
  358. package/dist/plugins/devices-homekit/mappers/sensor.mapper.js.map +1 -1
  359. package/dist/plugins/devices-homekit/mappers/service-fault.d.ts +4 -0
  360. package/dist/plugins/devices-homekit/mappers/service-fault.js +33 -0
  361. package/dist/plugins/devices-homekit/mappers/service-fault.js.map +1 -0
  362. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.d.ts +4 -0
  363. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js +128 -19
  364. package/dist/plugins/devices-homekit/mappers/thermostat-coordinator.js.map +1 -1
  365. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js +5 -3
  366. package/dist/plugins/devices-homekit/mappers/thermostat.mapper.js.map +1 -1
  367. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.d.ts +3 -0
  368. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js +18 -0
  369. package/dist/plugins/devices-homekit/mappers/unavailable-characteristic.js.map +1 -0
  370. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js +19 -3
  371. package/dist/plugins/devices-homekit/mappers/window-covering.mapper.js.map +1 -1
  372. package/dist/plugins/devices-homekit/services/homekit-bridge.service.d.ts +4 -0
  373. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js +58 -29
  374. package/dist/plugins/devices-homekit/services/homekit-bridge.service.js.map +1 -1
  375. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.d.ts +2 -0
  376. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js +3 -0
  377. package/dist/plugins/devices-homekit/services/homekit-command.dispatcher.js.map +1 -1
  378. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.d.ts +30 -2
  379. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js +126 -2
  380. package/dist/plugins/devices-homekit/services/homekit-mapper-registry.service.js.map +1 -1
  381. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.d.ts +8 -0
  382. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js +17 -0
  383. package/dist/plugins/devices-homekit/services/homekit-mapping-maintenance.js.map +1 -0
  384. package/dist/plugins/devices-homekit/services/homekit-property-state.service.d.ts +19 -0
  385. package/dist/plugins/devices-homekit/services/homekit-property-state.service.js +69 -0
  386. package/dist/plugins/devices-homekit/services/homekit-property-state.service.js.map +1 -0
  387. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.d.ts +13 -0
  388. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js +60 -0
  389. package/dist/plugins/devices-shelly-ng/contracts/cover-action.contract.js.map +1 -0
  390. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.d.ts +13 -0
  391. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js +3 -0
  392. package/dist/plugins/devices-shelly-ng/contracts/cover-recovery.contract.js.map +1 -0
  393. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.d.ts +1 -0
  394. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js +5 -0
  395. package/dist/plugins/devices-shelly-ng/contracts/guard-script-source.js.map +1 -0
  396. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.d.ts +21 -0
  397. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js +47 -0
  398. package/dist/plugins/devices-shelly-ng/contracts/guard-script.contract.js.map +1 -0
  399. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.d.ts +2 -0
  400. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js +27 -0
  401. package/dist/plugins/devices-shelly-ng/contracts/member-guard-script-source.js.map +1 -0
  402. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.d.ts +36 -0
  403. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js +200 -0
  404. package/dist/plugins/devices-shelly-ng/contracts/native-temperature.contract.js.map +1 -0
  405. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.d.ts +44 -0
  406. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js +29 -0
  407. package/dist/plugins/devices-shelly-ng/contracts/protective-switch.contract.js.map +1 -0
  408. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.d.ts +11 -0
  409. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js +98 -0
  410. package/dist/plugins/devices-shelly-ng/controllers/shelly-cover-recovery.controller.js.map +1 -0
  411. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.d.ts +51 -1
  412. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js +688 -2
  413. package/dist/plugins/devices-shelly-ng/delegates/delegates-manager.service.js.map +1 -1
  414. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.d.ts +46 -1
  415. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js +315 -4
  416. package/dist/plugins/devices-shelly-ng/delegates/shelly-device.delegate.js.map +1 -1
  417. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.d.ts +3 -1
  418. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js +8 -0
  419. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.openapi.js.map +1 -1
  420. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js +16 -1
  421. package/dist/plugins/devices-shelly-ng/devices-shelly-ng.plugin.js.map +1 -1
  422. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.d.ts +11 -0
  423. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js +77 -0
  424. package/dist/plugins/devices-shelly-ng/dto/cover-recovery.dto.js.map +1 -0
  425. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.d.ts +5 -0
  426. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js +32 -0
  427. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-ordering.entity.js.map +1 -0
  428. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.d.ts +17 -0
  429. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js +80 -0
  430. package/dist/plugins/devices-shelly-ng/entities/shelly-cover-recovery.entity.js.map +1 -0
  431. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.d.ts +16 -0
  432. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js +70 -0
  433. package/dist/plugins/devices-shelly-ng/entities/shelly-sample-source.entity.js.map +1 -0
  434. package/dist/plugins/devices-shelly-ng/mappings/definitions/covers.yaml +30 -24
  435. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.d.ts +21 -0
  436. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js +114 -0
  437. package/dist/plugins/devices-shelly-ng/models/cover-recovery.model.js.map +1 -0
  438. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.d.ts +27 -1
  439. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js +146 -0
  440. package/dist/plugins/devices-shelly-ng/platforms/shelly-ng.device.platform.js.map +1 -1
  441. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.d.ts +16 -0
  442. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js +154 -0
  443. package/dist/plugins/devices-shelly-ng/services/authenticated-shelly-script-http.js.map +1 -0
  444. package/dist/plugins/devices-shelly-ng/services/device-manager.service.d.ts +4 -1
  445. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js +113 -4
  446. package/dist/plugins/devices-shelly-ng/services/device-manager.service.js.map +1 -1
  447. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.d.ts +2 -0
  448. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js +78 -0
  449. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-http.js.map +1 -0
  450. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.d.ts +9 -0
  451. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js +56 -0
  452. package/dist/plugins/devices-shelly-ng/services/guarded-shelly-rpc.js.map +1 -0
  453. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.d.ts +45 -0
  454. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js +278 -0
  455. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-artifact.js.map +1 -0
  456. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.d.ts +49 -0
  457. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js +32 -0
  458. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-lease.contract.js.map +1 -0
  459. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.d.ts +53 -0
  460. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js +91 -0
  461. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-qualification.js.map +1 -0
  462. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.d.ts +35 -0
  463. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js +244 -0
  464. package/dist/plugins/devices-shelly-ng/services/remote-dew-point-session.js.map +1 -0
  465. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.d.ts +9 -0
  466. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js +50 -0
  467. package/dist/plugins/devices-shelly-ng/services/shelly-cover-ordering.service.js.map +1 -0
  468. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.d.ts +29 -0
  469. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js +166 -0
  470. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery-lane.service.js.map +1 -0
  471. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.d.ts +21 -0
  472. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js +207 -0
  473. package/dist/plugins/devices-shelly-ng/services/shelly-cover-recovery.service.js.map +1 -0
  474. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.d.ts +25 -0
  475. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js +132 -0
  476. package/dist/plugins/devices-shelly-ng/services/shelly-cover-session.js.map +1 -0
  477. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.d.ts +9 -0
  478. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js +63 -0
  479. package/dist/plugins/devices-shelly-ng/services/shelly-cover-telemetry.js.map +1 -0
  480. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.d.ts +33 -0
  481. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js +191 -0
  482. package/dist/plugins/devices-shelly-ng/services/shelly-guard-rpc-session.js.map +1 -0
  483. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.d.ts +3 -0
  484. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js +32 -4
  485. package/dist/plugins/devices-shelly-ng/services/shelly-ng.service.js.map +1 -1
  486. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.d.ts +34 -0
  487. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js +194 -0
  488. package/dist/plugins/devices-shelly-ng/services/shelly-sample-sources.service.js.map +1 -0
  489. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js +5 -2
  490. package/dist/plugins/devices-shelly-ng/services/shelly-ws-server.service.js.map +1 -1
  491. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.d.ts +4 -0
  492. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js +3 -0
  493. package/dist/plugins/devices-shelly-v1/platforms/shelly-v1.device.platform.js.map +1 -1
  494. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.d.ts +114 -0
  495. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js +12 -0
  496. package/dist/plugins/devices-virtual/contracts/thermostat-actuation.contract.js.map +1 -0
  497. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.d.ts +4 -0
  498. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js +3 -0
  499. package/dist/plugins/devices-virtual/contracts/thermostat-command.contract.js.map +1 -0
  500. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.d.ts +15 -0
  501. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js +178 -0
  502. package/dist/plugins/devices-virtual/controllers/native-thermostat.controller.js.map +1 -0
  503. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.d.ts +11 -0
  504. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js +92 -0
  505. package/dist/plugins/devices-virtual/controllers/thermostat-authoring-context.controller.js.map +1 -0
  506. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.d.ts +16 -0
  507. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js +179 -0
  508. package/dist/plugins/devices-virtual/controllers/thermostat-installation.controller.js.map +1 -0
  509. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.d.ts +11 -0
  510. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js +100 -0
  511. package/dist/plugins/devices-virtual/controllers/virtual-dew-point-config.controller.js.map +1 -0
  512. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.d.ts +19 -0
  513. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js +168 -0
  514. package/dist/plugins/devices-virtual/controllers/virtual-measurement-authoring.controller.js.map +1 -0
  515. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.d.ts +28 -0
  516. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js +278 -0
  517. package/dist/plugins/devices-virtual/controllers/virtual-producer-config.controller.js.map +1 -0
  518. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.d.ts +12 -0
  519. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js +111 -0
  520. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-authoring.controller.js.map +1 -0
  521. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.d.ts +14 -0
  522. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js +160 -0
  523. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-comfort.controller.js.map +1 -0
  524. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.d.ts +18 -0
  525. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js +196 -0
  526. package/dist/plugins/devices-virtual/controllers/virtual-thermostat-config.controller.js.map +1 -0
  527. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.d.ts +14 -0
  528. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js +128 -0
  529. package/dist/plugins/devices-virtual/controllers/virtual-transform-config.controller.js.map +1 -0
  530. package/dist/plugins/devices-virtual/devices-virtual.constants.d.ts +1 -0
  531. package/dist/plugins/devices-virtual/devices-virtual.constants.js +2 -1
  532. package/dist/plugins/devices-virtual/devices-virtual.constants.js.map +1 -1
  533. package/dist/plugins/devices-virtual/devices-virtual.openapi.d.ts +24 -2
  534. package/dist/plugins/devices-virtual/devices-virtual.openapi.js +95 -0
  535. package/dist/plugins/devices-virtual/devices-virtual.openapi.js.map +1 -1
  536. package/dist/plugins/devices-virtual/devices-virtual.plugin.d.ts +7 -1
  537. package/dist/plugins/devices-virtual/devices-virtual.plugin.js +167 -10
  538. package/dist/plugins/devices-virtual/devices-virtual.plugin.js.map +1 -1
  539. package/dist/plugins/devices-virtual/dto/create-device.dto.d.ts +2 -0
  540. package/dist/plugins/devices-virtual/dto/create-device.dto.js +20 -0
  541. package/dist/plugins/devices-virtual/dto/create-device.dto.js.map +1 -1
  542. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.d.ts +14 -0
  543. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js +119 -0
  544. package/dist/plugins/devices-virtual/dto/dew-point-config.dto.js.map +1 -0
  545. package/dist/plugins/devices-virtual/dto/group-catalog.dto.d.ts +8 -0
  546. package/dist/plugins/devices-virtual/dto/group-catalog.dto.js +62 -0
  547. package/dist/plugins/devices-virtual/dto/group-catalog.dto.js.map +1 -0
  548. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.d.ts +19 -0
  549. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js +108 -0
  550. package/dist/plugins/devices-virtual/dto/light-group-draft.dto.js.map +1 -0
  551. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.d.ts +25 -0
  552. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js +157 -0
  553. package/dist/plugins/devices-virtual/dto/measurement-authoring.dto.js.map +1 -0
  554. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.d.ts +21 -0
  555. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js +122 -0
  556. package/dist/plugins/devices-virtual/dto/native-thermostat.dto.js.map +1 -0
  557. package/dist/plugins/devices-virtual/dto/producer-config.dto.d.ts +35 -0
  558. package/dist/plugins/devices-virtual/dto/producer-config.dto.js +290 -0
  559. package/dist/plugins/devices-virtual/dto/producer-config.dto.js.map +1 -0
  560. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.d.ts +6 -0
  561. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js +46 -0
  562. package/dist/plugins/devices-virtual/dto/thermostat-authoring.dto.js.map +1 -0
  563. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.d.ts +39 -0
  564. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js +244 -0
  565. package/dist/plugins/devices-virtual/dto/thermostat-comfort.dto.js.map +1 -0
  566. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.d.ts +94 -0
  567. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js +718 -0
  568. package/dist/plugins/devices-virtual/dto/thermostat-config.dto.js.map +1 -0
  569. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.d.ts +71 -0
  570. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js +410 -0
  571. package/dist/plugins/devices-virtual/dto/thermostat-installation.dto.js.map +1 -0
  572. package/dist/plugins/devices-virtual/dto/transform-config.dto.d.ts +71 -0
  573. package/dist/plugins/devices-virtual/dto/transform-config.dto.js +430 -0
  574. package/dist/plugins/devices-virtual/dto/transform-config.dto.js.map +1 -0
  575. package/dist/plugins/devices-virtual/dto/update-device.dto.d.ts +2 -0
  576. package/dist/plugins/devices-virtual/dto/update-device.dto.js +20 -0
  577. package/dist/plugins/devices-virtual/dto/update-device.dto.js.map +1 -1
  578. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.d.ts +13 -1
  579. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js +56 -6
  580. package/dist/plugins/devices-virtual/entities/devices-virtual.entity.js.map +1 -1
  581. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.d.ts +23 -0
  582. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js +103 -0
  583. package/dist/plugins/devices-virtual/entities/native-thermostat.entity.js.map +1 -0
  584. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.d.ts +19 -0
  585. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js +87 -0
  586. package/dist/plugins/devices-virtual/entities/thermostat-cooling-dependency.entity.js.map +1 -0
  587. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.d.ts +36 -0
  588. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js +125 -0
  589. package/dist/plugins/devices-virtual/entities/thermostat-installation.entity.js.map +1 -0
  590. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.d.ts +15 -0
  591. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js +70 -0
  592. package/dist/plugins/devices-virtual/entities/thermostat-member-protection.entity.js.map +1 -0
  593. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.d.ts +7 -0
  594. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js +39 -0
  595. package/dist/plugins/devices-virtual/entities/thermostat-override-clock.entity.js.map +1 -0
  596. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.d.ts +28 -0
  597. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js +104 -0
  598. package/dist/plugins/devices-virtual/entities/virtual-dew-point.entity.js.map +1 -0
  599. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.d.ts +89 -0
  600. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js +281 -0
  601. package/dist/plugins/devices-virtual/entities/virtual-producer.entity.js.map +1 -0
  602. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.d.ts +45 -0
  603. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js +184 -0
  604. package/dist/plugins/devices-virtual/entities/virtual-thermostat-runtime.entity.js.map +1 -0
  605. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.d.ts +86 -0
  606. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js +337 -0
  607. package/dist/plugins/devices-virtual/entities/virtual-thermostat.entity.js.map +1 -0
  608. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.d.ts +23 -0
  609. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js +101 -0
  610. package/dist/plugins/devices-virtual/entities/virtual-transform.entity.js.map +1 -0
  611. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.d.ts +5 -0
  612. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js +65 -22
  613. package/dist/plugins/devices-virtual/listeners/virtual-device-information.listener.js.map +1 -1
  614. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.d.ts +8 -1
  615. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js +123 -32
  616. package/dist/plugins/devices-virtual/listeners/virtual-index-maintenance.listener.js.map +1 -1
  617. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.d.ts +3 -0
  618. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js +41 -3
  619. package/dist/plugins/devices-virtual/listeners/virtual-projection.listener.js.map +1 -1
  620. package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js +28 -15
  621. package/dist/plugins/devices-virtual/listeners/virtual-status.listener.js.map +1 -1
  622. package/dist/plugins/devices-virtual/models/dew-point-response.model.d.ts +38 -0
  623. package/dist/plugins/devices-virtual/models/dew-point-response.model.js +193 -0
  624. package/dist/plugins/devices-virtual/models/dew-point-response.model.js.map +1 -0
  625. package/dist/plugins/devices-virtual/models/group-catalog.model.d.ts +26 -0
  626. package/dist/plugins/devices-virtual/models/group-catalog.model.js +117 -0
  627. package/dist/plugins/devices-virtual/models/group-catalog.model.js.map +1 -0
  628. package/dist/plugins/devices-virtual/models/light-group-draft.model.d.ts +28 -0
  629. package/dist/plugins/devices-virtual/models/light-group-draft.model.js +122 -0
  630. package/dist/plugins/devices-virtual/models/light-group-draft.model.js.map +1 -0
  631. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.d.ts +26 -0
  632. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js +125 -0
  633. package/dist/plugins/devices-virtual/models/measurement-authoring-response.model.js.map +1 -0
  634. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.d.ts +84 -0
  635. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js +406 -0
  636. package/dist/plugins/devices-virtual/models/native-thermostat-response.model.js.map +1 -0
  637. package/dist/plugins/devices-virtual/models/numeric-operator.model.d.ts +23 -0
  638. package/dist/plugins/devices-virtual/models/numeric-operator.model.js +120 -0
  639. package/dist/plugins/devices-virtual/models/numeric-operator.model.js.map +1 -0
  640. package/dist/plugins/devices-virtual/models/producer-response.model.d.ts +138 -0
  641. package/dist/plugins/devices-virtual/models/producer-response.model.js +764 -0
  642. package/dist/plugins/devices-virtual/models/producer-response.model.js.map +1 -0
  643. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.d.ts +22 -0
  644. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js +134 -0
  645. package/dist/plugins/devices-virtual/models/thermostat-authoring-context.model.js.map +1 -0
  646. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.d.ts +18 -0
  647. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js +87 -0
  648. package/dist/plugins/devices-virtual/models/thermostat-authoring-response.model.js.map +1 -0
  649. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.d.ts +60 -0
  650. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js +341 -0
  651. package/dist/plugins/devices-virtual/models/thermostat-comfort-response.model.js.map +1 -0
  652. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.d.ts +84 -0
  653. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js +440 -0
  654. package/dist/plugins/devices-virtual/models/thermostat-installation-response.model.js.map +1 -0
  655. package/dist/plugins/devices-virtual/models/thermostat-response.model.d.ts +218 -0
  656. package/dist/plugins/devices-virtual/models/thermostat-response.model.js +1157 -0
  657. package/dist/plugins/devices-virtual/models/thermostat-response.model.js.map +1 -0
  658. package/dist/plugins/devices-virtual/models/transform-response.model.d.ts +73 -0
  659. package/dist/plugins/devices-virtual/models/transform-response.model.js +386 -0
  660. package/dist/plugins/devices-virtual/models/transform-response.model.js.map +1 -0
  661. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.d.ts +5 -1
  662. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js +22 -3
  663. package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js.map +1 -1
  664. package/dist/plugins/devices-virtual/services/native-thermostat.service.d.ts +72 -0
  665. package/dist/plugins/devices-virtual/services/native-thermostat.service.js +932 -0
  666. package/dist/plugins/devices-virtual/services/native-thermostat.service.js.map +1 -0
  667. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.d.ts +14 -0
  668. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js +147 -0
  669. package/dist/plugins/devices-virtual/services/thermostat-authoring-context.service.js.map +1 -0
  670. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.d.ts +199 -0
  671. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js +1064 -0
  672. package/dist/plugins/devices-virtual/services/thermostat-comfort-selection.js.map +1 -0
  673. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.d.ts +75 -0
  674. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js +445 -0
  675. package/dist/plugins/devices-virtual/services/thermostat-controller-mutation.js.map +1 -0
  676. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.d.ts +53 -0
  677. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js +267 -0
  678. package/dist/plugins/devices-virtual/services/thermostat-cooling-dependency.service.js.map +1 -0
  679. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.d.ts +56 -0
  680. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js +438 -0
  681. package/dist/plugins/devices-virtual/services/thermostat-creation-catalog.js.map +1 -0
  682. package/dist/plugins/devices-virtual/services/thermostat-creation-response.d.ts +37 -0
  683. package/dist/plugins/devices-virtual/services/thermostat-creation-response.js +430 -0
  684. package/dist/plugins/devices-virtual/services/thermostat-creation-response.js.map +1 -0
  685. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.d.ts +13 -0
  686. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js +263 -0
  687. package/dist/plugins/devices-virtual/services/thermostat-installation-artifact.js.map +1 -0
  688. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.d.ts +10 -0
  689. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js +238 -0
  690. package/dist/plugins/devices-virtual/services/thermostat-installation-bindings.service.js.map +1 -0
  691. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.d.ts +41 -0
  692. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js +350 -0
  693. package/dist/plugins/devices-virtual/services/thermostat-installation-loader.service.js.map +1 -0
  694. package/dist/plugins/devices-virtual/services/thermostat-installation.service.d.ts +40 -0
  695. package/dist/plugins/devices-virtual/services/thermostat-installation.service.js +263 -0
  696. package/dist/plugins/devices-virtual/services/thermostat-installation.service.js.map +1 -0
  697. package/dist/plugins/devices-virtual/services/thermostat-installation.types.d.ts +72 -0
  698. package/dist/plugins/devices-virtual/services/thermostat-installation.types.js +13 -0
  699. package/dist/plugins/devices-virtual/services/thermostat-installation.types.js.map +1 -0
  700. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.d.ts +45 -0
  701. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js +235 -0
  702. package/dist/plugins/devices-virtual/services/thermostat-member-protection.service.js.map +1 -0
  703. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.d.ts +1 -0
  704. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js +16 -0
  705. package/dist/plugins/devices-virtual/services/thermostat-override-clock.sql.js.map +1 -0
  706. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.d.ts +27 -0
  707. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js +132 -0
  708. package/dist/plugins/devices-virtual/services/thermostat-protection-source.utils.js.map +1 -0
  709. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.d.ts +88 -0
  710. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js +200 -0
  711. package/dist/plugins/devices-virtual/services/thermostat-remote-cooling-adapter.js.map +1 -0
  712. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.d.ts +35 -0
  713. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js +200 -0
  714. package/dist/plugins/devices-virtual/services/virtual-aggregate-evaluator.js.map +1 -0
  715. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.d.ts +5 -0
  716. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js +18 -0
  717. package/dist/plugins/devices-virtual/services/virtual-aggregate-policy.utils.js.map +1 -0
  718. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.d.ts +48 -0
  719. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js +425 -0
  720. package/dist/plugins/devices-virtual/services/virtual-aggregate-runtime.service.js.map +1 -0
  721. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.d.ts +13 -0
  722. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js +38 -0
  723. package/dist/plugins/devices-virtual/services/virtual-cooling-policy.utils.js.map +1 -0
  724. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.d.ts +7 -0
  725. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js +41 -0
  726. package/dist/plugins/devices-virtual/services/virtual-cover-contract.utils.js.map +1 -0
  727. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.d.ts +16 -0
  728. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js +42 -0
  729. package/dist/plugins/devices-virtual/services/virtual-cover-readiness.utils.js.map +1 -0
  730. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.d.ts +118 -0
  731. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js +667 -0
  732. package/dist/plugins/devices-virtual/services/virtual-dependency-graph.service.js.map +1 -0
  733. package/dist/plugins/devices-virtual/services/virtual-devices.service.d.ts +8 -4
  734. package/dist/plugins/devices-virtual/services/virtual-devices.service.js +105 -22
  735. package/dist/plugins/devices-virtual/services/virtual-devices.service.js.map +1 -1
  736. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.d.ts +28 -0
  737. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js +193 -0
  738. package/dist/plugins/devices-virtual/services/virtual-dew-point-config.service.js.map +1 -0
  739. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.d.ts +5 -0
  740. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js +69 -0
  741. package/dist/plugins/devices-virtual/services/virtual-dew-point-contract.utils.js.map +1 -0
  742. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.d.ts +65 -0
  743. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js +524 -0
  744. package/dist/plugins/devices-virtual/services/virtual-dew-point-runtime.service.js.map +1 -0
  745. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.d.ts +9 -0
  746. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js +25 -0
  747. package/dist/plugins/devices-virtual/services/virtual-dew-point.utils.js.map +1 -0
  748. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.d.ts +10 -0
  749. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js +117 -0
  750. package/dist/plugins/devices-virtual/services/virtual-group-catalog.service.js.map +1 -0
  751. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.d.ts +4 -0
  752. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js +35 -0
  753. package/dist/plugins/devices-virtual/services/virtual-group-contract.utils.js.map +1 -0
  754. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.d.ts +10 -0
  755. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js +35 -0
  756. package/dist/plugins/devices-virtual/services/virtual-group-field.utils.js.map +1 -0
  757. package/dist/plugins/devices-virtual/services/virtual-group-profile.d.ts +19 -0
  758. package/dist/plugins/devices-virtual/services/virtual-group-profile.js +137 -0
  759. package/dist/plugins/devices-virtual/services/virtual-group-profile.js.map +1 -0
  760. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.d.ts +43 -0
  761. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js +217 -0
  762. package/dist/plugins/devices-virtual/services/virtual-light-group-authoring.service.js.map +1 -0
  763. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.d.ts +28 -0
  764. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js +262 -0
  765. package/dist/plugins/devices-virtual/services/virtual-light-group-command.service.js.map +1 -0
  766. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.d.ts +19 -0
  767. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js +91 -0
  768. package/dist/plugins/devices-virtual/services/virtual-light-group-contribution.service.js.map +1 -0
  769. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.d.ts +37 -0
  770. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js +346 -0
  771. package/dist/plugins/devices-virtual/services/virtual-light-group-state.service.js.map +1 -0
  772. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.d.ts +46 -0
  773. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js +204 -0
  774. package/dist/plugins/devices-virtual/services/virtual-light-group.utils.js.map +1 -0
  775. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.d.ts +37 -0
  776. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js +270 -0
  777. package/dist/plugins/devices-virtual/services/virtual-measurement-authoring.service.js.map +1 -0
  778. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.d.ts +21 -0
  779. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js +166 -0
  780. package/dist/plugins/devices-virtual/services/virtual-measurement-contribution.service.js.map +1 -0
  781. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.d.ts +3 -0
  782. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js +25 -0
  783. package/dist/plugins/devices-virtual/services/virtual-measurement-metadata.utils.js.map +1 -0
  784. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.d.ts +24 -0
  785. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js +145 -0
  786. package/dist/plugins/devices-virtual/services/virtual-numeric-operator-host.service.js.map +1 -0
  787. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.d.ts +18 -0
  788. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js +86 -0
  789. package/dist/plugins/devices-virtual/services/virtual-numeric-operator.registry.js.map +1 -0
  790. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.d.ts +29 -0
  791. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js +136 -0
  792. package/dist/plugins/devices-virtual/services/virtual-numeric-profile.utils.js.map +1 -0
  793. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.d.ts +59 -0
  794. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js +165 -0
  795. package/dist/plugins/devices-virtual/services/virtual-numeric-transform.utils.js.map +1 -0
  796. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.d.ts +64 -0
  797. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js +694 -0
  798. package/dist/plugins/devices-virtual/services/virtual-producer-config.service.js.map +1 -0
  799. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.d.ts +60 -0
  800. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js +484 -0
  801. package/dist/plugins/devices-virtual/services/virtual-producer-state.service.js.map +1 -0
  802. package/dist/plugins/devices-virtual/services/virtual-property-index.service.d.ts +11 -2
  803. package/dist/plugins/devices-virtual/services/virtual-property-index.service.js +166 -13
  804. package/dist/plugins/devices-virtual/services/virtual-property-index.service.js.map +1 -1
  805. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.d.ts +3 -0
  806. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js +10 -0
  807. package/dist/plugins/devices-virtual/services/virtual-source-eligibility.utils.js.map +1 -0
  808. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.d.ts +27 -0
  809. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js +385 -0
  810. package/dist/plugins/devices-virtual/services/virtual-thermostat-authoring.service.js.map +1 -0
  811. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.d.ts +90 -0
  812. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js +1189 -0
  813. package/dist/plugins/devices-virtual/services/virtual-thermostat-automation.service.js.map +1 -0
  814. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.d.ts +5 -0
  815. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js +29 -0
  816. package/dist/plugins/devices-virtual/services/virtual-thermostat-branch.utils.js.map +1 -0
  817. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.d.ts +80 -0
  818. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js +489 -0
  819. package/dist/plugins/devices-virtual/services/virtual-thermostat-claims.service.js.map +1 -0
  820. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.d.ts +80 -0
  821. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js +580 -0
  822. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.service.js.map +1 -0
  823. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.d.ts +58 -0
  824. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js +106 -0
  825. package/dist/plugins/devices-virtual/services/virtual-thermostat-comfort.utils.js.map +1 -0
  826. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.d.ts +909 -0
  827. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js +1171 -0
  828. package/dist/plugins/devices-virtual/services/virtual-thermostat-config.service.js.map +1 -0
  829. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.d.ts +5 -0
  830. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js +51 -0
  831. package/dist/plugins/devices-virtual/services/virtual-thermostat-contract.utils.js.map +1 -0
  832. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.d.ts +46 -0
  833. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js +166 -0
  834. package/dist/plugins/devices-virtual/services/virtual-thermostat-inputs.service.js.map +1 -0
  835. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.d.ts +4 -0
  836. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js +59 -0
  837. package/dist/plugins/devices-virtual/services/virtual-thermostat-ownership.sql.js.map +1 -0
  838. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.d.ts +45 -0
  839. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js +149 -0
  840. package/dist/plugins/devices-virtual/services/virtual-thermostat-policy.utils.js.map +1 -0
  841. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.d.ts +56 -0
  842. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js +680 -0
  843. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime-ownership.js.map +1 -0
  844. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.d.ts +133 -0
  845. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js +1617 -0
  846. package/dist/plugins/devices-virtual/services/virtual-thermostat-runtime.service.js.map +1 -0
  847. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.d.ts +39 -0
  848. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js +561 -0
  849. package/dist/plugins/devices-virtual/services/virtual-thermostat-transport.service.js.map +1 -0
  850. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.d.ts +41 -0
  851. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js +209 -0
  852. package/dist/plugins/devices-virtual/services/virtual-transform-config.service.js.map +1 -0
  853. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.d.ts +8 -0
  854. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js +103 -0
  855. package/dist/plugins/devices-virtual/services/virtual-transform-contract.utils.js.map +1 -0
  856. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.d.ts +3 -0
  857. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js +18 -0
  858. package/dist/plugins/devices-virtual/services/virtual-transform-preview.utils.js.map +1 -0
  859. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.d.ts +15 -0
  860. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js +102 -0
  861. package/dist/plugins/devices-virtual/services/virtual-transform-resolver.js.map +1 -0
  862. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.d.ts +54 -0
  863. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js +470 -0
  864. package/dist/plugins/devices-virtual/services/virtual-transform-runtime.service.js.map +1 -0
  865. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.d.ts +6 -0
  866. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js +100 -0
  867. package/dist/plugins/devices-virtual/services/virtual-typed-group.utils.js.map +1 -0
  868. package/dist/plugins/devices-virtual/services/virtual-value-source.service.d.ts +7 -0
  869. package/dist/plugins/devices-virtual/services/virtual-value-source.service.js +36 -2
  870. package/dist/plugins/devices-virtual/services/virtual-value-source.service.js.map +1 -1
  871. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.d.ts +17 -0
  872. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js +52 -0
  873. package/dist/plugins/devices-virtual/services/virtual-window-contact.utils.js.map +1 -0
  874. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.d.ts +44 -0
  875. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js +171 -0
  876. package/dist/plugins/devices-virtual/services/virtual-window-trend.utils.js.map +1 -0
  877. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.d.ts +30 -0
  878. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js +195 -0
  879. package/dist/plugins/devices-virtual/subscribers/virtual-thermostat-ownership.subscriber.js.map +1 -0
  880. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.d.ts +9 -0
  881. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js +58 -0
  882. package/dist/plugins/devices-virtual/subscribers/virtual-transform-metadata.subscriber.js.map +1 -0
  883. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.d.ts +1 -1
  884. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js +6 -1
  885. package/dist/plugins/devices-virtual/validators/category-allowed-constraint.validator.js.map +1 -1
  886. package/dist/plugins/devices-wled/interfaces/wled.interface.d.ts +7 -0
  887. package/dist/plugins/devices-wled/interfaces/wled.interface.js.map +1 -1
  888. package/dist/plugins/devices-wled/platforms/wled.device.platform.d.ts +4 -2
  889. package/dist/plugins/devices-wled/platforms/wled.device.platform.js +56 -9
  890. package/dist/plugins/devices-wled/platforms/wled.device.platform.js.map +1 -1
  891. package/dist/plugins/devices-wled/services/device-mapper.service.d.ts +3 -2
  892. package/dist/plugins/devices-wled/services/device-mapper.service.js +48 -1
  893. package/dist/plugins/devices-wled/services/device-mapper.service.js.map +1 -1
  894. package/dist/plugins/devices-wled/services/wled-client-adapter.service.d.ts +6 -1
  895. package/dist/plugins/devices-wled/services/wled-client-adapter.service.js +101 -13
  896. package/dist/plugins/devices-wled/services/wled-client-adapter.service.js.map +1 -1
  897. package/dist/plugins/devices-wled/services/wled.service.js +5 -2
  898. package/dist/plugins/devices-wled/services/wled.service.js.map +1 -1
  899. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.d.ts +38 -0
  900. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js +95 -0
  901. package/dist/plugins/devices-zigbee2mqtt/contracts/sample-source.contract.js.map +1 -0
  902. package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js +11 -1
  903. package/dist/plugins/devices-zigbee2mqtt/devices-zigbee2mqtt.plugin.js.map +1 -1
  904. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.d.ts +18 -0
  905. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js +79 -0
  906. package/dist/plugins/devices-zigbee2mqtt/entities/zigbee-sample-source.entity.js.map +1 -0
  907. package/dist/plugins/devices-zigbee2mqtt/interfaces/zigbee2mqtt.interface.d.ts +11 -0
  908. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.d.ts +11 -2
  909. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js +100 -11
  910. package/dist/plugins/devices-zigbee2mqtt/platforms/zigbee2mqtt.device.platform.js.map +1 -1
  911. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.d.ts +31 -13
  912. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js +166 -5
  913. package/dist/plugins/devices-zigbee2mqtt/services/base-client-adapter.js.map +1 -1
  914. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.d.ts +1 -0
  915. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js +44 -3
  916. package/dist/plugins/devices-zigbee2mqtt/services/device-adoption.service.js.map +1 -1
  917. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.d.ts +20 -3
  918. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js +156 -34
  919. package/dist/plugins/devices-zigbee2mqtt/services/device-mapper.service.js.map +1 -1
  920. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.d.ts +1 -1
  921. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js +14 -1
  922. package/dist/plugins/devices-zigbee2mqtt/services/mqtt-client-adapter.service.js.map +1 -1
  923. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.d.ts +15 -0
  924. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js +249 -0
  925. package/dist/plugins/devices-zigbee2mqtt/services/native-climate-adapter.service.js.map +1 -0
  926. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.d.ts +2 -0
  927. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js +15 -0
  928. package/dist/plugins/devices-zigbee2mqtt/services/websocket-sample-evidence.js.map +1 -0
  929. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.d.ts +7 -1
  930. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js +45 -2
  931. package/dist/plugins/devices-zigbee2mqtt/services/ws-client-adapter.service.js.map +1 -1
  932. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.d.ts +49 -0
  933. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js +264 -0
  934. package/dist/plugins/devices-zigbee2mqtt/services/zigbee-sample-sources.service.js.map +1 -0
  935. package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js +2 -0
  936. package/dist/plugins/devices-zigbee2mqtt/services/zigbee2mqtt.service.js.map +1 -1
  937. package/dist/plugins/scenes-local/platforms/local-scene.platform.d.ts +6 -3
  938. package/dist/plugins/scenes-local/platforms/local-scene.platform.js +101 -15
  939. package/dist/plugins/scenes-local/platforms/local-scene.platform.js.map +1 -1
  940. package/dist/plugins/spaces-home-control/activity/activity-actor.d.ts +2 -0
  941. package/dist/plugins/spaces-home-control/activity/activity-actor.js +14 -0
  942. package/dist/plugins/spaces-home-control/activity/activity-actor.js.map +1 -0
  943. package/dist/plugins/spaces-home-control/activity/activity-result.utils.d.ts +6 -0
  944. package/dist/plugins/spaces-home-control/activity/activity-result.utils.js +26 -0
  945. package/dist/plugins/spaces-home-control/activity/activity-result.utils.js.map +1 -0
  946. package/dist/plugins/spaces-home-control/activity/space-activity.constants.d.ts +32 -0
  947. package/dist/plugins/spaces-home-control/activity/space-activity.constants.js +40 -0
  948. package/dist/plugins/spaces-home-control/activity/space-activity.constants.js.map +1 -0
  949. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.d.ts +3 -0
  950. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js +25 -0
  951. package/dist/plugins/spaces-home-control/activity/space-activity.defaults.js.map +1 -0
  952. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.d.ts +2 -0
  953. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js +37 -0
  954. package/dist/plugins/spaces-home-control/activity/validate-activity-configuration.js.map +1 -0
  955. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.d.ts +12 -0
  956. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js +97 -0
  957. package/dist/plugins/spaces-home-control/controllers/space-mode-schedules.controller.js.map +1 -0
  958. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.d.ts +19 -0
  959. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js +220 -0
  960. package/dist/plugins/spaces-home-control/controllers/space-modes.controller.js.map +1 -0
  961. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.d.ts +18 -0
  962. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js +147 -0
  963. package/dist/plugins/spaces-home-control/controllers/space-occupancy.controller.js.map +1 -0
  964. package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js +4 -0
  965. package/dist/plugins/spaces-home-control/controllers/spaces-domain.controller.js.map +1 -1
  966. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.d.ts +22 -0
  967. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js +119 -0
  968. package/dist/plugins/spaces-home-control/dto/activity-mode.dto.js.map +1 -0
  969. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.d.ts +18 -0
  970. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js +127 -0
  971. package/dist/plugins/spaces-home-control/dto/space-mode-schedule.dto.js.map +1 -0
  972. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.d.ts +13 -0
  973. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js +99 -0
  974. package/dist/plugins/spaces-home-control/dto/space-occupancy.dto.js.map +1 -0
  975. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.d.ts +12 -0
  976. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js +72 -0
  977. package/dist/plugins/spaces-home-control/entities/space-activity-config.entity.js.map +1 -0
  978. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.d.ts +14 -0
  979. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js +105 -0
  980. package/dist/plugins/spaces-home-control/entities/space-activity-state.entity.js.map +1 -0
  981. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.d.ts +19 -0
  982. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js +110 -0
  983. package/dist/plugins/spaces-home-control/entities/space-mode-schedule.entity.js.map +1 -0
  984. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.d.ts +23 -0
  985. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js +135 -0
  986. package/dist/plugins/spaces-home-control/entities/space-occupancy.entity.js.map +1 -0
  987. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.d.ts +2 -0
  988. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js +23 -0
  989. package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js.map +1 -1
  990. package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js +3 -0
  991. package/dist/plugins/spaces-home-control/listeners/websocket-exchange.listener.js.map +1 -1
  992. package/dist/plugins/spaces-home-control/models/activity-configuration.model.d.ts +27 -0
  993. package/dist/plugins/spaces-home-control/models/activity-configuration.model.js +182 -0
  994. package/dist/plugins/spaces-home-control/models/activity-configuration.model.js.map +1 -0
  995. package/dist/plugins/spaces-home-control/models/activity-response.model.d.ts +16 -0
  996. package/dist/plugins/spaces-home-control/models/activity-response.model.js +79 -0
  997. package/dist/plugins/spaces-home-control/models/activity-response.model.js.map +1 -0
  998. package/dist/plugins/spaces-home-control/models/activity-result.model.d.ts +6 -0
  999. package/dist/plugins/spaces-home-control/models/activity-result.model.js +37 -0
  1000. package/dist/plugins/spaces-home-control/models/activity-result.model.js.map +1 -0
  1001. package/dist/plugins/spaces-home-control/models/climate-contribution.model.d.ts +11 -0
  1002. package/dist/plugins/spaces-home-control/models/climate-contribution.model.js +66 -0
  1003. package/dist/plugins/spaces-home-control/models/climate-contribution.model.js.map +1 -0
  1004. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.d.ts +9 -0
  1005. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js +45 -0
  1006. package/dist/plugins/spaces-home-control/models/space-mode-schedule-response.model.js.map +1 -0
  1007. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.d.ts +34 -0
  1008. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js +170 -0
  1009. package/dist/plugins/spaces-home-control/models/space-mode-schedule.model.js.map +1 -0
  1010. package/dist/plugins/spaces-home-control/models/space-occupancy.model.d.ts +26 -0
  1011. package/dist/plugins/spaces-home-control/models/space-occupancy.model.js +121 -0
  1012. package/dist/plugins/spaces-home-control/models/space-occupancy.model.js.map +1 -0
  1013. package/dist/plugins/spaces-home-control/models/spaces-response.model.d.ts +13 -0
  1014. package/dist/plugins/spaces-home-control/models/spaces-response.model.js +81 -2
  1015. package/dist/plugins/spaces-home-control/models/spaces-response.model.js.map +1 -1
  1016. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.d.ts +7 -0
  1017. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js +57 -0
  1018. package/dist/plugins/spaces-home-control/occupancy/occupancy-admission.js.map +1 -0
  1019. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.d.ts +31 -0
  1020. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js +30 -0
  1021. package/dist/plugins/spaces-home-control/occupancy/space-occupancy.types.js.map +1 -0
  1022. package/dist/plugins/spaces-home-control/schedule/schedule-time.d.ts +9 -0
  1023. package/dist/plugins/spaces-home-control/schedule/schedule-time.js +79 -0
  1024. package/dist/plugins/spaces-home-control/schedule/schedule-time.js.map +1 -0
  1025. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.d.ts +28 -0
  1026. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js +7 -0
  1027. package/dist/plugins/spaces-home-control/schedule/space-mode-schedule.types.js.map +1 -0
  1028. package/dist/plugins/spaces-home-control/services/activity-test-support.d.ts +16 -0
  1029. package/dist/plugins/spaces-home-control/services/activity-test-support.js +34 -0
  1030. package/dist/plugins/spaces-home-control/services/activity-test-support.js.map +1 -0
  1031. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.d.ts +15 -0
  1032. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js +97 -0
  1033. package/dist/plugins/spaces-home-control/services/climate-contribution-planner.service.js.map +1 -0
  1034. package/dist/plugins/spaces-home-control/services/climate-intent.service.d.ts +15 -2
  1035. package/dist/plugins/spaces-home-control/services/climate-intent.service.js +155 -15
  1036. package/dist/plugins/spaces-home-control/services/climate-intent.service.js.map +1 -1
  1037. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.d.ts +31 -0
  1038. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js +189 -0
  1039. package/dist/plugins/spaces-home-control/services/cover-group-intent.port.js.map +1 -0
  1040. package/dist/plugins/spaces-home-control/services/covers-intent.service.d.ts +8 -3
  1041. package/dist/plugins/spaces-home-control/services/covers-intent.service.js +139 -65
  1042. package/dist/plugins/spaces-home-control/services/covers-intent.service.js.map +1 -1
  1043. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.d.ts +16 -0
  1044. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js +66 -0
  1045. package/dist/plugins/spaces-home-control/services/lighting-contribution-planner.service.js.map +1 -0
  1046. package/dist/plugins/spaces-home-control/services/lighting-intent.service.d.ts +13 -3
  1047. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js +93 -13
  1048. package/dist/plugins/spaces-home-control/services/lighting-intent.service.js.map +1 -1
  1049. package/dist/plugins/spaces-home-control/services/space-activity-config.service.d.ts +25 -0
  1050. package/dist/plugins/spaces-home-control/services/space-activity-config.service.js +144 -0
  1051. package/dist/plugins/spaces-home-control/services/space-activity-config.service.js.map +1 -0
  1052. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.d.ts +21 -0
  1053. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js +139 -0
  1054. package/dist/plugins/spaces-home-control/services/space-activity-domains.service.js.map +1 -0
  1055. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.d.ts +17 -0
  1056. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js +5 -0
  1057. package/dist/plugins/spaces-home-control/services/space-climate-automation.port.js.map +1 -0
  1058. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.d.ts +63 -0
  1059. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js +722 -0
  1060. package/dist/plugins/spaces-home-control/services/space-climate-automation.service.js.map +1 -0
  1061. package/dist/plugins/spaces-home-control/services/space-climate-state.service.d.ts +8 -3
  1062. package/dist/plugins/spaces-home-control/services/space-climate-state.service.js +25 -19
  1063. package/dist/plugins/spaces-home-control/services/space-climate-state.service.js.map +1 -1
  1064. package/dist/plugins/spaces-home-control/services/space-covers-state.service.d.ts +16 -2
  1065. package/dist/plugins/spaces-home-control/services/space-covers-state.service.js +102 -18
  1066. package/dist/plugins/spaces-home-control/services/space-covers-state.service.js.map +1 -1
  1067. package/dist/plugins/spaces-home-control/services/space-intent-base.service.d.ts +2 -0
  1068. package/dist/plugins/spaces-home-control/services/space-intent-base.service.js.map +1 -1
  1069. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.d.ts +4 -1
  1070. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js +94 -24
  1071. package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js.map +1 -1
  1072. package/dist/plugins/spaces-home-control/services/space-media-activity.service.d.ts +8 -2
  1073. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js +79 -13
  1074. package/dist/plugins/spaces-home-control/services/space-media-activity.service.js.map +1 -1
  1075. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.d.ts +24 -0
  1076. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js +132 -0
  1077. package/dist/plugins/spaces-home-control/services/space-mode-schedule-config.service.js.map +1 -0
  1078. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.d.ts +39 -0
  1079. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js +289 -0
  1080. package/dist/plugins/spaces-home-control/services/space-mode-scheduler.service.js.map +1 -0
  1081. package/dist/plugins/spaces-home-control/services/space-mode.service.d.ts +34 -0
  1082. package/dist/plugins/spaces-home-control/services/space-mode.service.js +296 -0
  1083. package/dist/plugins/spaces-home-control/services/space-mode.service.js.map +1 -0
  1084. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.d.ts +26 -0
  1085. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js +134 -0
  1086. package/dist/plugins/spaces-home-control/services/space-occupancy-config.service.js.map +1 -0
  1087. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.d.ts +21 -0
  1088. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js +84 -0
  1089. package/dist/plugins/spaces-home-control/services/space-occupancy-inputs.service.js.map +1 -0
  1090. package/dist/plugins/spaces-home-control/services/space-occupancy.service.d.ts +48 -0
  1091. package/dist/plugins/spaces-home-control/services/space-occupancy.service.js +285 -0
  1092. package/dist/plugins/spaces-home-control/services/space-occupancy.service.js.map +1 -0
  1093. package/dist/plugins/spaces-home-control/services/space-state-read.service.d.ts +5 -1
  1094. package/dist/plugins/spaces-home-control/services/space-state-read.service.js +33 -7
  1095. package/dist/plugins/spaces-home-control/services/space-state-read.service.js.map +1 -1
  1096. package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js +52 -0
  1097. package/dist/plugins/spaces-home-control/spaces-home-control.openapi.js.map +1 -1
  1098. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.d.ts +5 -1
  1099. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js +57 -2
  1100. package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js.map +1 -1
  1101. package/dist/spec/channels.d.ts +27 -4
  1102. package/dist/spec/channels.js +37 -6
  1103. package/dist/spec/channels.js.map +1 -1
  1104. package/dist/spec/devices.d.ts +20 -0
  1105. package/dist/spec/devices.js +20 -0
  1106. package/dist/spec/devices.js.map +1 -1
  1107. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1108. package/package.json +4 -3
@@ -0,0 +1,1617 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var VirtualThermostatRuntimeService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.VirtualThermostatRuntimeService = void 0;
17
+ const node_crypto_1 = require("node:crypto");
18
+ const typeorm_1 = require("typeorm");
19
+ const common_1 = require("@nestjs/common");
20
+ const config_1 = require("@nestjs/config");
21
+ const event_emitter_1 = require("@nestjs/event-emitter");
22
+ const sqlite_data_source_1 = require("../../../common/database/sqlite-data-source");
23
+ const config_utils_1 = require("../../../common/utils/config.utils");
24
+ const devices_constants_1 = require("../../../modules/devices/devices.constants");
25
+ const devices_entity_1 = require("../../../modules/devices/entities/devices.entity");
26
+ const controller_publication_context_1 = require("../../../modules/devices/services/controller-publication-context");
27
+ const creation_capture_1 = require("../../../modules/devices/services/creation-capture");
28
+ const device_structure_lock_service_1 = require("../../../modules/devices/services/device-structure-lock.service");
29
+ const property_producer_registry_service_1 = require("../../../modules/devices/services/property-producer.registry.service");
30
+ const property_value_service_1 = require("../../../modules/devices/services/property-value.service");
31
+ const devices_shelly_ng_entity_1 = require("../../devices-shelly-ng/entities/devices-shelly-ng.entity");
32
+ const thermostat_actuation_contract_1 = require("../contracts/thermostat-actuation.contract");
33
+ const devices_virtual_entity_1 = require("../entities/devices-virtual.entity");
34
+ const virtual_thermostat_runtime_entity_1 = require("../entities/virtual-thermostat-runtime.entity");
35
+ const virtual_thermostat_entity_1 = require("../entities/virtual-thermostat.entity");
36
+ const thermostat_controller_mutation_1 = require("./thermostat-controller-mutation");
37
+ const thermostat_cooling_dependency_service_1 = require("./thermostat-cooling-dependency.service");
38
+ const thermostat_member_protection_service_1 = require("./thermostat-member-protection.service");
39
+ const virtual_dependency_graph_service_1 = require("./virtual-dependency-graph.service");
40
+ const virtual_thermostat_automation_service_1 = require("./virtual-thermostat-automation.service");
41
+ const virtual_thermostat_branch_utils_1 = require("./virtual-thermostat-branch.utils");
42
+ const virtual_thermostat_claims_service_1 = require("./virtual-thermostat-claims.service");
43
+ const virtual_thermostat_comfort_service_1 = require("./virtual-thermostat-comfort.service");
44
+ const virtual_thermostat_comfort_utils_1 = require("./virtual-thermostat-comfort.utils");
45
+ const virtual_thermostat_config_service_1 = require("./virtual-thermostat-config.service");
46
+ const virtual_thermostat_contract_utils_1 = require("./virtual-thermostat-contract.utils");
47
+ const virtual_thermostat_inputs_service_1 = require("./virtual-thermostat-inputs.service");
48
+ const virtual_thermostat_policy_utils_1 = require("./virtual-thermostat-policy.utils");
49
+ const virtual_thermostat_runtime_ownership_1 = require("./virtual-thermostat-runtime-ownership");
50
+ const virtual_thermostat_transport_service_1 = require("./virtual-thermostat-transport.service");
51
+ const virtual_window_contact_utils_1 = require("./virtual-window-contact.utils");
52
+ const virtual_window_trend_utils_1 = require("./virtual-window-trend.utils");
53
+ const unresolved = (command) => !['confirmed', 'cancelled'].includes(command.status);
54
+ const newestCommandFirst = (a, b) => b.preparedAt.getTime() - a.preparedAt.getTime() ||
55
+ b.decisionRevision - a.decisionRevision ||
56
+ (b.id > a.id ? 1 : b.id < a.id ? -1 : 0);
57
+ class ThermostatDecisionRetiredError extends Error {
58
+ }
59
+ const retryDelaysMs = [1000, 2000, 4000, 8000, 16000];
60
+ const copyBranchDiagnostic = (branch, unavailable = false) => ({
61
+ ...branch,
62
+ cooling_protection: branch.cooling_protection
63
+ ? {
64
+ ...branch.cooling_protection,
65
+ ready: !unavailable && branch.cooling_protection.ready,
66
+ reasons: [...branch.cooling_protection.reasons],
67
+ dew_point: unavailable ? null : branch.cooling_protection.dew_point,
68
+ surface: unavailable ? null : branch.cooling_protection.surface,
69
+ }
70
+ : null,
71
+ ...(unavailable
72
+ ? {
73
+ activity: 'unknown',
74
+ qualification_ready: null,
75
+ activity_sampled_at: null,
76
+ activity_expires_at: null,
77
+ release_proven: false,
78
+ }
79
+ : {}),
80
+ protection: branch.protection
81
+ ? {
82
+ ...branch.protection,
83
+ reasons: unavailable
84
+ ? ['graph_or_runtime_unavailable', ...branch.protection.reasons]
85
+ : [...branch.protection.reasons],
86
+ ...(unavailable
87
+ ? {
88
+ ready: false,
89
+ latched: true,
90
+ temperature: null,
91
+ status: 'unavailable',
92
+ quality: 'unavailable',
93
+ }
94
+ : {}),
95
+ }
96
+ : null,
97
+ });
98
+ let VirtualThermostatRuntimeService = VirtualThermostatRuntimeService_1 = class VirtualThermostatRuntimeService {
99
+ get coolingDependencies() {
100
+ return (this.coolingService ??= new thermostat_cooling_dependency_service_1.ThermostatCoolingDependencyService(this.dataSource, this.values, this.claims));
101
+ }
102
+ isReconciled(claim) {
103
+ const proof = this.reconciled.get(`${claim.id}:${claim.revision}`);
104
+ const qualification = this.claims.qualification(claim, false);
105
+ return !!proof && !!qualification && proof.qualification === qualification && proof.sourceIsCurrent();
106
+ }
107
+ constructor(dataSource, structure, claims, inputs, transport, values, producers, events, graph, comfort, configService = new config_1.ConfigService(), memberProtection = new thermostat_member_protection_service_1.ThermostatMemberProtectionService(dataSource, values), automation) {
108
+ this.dataSource = dataSource;
109
+ this.structure = structure;
110
+ this.claims = claims;
111
+ this.inputs = inputs;
112
+ this.transport = transport;
113
+ this.values = values;
114
+ this.producers = producers;
115
+ this.events = events;
116
+ this.graph = graph;
117
+ this.comfort = comfort;
118
+ this.configService = configService;
119
+ this.memberProtection = memberProtection;
120
+ this.automation = automation;
121
+ this.ownership = new virtual_thermostat_runtime_ownership_1.ThermostatRuntimeOwnership();
122
+ this.logger = new common_1.Logger(VirtualThermostatRuntimeService_1.name);
123
+ this.active = false;
124
+ this.epoch = (0, node_crypto_1.randomUUID)();
125
+ this.sequence = 0;
126
+ this.queues = new Map();
127
+ this.retiredQueues = new Set();
128
+ this.epochs = new Map();
129
+ this.contexts = new Map();
130
+ this.diagnostics = new Map();
131
+ this.memberFaults = new Map();
132
+ this.reconciled = new Map();
133
+ this.diagnosticGuards = new Map();
134
+ this.contacts = new Map();
135
+ this.trends = new Map();
136
+ this.outputs = new Map();
137
+ this.inFlight = new Map();
138
+ this.inFlightCommands = new Map();
139
+ this.listener = (payload) => {
140
+ if (payload?.id && this.outputs.has(payload.id))
141
+ return;
142
+ const propertyId = payload?.propertyId ?? payload?.id;
143
+ for (const [id, context] of this.contexts)
144
+ if (!propertyId ||
145
+ context.bindings.some((binding) => binding.property?.id === propertyId) ||
146
+ context.memberBindings.some((entry) => entry.binding?.sourcePropertyId === propertyId || entry.binding?.physicalPropertyIdentity === propertyId) ||
147
+ context.claims.some((claim) => claim.sourcePropertyId === propertyId)) {
148
+ this.memberProtection.read(context.memberBindings, Date.now());
149
+ void this.request(id);
150
+ }
151
+ };
152
+ this.reset = () => {
153
+ this.memberProtection.reset();
154
+ this.coolingService?.reset();
155
+ this.reconciled.clear();
156
+ this.contacts.clear();
157
+ for (const [id, trend] of this.trends)
158
+ this.trends.set(id, {
159
+ ...(0, virtual_window_trend_utils_1.createVirtualWindowTrendState)(),
160
+ pausedAt: trend.pausedAt,
161
+ pausedUntil: trend.pausedUntil,
162
+ cooldownUntil: trend.cooldownUntil,
163
+ });
164
+ this.listener();
165
+ };
166
+ this.journal = new virtual_thermostat_runtime_ownership_1.ThermostatRuntimeJournal(dataSource, structure);
167
+ }
168
+ onApplicationBootstrap() {
169
+ if (this.bootstrap)
170
+ return this.bootstrap.completion;
171
+ if (this.active)
172
+ return Promise.resolve();
173
+ try {
174
+ if ((0, config_utils_1.getEnvValue)(this.configService, 'FB_CLI', null) === 'on')
175
+ return Promise.resolve();
176
+ }
177
+ catch (cause) {
178
+ return Promise.resolve().then(() => {
179
+ throw cause;
180
+ });
181
+ }
182
+ const lifecycle = { stops: [] };
183
+ let resolve, reject;
184
+ const completion = new Promise((yes, no) => {
185
+ resolve = yes;
186
+ reject = no;
187
+ });
188
+ const attempt = { lifecycle, completion };
189
+ this.lifecycle = lifecycle;
190
+ this.active = true;
191
+ this.bootstrap = attempt;
192
+ void this.startLifecycle(lifecycle).then(() => {
193
+ if (this.bootstrap === attempt)
194
+ this.bootstrap = undefined;
195
+ resolve();
196
+ }, (cause) => {
197
+ if (this.lifecycle === lifecycle) {
198
+ try {
199
+ this.onModuleDestroy();
200
+ }
201
+ catch (cleanup) {
202
+ this.logger.error('Failed to retire original thermostat runtime', cleanup);
203
+ }
204
+ }
205
+ if (this.bootstrap === attempt)
206
+ this.bootstrap = undefined;
207
+ reject(cause);
208
+ });
209
+ return completion;
210
+ }
211
+ isCurrentLifecycle(lifecycle) {
212
+ return lifecycle !== undefined && this.active && this.lifecycle === lifecycle;
213
+ }
214
+ async startLifecycle(lifecycle) {
215
+ const assertCurrent = () => {
216
+ if (!this.isCurrentLifecycle(lifecycle))
217
+ throw new Error('Original runtime lifecycle ended');
218
+ };
219
+ const own = (stop) => {
220
+ if (stop === undefined)
221
+ return;
222
+ if (!this.isCurrentLifecycle(lifecycle)) {
223
+ stop();
224
+ assertCurrent();
225
+ }
226
+ lifecycle.stops.push(stop);
227
+ };
228
+ const hooks = (0, creation_capture_1.captureCreation)(this, ['capturePredecessors', 'requestInstalled']);
229
+ own(this.automation?.registerRuntime((id) => {
230
+ assertCurrent();
231
+ return hooks.values.capturePredecessors.call(hooks.receiver, id);
232
+ }, (id) => {
233
+ if (!this.isCurrentLifecycle(lifecycle) || !hooks.current())
234
+ return Promise.reject(new Error('Original thermostat runtime unavailable'));
235
+ return hooks.values.requestInstalled.call(hooks.receiver, id);
236
+ }));
237
+ own(this.transport.registerCoolingFrameReader?.((claim) => {
238
+ if (!this.isCurrentLifecycle(lifecycle))
239
+ return null;
240
+ const context = this.contexts.get(claim.controllerId), binding = context?.coolingBindings.find((b) => b.claimId === claim.id);
241
+ if (!context || !binding || !context.publishGuard())
242
+ return null;
243
+ const captured = this.coolingDependencies.capture(binding);
244
+ return captured
245
+ ? {
246
+ ...captured,
247
+ isCurrent: () => captured.isCurrent() &&
248
+ context.publishGuard() &&
249
+ this.contexts.get(claim.controllerId) === context &&
250
+ context.config.revision === captured.controllerRevision &&
251
+ context.claims.some((c) => c.id === claim.id && c.revision === claim.revision),
252
+ }
253
+ : null;
254
+ }));
255
+ own(this.claims.registerRuntimeAdmission((claim) => {
256
+ if (!this.isCurrentLifecycle(lifecycle))
257
+ return false;
258
+ const context = this.contexts.get(claim.controllerId);
259
+ return !!context && this.canSend(context, claim, 'on');
260
+ }));
261
+ const listener = (...args) => {
262
+ if (this.isCurrentLifecycle(lifecycle))
263
+ this.listener(...args);
264
+ };
265
+ const reset = () => {
266
+ if (this.isCurrentLifecycle(lifecycle))
267
+ this.reset();
268
+ };
269
+ const invalidated = (payload) => {
270
+ if (!this.isCurrentLifecycle(lifecycle))
271
+ return;
272
+ this.memberProtection.invalidateSource(payload.propertyId);
273
+ this.listener(payload);
274
+ };
275
+ this.events.on(devices_constants_1.EventType.CHANNEL_PROPERTY_SAMPLE_INVALIDATED, invalidated);
276
+ own(() => this.events.off(devices_constants_1.EventType.CHANNEL_PROPERTY_SAMPLE_INVALIDATED, invalidated));
277
+ for (const event of [devices_constants_1.EventType.CHANNEL_PROPERTY_SAMPLE_ACCEPTED, devices_constants_1.EventType.CHANNEL_PROPERTY_VALUE_STATE_CHANGED]) {
278
+ this.events.on(event, listener);
279
+ own(() => this.events.off(event, listener));
280
+ }
281
+ for (const event of [
282
+ devices_constants_1.EventType.DEVICE_CONNECTION_CHANGED,
283
+ devices_constants_1.EventType.CHANNEL_PROPERTY_UPDATED,
284
+ devices_constants_1.EventType.CHANNEL_PROPERTY_DELETED,
285
+ devices_constants_1.EventType.CHANNEL_UPDATED,
286
+ devices_constants_1.EventType.CHANNEL_DELETED,
287
+ devices_constants_1.EventType.DEVICE_UPDATED,
288
+ devices_constants_1.EventType.DEVICE_DELETED,
289
+ ]) {
290
+ this.events.on(event, reset);
291
+ own(() => this.events.off(event, reset));
292
+ }
293
+ const configured = (id) => {
294
+ if (!this.isCurrentLifecycle(lifecycle))
295
+ return;
296
+ this.memberProtection.reset();
297
+ this.coolingService?.reset();
298
+ void this.request(id);
299
+ };
300
+ this.events.on(virtual_thermostat_config_service_1.THERMOSTAT_CONFIG_CHANGED, configured);
301
+ own(() => this.events.off(virtual_thermostat_config_service_1.THERMOSTAT_CONFIG_CHANGED, configured));
302
+ await this.automation?.restoreCurrentInstallations();
303
+ assertCurrent();
304
+ await this.journal.restart([...this.inFlightCommands.values()]);
305
+ assertCurrent();
306
+ const configurations = await this.dataSource.manager.find(virtual_thermostat_entity_1.VirtualThermostatConfigEntity);
307
+ assertCurrent();
308
+ for (const config of configurations)
309
+ void this.request(config.controllerId);
310
+ await this.flush();
311
+ assertCurrent();
312
+ lifecycle.timer = setInterval(() => {
313
+ if (!this.isCurrentLifecycle(lifecycle))
314
+ return;
315
+ for (const id of this.contexts.keys())
316
+ void this.request(id, false);
317
+ }, 1000);
318
+ this.timer = lifecycle.timer;
319
+ lifecycle.timer.unref();
320
+ }
321
+ onModuleDestroy() {
322
+ const lifecycle = this.lifecycle, outputs = [...this.outputs.values()];
323
+ this.active = false;
324
+ this.lifecycle = undefined;
325
+ if (this.bootstrap?.lifecycle === lifecycle)
326
+ this.bootstrap = undefined;
327
+ this.timer = undefined;
328
+ if (lifecycle?.timer)
329
+ clearInterval(lifecycle.timer);
330
+ this.outputs.clear();
331
+ this.diagnosticGuards.clear();
332
+ this.contexts.clear();
333
+ for (const queue of this.queues.values()) {
334
+ this.retiredQueues.add(queue);
335
+ void queue.then(() => this.retiredQueues.delete(queue), () => this.retiredQueues.delete(queue));
336
+ }
337
+ this.queues.clear();
338
+ this.contacts.clear();
339
+ this.trends.clear();
340
+ this.reconciled.clear();
341
+ this.memberFaults.clear();
342
+ this.memberProtection.reset();
343
+ this.coolingService?.reset();
344
+ for (const id of this.epochs.keys())
345
+ this.epochs.set(id, (this.epochs.get(id) ?? 0) + 1);
346
+ const stops = lifecycle?.stops.splice(0) ?? [];
347
+ let failure;
348
+ for (const stop of [...stops, ...outputs.map((output) => () => this.producers.unregister(output.lease))]) {
349
+ try {
350
+ stop();
351
+ }
352
+ catch (cause) {
353
+ failure ??= { cause };
354
+ }
355
+ }
356
+ if (failure)
357
+ throw failure.cause;
358
+ }
359
+ readDiagnostics(controllerId) {
360
+ const result = this.diagnostics.get(controllerId);
361
+ const observedAt = new Date(), context = this.contexts.get(controllerId);
362
+ if (result && (!this.graph.isValidated() || this.diagnosticGuards.get(controllerId)?.() === false))
363
+ return {
364
+ ...result,
365
+ effective_comfort: { ...result.effective_comfort },
366
+ readiness: 'unavailable',
367
+ current_temperature: null,
368
+ floor_temperature: null,
369
+ comfort_demand: 'off',
370
+ reasons: ['graph_validation_pending'],
371
+ headline_reason: 'graph_validation_pending',
372
+ inputs: result.inputs.map((input) => ({
373
+ ...input,
374
+ status: 'unavailable',
375
+ quality: 'unavailable',
376
+ reasons: ['graph_validation_pending'],
377
+ })),
378
+ branches: result.branches.map((branch) => copyBranchDiagnostic(branch, true)),
379
+ };
380
+ return result
381
+ ? {
382
+ ...result,
383
+ effective_comfort: { ...result.effective_comfort },
384
+ inputs: result.inputs.map((input) => ({ ...input, reasons: [...input.reasons] })),
385
+ reasons: [...result.reasons],
386
+ branches: result.branches.map((branch) => ({
387
+ ...copyBranchDiagnostic(branch),
388
+ ...this.branchObservation(context?.config.revision === result.configuration_revision &&
389
+ context.state.decisionRevision === result.decision_revision
390
+ ? context
391
+ : undefined, branch.claim, observedAt),
392
+ })),
393
+ }
394
+ : null;
395
+ }
396
+ async inspect(controllerId) {
397
+ if (!(await this.dataSource.manager.existsBy(virtual_thermostat_entity_1.VirtualThermostatConfigEntity, { controllerId })))
398
+ return null;
399
+ await this.request(controllerId, false);
400
+ return this.readDiagnostics(controllerId);
401
+ }
402
+ request(controllerId, revoke = true) {
403
+ return this.requestOperation(controllerId, revoke, false);
404
+ }
405
+ requestInstalled(controllerId) {
406
+ return this.requestOperation(controllerId, true, true);
407
+ }
408
+ requestOperation(controllerId, revoke, complete) {
409
+ const lifecycle = this.lifecycle;
410
+ if (!this.isCurrentLifecycle(lifecycle))
411
+ return complete ? Promise.reject(new Error('Original thermostat runtime unavailable')) : Promise.resolve();
412
+ const originalNativeEvent = (0, sqlite_data_source_1.hasCurrentSqliteConnectionLease)(this.dataSource);
413
+ const owned = this.ownership.admit(controllerId);
414
+ const original = this.ownership.completion(owned);
415
+ if (revoke)
416
+ this.epochs.set(controllerId, (this.epochs.get(controllerId) ?? 0) + 1);
417
+ const previous = this.queues.get(controllerId) ?? Promise.resolve();
418
+ const next = (0, sqlite_data_source_1.outsideSqliteTransaction)(this.dataSource, () => previous
419
+ .catch(() => undefined)
420
+ .then(() => controller_publication_context_1.ControllerPublicationContext.independent(() => this.ownership.run(owned, () => this.evaluate(controllerId, lifecycle))))
421
+ .catch(() => {
422
+ if (!this.isCurrentLifecycle(lifecycle))
423
+ return;
424
+ this.diagnostics.set(controllerId, {
425
+ epoch: this.epoch,
426
+ sequence: ++this.sequence,
427
+ configuration_revision: 0,
428
+ decision_revision: 0,
429
+ readiness: 'unavailable',
430
+ requested_mode: 'off',
431
+ effective_comfort: {
432
+ source: 'manual',
433
+ preset: null,
434
+ override_id: null,
435
+ expires_at: null,
436
+ heating_setpoint: null,
437
+ cooling_setpoint: null,
438
+ },
439
+ heating_setpoint: null,
440
+ cooling_setpoint: null,
441
+ current_temperature: null,
442
+ floor_temperature: null,
443
+ floor_latched: false,
444
+ comfort_demand: 'off',
445
+ reasons: ['runtime_error'],
446
+ headline_reason: 'runtime_error',
447
+ inputs: [],
448
+ branches: this.diagnostics.get(controllerId)?.branches.map((branch) => copyBranchDiagnostic(branch, true)) ?? [],
449
+ });
450
+ }));
451
+ this.queues.set(controllerId, next);
452
+ void next.finally(() => {
453
+ if (this.queues.get(controllerId) === next)
454
+ this.queues.delete(controllerId);
455
+ });
456
+ const completion = complete ? Promise.all([next, original]).then(() => undefined) : next;
457
+ return originalNativeEvent
458
+ ? controller_publication_context_1.ControllerPublicationContext.effect('thermostat.runtime-request', () => completion)
459
+ : completion;
460
+ }
461
+ capturePredecessors(controllerId) {
462
+ this.epochs.set(controllerId, (this.epochs.get(controllerId) ?? 0) + 1);
463
+ return this.ownership.capture(controllerId);
464
+ }
465
+ fenceMember(claimId) {
466
+ for (const [id, context] of this.contexts)
467
+ if (context.claims.some((claim) => claim.id === claimId))
468
+ void this.request(id);
469
+ }
470
+ async flush() {
471
+ const lifecycle = this.lifecycle;
472
+ if (lifecycle === undefined) {
473
+ await Promise.all([...this.retiredQueues]);
474
+ return;
475
+ }
476
+ while (this.isCurrentLifecycle(lifecycle) && this.queues.size)
477
+ await Promise.all([...this.queues.values()]);
478
+ }
479
+ async write(entity, validate) {
480
+ const publishOutcome = () => {
481
+ if (entity instanceof virtual_thermostat_runtime_entity_1.VirtualThermostatCommandEntity) {
482
+ const current = this.contexts.get(entity.controllerId)?.commands.find((command) => command.id === entity.id);
483
+ if (current)
484
+ Object.assign(current, entity);
485
+ }
486
+ };
487
+ if (entity instanceof virtual_thermostat_runtime_entity_1.VirtualThermostatCommandEntity) {
488
+ await this.journal.write(entity, validate);
489
+ }
490
+ else {
491
+ await this.journal.persistRuntimeRows([entity]);
492
+ }
493
+ publishOutcome();
494
+ }
495
+ async readAutomationImage(manager, controllerId) {
496
+ const slots = await manager.query('SELECT * FROM devices_module_climate_automation_slots WHERE controllerId = ?', [controllerId]);
497
+ const sources = await manager.query(`SELECT * FROM devices_module_climate_automation_sources WHERE generationId IN
498
+ (SELECT generationId FROM devices_module_climate_automation_slots WHERE controllerId = ?) ORDER BY generationId`, [controllerId]);
499
+ return JSON.stringify({ slots, sources });
500
+ }
501
+ async validateNativeDecision(manager, context, claim, action, requireLiveDecision = true) {
502
+ if (!this.isCurrentLifecycle(context.lifecycle))
503
+ throw new ThermostatDecisionRetiredError('Original runtime lifecycle ended');
504
+ const current = await manager.findOneBy(virtual_thermostat_entity_1.VirtualThermostatActuatorClaimEntity, { id: claim.id });
505
+ const identity = [
506
+ 'id',
507
+ 'controllerId',
508
+ 'revision',
509
+ 'sourcePropertyId',
510
+ 'sourcePropertyIdentity',
511
+ 'sourceDeviceId',
512
+ 'sourceDeviceIdentity',
513
+ 'physicalIdentity',
514
+ 'contractFingerprint',
515
+ 'qualificationGeneration',
516
+ 'providerProfile',
517
+ 'providerProfileVersion',
518
+ ];
519
+ if (!current || current.state === 'released' || identity.some((key) => !Object.is(current[key], claim[key])))
520
+ throw new Error('Original thermostat native claim required');
521
+ if (action === 'off')
522
+ return;
523
+ const original = context.onNative;
524
+ if (!original?.current())
525
+ throw new Error('Original thermostat native decision required');
526
+ if (requireLiveDecision && !this.canSend(context, claim, 'on'))
527
+ throw new ThermostatDecisionRetiredError('Original thermostat decision retired before native dispatch');
528
+ await (0, thermostat_controller_mutation_1.assertControllerMutationImage)(manager, claim.controllerId, original.image);
529
+ await original.verifyBindings(manager);
530
+ if ((await this.readAutomationImage(manager, claim.controllerId)) !== original.automation)
531
+ throw new Error('Original thermostat native automation required');
532
+ const automation = await this.automation?.resolve(manager, context.config);
533
+ if (JSON.stringify(automation?.baseline ?? null) !== JSON.stringify(context.automation?.baseline ?? null) ||
534
+ (automation?.baseline && !automation.isCurrent()) ||
535
+ !original.current())
536
+ throw new Error('Original thermostat native automation required');
537
+ if (requireLiveDecision && !this.canSend(context, claim, 'on'))
538
+ throw new ThermostatDecisionRetiredError('Original thermostat decision retired before native dispatch');
539
+ }
540
+ async load(controllerId) {
541
+ const lifecycle = this.lifecycle;
542
+ await this.comfort.settle(controllerId);
543
+ return this.structure.runShared(async () => {
544
+ let image, automationImage;
545
+ try {
546
+ image = await (0, thermostat_controller_mutation_1.readControllerMutationImage)(this.dataSource.manager, controllerId);
547
+ automationImage = await this.readAutomationImage(this.dataSource.manager, controllerId);
548
+ }
549
+ catch {
550
+ }
551
+ const admission = this.claims.capture();
552
+ const publishGuard = this.graph.capturePublishGuard();
553
+ const config = await this.dataSource.manager.findOneBy(virtual_thermostat_entity_1.VirtualThermostatConfigEntity, { controllerId });
554
+ if (!config)
555
+ return null;
556
+ const automation = await this.automation?.resolve(this.dataSource.manager, config);
557
+ const owner = config.ownerDeviceId
558
+ ? await this.dataSource.manager.findOneBy(devices_entity_1.DeviceEntity, { id: config.ownerDeviceId })
559
+ : null;
560
+ const claims = await this.dataSource.manager.findBy(virtual_thermostat_entity_1.VirtualThermostatActuatorClaimEntity, {
561
+ controllerId,
562
+ state: (0, typeorm_1.Not)('released'),
563
+ });
564
+ const rows = await this.dataSource.manager.findBy(virtual_thermostat_entity_1.VirtualThermostatSourceEntity, { controllerId });
565
+ const bindings = await this.inputs.load(rows);
566
+ const memberBindings = await this.memberProtection.load(config, claims);
567
+ const coolingBindings = await this.coolingDependencies.load(config, claims);
568
+ const commands = await this.loadDecisionCommands(controllerId, claims);
569
+ const state = (await this.dataSource.manager.findOneBy(virtual_thermostat_runtime_entity_1.VirtualThermostatRuntimeEntity, { controllerId })) ??
570
+ this.dataSource.manager.create(virtual_thermostat_runtime_entity_1.VirtualThermostatRuntimeEntity, {
571
+ controllerId,
572
+ decisionRevision: 0,
573
+ configurationRevision: config.revision,
574
+ floorLatched: false,
575
+ heuristicHold: null,
576
+ previousDemand: 'off',
577
+ reasons: [],
578
+ evaluatedAt: new Date(),
579
+ });
580
+ await this.journal.captureRuntimeRow(this.dataSource.manager, state);
581
+ const branches = new Map(), targets = new Map();
582
+ for (const claim of claims) {
583
+ const branch = (await this.dataSource.manager.findOneBy(virtual_thermostat_runtime_entity_1.VirtualThermostatBranchRuntimeEntity, { claimId: claim.id })) ??
584
+ this.dataSource.manager.create(virtual_thermostat_runtime_entity_1.VirtualThermostatBranchRuntimeEntity, {
585
+ claimId: claim.id,
586
+ activity: 'unknown',
587
+ lastVerifiedOffAt: null,
588
+ releaseProofId: null,
589
+ releaseAttempts: 0,
590
+ nextReleaseAt: null,
591
+ fault: null,
592
+ floorLatched: null,
593
+ });
594
+ await this.journal.captureRuntimeRow(this.dataSource.manager, branch);
595
+ branches.set(claim.id, branch);
596
+ const property = claim.sourcePropertyId
597
+ ? await this.dataSource.manager.findOne(devices_entity_1.ChannelPropertyEntity, {
598
+ where: { id: claim.sourcePropertyId },
599
+ relations: ['channel', 'channel.device'],
600
+ })
601
+ : null;
602
+ if (property) {
603
+ const channel = property.channel;
604
+ targets.set(claim.id, { property, channel, device: channel.device, value: false });
605
+ }
606
+ }
607
+ let onNative;
608
+ try {
609
+ if (image && automationImage !== undefined) {
610
+ const edges = (0, creation_capture_1.captureCreation)(this.graph, ['edges']);
611
+ const bindings = await (0, thermostat_controller_mutation_1.captureControllerBindings)(this.dataSource.manager, controllerId, image, [], (manager) => edges.values.edges.call(edges.receiver, manager));
612
+ await (0, thermostat_controller_mutation_1.assertControllerMutationImage)(this.dataSource.manager, controllerId, image);
613
+ if (automationImage === (await this.readAutomationImage(this.dataSource.manager, controllerId)))
614
+ onNative = {
615
+ image,
616
+ automation: automationImage,
617
+ verifyBindings: (manager) => bindings(undefined, manager),
618
+ current: () => edges.current(),
619
+ };
620
+ }
621
+ }
622
+ catch {
623
+ }
624
+ return {
625
+ lifecycle,
626
+ onNative,
627
+ admission,
628
+ publishGuard: () => this.isCurrentLifecycle(lifecycle) && publishGuard() && (!automation?.baseline || automation.isCurrent()),
629
+ automation,
630
+ config,
631
+ owner,
632
+ claims,
633
+ bindings,
634
+ memberBindings,
635
+ memberProtection: [],
636
+ coolingBindings,
637
+ coolingProtection: [],
638
+ commands,
639
+ state,
640
+ branches,
641
+ targets,
642
+ epoch: this.epochs.get(controllerId) ?? 0,
643
+ decision: {
644
+ desiredHeating: false,
645
+ desiredCooling: false,
646
+ comfortDemand: 'off',
647
+ floorOverheatLatched: state.floorLatched,
648
+ reasons: [],
649
+ },
650
+ };
651
+ });
652
+ }
653
+ async loadDecisionCommands(controllerId, claims) {
654
+ const byId = new Map();
655
+ for (const claim of claims) {
656
+ const scoped = () => this.dataSource.manager
657
+ .createQueryBuilder(virtual_thermostat_runtime_entity_1.VirtualThermostatCommandEntity, 'command')
658
+ .where('command.controllerId = :controllerId', { controllerId })
659
+ .andWhere('command.claimId = :claimId', { claimId: claim.id });
660
+ const pending = () => scoped().andWhere("command.status NOT IN ('confirmed', 'cancelled')");
661
+ const witnesses = await Promise.all([
662
+ scoped()
663
+ .andWhere("command.action = 'on' AND command.status <> 'cancelled'")
664
+ .orderBy('command.preparedAt', 'DESC')
665
+ .addOrderBy('command.decisionRevision', 'DESC')
666
+ .addOrderBy('command.id', 'DESC')
667
+ .limit(1)
668
+ .getOne(),
669
+ pending().andWhere("command.action = 'on'").limit(1).getOne(),
670
+ pending().andWhere("command.action = 'off'").limit(1).getOne(),
671
+ pending().andWhere("command.action = 'on' AND command.status = 'unknown'").limit(1).getOne(),
672
+ pending()
673
+ .andWhere("command.action = 'on' AND command.dispatchedAt IS NOT NULL")
674
+ .orderBy('command.dispatchedAt', 'DESC')
675
+ .addOrderBy('command.id', 'DESC')
676
+ .limit(1)
677
+ .getOne(),
678
+ pending().andWhere("command.fault IS NOT NULL AND command.fault <> ''").limit(1).getOne(),
679
+ ]);
680
+ for (const command of witnesses)
681
+ if (command && !byId.has(command.id))
682
+ byId.set(command.id, command);
683
+ }
684
+ return [...byId.values()];
685
+ }
686
+ async loadUnresolvedCommands(controllerId, claimId, manager = this.dataSource.manager) {
687
+ return manager
688
+ .createQueryBuilder(virtual_thermostat_runtime_entity_1.VirtualThermostatCommandEntity, 'command')
689
+ .where('command.controllerId = :controllerId AND command.claimId = :claimId', { controllerId, claimId })
690
+ .andWhere("command.status NOT IN ('confirmed', 'cancelled')")
691
+ .getMany();
692
+ }
693
+ evidence(context, claim, now) {
694
+ const branch = context.branches.get(claim.id), target = context.targets.get(claim.id);
695
+ const feedback = target ? this.values.readQualifiedSample(target.property, 30_000, new Date(now)) : null;
696
+ branch.activity = typeof feedback?.value === 'boolean' ? (feedback.value ? 'on' : 'off') : 'unknown';
697
+ const latest = new Map(context.commands.map((command) => [command.id, command]));
698
+ for (const command of this.inFlightCommands.values())
699
+ if (command.claimId === claim.id)
700
+ latest.set(command.id, command);
701
+ const pending = [...latest.values()].filter((command) => command.claimId === claim.id && unresolved(command));
702
+ const qualification = this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims));
703
+ const parallel = context.claims.filter((member) => member.role === claim.role).length > 1;
704
+ const unobservedOn = parallel &&
705
+ pending.some((command) => command.action === 'on' &&
706
+ command.status === 'accepted' &&
707
+ (!feedback ||
708
+ feedback.value !== true ||
709
+ !command.dispatchedAt ||
710
+ feedback.receivedAt.getTime() < command.dispatchedAt.getTime()));
711
+ let ownedReady = true;
712
+ if (context.automation?.baseline &&
713
+ context.owner?.enabled &&
714
+ claim.state === 'reserved' &&
715
+ target?.device.enabled &&
716
+ qualification) {
717
+ ownedReady = !!this.transport.captureReconcileReadiness(target, claim, qualification)?.isCurrent();
718
+ context.ownedReadinessRefusals ??= new Set();
719
+ if (ownedReady)
720
+ context.ownedReadinessRefusals.delete(claim.id);
721
+ else
722
+ context.ownedReadinessRefusals.add(claim.id);
723
+ }
724
+ return {
725
+ activity: branch.activity,
726
+ pendingOn: pending.some((command) => command.action === 'on'),
727
+ releaseProven: this.isReconciled(claim),
728
+ offSince: branch.lastVerifiedOffAt?.getTime() ?? null,
729
+ canEnergize: !!context.owner?.enabled &&
730
+ claim.state === 'reserved' &&
731
+ !!target?.device.enabled &&
732
+ !!qualification &&
733
+ ownedReady &&
734
+ !!this.transport.get(target, claim)?.canReconcile(target, qualification) &&
735
+ this.isReconciled(claim) &&
736
+ !branch.fault &&
737
+ !this.memberFaults.has(`${claim.id}:${claim.revision}`) &&
738
+ !unobservedOn &&
739
+ (branch.activity === 'on' ||
740
+ (branch.lastVerifiedOffAt !== null &&
741
+ now >= branch.lastVerifiedOffAt.getTime() + context.config.policy.minimumOffMs)) &&
742
+ !pending.some((command) => command.action === 'off'),
743
+ };
744
+ }
745
+ decide(context, frame, now, advance) {
746
+ const windows = frame.contacts.map((contact) => {
747
+ const state = (0, virtual_window_contact_utils_1.evaluateVirtualWindowContact)(this.contacts.get(contact.id) ?? (0, virtual_window_contact_utils_1.createVirtualWindowContactState)(), { openingMs: context.config.contactOpeningMs, closingMs: context.config.contactClosingMs }, {
748
+ now,
749
+ basis: (0, virtual_thermostat_contract_utils_1.thermostatFingerprint)({ contact: contact.basis, configRevision: context.config.revision }),
750
+ reported: contact.value,
751
+ });
752
+ if (advance)
753
+ this.contacts.set(contact.id, state);
754
+ return state.confirmed === 'unknown' ? null : state.confirmed;
755
+ });
756
+ let trend = this.trends.get(context.config.controllerId);
757
+ if (!trend) {
758
+ trend = (0, virtual_window_trend_utils_1.createVirtualWindowTrendState)();
759
+ if (context.state.heuristicHold)
760
+ Object.assign(trend, context.state.heuristicHold);
761
+ }
762
+ const previousDirection = context.state.previousDemand === 'heat'
763
+ ? 'heating'
764
+ : context.state.previousDemand === 'cool'
765
+ ? 'cooling'
766
+ : context.config.requestedMode === 'cool'
767
+ ? 'cooling'
768
+ : 'heating';
769
+ const heuristic = context.config.heuristic
770
+ ? (0, virtual_window_trend_utils_1.evaluateVirtualWindowTrend)(context.config.heuristic, trend, {
771
+ now,
772
+ enabled: true,
773
+ direction: context.config.requestedMode === 'off' ? 'off' : previousDirection,
774
+ frame: frame.ambientSample
775
+ ? {
776
+ temperature: frame.ambient,
777
+ sampledAt: frame.ambientSample.sampledAt.getTime(),
778
+ basis: (0, virtual_thermostat_contract_utils_1.thermostatFingerprint)({ input: frame.basis, configRevision: context.config.revision }),
779
+ quality: frame.ambientSample.quality,
780
+ }
781
+ : null,
782
+ })
783
+ : null;
784
+ if (advance && heuristic)
785
+ this.trends.set(context.config.controllerId, heuristic.state);
786
+ const branchEvidence = (role) => (0, virtual_thermostat_branch_utils_1.thermostatBranchEvidence)(context.claims.filter((claim) => claim.role === role).map((claim) => this.evidence(context, claim, now)));
787
+ const effective = (0, virtual_thermostat_comfort_utils_1.effectiveThermostatComfort)(context.config.policy, context.config.comfort, context.automation);
788
+ const decision = (0, virtual_thermostat_policy_utils_1.evaluateVirtualThermostatPolicy)({
789
+ ...context.config.policy,
790
+ floor: context.memberBindings.length && !context.bindings.some((row) => row.binding.role === 'floor')
791
+ ? null
792
+ : context.config.policy.floor,
793
+ heatingSetpoint: effective.heating_setpoint,
794
+ coolingSetpoint: effective.cooling_setpoint,
795
+ }, {
796
+ now,
797
+ mode: context.owner?.enabled && effective.source !== 'user_off' ? context.config.requestedMode : 'off',
798
+ ambient: frame.ambient,
799
+ floor: frame.floor,
800
+ heating: branchEvidence('heating'),
801
+ cooling: branchEvidence('cooling'),
802
+ previousDemand: context.state.previousDemand,
803
+ floorOverheatLatched: context.state.floorLatched,
804
+ windows,
805
+ heuristicWindowPause: heuristic?.paused ?? false,
806
+ reconciled: context.claims.length > 0 && context.claims.every((claim) => this.isReconciled(claim)),
807
+ });
808
+ context.coolingProtection = this.coolingDependencies.read(context.coolingBindings, now);
809
+ if (context.config.policy.cooling &&
810
+ context.coolingBindings.length !== context.claims.filter((c) => c.role === 'cooling').length) {
811
+ decision.desiredCooling = false;
812
+ decision.reasons.push('cooling_mandatory_dependencies_missing');
813
+ }
814
+ for (const member of context.coolingProtection) {
815
+ if (!member.ready) {
816
+ decision.desiredCooling = false;
817
+ decision.reasons.push(...member.reasons.map((reason) => `${reason}:${member.claim}`));
818
+ }
819
+ }
820
+ context.memberProtection = this.memberProtection.read(context.memberBindings, now);
821
+ for (const member of context.memberProtection) {
822
+ const branch = context.branches.get(member.claim);
823
+ if (branch)
824
+ branch.floorLatched = member.latched;
825
+ if (!member.ready) {
826
+ decision.desiredHeating = false;
827
+ decision.reasons.push(...member.reasons.map((reason) => `${reason}:${member.claim}`));
828
+ }
829
+ }
830
+ for (const claim of context.claims)
831
+ if (context.commands.some((command) => command.claimId === claim.id && command.action === 'on' && command.status === 'unknown')) {
832
+ decision.reasons.push(claim.role + '_unresolved_on');
833
+ if (claim.role === 'heating')
834
+ decision.desiredHeating = false;
835
+ else
836
+ decision.desiredCooling = false;
837
+ }
838
+ if (!this.comfort.isCurrent(context.config) ||
839
+ (context.config.comfort && (0, virtual_thermostat_comfort_utils_1.validateThermostatComfort)(context.config.comfort, context.config.policy).length)) {
840
+ decision.desiredHeating = false;
841
+ decision.desiredCooling = false;
842
+ decision.reasons.push(context.config.comfort?.temporary_override?.status === 'clock_uncertain'
843
+ ? 'comfort_clock_uncertain'
844
+ : 'comfort_refresh_required');
845
+ }
846
+ if (!context.publishGuard()) {
847
+ decision.desiredHeating = false;
848
+ decision.desiredCooling = false;
849
+ decision.comfortDemand = 'off';
850
+ decision.reasons.push('graph_validation_pending');
851
+ }
852
+ return decision;
853
+ }
854
+ canSend(context, claim, action) {
855
+ const current = this.contexts.get(context.config.controllerId);
856
+ const liveClaim = current?.claims.find((candidate) => candidate.id === claim.id);
857
+ if (!this.isCurrentLifecycle(context.lifecycle) ||
858
+ !current ||
859
+ !context.admission.isCurrent() ||
860
+ !liveClaim ||
861
+ liveClaim.revision !== claim.revision ||
862
+ liveClaim.physicalIdentity !== claim.physicalIdentity ||
863
+ liveClaim.sourcePropertyId !== claim.sourcePropertyId)
864
+ return false;
865
+ if (action === 'off')
866
+ return true;
867
+ if (current !== context ||
868
+ !context.publishGuard() ||
869
+ current.config.revision !== context.config.revision ||
870
+ context.epoch !== this.epochs.get(context.config.controllerId))
871
+ return false;
872
+ const fresh = this.decide(current, this.inputs.read(current.bindings), Date.now(), false);
873
+ return claim.role === 'heating' ? fresh.desiredHeating : fresh.desiredCooling;
874
+ }
875
+ async evaluate(controllerId, lifecycle = this.lifecycle) {
876
+ if (!this.isCurrentLifecycle(lifecycle))
877
+ return;
878
+ const context = await this.load(controllerId);
879
+ if (!context || !this.isCurrentLifecycle(lifecycle))
880
+ return;
881
+ this.contexts.set(controllerId, context);
882
+ const now = Date.now(), frame = this.inputs.read(context.bindings, now);
883
+ context.decision = this.decide(context, frame, now, true);
884
+ this.acknowledgeMemberRelease(context);
885
+ this.acknowledgeCoolingRelease(context);
886
+ context.state.decisionRevision++;
887
+ context.state.configurationRevision = context.config.revision;
888
+ context.state.floorLatched = context.decision.floorOverheatLatched;
889
+ context.state.previousDemand = context.decision.comfortDemand;
890
+ context.state.reasons = context.decision.reasons;
891
+ context.state.evaluatedAt = new Date(now);
892
+ const trend = this.trends.get(controllerId);
893
+ context.state.heuristicHold =
894
+ trend?.pausedAt !== null && trend?.pausedUntil !== null && trend
895
+ ? { pausedAt: trend.pausedAt, pausedUntil: trend.pausedUntil, cooldownUntil: trend.cooldownUntil }
896
+ : null;
897
+ await this.journal.persistRuntimeRows([context.state, ...context.branches.values()]);
898
+ if (!this.isCurrentLifecycle(lifecycle))
899
+ return;
900
+ for (const claim of context.claims) {
901
+ const desired = claim.role === 'heating' ? context.decision.desiredHeating : context.decision.desiredCooling;
902
+ const branch = context.branches.get(claim.id);
903
+ const pending = context.commands.some((command) => command.claimId === claim.id && command.action === 'on' && unresolved(command));
904
+ if (!desired && (branch.activity !== 'off' || pending || !this.isReconciled(claim) || claim.state !== 'reserved'))
905
+ await this.prepare(context, claim, 'off');
906
+ }
907
+ for (const claim of context.claims) {
908
+ if (!this.isCurrentLifecycle(lifecycle))
909
+ return;
910
+ await this.reconcile(context, claim);
911
+ }
912
+ if (!this.isCurrentLifecycle(lifecycle))
913
+ return;
914
+ this.acknowledgeMemberRelease(context);
915
+ this.acknowledgeCoolingRelease(context);
916
+ for (const claim of context.claims) {
917
+ const desired = claim.role === 'heating' ? context.decision.desiredHeating : context.decision.desiredCooling;
918
+ const latest = context.commands
919
+ .filter((command) => command.claimId === claim.id && command.action === 'on' && command.status !== 'cancelled')
920
+ .sort(newestCommandFirst)[0];
921
+ if (desired &&
922
+ (!latest ||
923
+ (latest.status === 'confirmed' && context.branches.get(claim.id).activity === 'off') ||
924
+ (context.branches.get(claim.id).activity === 'on' &&
925
+ now - latest.preparedAt.getTime() >= claim.leaseSeconds * 500)))
926
+ await this.prepare(context, claim, 'on');
927
+ }
928
+ await this.publish(context, frame);
929
+ }
930
+ releaseScope(context) {
931
+ return (0, virtual_thermostat_contract_utils_1.thermostatFingerprint)({
932
+ configuration: context.config.revision,
933
+ inputs: context.bindings
934
+ .map(({ binding, compatible, producerRevision }) => ({ binding, compatible, producerRevision }))
935
+ .sort((a, b) => a.binding.id.localeCompare(b.binding.id)),
936
+ claims: context.claims
937
+ .map((claim) => ({
938
+ id: claim.id,
939
+ revision: claim.revision,
940
+ generation: claim.qualificationGeneration,
941
+ role: claim.role,
942
+ state: claim.state,
943
+ leaseSeconds: claim.leaseSeconds,
944
+ providerProfile: claim.providerProfile,
945
+ providerProfileVersion: claim.providerProfileVersion,
946
+ device: claim.sourceDeviceId,
947
+ physicalIdentity: claim.physicalIdentity,
948
+ source: claim.sourcePropertyId,
949
+ contract: claim.contractFingerprint,
950
+ }))
951
+ .sort((a, b) => a.id.localeCompare(b.id)),
952
+ cooling: context.coolingBindings.map((entry) => ({ claim: entry.claimId, basis: entry.basis })),
953
+ members: context.memberBindings
954
+ .map((member) => ({ claim: member.claimId, basis: member.basis }))
955
+ .sort((a, b) => a.claim.localeCompare(b.claim)),
956
+ });
957
+ }
958
+ hasCurrentDrain(context, claim, requiredAfter) {
959
+ const proof = this.reconciled.get(`${claim.id}:${claim.revision}`);
960
+ const member = this.memberProtection.requiredReleaseAfter(context.memberBindings);
961
+ const cooling = claim.role === 'cooling' ? this.coolingDependencies.requiredReleaseAfter(context.coolingBindings) : null;
962
+ const after = requiredAfter ?? (member === null ? cooling : cooling === null ? member : Math.max(member, cooling));
963
+ const evidence = this.evidence(context, claim, Date.now());
964
+ const target = context.targets.get(claim.id);
965
+ return (!!proof &&
966
+ !!target &&
967
+ !!this.transport.get(target, claim)?.canReconcile(target, proof.qualification) &&
968
+ proof.scope === this.releaseScope(context) &&
969
+ proof.scopeIsCurrent() &&
970
+ (after === null || proof.observedAt > after) &&
971
+ evidence.activity === 'off' &&
972
+ !evidence.pendingOn &&
973
+ evidence.releaseProven &&
974
+ ![...this.inFlightCommands.values()].some((command) => command.claimId === claim.id));
975
+ }
976
+ acknowledgeMemberRelease(context) {
977
+ const after = this.memberProtection.requiredReleaseAfter(context.memberBindings);
978
+ if (after === null ||
979
+ !context.admission.isCurrent() ||
980
+ !context.publishGuard() ||
981
+ this.contexts.get(context.config.controllerId) !== context ||
982
+ context.epoch !== this.epochs.get(context.config.controllerId))
983
+ return;
984
+ const heating = context.claims.filter((claim) => claim.role === 'heating');
985
+ if (!heating.length || !heating.every((claim) => this.hasCurrentDrain(context, claim)))
986
+ return;
987
+ this.memberProtection.acknowledgeRelease(context.memberBindings, Date.now());
988
+ }
989
+ acknowledgeCoolingRelease(context) {
990
+ const after = this.coolingDependencies.requiredReleaseAfter(context.coolingBindings);
991
+ if (after === null ||
992
+ !context.admission.isCurrent() ||
993
+ !context.publishGuard() ||
994
+ this.contexts.get(context.config.controllerId) !== context ||
995
+ context.epoch !== this.epochs.get(context.config.controllerId))
996
+ return;
997
+ const cooling = context.claims.filter((claim) => claim.role === 'cooling');
998
+ if (!cooling.length || !cooling.every((claim) => this.hasCurrentDrain(context, claim, after)))
999
+ return;
1000
+ this.coolingDependencies.acknowledgeRelease(context.coolingBindings);
1001
+ }
1002
+ async prepare(context, claim, action) {
1003
+ const branch = context.branches.get(claim.id), now = Date.now();
1004
+ if (action === 'off' &&
1005
+ ((branch.nextReleaseAt && branch.nextReleaseAt.getTime() > now) ||
1006
+ [...this.inFlightCommands.values()].some((command) => command.claimId === claim.id && command.action === 'off')))
1007
+ return;
1008
+ const target = context.targets.get(claim.id), qualification = this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims));
1009
+ const readiness = target && action === 'on' && context.automation?.baseline
1010
+ ? this.transport.captureReconcileReadiness(target, claim, qualification)
1011
+ : undefined;
1012
+ if (readiness === null || (readiness && !readiness.isCurrent())) {
1013
+ (context.ownedReadinessRefusals ??= new Set()).add(claim.id);
1014
+ return;
1015
+ }
1016
+ const adapter = target && this.transport.capture(target, claim, qualification);
1017
+ if (!target || !adapter) {
1018
+ branch.fault = 'actuator_missing_or_unsupported';
1019
+ await this.write(branch);
1020
+ return;
1021
+ }
1022
+ const command = this.dataSource.manager.create(virtual_thermostat_runtime_entity_1.VirtualThermostatCommandEntity, {
1023
+ id: (0, node_crypto_1.randomUUID)(),
1024
+ controllerId: claim.controllerId,
1025
+ claimId: claim.id,
1026
+ claimRevision: claim.revision,
1027
+ configurationRevision: context.config.revision,
1028
+ decisionRevision: context.state.decisionRevision,
1029
+ action,
1030
+ status: 'prepared',
1031
+ preparedAt: new Date(now),
1032
+ dispatchedAt: null,
1033
+ settledAt: null,
1034
+ proofId: null,
1035
+ fault: null,
1036
+ });
1037
+ if (action === 'off') {
1038
+ branch.releaseAttempts++;
1039
+ branch.nextReleaseAt = new Date(now + retryDelaysMs[Math.min(branch.releaseAttempts - 1, retryDelaysMs.length - 1)]);
1040
+ }
1041
+ await this.journal.insert(command, branch, (manager) => this.validateNativeDecision(manager, context, claim, action, false));
1042
+ context.commands.push(command);
1043
+ this.inFlightCommands.set(command.id, command);
1044
+ const operation = this.dispatch(context, claim, target, command, adapter, qualification, readiness?.isCurrent).finally(() => {
1045
+ this.inFlight.delete(command.id);
1046
+ this.inFlightCommands.delete(command.id);
1047
+ });
1048
+ this.inFlight.set(command.id, operation);
1049
+ this.ownership.enroll(command, operation);
1050
+ void operation.catch(() => undefined);
1051
+ }
1052
+ recordMemberFault(context, claim, reason) {
1053
+ if (!this.isCurrentLifecycle(context.lifecycle) ||
1054
+ context.claims.filter((member) => member.role === claim.role).length < 2)
1055
+ return null;
1056
+ this.memberFaults.set(`${claim.id}:${claim.revision}`, reason);
1057
+ const current = this.contexts.get(claim.controllerId);
1058
+ if (current?.claims.find((member) => member.id === claim.id)?.revision !== claim.revision)
1059
+ return null;
1060
+ const branch = current.branches.get(claim.id);
1061
+ branch.fault = reason;
1062
+ context.branches.get(claim.id).fault = reason;
1063
+ return branch;
1064
+ }
1065
+ async dispatch(context, claim, target, command, adapter, qualification, readinessCurrent) {
1066
+ let enteredTransport = false;
1067
+ let refusedOn = false;
1068
+ let expiredTransport = false;
1069
+ try {
1070
+ expiredTransport = !adapter.isCurrent() || (readinessCurrent !== undefined && !readinessCurrent());
1071
+ if (expiredTransport || !this.canSend(context, claim, command.action)) {
1072
+ command.status = 'cancelled';
1073
+ await this.write(command);
1074
+ if (!expiredTransport)
1075
+ await this.retryOffImmediately(command, context);
1076
+ return;
1077
+ }
1078
+ const authority = this.claims.mintAuthority(claim.id, command.action), update = { ...target, value: command.action === 'on' };
1079
+ const guard = () => adapter.isCurrent() &&
1080
+ (readinessCurrent === undefined || readinessCurrent()) &&
1081
+ this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims)) === qualification &&
1082
+ this.canSend(context, claim, command.action) &&
1083
+ this.claims.isAuthorized(authority, update);
1084
+ command.status = 'dispatching';
1085
+ command.dispatchedAt = new Date();
1086
+ await this.write(command, (manager) => this.validateNativeDecision(manager, context, claim, command.action));
1087
+ if (!guard()) {
1088
+ expiredTransport = !adapter.isCurrent() || (readinessCurrent !== undefined && !readinessCurrent());
1089
+ command.status = 'cancelled';
1090
+ await this.write(command);
1091
+ if (!expiredTransport)
1092
+ await this.retryOffImmediately(command, context);
1093
+ return;
1094
+ }
1095
+ enteredTransport = true;
1096
+ const result = await adapter.send(update, claim, qualification, guard, {
1097
+ commandId: command.id,
1098
+ });
1099
+ refusedOn = command.action === 'on' && result.outcome === 'refused';
1100
+ command.status = refusedOn ? 'cancelled' : result.outcome === 'accepted' ? 'accepted' : 'unknown';
1101
+ command.settledAt = new Date();
1102
+ command.fault =
1103
+ result.outcome === 'refused'
1104
+ ? result.reasons.join(',')
1105
+ : result.outcome === 'unknown'
1106
+ ? 'command_execution_unknown'
1107
+ : null;
1108
+ if (command.action === 'on' && result.outcome !== 'accepted') {
1109
+ const branch = this.recordMemberFault(context, claim, command.fault ?? 'mandatory_member_refused');
1110
+ if (branch)
1111
+ await this.write(branch);
1112
+ }
1113
+ await this.write(command);
1114
+ }
1115
+ catch (error) {
1116
+ command.status = enteredTransport && !refusedOn ? 'unknown' : 'cancelled';
1117
+ const retiredBeforeSend = !enteredTransport && error instanceof ThermostatDecisionRetiredError;
1118
+ command.fault = retiredBeforeSend ? null : error instanceof Error ? error.message : 'dispatch_error';
1119
+ if (command.action === 'on' && !retiredBeforeSend)
1120
+ this.recordMemberFault(context, claim, command.fault);
1121
+ try {
1122
+ await this.write(command);
1123
+ if (!enteredTransport)
1124
+ await this.retryOffImmediately(command, context);
1125
+ }
1126
+ catch (cleanup) {
1127
+ if (retiredBeforeSend)
1128
+ throw cleanup;
1129
+ this.logger.error('Failed to persist original thermostat command failure', cleanup);
1130
+ }
1131
+ if (!retiredBeforeSend)
1132
+ throw error;
1133
+ }
1134
+ finally {
1135
+ if (this.isCurrentLifecycle(context.lifecycle) && !refusedOn && !expiredTransport)
1136
+ void this.request(claim.controllerId, !context.claims.some((member) => context.claims.filter((other) => other.role === member.role).length > 1));
1137
+ }
1138
+ }
1139
+ async retryOffImmediately(command, context) {
1140
+ if (!this.isCurrentLifecycle(context.lifecycle))
1141
+ return;
1142
+ if (command.action !== 'off')
1143
+ return;
1144
+ await this.journal.runNative(async (manager) => {
1145
+ const branch = await manager.findOneBy(virtual_thermostat_runtime_entity_1.VirtualThermostatBranchRuntimeEntity, { claimId: command.claimId });
1146
+ if (!branch)
1147
+ return;
1148
+ await this.journal.captureRuntimeRow(manager, branch);
1149
+ branch.releaseAttempts = Math.max(0, branch.releaseAttempts - 1);
1150
+ branch.nextReleaseAt = null;
1151
+ await this.journal.writeRuntimeRows(manager, [branch]);
1152
+ });
1153
+ }
1154
+ async reconcile(context, claim) {
1155
+ const target = context.targets.get(claim.id), qualification = this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims));
1156
+ if (context.automation?.baseline && (!target || !qualification)) {
1157
+ (context.ownedReadinessRefusals ??= new Set()).add(claim.id);
1158
+ return;
1159
+ }
1160
+ const metadata = context.automation?.baseline && target && qualification
1161
+ ? this.transport.captureOffMetadata(target, claim, qualification)
1162
+ : undefined;
1163
+ if (metadata === null || (metadata && !metadata.isCurrent())) {
1164
+ (context.ownedReadinessRefusals ??= new Set()).add(claim.id);
1165
+ return;
1166
+ }
1167
+ const readiness = context.automation?.baseline && target && qualification
1168
+ ? this.transport.captureReconcileReadiness(target, claim, qualification)
1169
+ : undefined;
1170
+ if (readiness === null || (readiness && !readiness.isCurrent())) {
1171
+ (context.ownedReadinessRefusals ??= new Set()).add(claim.id);
1172
+ return;
1173
+ }
1174
+ const adapter = target && this.transport.capture(target, claim, qualification);
1175
+ if (!target || !qualification || !adapter?.canReconcile(target, qualification))
1176
+ return;
1177
+ const off = this.values.readQualifiedSample(target.property, 30_000);
1178
+ if (off?.value !== false)
1179
+ return;
1180
+ if ([...this.inFlightCommands.values()].some((command) => command.claimId === claim.id))
1181
+ return;
1182
+ const { pending, controllerImage } = await this.structure.runShared(async () => {
1183
+ const pending = await this.loadUnresolvedCommands(claim.controllerId, claim.id);
1184
+ await this.journal.capturePending(this.dataSource.manager, pending, claim.controllerId, claim.id);
1185
+ return {
1186
+ pending,
1187
+ controllerImage: await (0, thermostat_controller_mutation_1.readControllerMutationImage)(this.dataSource.manager, claim.controllerId),
1188
+ };
1189
+ });
1190
+ if (pending.some((command) => this.inFlight.has(command.id)))
1191
+ return;
1192
+ if (!pending.length && this.hasCurrentDrain(context, claim))
1193
+ return;
1194
+ if (!pending.length && !context.publishGuard() && this.isReconciled(claim))
1195
+ return;
1196
+ const startedAt = new Date();
1197
+ if (!adapter.isCurrent())
1198
+ return;
1199
+ const proof = await adapter.reconcile(target, pending.map((command) => command.id), off, () => adapter.isCurrent() && this.canSend(context, claim, 'off'), {
1200
+ controllerId: context.config.controllerId,
1201
+ controllerRevision: context.config.revision,
1202
+ claimId: claim.id,
1203
+ claimRevision: claim.revision,
1204
+ contractFingerprint: claim.contractFingerprint,
1205
+ qualification,
1206
+ });
1207
+ let retireConfirmedCommandIds;
1208
+ try {
1209
+ retireConfirmedCommandIds = proof?.retireConfirmedCommandIds;
1210
+ }
1211
+ catch {
1212
+ }
1213
+ const acceptedOff = this.values.readQualifiedSample(target.property, 30_000);
1214
+ const endedAt = new Date();
1215
+ const covered = new Set(proof?.coveredCommandIds ?? []);
1216
+ if (!proof ||
1217
+ (metadata !== undefined && !metadata.isCurrent()) ||
1218
+ (readiness !== undefined && !readiness.isCurrent()) ||
1219
+ !adapter.isCurrent() ||
1220
+ !acceptedOff ||
1221
+ acceptedOff.value !== false ||
1222
+ acceptedOff.provenance !== 'live' ||
1223
+ acceptedOff.quality !== 'good' ||
1224
+ !proof.isCurrent?.() ||
1225
+ !proof.sourceIsCurrent?.() ||
1226
+ this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims)) !== qualification ||
1227
+ proof.scope?.controllerId !== context.config.controllerId ||
1228
+ proof.scope.controllerRevision !== context.config.revision ||
1229
+ proof.scope.claimId !== claim.id ||
1230
+ proof.scope.claimRevision !== claim.revision ||
1231
+ proof.scope.contractFingerprint !== claim.contractFingerprint ||
1232
+ !Number.isFinite(proof.observedAt?.getTime()) ||
1233
+ proof.observedAt.getTime() < startedAt.getTime() ||
1234
+ proof.observedAt.getTime() > endedAt.getTime() ||
1235
+ !this.canSend(context, claim, 'off') ||
1236
+ !proof.proofId ||
1237
+ !proof.connectionIdentity ||
1238
+ proof.physicalIdentity !== claim.physicalIdentity ||
1239
+ !proof.externalWriterBarrier ||
1240
+ pending.some((command) => !covered.has(command.id)) ||
1241
+ proof.offSample.propertyId !== target.property.id ||
1242
+ proof.offSample.value !== false ||
1243
+ proof.offSample.provenance !== 'live' ||
1244
+ proof.offSample.quality !== 'good' ||
1245
+ proof.offSample.sampledAt.getTime() < proof.observedAt.getTime() ||
1246
+ proof.offSample.receivedAt.getTime() > endedAt.getTime() ||
1247
+ proof.offSample.sampledAt.getTime() !== acceptedOff.sampledAt.getTime() ||
1248
+ proof.offSample.receivedAt.getTime() !== acceptedOff.receivedAt.getTime() ||
1249
+ proof.offSample.revision !== acceptedOff.revision)
1250
+ return;
1251
+ const isProofCurrent = () => {
1252
+ const currentOff = this.values.readQualifiedSample(target.property, 30_000);
1253
+ return (adapter.isCurrent() &&
1254
+ (metadata === undefined || metadata.isCurrent()) &&
1255
+ (readiness === undefined || readiness.isCurrent()) &&
1256
+ this.canSend(context, claim, 'off') &&
1257
+ proof.isCurrent() &&
1258
+ proof.sourceIsCurrent() &&
1259
+ this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims)) === qualification &&
1260
+ this.contexts.get(claim.controllerId)?.config.revision === proof.scope.controllerRevision &&
1261
+ !!currentOff &&
1262
+ currentOff.value === false &&
1263
+ currentOff.provenance === 'live' &&
1264
+ currentOff.quality === 'good' &&
1265
+ currentOff.sampledAt.getTime() === proof.offSample.sampledAt.getTime() &&
1266
+ currentOff.receivedAt.getTime() === proof.offSample.receivedAt.getTime() &&
1267
+ currentOff.revision === proof.offSample.revision &&
1268
+ adapter.canReconcile(target, qualification));
1269
+ };
1270
+ const branch = context.branches.get(claim.id);
1271
+ const staleProof = new Error('Qualified release proof expired during journal settlement');
1272
+ const settled = await this.journal
1273
+ .runNative(async (manager) => {
1274
+ const current = await this.loadUnresolvedCommands(claim.controllerId, claim.id, manager);
1275
+ const currentConfig = await manager.findOneBy(virtual_thermostat_entity_1.VirtualThermostatConfigEntity, {
1276
+ controllerId: claim.controllerId,
1277
+ });
1278
+ const currentClaim = await manager.findOneBy(virtual_thermostat_entity_1.VirtualThermostatActuatorClaimEntity, { id: claim.id });
1279
+ const currentQualification = this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims));
1280
+ const currentOff = this.values.readQualifiedSample(target.property, 30_000);
1281
+ if (!this.canSend(context, claim, 'off') ||
1282
+ !proof.isCurrent?.() ||
1283
+ !proof.sourceIsCurrent?.() ||
1284
+ currentConfig?.revision !== proof.scope.controllerRevision ||
1285
+ !currentClaim ||
1286
+ currentClaim.state === 'released' ||
1287
+ currentClaim.revision !== proof.scope.claimRevision ||
1288
+ currentClaim.contractFingerprint !== proof.scope.contractFingerprint ||
1289
+ currentClaim.sourcePropertyId !== target.property.id ||
1290
+ currentClaim.physicalIdentity !== proof.physicalIdentity ||
1291
+ currentQualification !== qualification ||
1292
+ !currentOff ||
1293
+ currentOff.value !== false ||
1294
+ currentOff.provenance !== 'live' ||
1295
+ currentOff.quality !== 'good' ||
1296
+ currentOff.sampledAt.getTime() !== proof.offSample.sampledAt.getTime() ||
1297
+ currentOff.receivedAt.getTime() !== proof.offSample.receivedAt.getTime() ||
1298
+ currentOff.revision !== proof.offSample.revision ||
1299
+ !adapter.isCurrent() ||
1300
+ !adapter.canReconcile(target, currentQualification) ||
1301
+ current.some((command) => this.inFlight.has(command.id) || !covered.has(command.id)))
1302
+ return null;
1303
+ const settledBranch = await manager.findOneBy(virtual_thermostat_runtime_entity_1.VirtualThermostatBranchRuntimeEntity, { claimId: claim.id });
1304
+ if (!settledBranch)
1305
+ throw staleProof;
1306
+ await this.journal.captureRuntimeRow(manager, settledBranch);
1307
+ Object.assign(settledBranch, {
1308
+ releaseProofId: proof.proofId,
1309
+ activity: 'off',
1310
+ lastVerifiedOffAt: !branch.lastVerifiedOffAt || current.some((command) => command.action === 'on')
1311
+ ? proof.offSample.receivedAt
1312
+ : branch.lastVerifiedOffAt,
1313
+ releaseAttempts: 0,
1314
+ nextReleaseAt: null,
1315
+ fault: null,
1316
+ });
1317
+ const settledAt = new Date();
1318
+ if (!(await this.journal.confirmPending(manager, pending, claim.controllerId, claim.id, proof.proofId, settledAt)))
1319
+ return null;
1320
+ const verifyController = async () => {
1321
+ if (JSON.stringify(await (0, thermostat_controller_mutation_1.readControllerMutationImage)(manager, claim.controllerId)) !==
1322
+ JSON.stringify(controllerImage) ||
1323
+ !isProofCurrent())
1324
+ throw staleProof;
1325
+ };
1326
+ await verifyController();
1327
+ this.journal.addNativeCheck(manager, verifyController, isProofCurrent);
1328
+ await this.journal.writeRuntimeRows(manager, [settledBranch]);
1329
+ if (!isProofCurrent())
1330
+ throw staleProof;
1331
+ return { branch: settledBranch, currentIds: new Set(current.map((command) => command.id)), settledAt };
1332
+ })
1333
+ .catch((error) => {
1334
+ if (error === staleProof)
1335
+ return null;
1336
+ throw error;
1337
+ });
1338
+ if (!settled)
1339
+ return;
1340
+ try {
1341
+ if (retireConfirmedCommandIds != null)
1342
+ (0, creation_capture_1.invokeCreation)(retireConfirmedCommandIds, proof, [...settled.currentIds]);
1343
+ }
1344
+ catch {
1345
+ }
1346
+ context.branches.set(claim.id, settled.branch);
1347
+ for (const command of context.commands)
1348
+ if (settled.currentIds.has(command.id) && unresolved(command)) {
1349
+ command.status = 'confirmed';
1350
+ command.proofId = proof.proofId;
1351
+ command.settledAt = settled.settledAt;
1352
+ }
1353
+ if (!isProofCurrent())
1354
+ return;
1355
+ this.memberFaults.delete(`${claim.id}:${claim.revision}`);
1356
+ if (claim.state === 'releasing') {
1357
+ const authority = this.claims.mintAuthority(claim.id, 'off');
1358
+ await this.claims.completeRelease(this.claims.recordQualifiedRelease(authority, {
1359
+ outputConfirmedOff: true,
1360
+ pendingOnDrained: true,
1361
+ evidenceId: proof.proofId,
1362
+ qualification,
1363
+ isCurrent: isProofCurrent,
1364
+ controllerRevision: proof.scope.controllerRevision,
1365
+ }));
1366
+ }
1367
+ this.reconciled.set(`${claim.id}:${claim.revision}`, {
1368
+ qualification,
1369
+ sourceIsCurrent: proof.sourceIsCurrent,
1370
+ observedAt: proof.offSample.receivedAt.getTime(),
1371
+ scope: this.releaseScope(context),
1372
+ scopeIsCurrent: () => context.admission.isCurrent() &&
1373
+ context.publishGuard() &&
1374
+ (metadata === undefined || metadata.isCurrent()) &&
1375
+ (readiness === undefined || readiness.isCurrent()),
1376
+ });
1377
+ }
1378
+ branchObservation(context, claimId, now) {
1379
+ const unavailable = {
1380
+ qualification_ready: null,
1381
+ activity: 'unknown',
1382
+ activity_sampled_at: null,
1383
+ activity_expires_at: null,
1384
+ };
1385
+ if (!this.active ||
1386
+ !context ||
1387
+ !context.admission.isCurrent() ||
1388
+ !context.publishGuard() ||
1389
+ context.epoch !== (this.epochs.get(context.config.controllerId) ?? 0))
1390
+ return unavailable;
1391
+ const claim = context.claims.find((member) => member.id === claimId), target = context.targets.get(claimId);
1392
+ if (!claim ||
1393
+ !target?.device.enabled ||
1394
+ !(target.property instanceof devices_shelly_ng_entity_1.ShellyNgChannelPropertyEntity) ||
1395
+ target.property.id !== claim.sourcePropertyId ||
1396
+ (0, virtual_thermostat_contract_utils_1.thermostatActuatorIdentity)(target.property, target.channel, target.device) !== claim.physicalIdentity ||
1397
+ !this.values.captureSampleSourceGuard(target.property)())
1398
+ return unavailable;
1399
+ const qualificationReady = this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims))
1400
+ ? true
1401
+ : null;
1402
+ const sample = this.values.readQualifiedSampleSnapshot(target.property, 30_000, now);
1403
+ if (!sample ||
1404
+ sample.propertyId !== target.property.id ||
1405
+ sample.provenance !== 'live' ||
1406
+ sample.quality !== 'good' ||
1407
+ typeof sample.value !== 'boolean')
1408
+ return { ...unavailable, qualification_ready: qualificationReady };
1409
+ const sampledAt = sample.sampledAt.getTime(), receivedAt = sample.receivedAt.getTime(), expiresAt = new Date(sampledAt + 30_000);
1410
+ if (!Number.isFinite(sampledAt) ||
1411
+ !Number.isFinite(receivedAt) ||
1412
+ !Number.isFinite(expiresAt.getTime()) ||
1413
+ sampledAt > now.getTime() ||
1414
+ receivedAt > now.getTime() ||
1415
+ now.getTime() >= expiresAt.getTime())
1416
+ return { ...unavailable, qualification_ready: qualificationReady };
1417
+ const commands = new Map(context.commands.map((command) => [command.id, command]));
1418
+ for (const command of this.inFlightCommands.values())
1419
+ if (command.claimId === claim.id)
1420
+ commands.set(command.id, command);
1421
+ if ([...commands.values()].some((command) => command.claimId === claim.id &&
1422
+ unresolved(command) &&
1423
+ command.action === 'on' &&
1424
+ command.dispatchedAt &&
1425
+ receivedAt < command.dispatchedAt.getTime()))
1426
+ return { ...unavailable, qualification_ready: qualificationReady };
1427
+ return {
1428
+ qualification_ready: qualificationReady,
1429
+ activity: sample.value ? 'on' : 'off',
1430
+ activity_sampled_at: sample.sampledAt.toISOString(),
1431
+ activity_expires_at: expiresAt.toISOString(),
1432
+ };
1433
+ }
1434
+ async publish(context, frame) {
1435
+ if (!context.publishGuard())
1436
+ return;
1437
+ const observedAt = new Date();
1438
+ const branches = context.claims.map((claim) => {
1439
+ const branch = context.branches.get(claim.id), commands = context.commands.filter((command) => command.claimId === claim.id && unresolved(command));
1440
+ const target = context.targets.get(claim.id);
1441
+ const readinessFault = !target
1442
+ ? 'actuator_missing'
1443
+ : !this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims))
1444
+ ? 'hardware_qualification_missing'
1445
+ : !this.values.readQualifiedSample(target.property, 30_000)
1446
+ ? 'feedback_unavailable'
1447
+ : claim.state !== 'reserved'
1448
+ ? `actuator_${claim.state}`
1449
+ : null;
1450
+ return {
1451
+ protection: context.memberProtection.find((entry) => entry.claim === claim.id) ?? null,
1452
+ cooling_protection: context.coolingProtection.find((entry) => entry.claim === claim.id) ?? null,
1453
+ claim: claim.id,
1454
+ group_identity: (0, thermostat_actuation_contract_1.thermostatBranchGroupIdentity)(claim.controllerId, claim.role),
1455
+ physical_identity: claim.physicalIdentity,
1456
+ claim_state: claim.state,
1457
+ last_verified_off_at: branch.lastVerifiedOffAt?.toISOString() ?? null,
1458
+ release_evidence: claim.releaseEvidence,
1459
+ role: claim.role,
1460
+ activity: commands.some((command) => command.action === 'on' &&
1461
+ command.dispatchedAt &&
1462
+ ((target ? this.values.readQualifiedSample(target.property, 30_000)?.receivedAt.getTime() : null) ?? 0) <
1463
+ command.dispatchedAt.getTime())
1464
+ ? 'unknown'
1465
+ : branch.activity,
1466
+ pending_on: commands.some((command) => command.action === 'on'),
1467
+ release_pending: commands.some((command) => command.action === 'off'),
1468
+ release_attempts: branch.releaseAttempts,
1469
+ next_release_at: branch.nextReleaseAt?.toISOString() ?? null,
1470
+ release_proven: branch.activity === 'off' && !commands.some((command) => command.action === 'on') && this.isReconciled(claim),
1471
+ fault: this.memberFaults.get(`${claim.id}:${claim.revision}`) ??
1472
+ branch.fault ??
1473
+ commands.find((command) => command.fault)?.fault ??
1474
+ readinessFault,
1475
+ };
1476
+ });
1477
+ const reasons = [...context.decision.reasons];
1478
+ if (context.claims.some((claim) => !this.claims.qualification(claim, (0, thermostat_actuation_contract_1.thermostatHasOpposedBranches)(context.claims))))
1479
+ reasons.push('hardware_qualification_missing');
1480
+ if (context.claims.some((claim) => !this.isReconciled(claim)))
1481
+ reasons.push('release_ordering_unreconciled');
1482
+ if (context.automation?.baseline && context.ownedReadinessRefusals?.size)
1483
+ reasons.push('owned_transport_not_ready');
1484
+ const priority = [
1485
+ 'release_ordering_unreconciled',
1486
+ 'ambient_unavailable',
1487
+ 'floor_unavailable',
1488
+ 'contact_unknown',
1489
+ 'user_off',
1490
+ 'floor_overheat',
1491
+ 'window_open',
1492
+ 'suspected_window_open',
1493
+ ];
1494
+ const runtime = {
1495
+ epoch: this.epoch,
1496
+ sequence: ++this.sequence,
1497
+ configuration_revision: context.config.revision,
1498
+ decision_revision: context.state.decisionRevision,
1499
+ readiness: reasons.some((reason) => [
1500
+ 'hardware_qualification_missing',
1501
+ 'release_ordering_unreconciled',
1502
+ 'startup_unreconciled',
1503
+ 'owned_transport_not_ready',
1504
+ ].includes(reason) || reason.startsWith('member_'))
1505
+ ? 'suspended'
1506
+ : 'ready',
1507
+ inputs: frame.inputs,
1508
+ requested_mode: context.config.requestedMode,
1509
+ effective_comfort: (0, virtual_thermostat_comfort_utils_1.effectiveThermostatComfort)(context.config.policy, context.config.comfort, context.automation),
1510
+ heating_setpoint: context.config.policy.heatingSetpoint,
1511
+ cooling_setpoint: context.config.policy.coolingSetpoint,
1512
+ current_temperature: frame.ambient,
1513
+ floor_temperature: context.config.displayFloorClaimId
1514
+ ? (context.memberProtection.find((row) => row.claim === context.config.displayFloorClaimId)?.temperature ??
1515
+ null)
1516
+ : frame.floor,
1517
+ floor_latched: context.state.floorLatched,
1518
+ comfort_demand: context.decision.comfortDemand,
1519
+ reasons: [...new Set(reasons)],
1520
+ headline_reason: priority.find((reason) => reasons.includes(reason)) ?? reasons[0] ?? null,
1521
+ branches: branches.map((branch) => ({ ...branch, ...this.branchObservation(context, branch.claim, observedAt) })),
1522
+ };
1523
+ if (!context.publishGuard())
1524
+ return;
1525
+ this.diagnostics.set(context.config.controllerId, runtime);
1526
+ this.diagnosticGuards.set(context.config.controllerId, context.publishGuard);
1527
+ this.events.emit('DevicesVirtualPlugin.Thermostat.RuntimeChanged', {
1528
+ controller: context.config.controllerId,
1529
+ configuration_revision: context.config.revision,
1530
+ decision_revision: context.state.decisionRevision,
1531
+ epoch: this.epoch,
1532
+ sequence: runtime.sequence,
1533
+ runtime,
1534
+ });
1535
+ if (!context.publishGuard())
1536
+ return;
1537
+ const properties = await this.dataSource.manager.find(devices_virtual_entity_1.VirtualChannelPropertyEntity, {
1538
+ where: { channel: { device: { id: context.config.controllerId } } },
1539
+ relations: ['channel'],
1540
+ });
1541
+ if (!context.publishGuard())
1542
+ return;
1543
+ for (const property of properties) {
1544
+ if (!context.publishGuard())
1545
+ return;
1546
+ if (property.valueOrigin !== devices_virtual_entity_1.VirtualValueOrigin.LOCAL ||
1547
+ property.permissions.some((permission) => permission === devices_constants_1.PermissionType.READ_WRITE || permission === devices_constants_1.PermissionType.WRITE_ONLY))
1548
+ continue;
1549
+ const channel = property.channel;
1550
+ let value, sample = frame.ambientSample;
1551
+ if (channel.category === devices_constants_1.ChannelCategory.TEMPERATURE && property.category === devices_constants_1.PropertyCategory.TEMPERATURE)
1552
+ value = frame.ambient;
1553
+ else if (channel.category === devices_constants_1.ChannelCategory.THERMOSTAT &&
1554
+ property.category === devices_constants_1.PropertyCategory.FLOOR_TEMPERATURE) {
1555
+ const selected = context.config.displayFloorClaimId &&
1556
+ context.memberBindings.find((entry) => entry.claimId === context.config.displayFloorClaimId);
1557
+ sample = selected
1558
+ ? selected.source &&
1559
+ this.values.readQualifiedSample(selected.source.property, selected.binding.maximumAgeSeconds * 1000)
1560
+ : frame.floorSample;
1561
+ value = sample && typeof sample.value === 'number' ? sample.value : null;
1562
+ }
1563
+ else if (property.category === devices_constants_1.PropertyCategory.STATUS &&
1564
+ [devices_constants_1.ChannelCategory.HEATER, devices_constants_1.ChannelCategory.COOLER].includes(channel.category)) {
1565
+ const activity = (0, virtual_thermostat_branch_utils_1.thermostatBranchActivity)(branches.filter((branch) => branch.role === (channel.category === devices_constants_1.ChannelCategory.HEATER ? 'heating' : 'cooling')));
1566
+ value = activity === 'unknown' ? null : activity === 'on';
1567
+ sample = null;
1568
+ }
1569
+ else
1570
+ continue;
1571
+ let output = this.outputs.get(property.id);
1572
+ if (!output || output.lease.revision !== context.config.revision || !this.producers.isAvailable(output.lease)) {
1573
+ output = {
1574
+ property,
1575
+ lease: this.producers.register(property, context.config.revision, {
1576
+ isCurrent: context.publishGuard,
1577
+ reason: 'graph_validation_pending',
1578
+ }),
1579
+ };
1580
+ this.outputs.set(property.id, output);
1581
+ }
1582
+ if (value === null) {
1583
+ this.producers.invalidate(output.lease, ['input_or_feedback_unavailable']);
1584
+ continue;
1585
+ }
1586
+ const sampledAt = sample?.sampledAt ?? new Date();
1587
+ await this.values.publishDerived(property, output.lease, value, {
1588
+ quality: 'good',
1589
+ reasons: [],
1590
+ sampledAt,
1591
+ evaluatedAt: new Date(),
1592
+ expiresAt: new Date(Math.min(sampledAt.getTime() + 30000, Date.now() + 1000)),
1593
+ });
1594
+ }
1595
+ }
1596
+ };
1597
+ exports.VirtualThermostatRuntimeService = VirtualThermostatRuntimeService;
1598
+ exports.VirtualThermostatRuntimeService = VirtualThermostatRuntimeService = VirtualThermostatRuntimeService_1 = __decorate([
1599
+ (0, common_1.Injectable)(),
1600
+ __param(10, (0, common_1.Optional)()),
1601
+ __param(11, (0, common_1.Optional)()),
1602
+ __param(12, (0, common_1.Optional)()),
1603
+ __metadata("design:paramtypes", [typeorm_1.DataSource,
1604
+ device_structure_lock_service_1.DeviceStructureLockService,
1605
+ virtual_thermostat_claims_service_1.VirtualThermostatClaimsService,
1606
+ virtual_thermostat_inputs_service_1.VirtualThermostatInputsService,
1607
+ virtual_thermostat_transport_service_1.VirtualThermostatTransportService,
1608
+ property_value_service_1.PropertyValueService,
1609
+ property_producer_registry_service_1.PropertyProducerRegistryService,
1610
+ event_emitter_1.EventEmitter2,
1611
+ virtual_dependency_graph_service_1.VirtualDependencyGraphService,
1612
+ virtual_thermostat_comfort_service_1.VirtualThermostatComfortService,
1613
+ config_1.ConfigService,
1614
+ thermostat_member_protection_service_1.ThermostatMemberProtectionService,
1615
+ virtual_thermostat_automation_service_1.VirtualThermostatAutomationService])
1616
+ ], VirtualThermostatRuntimeService);
1617
+ //# sourceMappingURL=virtual-thermostat-runtime.service.js.map