@zwave-js/cc 14.0.0-beta.4 → 14.0.0-beta.5

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 (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -1,10 +1,37 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
6
34
  };
7
- var ThermostatSetpointCCSet_1, ThermostatSetpointCCReport_1, ThermostatSetpointCCGet_1, ThermostatSetpointCCCapabilitiesReport_1, ThermostatSetpointCCCapabilitiesGet_1, ThermostatSetpointCCSupportedReport_1;
8
35
  function __assertType(argName, typeName, boundHasError) {
9
36
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
10
37
  if (boundHasError()) {
@@ -22,7 +49,7 @@ import { Bytes } from "@zwave-js/shared/safe";
22
49
  import { getEnumMemberName, pick } from "@zwave-js/shared/safe";
23
50
  import { CCAPI, POLL_VALUE, SET_VALUE, throwUnsupportedProperty, throwWrongValueType, } from "../lib/API.js";
24
51
  import { CommandClass, } from "../lib/CommandClass.js";
25
- import { API, CCCommand, ccValue, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
52
+ import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
26
53
  import { V } from "../lib/Values.js";
27
54
  import { ThermostatSetpointCommand, ThermostatSetpointType, } from "../lib/_Types.js";
28
55
  // This array is used to map the advertised supported types (interpretation A)
@@ -64,236 +91,295 @@ export const ThermostatSetpointCCValues = Object.freeze({
64
91
  ...V.dynamicPropertyAndKeyWithName("setpointScale", "setpointScale", (setpointType) => setpointType, ({ property, propertyKey }) => property === "setpointScale" && typeof propertyKey === "number", undefined, { internal: true }),
65
92
  }),
66
93
  });
67
- let ThermostatSetpointCCAPI = class ThermostatSetpointCCAPI extends CCAPI {
68
- supportsCommand(cmd) {
69
- switch (cmd) {
70
- case ThermostatSetpointCommand.Get:
71
- case ThermostatSetpointCommand.SupportedGet:
72
- return this.isSinglecast();
73
- case ThermostatSetpointCommand.Set:
74
- return true; // This is mandatory
75
- case ThermostatSetpointCommand.CapabilitiesGet:
76
- return this.version >= 3 && this.isSinglecast();
77
- }
78
- return super.supportsCommand(cmd);
79
- }
80
- get [SET_VALUE]() {
81
- return async function ({ property, propertyKey }, value) {
82
- if (property !== "setpoint") {
83
- throwUnsupportedProperty(this.ccId, property);
84
- }
85
- if (typeof propertyKey !== "number") {
86
- throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);
87
- }
88
- if (typeof value !== "number") {
89
- throwWrongValueType(this.ccId, property, "number", typeof value);
90
- }
91
- // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the
92
- // actual Setpoint Type during the node interview. Fall back to the first scale if none is known
93
- const preferredScale = this.tryGetValueDB()?.getValue(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));
94
- const result = await this.set(propertyKey, value, preferredScale ?? 0);
95
- // Verify the current value after a delay, unless the command was supervised and successful
96
- if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {
97
- // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600
98
- // aren't able to handle the GET this quickly.
99
- this.schedulePoll({ property, propertyKey }, value);
94
+ let ThermostatSetpointCCAPI = (() => {
95
+ let _classDecorators = [API(CommandClasses["Thermostat Setpoint"])];
96
+ let _classDescriptor;
97
+ let _classExtraInitializers = [];
98
+ let _classThis;
99
+ let _classSuper = CCAPI;
100
+ var ThermostatSetpointCCAPI = class extends _classSuper {
101
+ static { _classThis = this; }
102
+ static {
103
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
104
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
105
+ ThermostatSetpointCCAPI = _classThis = _classDescriptor.value;
106
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
107
+ __runInitializers(_classThis, _classExtraInitializers);
108
+ }
109
+ supportsCommand(cmd) {
110
+ switch (cmd) {
111
+ case ThermostatSetpointCommand.Get:
112
+ case ThermostatSetpointCommand.SupportedGet:
113
+ return this.isSinglecast();
114
+ case ThermostatSetpointCommand.Set:
115
+ return true; // This is mandatory
116
+ case ThermostatSetpointCommand.CapabilitiesGet:
117
+ return this.version >= 3 && this.isSinglecast();
100
118
  }
101
- return result;
102
- };
103
- }
104
- get [POLL_VALUE]() {
105
- return async function ({ property, propertyKey }) {
106
- switch (property) {
107
- case "setpoint":
108
- if (typeof propertyKey !== "number") {
109
- throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);
110
- }
111
- return (await this.get(propertyKey))?.value;
112
- default:
119
+ return super.supportsCommand(cmd);
120
+ }
121
+ get [SET_VALUE]() {
122
+ return async function ({ property, propertyKey }, value) {
123
+ if (property !== "setpoint") {
113
124
  throwUnsupportedProperty(this.ccId, property);
125
+ }
126
+ if (typeof propertyKey !== "number") {
127
+ throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);
128
+ }
129
+ if (typeof value !== "number") {
130
+ throwWrongValueType(this.ccId, property, "number", typeof value);
131
+ }
132
+ // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the
133
+ // actual Setpoint Type during the node interview. Fall back to the first scale if none is known
134
+ const preferredScale = this.tryGetValueDB()?.getValue(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));
135
+ const result = await this.set(propertyKey, value, preferredScale ?? 0);
136
+ // Verify the current value after a delay, unless the command was supervised and successful
137
+ if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {
138
+ // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600
139
+ // aren't able to handle the GET this quickly.
140
+ this.schedulePoll({ property, propertyKey }, value);
141
+ }
142
+ return result;
143
+ };
144
+ }
145
+ get [POLL_VALUE]() {
146
+ return async function ({ property, propertyKey }) {
147
+ switch (property) {
148
+ case "setpoint":
149
+ if (typeof propertyKey !== "number") {
150
+ throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);
151
+ }
152
+ return (await this.get(propertyKey))?.value;
153
+ default:
154
+ throwUnsupportedProperty(this.ccId, property);
155
+ }
156
+ };
157
+ }
158
+ async get(setpointType) {
159
+ __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
160
+ this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);
161
+ const cc = new ThermostatSetpointCCGet({
162
+ nodeId: this.endpoint.nodeId,
163
+ endpointIndex: this.endpoint.index,
164
+ setpointType,
165
+ });
166
+ const response = await this.host.sendCommand(cc, this.commandOptions);
167
+ if (!response)
168
+ return;
169
+ if (response.type !== ThermostatSetpointType["N/A"]) {
170
+ // This is a supported setpoint
171
+ const scale = getScale(response.scale);
172
+ return {
173
+ value: response.value,
174
+ scale,
175
+ };
114
176
  }
115
- };
116
- }
117
- async get(setpointType) {
118
- __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
119
- this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);
120
- const cc = new ThermostatSetpointCCGet({
121
- nodeId: this.endpoint.nodeId,
122
- endpointIndex: this.endpoint.index,
123
- setpointType,
124
- });
125
- const response = await this.host.sendCommand(cc, this.commandOptions);
126
- if (!response)
127
- return;
128
- if (response.type !== ThermostatSetpointType["N/A"]) {
129
- // This is a supported setpoint
130
- const scale = getScale(response.scale);
131
- return {
132
- value: response.value,
177
+ }
178
+ async set(setpointType, value, scale) {
179
+ __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
180
+ __assertType("value", "number", __assertType__number.bind(void 0, value));
181
+ __assertType("scale", "number", __assertType__number.bind(void 0, scale));
182
+ this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);
183
+ const cc = new ThermostatSetpointCCSet({
184
+ nodeId: this.endpoint.nodeId,
185
+ endpointIndex: this.endpoint.index,
186
+ setpointType,
187
+ value,
133
188
  scale,
134
- };
189
+ });
190
+ return this.host.sendCommand(cc, this.commandOptions);
135
191
  }
136
- }
137
- async set(setpointType, value, scale) {
138
- __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
139
- __assertType("value", "number", __assertType__number.bind(void 0, value));
140
- __assertType("scale", "number", __assertType__number.bind(void 0, scale));
141
- this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);
142
- const cc = new ThermostatSetpointCCSet({
143
- nodeId: this.endpoint.nodeId,
144
- endpointIndex: this.endpoint.index,
145
- setpointType,
146
- value,
147
- scale,
148
- });
149
- return this.host.sendCommand(cc, this.commandOptions);
150
- }
151
- async getCapabilities(setpointType) {
152
- __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
153
- this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);
154
- const cc = new ThermostatSetpointCCCapabilitiesGet({
155
- nodeId: this.endpoint.nodeId,
156
- endpointIndex: this.endpoint.index,
157
- setpointType,
158
- });
159
- const response = await this.host.sendCommand(cc, this.commandOptions);
160
- if (response) {
161
- return pick(response, [
162
- "minValue",
163
- "maxValue",
164
- "minValueScale",
165
- "maxValueScale",
166
- ]);
192
+ async getCapabilities(setpointType) {
193
+ __assertType("setpointType", "ThermostatSetpointType", __assertType__number.bind(void 0, setpointType));
194
+ this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);
195
+ const cc = new ThermostatSetpointCCCapabilitiesGet({
196
+ nodeId: this.endpoint.nodeId,
197
+ endpointIndex: this.endpoint.index,
198
+ setpointType,
199
+ });
200
+ const response = await this.host.sendCommand(cc, this.commandOptions);
201
+ if (response) {
202
+ return pick(response, [
203
+ "minValue",
204
+ "maxValue",
205
+ "minValueScale",
206
+ "maxValueScale",
207
+ ]);
208
+ }
167
209
  }
168
- }
169
- /**
170
- * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended
171
- * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined
172
- * during node interview.
173
- */
174
- async getSupportedSetpointTypes() {
175
- this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);
176
- const cc = new ThermostatSetpointCCSupportedGet({
177
- nodeId: this.endpoint.nodeId,
178
- endpointIndex: this.endpoint.index,
179
- });
180
- const response = await this.host.sendCommand(cc, this.commandOptions);
181
- return response?.supportedSetpointTypes;
182
- }
183
- };
184
- ThermostatSetpointCCAPI = __decorate([
185
- API(CommandClasses["Thermostat Setpoint"])
186
- ], ThermostatSetpointCCAPI);
187
- export { ThermostatSetpointCCAPI };
188
- let ThermostatSetpointCC = class ThermostatSetpointCC extends CommandClass {
189
- translatePropertyKey(ctx, property, propertyKey) {
190
- if (property === "setpoint") {
191
- return getEnumMemberName(ThermostatSetpointType, propertyKey);
210
+ /**
211
+ * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended
212
+ * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined
213
+ * during node interview.
214
+ */
215
+ async getSupportedSetpointTypes() {
216
+ this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);
217
+ const cc = new ThermostatSetpointCCSupportedGet({
218
+ nodeId: this.endpoint.nodeId,
219
+ endpointIndex: this.endpoint.index,
220
+ });
221
+ const response = await this.host.sendCommand(cc, this.commandOptions);
222
+ return response?.supportedSetpointTypes;
192
223
  }
193
- else {
194
- return super.translatePropertyKey(ctx, property, propertyKey);
224
+ };
225
+ return ThermostatSetpointCCAPI = _classThis;
226
+ })();
227
+ export { ThermostatSetpointCCAPI };
228
+ let ThermostatSetpointCC = (() => {
229
+ let _classDecorators = [commandClass(CommandClasses["Thermostat Setpoint"]), implementedVersion(3), ccValues(ThermostatSetpointCCValues)];
230
+ let _classDescriptor;
231
+ let _classExtraInitializers = [];
232
+ let _classThis;
233
+ let _classSuper = CommandClass;
234
+ var ThermostatSetpointCC = class extends _classSuper {
235
+ static { _classThis = this; }
236
+ static {
237
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
238
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
239
+ ThermostatSetpointCC = _classThis = _classDescriptor.value;
240
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
241
+ __runInitializers(_classThis, _classExtraInitializers);
195
242
  }
196
- }
197
- async interview(ctx) {
198
- const node = this.getNode(ctx);
199
- const endpoint = this.getEndpoint(ctx);
200
- const api = CCAPI.create(CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
201
- priority: MessagePriority.NodeQuery,
202
- });
203
- ctx.logNode(node.id, {
204
- endpoint: this.endpointIndex,
205
- message: `Interviewing ${this.ccName}...`,
206
- direction: "none",
207
- });
208
- if (api.version <= 2) {
209
- // It has been found that early implementations of this Command Class applied two non-interoperable
210
- // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat
211
- // Setpoint Supported Report Command.
212
- // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2
213
- // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing
214
- // the requested Setpoint Type.
215
- // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the
216
- // controlling node MUST conclude that the actual Setpoint Type is supported.
217
- // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report
218
- // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.
219
- // Now scan all endpoints. Each type we received a value for gets marked as supported
220
- const supportedSetpointTypes = [];
221
- for (let type = ThermostatSetpointType.Heating; type <= ThermostatSetpointType["Full Power"]; type++) {
222
- const setpointName = getEnumMemberName(ThermostatSetpointType, type);
223
- // Every time, query the current value
224
- ctx.logNode(node.id, {
225
- endpoint: this.endpointIndex,
226
- message: `querying current value of setpoint ${setpointName}...`,
227
- direction: "outbound",
228
- });
229
- const setpoint = await api.get(type);
230
- // If the node did not respond, assume the setpoint type is not supported
231
- let logMessage;
232
- if (setpoint) {
233
- // Setpoint supported, remember the type
234
- supportedSetpointTypes.push(type);
235
- logMessage =
236
- `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
237
- }
238
- else {
239
- // We're sure about the interpretation - this should not happen
240
- logMessage = `setpoint ${setpointName} is not supported`;
241
- }
242
- ctx.logNode(node.id, {
243
- endpoint: this.endpointIndex,
244
- message: logMessage,
245
- direction: "inbound",
246
- });
243
+ translatePropertyKey(ctx, property, propertyKey) {
244
+ if (property === "setpoint") {
245
+ return getEnumMemberName(ThermostatSetpointType, propertyKey);
246
+ }
247
+ else {
248
+ return super.translatePropertyKey(ctx, property, propertyKey);
247
249
  }
248
- // Remember which setpoint types are actually supported
249
- this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);
250
250
  }
251
- else {
252
- // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes
253
- // Query the supported setpoint types
254
- let setpointTypes = [];
251
+ async interview(ctx) {
252
+ const node = this.getNode(ctx);
253
+ const endpoint = this.getEndpoint(ctx);
254
+ const api = CCAPI.create(CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
255
+ priority: MessagePriority.NodeQuery,
256
+ });
255
257
  ctx.logNode(node.id, {
256
258
  endpoint: this.endpointIndex,
257
- message: "retrieving supported setpoint types...",
258
- direction: "outbound",
259
+ message: `Interviewing ${this.ccName}...`,
260
+ direction: "none",
259
261
  });
260
- const resp = await api.getSupportedSetpointTypes();
261
- if (resp) {
262
- setpointTypes = [...resp];
263
- const logMessage = "received supported setpoint types:\n"
264
- + setpointTypes
265
- .map((type) => getEnumMemberName(ThermostatSetpointType, type))
266
- .map((name) => `· ${name}`)
267
- .join("\n");
268
- ctx.logNode(node.id, {
269
- endpoint: this.endpointIndex,
270
- message: logMessage,
271
- direction: "inbound",
272
- });
262
+ if (api.version <= 2) {
263
+ // It has been found that early implementations of this Command Class applied two non-interoperable
264
+ // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat
265
+ // Setpoint Supported Report Command.
266
+ // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2
267
+ // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing
268
+ // the requested Setpoint Type.
269
+ // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the
270
+ // controlling node MUST conclude that the actual Setpoint Type is supported.
271
+ // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report
272
+ // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.
273
+ // Now scan all endpoints. Each type we received a value for gets marked as supported
274
+ const supportedSetpointTypes = [];
275
+ for (let type = ThermostatSetpointType.Heating; type <= ThermostatSetpointType["Full Power"]; type++) {
276
+ const setpointName = getEnumMemberName(ThermostatSetpointType, type);
277
+ // Every time, query the current value
278
+ ctx.logNode(node.id, {
279
+ endpoint: this.endpointIndex,
280
+ message: `querying current value of setpoint ${setpointName}...`,
281
+ direction: "outbound",
282
+ });
283
+ const setpoint = await api.get(type);
284
+ // If the node did not respond, assume the setpoint type is not supported
285
+ let logMessage;
286
+ if (setpoint) {
287
+ // Setpoint supported, remember the type
288
+ supportedSetpointTypes.push(type);
289
+ logMessage =
290
+ `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
291
+ }
292
+ else {
293
+ // We're sure about the interpretation - this should not happen
294
+ logMessage = `setpoint ${setpointName} is not supported`;
295
+ }
296
+ ctx.logNode(node.id, {
297
+ endpoint: this.endpointIndex,
298
+ message: logMessage,
299
+ direction: "inbound",
300
+ });
301
+ }
302
+ // Remember which setpoint types are actually supported
303
+ this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);
273
304
  }
274
305
  else {
306
+ // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes
307
+ // Query the supported setpoint types
308
+ let setpointTypes = [];
275
309
  ctx.logNode(node.id, {
276
310
  endpoint: this.endpointIndex,
277
- message: "Querying supported setpoint types timed out, skipping interview...",
278
- level: "warn",
311
+ message: "retrieving supported setpoint types...",
312
+ direction: "outbound",
279
313
  });
280
- return;
314
+ const resp = await api.getSupportedSetpointTypes();
315
+ if (resp) {
316
+ setpointTypes = [...resp];
317
+ const logMessage = "received supported setpoint types:\n"
318
+ + setpointTypes
319
+ .map((type) => getEnumMemberName(ThermostatSetpointType, type))
320
+ .map((name) => `· ${name}`)
321
+ .join("\n");
322
+ ctx.logNode(node.id, {
323
+ endpoint: this.endpointIndex,
324
+ message: logMessage,
325
+ direction: "inbound",
326
+ });
327
+ }
328
+ else {
329
+ ctx.logNode(node.id, {
330
+ endpoint: this.endpointIndex,
331
+ message: "Querying supported setpoint types timed out, skipping interview...",
332
+ level: "warn",
333
+ });
334
+ return;
335
+ }
336
+ for (const type of setpointTypes) {
337
+ const setpointName = getEnumMemberName(ThermostatSetpointType, type);
338
+ // Find out the capabilities of this setpoint
339
+ ctx.logNode(node.id, {
340
+ endpoint: this.endpointIndex,
341
+ message: `retrieving capabilities for setpoint ${setpointName}...`,
342
+ direction: "outbound",
343
+ });
344
+ const setpointCaps = await api.getCapabilities(type);
345
+ if (setpointCaps) {
346
+ const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);
347
+ const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);
348
+ const logMessage = `received capabilities for setpoint ${setpointName}:
349
+ minimum value: ${setpointCaps.minValue} ${minValueUnit}
350
+ maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
351
+ ctx.logNode(node.id, {
352
+ endpoint: this.endpointIndex,
353
+ message: logMessage,
354
+ direction: "inbound",
355
+ });
356
+ }
357
+ }
358
+ // Query the current value for all setpoint types
359
+ await this.refreshValues(ctx);
281
360
  }
361
+ // Remember that the interview is complete
362
+ this.setInterviewComplete(ctx, true);
363
+ }
364
+ async refreshValues(ctx) {
365
+ const node = this.getNode(ctx);
366
+ const endpoint = this.getEndpoint(ctx);
367
+ const api = CCAPI.create(CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
368
+ priority: MessagePriority.NodeQuery,
369
+ });
370
+ const setpointTypes = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];
371
+ // Query each setpoint's current value
282
372
  for (const type of setpointTypes) {
283
373
  const setpointName = getEnumMemberName(ThermostatSetpointType, type);
284
- // Find out the capabilities of this setpoint
374
+ // Every time, query the current value
285
375
  ctx.logNode(node.id, {
286
376
  endpoint: this.endpointIndex,
287
- message: `retrieving capabilities for setpoint ${setpointName}...`,
377
+ message: `querying current value of setpoint ${setpointName}...`,
288
378
  direction: "outbound",
289
379
  });
290
- const setpointCaps = await api.getCapabilities(type);
291
- if (setpointCaps) {
292
- const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);
293
- const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);
294
- const logMessage = `received capabilities for setpoint ${setpointName}:
295
- minimum value: ${setpointCaps.minValue} ${minValueUnit}
296
- maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
380
+ const setpoint = await api.get(type);
381
+ if (setpoint) {
382
+ const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
297
383
  ctx.logNode(node.id, {
298
384
  endpoint: this.endpointIndex,
299
385
  message: logMessage,
@@ -301,355 +387,400 @@ maximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;
301
387
  });
302
388
  }
303
389
  }
304
- // Query the current value for all setpoint types
305
- await this.refreshValues(ctx);
306
390
  }
307
- // Remember that the interview is complete
308
- this.setInterviewComplete(ctx, true);
309
- }
310
- async refreshValues(ctx) {
311
- const node = this.getNode(ctx);
312
- const endpoint = this.getEndpoint(ctx);
313
- const api = CCAPI.create(CommandClasses["Thermostat Setpoint"], ctx, endpoint).withOptions({
314
- priority: MessagePriority.NodeQuery,
315
- });
316
- const setpointTypes = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];
317
- // Query each setpoint's current value
318
- for (const type of setpointTypes) {
319
- const setpointName = getEnumMemberName(ThermostatSetpointType, type);
320
- // Every time, query the current value
321
- ctx.logNode(node.id, {
322
- endpoint: this.endpointIndex,
323
- message: `querying current value of setpoint ${setpointName}...`,
324
- direction: "outbound",
391
+ };
392
+ return ThermostatSetpointCC = _classThis;
393
+ })();
394
+ export { ThermostatSetpointCC };
395
+ let ThermostatSetpointCCSet = (() => {
396
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.Set), useSupervision()];
397
+ let _classDescriptor;
398
+ let _classExtraInitializers = [];
399
+ let _classThis;
400
+ let _classSuper = ThermostatSetpointCC;
401
+ var ThermostatSetpointCCSet = class extends _classSuper {
402
+ static { _classThis = this; }
403
+ static {
404
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
405
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
406
+ ThermostatSetpointCCSet = _classThis = _classDescriptor.value;
407
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
408
+ __runInitializers(_classThis, _classExtraInitializers);
409
+ }
410
+ constructor(options) {
411
+ super(options);
412
+ this.setpointType = options.setpointType;
413
+ this.value = options.value;
414
+ this.scale = options.scale;
415
+ }
416
+ static from(raw, ctx) {
417
+ validatePayload(raw.payload.length >= 1);
418
+ const setpointType = raw.payload[0] & 0b1111;
419
+ // parseFloatWithScale does its own validation
420
+ const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
421
+ return new this({
422
+ nodeId: ctx.sourceNodeId,
423
+ setpointType,
424
+ value,
425
+ scale,
325
426
  });
326
- const setpoint = await api.get(type);
327
- if (setpoint) {
328
- const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? ""}`;
329
- ctx.logNode(node.id, {
330
- endpoint: this.endpointIndex,
331
- message: logMessage,
332
- direction: "inbound",
333
- });
334
- }
335
427
  }
336
- }
337
- };
338
- ThermostatSetpointCC = __decorate([
339
- commandClass(CommandClasses["Thermostat Setpoint"]),
340
- implementedVersion(3),
341
- ccValues(ThermostatSetpointCCValues)
342
- ], ThermostatSetpointCC);
343
- export { ThermostatSetpointCC };
344
- let ThermostatSetpointCCSet = ThermostatSetpointCCSet_1 = class ThermostatSetpointCCSet extends ThermostatSetpointCC {
345
- constructor(options) {
346
- super(options);
347
- this.setpointType = options.setpointType;
348
- this.value = options.value;
349
- this.scale = options.scale;
350
- }
351
- static from(raw, ctx) {
352
- validatePayload(raw.payload.length >= 1);
353
- const setpointType = raw.payload[0] & 0b1111;
354
- // parseFloatWithScale does its own validation
355
- const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
356
- return new ThermostatSetpointCCSet_1({
357
- nodeId: ctx.sourceNodeId,
358
- setpointType,
359
- value,
360
- scale,
361
- });
362
- }
363
- setpointType;
364
- value;
365
- scale;
366
- serialize(ctx) {
367
- // If a config file overwrites how the float should be encoded, use that information
368
- const override = ctx.getDeviceConfig?.(this.nodeId)
369
- ?.compat?.overrideFloatEncoding;
370
- this.payload = Bytes.concat([
371
- Bytes.from([this.setpointType & 0b1111]),
372
- encodeFloatWithScale(this.value, this.scale, override),
373
- ]);
374
- return super.serialize(ctx);
375
- }
376
- toLogEntry(ctx) {
377
- const scale = getScale(this.scale);
378
- return {
379
- ...super.toLogEntry(ctx),
380
- message: {
381
- "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
382
- value: `${this.value} ${scale.unit}`,
383
- },
384
- };
385
- }
386
- };
387
- ThermostatSetpointCCSet = ThermostatSetpointCCSet_1 = __decorate([
388
- CCCommand(ThermostatSetpointCommand.Set),
389
- useSupervision()
390
- ], ThermostatSetpointCCSet);
428
+ setpointType;
429
+ value;
430
+ scale;
431
+ serialize(ctx) {
432
+ // If a config file overwrites how the float should be encoded, use that information
433
+ const override = ctx.getDeviceConfig?.(this.nodeId)
434
+ ?.compat?.overrideFloatEncoding;
435
+ this.payload = Bytes.concat([
436
+ Bytes.from([this.setpointType & 0b1111]),
437
+ encodeFloatWithScale(this.value, this.scale, override),
438
+ ]);
439
+ return super.serialize(ctx);
440
+ }
441
+ toLogEntry(ctx) {
442
+ const scale = getScale(this.scale);
443
+ return {
444
+ ...super.toLogEntry(ctx),
445
+ message: {
446
+ "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
447
+ value: `${this.value} ${scale.unit}`,
448
+ },
449
+ };
450
+ }
451
+ };
452
+ return ThermostatSetpointCCSet = _classThis;
453
+ })();
391
454
  export { ThermostatSetpointCCSet };
392
- let ThermostatSetpointCCReport = ThermostatSetpointCCReport_1 = class ThermostatSetpointCCReport extends ThermostatSetpointCC {
393
- constructor(options) {
394
- super(options);
395
- this.type = options.type;
396
- this.value = options.value;
397
- this.scale = options.scale;
398
- }
399
- static from(raw, ctx) {
400
- validatePayload(raw.payload.length >= 1);
401
- const type = raw.payload[0] & 0b1111;
402
- if (type === 0) {
403
- // Not supported
404
- return new ThermostatSetpointCCReport_1({
455
+ let ThermostatSetpointCCReport = (() => {
456
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.Report)];
457
+ let _classDescriptor;
458
+ let _classExtraInitializers = [];
459
+ let _classThis;
460
+ let _classSuper = ThermostatSetpointCC;
461
+ var ThermostatSetpointCCReport = class extends _classSuper {
462
+ static { _classThis = this; }
463
+ static {
464
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
465
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
466
+ ThermostatSetpointCCReport = _classThis = _classDescriptor.value;
467
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
468
+ __runInitializers(_classThis, _classExtraInitializers);
469
+ }
470
+ constructor(options) {
471
+ super(options);
472
+ this.type = options.type;
473
+ this.value = options.value;
474
+ this.scale = options.scale;
475
+ }
476
+ static from(raw, ctx) {
477
+ validatePayload(raw.payload.length >= 1);
478
+ const type = raw.payload[0] & 0b1111;
479
+ if (type === 0) {
480
+ // Not supported
481
+ return new this({
482
+ nodeId: ctx.sourceNodeId,
483
+ type,
484
+ value: 0,
485
+ scale: 0,
486
+ });
487
+ }
488
+ // parseFloatWithScale does its own validation
489
+ const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
490
+ return new this({
405
491
  nodeId: ctx.sourceNodeId,
406
492
  type,
407
- value: 0,
408
- scale: 0,
493
+ value,
494
+ scale,
409
495
  });
410
496
  }
411
- // parseFloatWithScale does its own validation
412
- const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
413
- return new ThermostatSetpointCCReport_1({
414
- nodeId: ctx.sourceNodeId,
415
- type,
416
- value,
417
- scale,
418
- });
419
- }
420
- persistValues(ctx) {
421
- if (!super.persistValues(ctx))
422
- return false;
423
- const scale = getScale(this.scale);
424
- const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);
425
- const existingMetadata = this.getMetadata(ctx, setpointValue);
426
- // Update the metadata when it is missing or the unit has changed
427
- if (existingMetadata?.unit !== scale.unit) {
428
- this.setMetadata(ctx, setpointValue, {
429
- ...(existingMetadata ?? setpointValue.meta),
430
- unit: scale.unit,
431
- });
497
+ persistValues(ctx) {
498
+ if (!super.persistValues(ctx))
499
+ return false;
500
+ const scale = getScale(this.scale);
501
+ const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);
502
+ const existingMetadata = this.getMetadata(ctx, setpointValue);
503
+ // Update the metadata when it is missing or the unit has changed
504
+ if (existingMetadata?.unit !== scale.unit) {
505
+ this.setMetadata(ctx, setpointValue, {
506
+ ...(existingMetadata ?? setpointValue.meta),
507
+ unit: scale.unit,
508
+ });
509
+ }
510
+ this.setValue(ctx, setpointValue, this.value);
511
+ // Remember the device-preferred setpoint scale so it can be used in SET commands
512
+ this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);
513
+ return true;
432
514
  }
433
- this.setValue(ctx, setpointValue, this.value);
434
- // Remember the device-preferred setpoint scale so it can be used in SET commands
435
- this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);
436
- return true;
437
- }
438
- type;
439
- scale;
440
- value;
441
- serialize(ctx) {
442
- this.payload = Bytes.concat([
443
- Bytes.from([this.type & 0b1111]),
444
- encodeFloatWithScale(this.value, this.scale),
445
- ]);
446
- return super.serialize(ctx);
447
- }
448
- toLogEntry(ctx) {
449
- const scale = getScale(this.scale);
450
- return {
451
- ...super.toLogEntry(ctx),
452
- message: {
453
- "setpoint type": getEnumMemberName(ThermostatSetpointType, this.type),
454
- value: `${this.value} ${scale.unit}`,
455
- },
456
- };
457
- }
458
- };
459
- ThermostatSetpointCCReport = ThermostatSetpointCCReport_1 = __decorate([
460
- CCCommand(ThermostatSetpointCommand.Report)
461
- ], ThermostatSetpointCCReport);
515
+ type;
516
+ scale;
517
+ value;
518
+ serialize(ctx) {
519
+ this.payload = Bytes.concat([
520
+ Bytes.from([this.type & 0b1111]),
521
+ encodeFloatWithScale(this.value, this.scale),
522
+ ]);
523
+ return super.serialize(ctx);
524
+ }
525
+ toLogEntry(ctx) {
526
+ const scale = getScale(this.scale);
527
+ return {
528
+ ...super.toLogEntry(ctx),
529
+ message: {
530
+ "setpoint type": getEnumMemberName(ThermostatSetpointType, this.type),
531
+ value: `${this.value} ${scale.unit}`,
532
+ },
533
+ };
534
+ }
535
+ };
536
+ return ThermostatSetpointCCReport = _classThis;
537
+ })();
462
538
  export { ThermostatSetpointCCReport };
463
539
  function testResponseForThermostatSetpointGet(sent, received) {
464
540
  // We expect a Thermostat Setpoint Report that matches the requested setpoint type
465
541
  return received.type === sent.setpointType;
466
542
  }
467
- let ThermostatSetpointCCGet = ThermostatSetpointCCGet_1 = class ThermostatSetpointCCGet extends ThermostatSetpointCC {
468
- constructor(options) {
469
- super(options);
470
- this.setpointType = options.setpointType;
471
- }
472
- static from(raw, ctx) {
473
- validatePayload(raw.payload.length >= 1);
474
- const setpointType = raw.payload[0] & 0b1111;
475
- return new ThermostatSetpointCCGet_1({
476
- nodeId: ctx.sourceNodeId,
477
- setpointType,
478
- });
479
- }
480
- setpointType;
481
- serialize(ctx) {
482
- this.payload = Bytes.from([this.setpointType & 0b1111]);
483
- return super.serialize(ctx);
484
- }
485
- toLogEntry(ctx) {
486
- return {
487
- ...super.toLogEntry(ctx),
488
- message: {
489
- "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
490
- },
491
- };
492
- }
493
- };
494
- ThermostatSetpointCCGet = ThermostatSetpointCCGet_1 = __decorate([
495
- CCCommand(ThermostatSetpointCommand.Get),
496
- expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)
497
- ], ThermostatSetpointCCGet);
543
+ let ThermostatSetpointCCGet = (() => {
544
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.Get), expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)];
545
+ let _classDescriptor;
546
+ let _classExtraInitializers = [];
547
+ let _classThis;
548
+ let _classSuper = ThermostatSetpointCC;
549
+ var ThermostatSetpointCCGet = class extends _classSuper {
550
+ static { _classThis = this; }
551
+ static {
552
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
553
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
554
+ ThermostatSetpointCCGet = _classThis = _classDescriptor.value;
555
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
556
+ __runInitializers(_classThis, _classExtraInitializers);
557
+ }
558
+ constructor(options) {
559
+ super(options);
560
+ this.setpointType = options.setpointType;
561
+ }
562
+ static from(raw, ctx) {
563
+ validatePayload(raw.payload.length >= 1);
564
+ const setpointType = raw.payload[0] & 0b1111;
565
+ return new this({
566
+ nodeId: ctx.sourceNodeId,
567
+ setpointType,
568
+ });
569
+ }
570
+ setpointType;
571
+ serialize(ctx) {
572
+ this.payload = Bytes.from([this.setpointType & 0b1111]);
573
+ return super.serialize(ctx);
574
+ }
575
+ toLogEntry(ctx) {
576
+ return {
577
+ ...super.toLogEntry(ctx),
578
+ message: {
579
+ "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
580
+ },
581
+ };
582
+ }
583
+ };
584
+ return ThermostatSetpointCCGet = _classThis;
585
+ })();
498
586
  export { ThermostatSetpointCCGet };
499
- let ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport_1 = class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {
500
- constructor(options) {
501
- super(options);
502
- this.type = options.type;
503
- this.minValue = options.minValue;
504
- this.minValueScale = options.minValueScale;
505
- this.maxValue = options.maxValue;
506
- this.maxValueScale = options.maxValueScale;
507
- }
508
- static from(raw, ctx) {
509
- validatePayload(raw.payload.length >= 1);
510
- const type = raw.payload[0];
511
- // parseFloatWithScale does its own validation
512
- const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));
513
- const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));
514
- return new ThermostatSetpointCCCapabilitiesReport_1({
515
- nodeId: ctx.sourceNodeId,
516
- type,
517
- minValue,
518
- minValueScale,
519
- maxValue,
520
- maxValueScale,
521
- });
522
- }
523
- persistValues(ctx) {
524
- if (!super.persistValues(ctx))
525
- return false;
526
- // Predefine the metadata
527
- const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);
528
- this.setMetadata(ctx, setpointValue, {
529
- ...setpointValue.meta,
530
- min: this.minValue,
531
- max: this.maxValue,
532
- unit: getSetpointUnit(this.minValueScale)
533
- || getSetpointUnit(this.maxValueScale),
534
- });
535
- return true;
536
- }
537
- type;
538
- minValue;
539
- maxValue;
540
- minValueScale;
541
- maxValueScale;
542
- serialize(ctx) {
543
- const min = encodeFloatWithScale(this.minValue, this.minValueScale);
544
- const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);
545
- this.payload = Bytes.concat([Bytes.from([this.type]), min, max]);
546
- return super.serialize(ctx);
547
- }
548
- toLogEntry(ctx) {
549
- const minValueScale = getScale(this.minValueScale);
550
- const maxValueScale = getScale(this.maxValueScale);
551
- return {
552
- ...super.toLogEntry(ctx),
553
- message: {
554
- "setpoint type": getEnumMemberName(ThermostatSetpointType, this.type),
555
- "min value": `${this.minValue} ${minValueScale.unit}`,
556
- "max value": `${this.maxValue} ${maxValueScale.unit}`,
557
- },
558
- };
559
- }
560
- };
561
- ThermostatSetpointCCCapabilitiesReport = ThermostatSetpointCCCapabilitiesReport_1 = __decorate([
562
- CCCommand(ThermostatSetpointCommand.CapabilitiesReport)
563
- ], ThermostatSetpointCCCapabilitiesReport);
587
+ let ThermostatSetpointCCCapabilitiesReport = (() => {
588
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.CapabilitiesReport)];
589
+ let _classDescriptor;
590
+ let _classExtraInitializers = [];
591
+ let _classThis;
592
+ let _classSuper = ThermostatSetpointCC;
593
+ var ThermostatSetpointCCCapabilitiesReport = class extends _classSuper {
594
+ static { _classThis = this; }
595
+ static {
596
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
597
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
598
+ ThermostatSetpointCCCapabilitiesReport = _classThis = _classDescriptor.value;
599
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
600
+ __runInitializers(_classThis, _classExtraInitializers);
601
+ }
602
+ constructor(options) {
603
+ super(options);
604
+ this.type = options.type;
605
+ this.minValue = options.minValue;
606
+ this.minValueScale = options.minValueScale;
607
+ this.maxValue = options.maxValue;
608
+ this.maxValueScale = options.maxValueScale;
609
+ }
610
+ static from(raw, ctx) {
611
+ validatePayload(raw.payload.length >= 1);
612
+ const type = raw.payload[0];
613
+ // parseFloatWithScale does its own validation
614
+ const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));
615
+ const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));
616
+ return new this({
617
+ nodeId: ctx.sourceNodeId,
618
+ type,
619
+ minValue,
620
+ minValueScale,
621
+ maxValue,
622
+ maxValueScale,
623
+ });
624
+ }
625
+ persistValues(ctx) {
626
+ if (!super.persistValues(ctx))
627
+ return false;
628
+ // Predefine the metadata
629
+ const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);
630
+ this.setMetadata(ctx, setpointValue, {
631
+ ...setpointValue.meta,
632
+ min: this.minValue,
633
+ max: this.maxValue,
634
+ unit: getSetpointUnit(this.minValueScale)
635
+ || getSetpointUnit(this.maxValueScale),
636
+ });
637
+ return true;
638
+ }
639
+ type;
640
+ minValue;
641
+ maxValue;
642
+ minValueScale;
643
+ maxValueScale;
644
+ serialize(ctx) {
645
+ const min = encodeFloatWithScale(this.minValue, this.minValueScale);
646
+ const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);
647
+ this.payload = Bytes.concat([Bytes.from([this.type]), min, max]);
648
+ return super.serialize(ctx);
649
+ }
650
+ toLogEntry(ctx) {
651
+ const minValueScale = getScale(this.minValueScale);
652
+ const maxValueScale = getScale(this.maxValueScale);
653
+ return {
654
+ ...super.toLogEntry(ctx),
655
+ message: {
656
+ "setpoint type": getEnumMemberName(ThermostatSetpointType, this.type),
657
+ "min value": `${this.minValue} ${minValueScale.unit}`,
658
+ "max value": `${this.maxValue} ${maxValueScale.unit}`,
659
+ },
660
+ };
661
+ }
662
+ };
663
+ return ThermostatSetpointCCCapabilitiesReport = _classThis;
664
+ })();
564
665
  export { ThermostatSetpointCCCapabilitiesReport };
565
- let ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet_1 = class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {
566
- constructor(options) {
567
- super(options);
568
- this.setpointType = options.setpointType;
569
- }
570
- static from(raw, ctx) {
571
- validatePayload(raw.payload.length >= 1);
572
- const setpointType = raw.payload[0] & 0b1111;
573
- return new ThermostatSetpointCCCapabilitiesGet_1({
574
- nodeId: ctx.sourceNodeId,
575
- setpointType,
576
- });
577
- }
578
- setpointType;
579
- serialize(ctx) {
580
- this.payload = Bytes.from([this.setpointType & 0b1111]);
581
- return super.serialize(ctx);
582
- }
583
- toLogEntry(ctx) {
584
- return {
585
- ...super.toLogEntry(ctx),
586
- message: {
587
- "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
588
- },
589
- };
590
- }
591
- };
592
- ThermostatSetpointCCCapabilitiesGet = ThermostatSetpointCCCapabilitiesGet_1 = __decorate([
593
- CCCommand(ThermostatSetpointCommand.CapabilitiesGet),
594
- expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)
595
- ], ThermostatSetpointCCCapabilitiesGet);
666
+ let ThermostatSetpointCCCapabilitiesGet = (() => {
667
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.CapabilitiesGet), expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)];
668
+ let _classDescriptor;
669
+ let _classExtraInitializers = [];
670
+ let _classThis;
671
+ let _classSuper = ThermostatSetpointCC;
672
+ var ThermostatSetpointCCCapabilitiesGet = class extends _classSuper {
673
+ static { _classThis = this; }
674
+ static {
675
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
676
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
677
+ ThermostatSetpointCCCapabilitiesGet = _classThis = _classDescriptor.value;
678
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
679
+ __runInitializers(_classThis, _classExtraInitializers);
680
+ }
681
+ constructor(options) {
682
+ super(options);
683
+ this.setpointType = options.setpointType;
684
+ }
685
+ static from(raw, ctx) {
686
+ validatePayload(raw.payload.length >= 1);
687
+ const setpointType = raw.payload[0] & 0b1111;
688
+ return new this({
689
+ nodeId: ctx.sourceNodeId,
690
+ setpointType,
691
+ });
692
+ }
693
+ setpointType;
694
+ serialize(ctx) {
695
+ this.payload = Bytes.from([this.setpointType & 0b1111]);
696
+ return super.serialize(ctx);
697
+ }
698
+ toLogEntry(ctx) {
699
+ return {
700
+ ...super.toLogEntry(ctx),
701
+ message: {
702
+ "setpoint type": getEnumMemberName(ThermostatSetpointType, this.setpointType),
703
+ },
704
+ };
705
+ }
706
+ };
707
+ return ThermostatSetpointCCCapabilitiesGet = _classThis;
708
+ })();
596
709
  export { ThermostatSetpointCCCapabilitiesGet };
597
- let ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport_1 = class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {
598
- constructor(options) {
599
- super(options);
600
- if (options.supportedSetpointTypes.length === 0) {
601
- throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);
710
+ let ThermostatSetpointCCSupportedReport = (() => {
711
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.SupportedReport), ccValueProperty("supportedSetpointTypes", ThermostatSetpointCCValues.supportedSetpointTypes)];
712
+ let _classDescriptor;
713
+ let _classExtraInitializers = [];
714
+ let _classThis;
715
+ let _classSuper = ThermostatSetpointCC;
716
+ var ThermostatSetpointCCSupportedReport = class extends _classSuper {
717
+ static { _classThis = this; }
718
+ static {
719
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
720
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
721
+ ThermostatSetpointCCSupportedReport = _classThis = _classDescriptor.value;
722
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
723
+ __runInitializers(_classThis, _classExtraInitializers);
602
724
  }
603
- this.supportedSetpointTypes = options.supportedSetpointTypes;
604
- }
605
- static from(raw, ctx) {
606
- validatePayload(raw.payload.length >= 1);
607
- const bitMask = raw.payload;
608
- const supported = parseBitMask(bitMask, ThermostatSetpointType["N/A"]);
609
- // We use this command only when we are sure that bitmask interpretation A is used
610
- // FIXME: Figure out if we can do this without the CC version
611
- const supportedSetpointTypes = supported.map((i) => thermostatSetpointTypeMap[i]);
612
- return new ThermostatSetpointCCSupportedReport_1({
613
- nodeId: ctx.sourceNodeId,
614
- supportedSetpointTypes,
615
- });
616
- }
617
- supportedSetpointTypes;
618
- serialize(ctx) {
619
- this.payload = encodeBitMask(
620
- // Encode as interpretation A
621
- this.supportedSetpointTypes
622
- .map((t) => thermostatSetpointTypeMap.indexOf(t))
623
- .filter((t) => t !== -1), undefined, ThermostatSetpointType["N/A"]);
624
- return super.serialize(ctx);
625
- }
626
- toLogEntry(ctx) {
627
- return {
628
- ...super.toLogEntry(ctx),
629
- message: {
630
- "supported setpoint types": this.supportedSetpointTypes
631
- .map((t) => `\n· ${getEnumMemberName(ThermostatSetpointType, t)}`)
632
- .join(""),
633
- },
634
- };
635
- }
636
- };
637
- __decorate([
638
- ccValue(ThermostatSetpointCCValues.supportedSetpointTypes)
639
- ], ThermostatSetpointCCSupportedReport.prototype, "supportedSetpointTypes", void 0);
640
- ThermostatSetpointCCSupportedReport = ThermostatSetpointCCSupportedReport_1 = __decorate([
641
- CCCommand(ThermostatSetpointCommand.SupportedReport)
642
- ], ThermostatSetpointCCSupportedReport);
725
+ constructor(options) {
726
+ super(options);
727
+ if (options.supportedSetpointTypes.length === 0) {
728
+ throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);
729
+ }
730
+ this.supportedSetpointTypes = options.supportedSetpointTypes;
731
+ }
732
+ static from(raw, ctx) {
733
+ validatePayload(raw.payload.length >= 1);
734
+ const bitMask = raw.payload;
735
+ const supported = parseBitMask(bitMask, ThermostatSetpointType["N/A"]);
736
+ // We use this command only when we are sure that bitmask interpretation A is used
737
+ // FIXME: Figure out if we can do this without the CC version
738
+ const supportedSetpointTypes = supported.map((i) => thermostatSetpointTypeMap[i]);
739
+ return new this({
740
+ nodeId: ctx.sourceNodeId,
741
+ supportedSetpointTypes,
742
+ });
743
+ }
744
+ supportedSetpointTypes;
745
+ serialize(ctx) {
746
+ this.payload = encodeBitMask(
747
+ // Encode as interpretation A
748
+ this.supportedSetpointTypes
749
+ .map((t) => thermostatSetpointTypeMap.indexOf(t))
750
+ .filter((t) => t !== -1), undefined, ThermostatSetpointType["N/A"]);
751
+ return super.serialize(ctx);
752
+ }
753
+ toLogEntry(ctx) {
754
+ return {
755
+ ...super.toLogEntry(ctx),
756
+ message: {
757
+ "supported setpoint types": this.supportedSetpointTypes
758
+ .map((t) => `\n· ${getEnumMemberName(ThermostatSetpointType, t)}`)
759
+ .join(""),
760
+ },
761
+ };
762
+ }
763
+ };
764
+ return ThermostatSetpointCCSupportedReport = _classThis;
765
+ })();
643
766
  export { ThermostatSetpointCCSupportedReport };
644
- let ThermostatSetpointCCSupportedGet = class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {
645
- };
646
- ThermostatSetpointCCSupportedGet = __decorate([
647
- CCCommand(ThermostatSetpointCommand.SupportedGet),
648
- expectedCCResponse(ThermostatSetpointCCSupportedReport)
649
- /**
650
- * Issues a SupportedGet command to the node. Due to inconsistencies in interpretation,
651
- * this command should not be used for nodes with CC versions 1 or 2
652
- */
653
- ], ThermostatSetpointCCSupportedGet);
767
+ let ThermostatSetpointCCSupportedGet = (() => {
768
+ let _classDecorators = [CCCommand(ThermostatSetpointCommand.SupportedGet), expectedCCResponse(ThermostatSetpointCCSupportedReport)];
769
+ let _classDescriptor;
770
+ let _classExtraInitializers = [];
771
+ let _classThis;
772
+ let _classSuper = ThermostatSetpointCC;
773
+ var ThermostatSetpointCCSupportedGet = class extends _classSuper {
774
+ static { _classThis = this; }
775
+ static {
776
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
777
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
778
+ ThermostatSetpointCCSupportedGet = _classThis = _classDescriptor.value;
779
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
780
+ __runInitializers(_classThis, _classExtraInitializers);
781
+ }
782
+ };
783
+ return ThermostatSetpointCCSupportedGet = _classThis;
784
+ })();
654
785
  export { ThermostatSetpointCCSupportedGet };
655
786
  //# sourceMappingURL=ThermostatSetpointCC.js.map