@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 MultilevelSensorCCReport_1, MultilevelSensorCCGet_1, MultilevelSensorCCSupportedSensorReport_1, MultilevelSensorCCSupportedScaleReport_1, MultilevelSensorCCGetSupportedScale_1;
8
35
  function __assertType(argName, typeName, boundHasError) {
9
36
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
10
37
  if (boundHasError()) {
@@ -84,7 +111,7 @@ import { Bytes } from "@zwave-js/shared/safe";
84
111
  import { num2hex } from "@zwave-js/shared/safe";
85
112
  import { CCAPI, POLL_VALUE, PhysicalCCAPI, throwUnsupportedProperty, } from "../lib/API.js";
86
113
  import { CommandClass, getEffectiveCCVersion, } from "../lib/CommandClass.js";
87
- import { API, CCCommand, ccValue, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
114
+ import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
88
115
  import { V } from "../lib/Values.js";
89
116
  import { MultilevelSensorCommand, } from "../lib/_Types.js";
90
117
  export const MultilevelSensorCCValues = Object.freeze({
@@ -193,172 +220,170 @@ function getPreferredSensorScale(ctx, nodeId, endpointIndex, sensorType, support
193
220
  }
194
221
  }
195
222
  // @noSetValueAPI This CC is read-only
196
- let MultilevelSensorCCAPI = class MultilevelSensorCCAPI extends PhysicalCCAPI {
197
- supportsCommand(cmd) {
198
- switch (cmd) {
199
- case MultilevelSensorCommand.Get:
200
- case MultilevelSensorCommand.Report:
201
- return true; // This is mandatory
202
- case MultilevelSensorCommand.GetSupportedSensor:
203
- case MultilevelSensorCommand.GetSupportedScale:
204
- return this.version >= 5;
205
- }
206
- return super.supportsCommand(cmd);
207
- }
208
- get [POLL_VALUE]() {
209
- return async function ({ property }) {
210
- // Look up the necessary information
211
- const valueId = {
212
- commandClass: CommandClasses["Multilevel Sensor"],
213
- endpoint: this.endpoint.index,
214
- property,
215
- };
216
- const ccSpecific = this.tryGetValueDB()?.getMetadata(valueId)
217
- ?.ccSpecific;
218
- if (!ccSpecific) {
219
- throwUnsupportedProperty(this.ccId, property);
223
+ let MultilevelSensorCCAPI = (() => {
224
+ let _classDecorators = [API(CommandClasses["Multilevel Sensor"])];
225
+ let _classDescriptor;
226
+ let _classExtraInitializers = [];
227
+ let _classThis;
228
+ let _classSuper = PhysicalCCAPI;
229
+ var MultilevelSensorCCAPI = class extends _classSuper {
230
+ static { _classThis = this; }
231
+ static {
232
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
233
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
234
+ MultilevelSensorCCAPI = _classThis = _classDescriptor.value;
235
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
236
+ __runInitializers(_classThis, _classExtraInitializers);
237
+ }
238
+ supportsCommand(cmd) {
239
+ switch (cmd) {
240
+ case MultilevelSensorCommand.Get:
241
+ case MultilevelSensorCommand.Report:
242
+ return true; // This is mandatory
243
+ case MultilevelSensorCommand.GetSupportedSensor:
244
+ case MultilevelSensorCommand.GetSupportedScale:
245
+ return this.version >= 5;
220
246
  }
221
- const { sensorType, scale } = ccSpecific;
222
- return this.get(sensorType, scale);
223
- };
224
- }
225
- async get(sensorType, scale) {
226
- __assertType("sensorType", "(optional) number", __assertType__optional_number.bind(void 0, sensorType));
227
- __assertType("scale", "(optional) number", __assertType__optional_number.bind(void 0, scale));
228
- this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.Get);
229
- // Figure out the preferred scale if none was given
230
- let preferredScale;
231
- if (sensorType != undefined && scale == undefined) {
232
- const supportedScales = this.tryGetValueDB()?.getValue({
233
- commandClass: this.ccId,
234
- endpoint: this.endpoint.index,
235
- property: "supportedScales",
236
- propertyKey: sensorType,
237
- }) ?? [];
238
- preferredScale = getPreferredSensorScale(this.host, this.endpoint.nodeId, this.endpoint.index, sensorType, supportedScales);
239
- }
240
- const cc = new MultilevelSensorCCGet({
241
- nodeId: this.endpoint.nodeId,
242
- endpointIndex: this.endpoint.index,
243
- sensorType: sensorType,
244
- scale: (scale ?? preferredScale),
245
- });
246
- const response = await this.host.sendCommand(cc, this.commandOptions);
247
- if (!response)
248
- return;
249
- const responseScale = getSensorScale(response.type, response.scale);
250
- if (sensorType == undefined) {
251
- // Overload #1: return the full response
252
- return {
253
- type: response.type,
254
- value: response.value,
255
- scale: responseScale,
256
- };
247
+ return super.supportsCommand(cmd);
257
248
  }
258
- else if (scale == undefined) {
259
- // Overload #2: return value and scale
260
- return {
261
- value: response.value,
262
- scale: responseScale,
249
+ get [POLL_VALUE]() {
250
+ return async function ({ property }) {
251
+ // Look up the necessary information
252
+ const valueId = {
253
+ commandClass: CommandClasses["Multilevel Sensor"],
254
+ endpoint: this.endpoint.index,
255
+ property,
256
+ };
257
+ const ccSpecific = this.tryGetValueDB()?.getMetadata(valueId)
258
+ ?.ccSpecific;
259
+ if (!ccSpecific) {
260
+ throwUnsupportedProperty(this.ccId, property);
261
+ }
262
+ const { sensorType, scale } = ccSpecific;
263
+ return this.get(sensorType, scale);
263
264
  };
264
265
  }
265
- else {
266
- // Overload #3: return only the value
267
- return response.value;
266
+ async get(sensorType, scale) {
267
+ __assertType("sensorType", "(optional) number", __assertType__optional_number.bind(void 0, sensorType));
268
+ __assertType("scale", "(optional) number", __assertType__optional_number.bind(void 0, scale));
269
+ this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.Get);
270
+ // Figure out the preferred scale if none was given
271
+ let preferredScale;
272
+ if (sensorType != undefined && scale == undefined) {
273
+ const supportedScales = this.tryGetValueDB()?.getValue({
274
+ commandClass: this.ccId,
275
+ endpoint: this.endpoint.index,
276
+ property: "supportedScales",
277
+ propertyKey: sensorType,
278
+ }) ?? [];
279
+ preferredScale = getPreferredSensorScale(this.host, this.endpoint.nodeId, this.endpoint.index, sensorType, supportedScales);
280
+ }
281
+ const cc = new MultilevelSensorCCGet({
282
+ nodeId: this.endpoint.nodeId,
283
+ endpointIndex: this.endpoint.index,
284
+ sensorType: sensorType,
285
+ scale: (scale ?? preferredScale),
286
+ });
287
+ const response = await this.host.sendCommand(cc, this.commandOptions);
288
+ if (!response)
289
+ return;
290
+ const responseScale = getSensorScale(response.type, response.scale);
291
+ if (sensorType == undefined) {
292
+ // Overload #1: return the full response
293
+ return {
294
+ type: response.type,
295
+ value: response.value,
296
+ scale: responseScale,
297
+ };
298
+ }
299
+ else if (scale == undefined) {
300
+ // Overload #2: return value and scale
301
+ return {
302
+ value: response.value,
303
+ scale: responseScale,
304
+ };
305
+ }
306
+ else {
307
+ // Overload #3: return only the value
308
+ return response.value;
309
+ }
268
310
  }
269
- }
270
- async getSupportedSensorTypes() {
271
- this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.GetSupportedSensor);
272
- const cc = new MultilevelSensorCCGetSupportedSensor({
273
- nodeId: this.endpoint.nodeId,
274
- endpointIndex: this.endpoint.index,
275
- });
276
- const response = await this.host.sendCommand(cc, this.commandOptions);
277
- return response?.supportedSensorTypes;
278
- }
279
- async getSupportedScales(sensorType) {
280
- __assertType("sensorType", "number", __assertType__number.bind(void 0, sensorType));
281
- this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.GetSupportedScale);
282
- const cc = new MultilevelSensorCCGetSupportedScale({
283
- nodeId: this.endpoint.nodeId,
284
- endpointIndex: this.endpoint.index,
285
- sensorType,
286
- });
287
- const response = await this.host.sendCommand(cc, this.commandOptions);
288
- return response?.supportedScales;
289
- }
290
- async sendReport(sensorType, scale, value) {
291
- __assertType("sensorType", "number", __assertType__number.bind(void 0, sensorType));
292
- __assertType("scale", undefined, __assertType__su__number__2_eu.bind(void 0, scale));
293
- __assertType("value", "number", __assertType__number.bind(void 0, value));
294
- this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.Report);
295
- const cc = new MultilevelSensorCCReport({
296
- nodeId: this.endpoint.nodeId,
297
- endpointIndex: this.endpoint.index,
298
- type: sensorType,
299
- scale,
300
- value,
301
- });
302
- return this.host.sendCommand(cc, this.commandOptions);
303
- }
304
- };
305
- MultilevelSensorCCAPI = __decorate([
306
- API(CommandClasses["Multilevel Sensor"])
307
- ], MultilevelSensorCCAPI);
311
+ async getSupportedSensorTypes() {
312
+ this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.GetSupportedSensor);
313
+ const cc = new MultilevelSensorCCGetSupportedSensor({
314
+ nodeId: this.endpoint.nodeId,
315
+ endpointIndex: this.endpoint.index,
316
+ });
317
+ const response = await this.host.sendCommand(cc, this.commandOptions);
318
+ return response?.supportedSensorTypes;
319
+ }
320
+ async getSupportedScales(sensorType) {
321
+ __assertType("sensorType", "number", __assertType__number.bind(void 0, sensorType));
322
+ this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.GetSupportedScale);
323
+ const cc = new MultilevelSensorCCGetSupportedScale({
324
+ nodeId: this.endpoint.nodeId,
325
+ endpointIndex: this.endpoint.index,
326
+ sensorType,
327
+ });
328
+ const response = await this.host.sendCommand(cc, this.commandOptions);
329
+ return response?.supportedScales;
330
+ }
331
+ async sendReport(sensorType, scale, value) {
332
+ __assertType("sensorType", "number", __assertType__number.bind(void 0, sensorType));
333
+ __assertType("scale", undefined, __assertType__su__number__2_eu.bind(void 0, scale));
334
+ __assertType("value", "number", __assertType__number.bind(void 0, value));
335
+ this.assertSupportsCommand(MultilevelSensorCommand, MultilevelSensorCommand.Report);
336
+ const cc = new MultilevelSensorCCReport({
337
+ nodeId: this.endpoint.nodeId,
338
+ endpointIndex: this.endpoint.index,
339
+ type: sensorType,
340
+ scale,
341
+ value,
342
+ });
343
+ return this.host.sendCommand(cc, this.commandOptions);
344
+ }
345
+ };
346
+ return MultilevelSensorCCAPI = _classThis;
347
+ })();
308
348
  export { MultilevelSensorCCAPI };
309
- let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass {
310
- async interview(ctx) {
311
- const node = this.getNode(ctx);
312
- const endpoint = this.getEndpoint(ctx);
313
- const api = CCAPI.create(CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
314
- priority: MessagePriority.NodeQuery,
315
- });
316
- ctx.logNode(node.id, {
317
- endpoint: this.endpointIndex,
318
- message: `Interviewing ${this.ccName}...`,
319
- direction: "none",
320
- });
321
- if (api.version >= 5) {
322
- // Query the supported sensor types
349
+ let MultilevelSensorCC = (() => {
350
+ let _classDecorators = [commandClass(CommandClasses["Multilevel Sensor"]), implementedVersion(11), ccValues(MultilevelSensorCCValues)];
351
+ let _classDescriptor;
352
+ let _classExtraInitializers = [];
353
+ let _classThis;
354
+ let _classSuper = CommandClass;
355
+ var MultilevelSensorCC = class extends _classSuper {
356
+ static { _classThis = this; }
357
+ static {
358
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
359
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
360
+ MultilevelSensorCC = _classThis = _classDescriptor.value;
361
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
362
+ __runInitializers(_classThis, _classExtraInitializers);
363
+ }
364
+ async interview(ctx) {
365
+ const node = this.getNode(ctx);
366
+ const endpoint = this.getEndpoint(ctx);
367
+ const api = CCAPI.create(CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
368
+ priority: MessagePriority.NodeQuery,
369
+ });
323
370
  ctx.logNode(node.id, {
324
371
  endpoint: this.endpointIndex,
325
- message: "retrieving supported sensor types...",
326
- direction: "outbound",
372
+ message: `Interviewing ${this.ccName}...`,
373
+ direction: "none",
327
374
  });
328
- const sensorTypes = await api.getSupportedSensorTypes();
329
- if (sensorTypes) {
330
- const logMessage = "received supported sensor types:\n"
331
- + sensorTypes
332
- .map((t) => getSensorName(t))
333
- .map((name) => `· ${name}`)
334
- .join("\n");
375
+ if (api.version >= 5) {
376
+ // Query the supported sensor types
335
377
  ctx.logNode(node.id, {
336
378
  endpoint: this.endpointIndex,
337
- message: logMessage,
338
- direction: "inbound",
339
- });
340
- }
341
- else {
342
- ctx.logNode(node.id, {
343
- endpoint: this.endpointIndex,
344
- message: "Querying supported sensor types timed out, skipping interview...",
345
- level: "warn",
346
- });
347
- return;
348
- }
349
- // As well as the supported scales for each sensor
350
- for (const type of sensorTypes) {
351
- ctx.logNode(node.id, {
352
- endpoint: this.endpointIndex,
353
- message: `querying supported scales for ${getSensorName(type)} sensor`,
379
+ message: "retrieving supported sensor types...",
354
380
  direction: "outbound",
355
381
  });
356
- const sensorScales = await api.getSupportedScales(type);
357
- if (sensorScales) {
358
- const logMessage = "received supported scales:\n"
359
- + sensorScales
360
- .map((s) => (getSensorScale(type, s)
361
- ?? getUnknownScale(s)).label)
382
+ const sensorTypes = await api.getSupportedSensorTypes();
383
+ if (sensorTypes) {
384
+ const logMessage = "received supported sensor types:\n"
385
+ + sensorTypes
386
+ .map((t) => getSensorName(t))
362
387
  .map((name) => `· ${name}`)
363
388
  .join("\n");
364
389
  ctx.logNode(node.id, {
@@ -370,60 +395,66 @@ let MultilevelSensorCC = class MultilevelSensorCC extends CommandClass {
370
395
  else {
371
396
  ctx.logNode(node.id, {
372
397
  endpoint: this.endpointIndex,
373
- message: "Querying supported scales timed out, skipping interview...",
398
+ message: "Querying supported sensor types timed out, skipping interview...",
374
399
  level: "warn",
375
400
  });
376
401
  return;
377
402
  }
403
+ // As well as the supported scales for each sensor
404
+ for (const type of sensorTypes) {
405
+ ctx.logNode(node.id, {
406
+ endpoint: this.endpointIndex,
407
+ message: `querying supported scales for ${getSensorName(type)} sensor`,
408
+ direction: "outbound",
409
+ });
410
+ const sensorScales = await api.getSupportedScales(type);
411
+ if (sensorScales) {
412
+ const logMessage = "received supported scales:\n"
413
+ + sensorScales
414
+ .map((s) => (getSensorScale(type, s)
415
+ ?? getUnknownScale(s)).label)
416
+ .map((name) => `· ${name}`)
417
+ .join("\n");
418
+ ctx.logNode(node.id, {
419
+ endpoint: this.endpointIndex,
420
+ message: logMessage,
421
+ direction: "inbound",
422
+ });
423
+ }
424
+ else {
425
+ ctx.logNode(node.id, {
426
+ endpoint: this.endpointIndex,
427
+ message: "Querying supported scales timed out, skipping interview...",
428
+ level: "warn",
429
+ });
430
+ return;
431
+ }
432
+ }
378
433
  }
434
+ await this.refreshValues(ctx);
435
+ // Remember that the interview is complete
436
+ this.setInterviewComplete(ctx, true);
379
437
  }
380
- await this.refreshValues(ctx);
381
- // Remember that the interview is complete
382
- this.setInterviewComplete(ctx, true);
383
- }
384
- async refreshValues(ctx) {
385
- const node = this.getNode(ctx);
386
- const endpoint = this.getEndpoint(ctx);
387
- const api = CCAPI.create(CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
388
- priority: MessagePriority.NodeQuery,
389
- });
390
- const valueDB = this.getValueDB(ctx);
391
- if (api.version <= 4) {
392
- // Sensors up to V4 only support a single value
393
- ctx.logNode(node.id, {
394
- endpoint: this.endpointIndex,
395
- message: "querying current sensor reading...",
396
- direction: "outbound",
438
+ async refreshValues(ctx) {
439
+ const node = this.getNode(ctx);
440
+ const endpoint = this.getEndpoint(ctx);
441
+ const api = CCAPI.create(CommandClasses["Multilevel Sensor"], ctx, endpoint).withOptions({
442
+ priority: MessagePriority.NodeQuery,
397
443
  });
398
- const mlsResponse = await api.get();
399
- if (mlsResponse) {
400
- const sensorScale = getSensorScale(mlsResponse.type, mlsResponse.scale.key);
401
- const logMessage = `received current sensor reading:
402
- sensor type: ${getSensorName(mlsResponse.type)}
403
- value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` : ""}`;
444
+ const valueDB = this.getValueDB(ctx);
445
+ if (api.version <= 4) {
446
+ // Sensors up to V4 only support a single value
404
447
  ctx.logNode(node.id, {
405
448
  endpoint: this.endpointIndex,
406
- message: logMessage,
407
- direction: "inbound",
408
- });
409
- }
410
- }
411
- else {
412
- // Query all sensor values
413
- const sensorTypes = valueDB.getValue({
414
- commandClass: this.ccId,
415
- property: "supportedSensorTypes",
416
- endpoint: this.endpointIndex,
417
- }) || [];
418
- for (const type of sensorTypes) {
419
- ctx.logNode(node.id, {
420
- endpoint: this.endpointIndex,
421
- message: `querying ${getSensorName(type)} sensor reading...`,
449
+ message: "querying current sensor reading...",
422
450
  direction: "outbound",
423
451
  });
424
- const value = await api.get(type);
425
- if (value) {
426
- const logMessage = `received current ${getSensorName(type)} sensor reading: ${value.value} ${value.scale.unit || ""}`;
452
+ const mlsResponse = await api.get();
453
+ if (mlsResponse) {
454
+ const sensorScale = getSensorScale(mlsResponse.type, mlsResponse.scale.key);
455
+ const logMessage = `received current sensor reading:
456
+ sensor type: ${getSensorName(mlsResponse.type)}
457
+ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` : ""}`;
427
458
  ctx.logNode(node.id, {
428
459
  endpoint: this.endpointIndex,
429
460
  message: logMessage,
@@ -431,323 +462,411 @@ value: ${mlsResponse.value}${sensorScale?.unit ? ` ${sensorScale.unit}` :
431
462
  });
432
463
  }
433
464
  }
465
+ else {
466
+ // Query all sensor values
467
+ const sensorTypes = valueDB.getValue({
468
+ commandClass: this.ccId,
469
+ property: "supportedSensorTypes",
470
+ endpoint: this.endpointIndex,
471
+ }) || [];
472
+ for (const type of sensorTypes) {
473
+ ctx.logNode(node.id, {
474
+ endpoint: this.endpointIndex,
475
+ message: `querying ${getSensorName(type)} sensor reading...`,
476
+ direction: "outbound",
477
+ });
478
+ const value = await api.get(type);
479
+ if (value) {
480
+ const logMessage = `received current ${getSensorName(type)} sensor reading: ${value.value} ${value.scale.unit || ""}`;
481
+ ctx.logNode(node.id, {
482
+ endpoint: this.endpointIndex,
483
+ message: logMessage,
484
+ direction: "inbound",
485
+ });
486
+ }
487
+ }
488
+ }
434
489
  }
435
- }
436
- shouldRefreshValues(ctx) {
437
- // Poll the device when all of the supported values were last updated longer than 6 hours ago.
438
- // This may lead to some values not being updated, but the user may have disabled some unnecessary
439
- // reports to reduce traffic.
440
- const valueDB = ctx.tryGetValueDB(this.nodeId);
441
- if (!valueDB)
442
- return true;
443
- const values = this.getDefinedValueIDs(ctx).filter((v) => MultilevelSensorCCValues.value.is(v));
444
- return values.every((v) => {
445
- const lastUpdated = valueDB.getTimestamp(v);
446
- return (lastUpdated == undefined
447
- || Date.now() - lastUpdated > timespan.hours(6));
448
- });
449
- }
450
- /**
451
- * Returns which sensor types are supported.
452
- * This only works AFTER the interview process
453
- */
454
- static getSupportedSensorTypesCached(ctx, endpoint) {
455
- return ctx
456
- .getValueDB(endpoint.nodeId)
457
- .getValue(MultilevelSensorCCValues.supportedSensorTypes.endpoint(endpoint.index));
458
- }
459
- /**
460
- * Returns which scales are supported for a given sensor type.
461
- * This only works AFTER the interview process
462
- */
463
- static getSupportedScalesCached(ctx, endpoint, sensorType) {
464
- return ctx
465
- .getValueDB(endpoint.nodeId)
466
- .getValue(MultilevelSensorCCValues.supportedScales(sensorType).endpoint(endpoint.index));
467
- }
468
- translatePropertyKey(ctx, property, propertyKey) {
469
- // TODO: check this
470
- if (property === "values" && typeof propertyKey === "number") {
471
- const sensor = getSensor(propertyKey);
472
- if (sensor)
473
- return sensor.label;
474
- }
475
- return super.translatePropertyKey(ctx, property, propertyKey);
476
- }
477
- };
478
- MultilevelSensorCC = __decorate([
479
- commandClass(CommandClasses["Multilevel Sensor"]),
480
- implementedVersion(11),
481
- ccValues(MultilevelSensorCCValues)
482
- ], MultilevelSensorCC);
490
+ shouldRefreshValues(ctx) {
491
+ // Poll the device when all of the supported values were last updated longer than 6 hours ago.
492
+ // This may lead to some values not being updated, but the user may have disabled some unnecessary
493
+ // reports to reduce traffic.
494
+ const valueDB = ctx.tryGetValueDB(this.nodeId);
495
+ if (!valueDB)
496
+ return true;
497
+ const values = this.getDefinedValueIDs(ctx).filter((v) => MultilevelSensorCCValues.value.is(v));
498
+ return values.every((v) => {
499
+ const lastUpdated = valueDB.getTimestamp(v);
500
+ return (lastUpdated == undefined
501
+ || Date.now() - lastUpdated > timespan.hours(6));
502
+ });
503
+ }
504
+ /**
505
+ * Returns which sensor types are supported.
506
+ * This only works AFTER the interview process
507
+ */
508
+ static getSupportedSensorTypesCached(ctx, endpoint) {
509
+ return ctx
510
+ .getValueDB(endpoint.nodeId)
511
+ .getValue(MultilevelSensorCCValues.supportedSensorTypes.endpoint(endpoint.index));
512
+ }
513
+ /**
514
+ * Returns which scales are supported for a given sensor type.
515
+ * This only works AFTER the interview process
516
+ */
517
+ static getSupportedScalesCached(ctx, endpoint, sensorType) {
518
+ return ctx
519
+ .getValueDB(endpoint.nodeId)
520
+ .getValue(MultilevelSensorCCValues.supportedScales(sensorType).endpoint(endpoint.index));
521
+ }
522
+ translatePropertyKey(ctx, property, propertyKey) {
523
+ // TODO: check this
524
+ if (property === "values" && typeof propertyKey === "number") {
525
+ const sensor = getSensor(propertyKey);
526
+ if (sensor)
527
+ return sensor.label;
528
+ }
529
+ return super.translatePropertyKey(ctx, property, propertyKey);
530
+ }
531
+ };
532
+ return MultilevelSensorCC = _classThis;
533
+ })();
483
534
  export { MultilevelSensorCC };
484
- let MultilevelSensorCCReport = MultilevelSensorCCReport_1 = class MultilevelSensorCCReport extends MultilevelSensorCC {
485
- constructor(options) {
486
- super(options);
487
- this.type = options.type;
488
- this.value = options.value;
489
- this.scale = typeof options.scale === "number"
490
- ? options.scale
491
- : options.scale.key;
492
- }
493
- static from(raw, ctx) {
494
- validatePayload(raw.payload.length >= 1);
495
- const type = raw.payload[0];
496
- // parseFloatWithScale does its own validation
497
- const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
498
- return new MultilevelSensorCCReport_1({
499
- nodeId: ctx.sourceNodeId,
500
- type,
501
- value,
502
- scale,
503
- });
504
- }
505
- persistValues(ctx) {
506
- if (!super.persistValues(ctx))
507
- return false;
508
- const sensor = getSensor(this.type);
509
- const scale = getSensorScale(this.type, this.scale) ?? getUnknownScale(this.scale);
510
- // Filter out unknown sensor types and scales, unless the strict validation is disabled
511
- const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
512
- const ccVersion = getEffectiveCCVersion(ctx, this);
513
- if (measurementValidation) {
514
- // Filter out unsupported sensor types and scales if possible
515
- if (ccVersion >= 5) {
516
- const supportedSensorTypes = this.getValue(ctx, MultilevelSensorCCValues.supportedSensorTypes);
517
- if (supportedSensorTypes?.length) {
518
- validatePayload.withReason(`Unsupported sensor type ${getSensorName(this.type)} or corrupted data`)(supportedSensorTypes.includes(this.type));
535
+ let MultilevelSensorCCReport = (() => {
536
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.Report), useSupervision()];
537
+ let _classDescriptor;
538
+ let _classExtraInitializers = [];
539
+ let _classThis;
540
+ let _classSuper = MultilevelSensorCC;
541
+ var MultilevelSensorCCReport = class extends _classSuper {
542
+ static { _classThis = this; }
543
+ static {
544
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
545
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
546
+ MultilevelSensorCCReport = _classThis = _classDescriptor.value;
547
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
548
+ __runInitializers(_classThis, _classExtraInitializers);
549
+ }
550
+ constructor(options) {
551
+ super(options);
552
+ this.type = options.type;
553
+ this.value = options.value;
554
+ this.scale = typeof options.scale === "number"
555
+ ? options.scale
556
+ : options.scale.key;
557
+ }
558
+ static from(raw, ctx) {
559
+ validatePayload(raw.payload.length >= 1);
560
+ const type = raw.payload[0];
561
+ // parseFloatWithScale does its own validation
562
+ const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));
563
+ return new this({
564
+ nodeId: ctx.sourceNodeId,
565
+ type,
566
+ value,
567
+ scale,
568
+ });
569
+ }
570
+ persistValues(ctx) {
571
+ if (!super.persistValues(ctx))
572
+ return false;
573
+ const sensor = getSensor(this.type);
574
+ const scale = getSensorScale(this.type, this.scale) ?? getUnknownScale(this.scale);
575
+ // Filter out unknown sensor types and scales, unless the strict validation is disabled
576
+ const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
577
+ const ccVersion = getEffectiveCCVersion(ctx, this);
578
+ if (measurementValidation) {
579
+ // Filter out unsupported sensor types and scales if possible
580
+ if (ccVersion >= 5) {
581
+ const supportedSensorTypes = this.getValue(ctx, MultilevelSensorCCValues.supportedSensorTypes);
582
+ if (supportedSensorTypes?.length) {
583
+ validatePayload.withReason(`Unsupported sensor type ${getSensorName(this.type)} or corrupted data`)(supportedSensorTypes.includes(this.type));
584
+ }
585
+ const supportedScales = this.getValue(ctx, MultilevelSensorCCValues.supportedScales(this.type));
586
+ if (supportedScales?.length) {
587
+ validatePayload.withReason(`Unsupported scale ${scale.label} or corrupted data`)(supportedScales.includes(scale.key));
588
+ }
519
589
  }
520
- const supportedScales = this.getValue(ctx, MultilevelSensorCCValues.supportedScales(this.type));
521
- if (supportedScales?.length) {
522
- validatePayload.withReason(`Unsupported scale ${scale.label} or corrupted data`)(supportedScales.includes(scale.key));
590
+ else {
591
+ // We support a higher CC version than the device, so any types and scales it uses should be known to us
592
+ // Filter out unknown ones.
593
+ validatePayload.withReason(`Unknown sensor type ${num2hex(this.type)} or corrupted data`)(!!sensor);
594
+ validatePayload.withReason(`Unknown scale ${num2hex(this.scale)} or corrupted data`)(scale.label !== getUnknownScale(this.scale).label);
523
595
  }
524
596
  }
525
- else {
526
- // We support a higher CC version than the device, so any types and scales it uses should be known to us
527
- // Filter out unknown ones.
528
- validatePayload.withReason(`Unknown sensor type ${num2hex(this.type)} or corrupted data`)(!!sensor);
529
- validatePayload.withReason(`Unknown scale ${num2hex(this.scale)} or corrupted data`)(scale.label !== getUnknownScale(this.scale).label);
530
- }
597
+ const sensorName = getSensorName(this.type);
598
+ const sensorValue = MultilevelSensorCCValues.value(sensorName);
599
+ this.setMetadata(ctx, sensorValue, {
600
+ ...sensorValue.meta,
601
+ unit: scale.unit,
602
+ ccSpecific: {
603
+ sensorType: this.type,
604
+ scale: scale.key,
605
+ },
606
+ });
607
+ this.setValue(ctx, sensorValue, this.value);
608
+ return true;
531
609
  }
532
- const sensorName = getSensorName(this.type);
533
- const sensorValue = MultilevelSensorCCValues.value(sensorName);
534
- this.setMetadata(ctx, sensorValue, {
535
- ...sensorValue.meta,
536
- unit: scale.unit,
537
- ccSpecific: {
538
- sensorType: this.type,
539
- scale: scale.key,
540
- },
541
- });
542
- this.setValue(ctx, sensorValue, this.value);
543
- return true;
544
- }
545
- type;
546
- scale;
547
- value;
548
- serialize(ctx) {
549
- this.payload = Bytes.concat([
550
- Bytes.from([this.type]),
551
- encodeFloatWithScale(this.value, this.scale),
552
- ]);
553
- return super.serialize(ctx);
554
- }
555
- toLogEntry(ctx) {
556
- return {
557
- ...super.toLogEntry(ctx),
558
- message: {
559
- "sensor type": getSensorName(this.type),
560
- scale: (getSensorScale(this.type, this.scale)
561
- ?? getUnknownScale(this.scale)).label,
562
- value: this.value,
563
- },
564
- };
565
- }
566
- };
567
- MultilevelSensorCCReport = MultilevelSensorCCReport_1 = __decorate([
568
- CCCommand(MultilevelSensorCommand.Report),
569
- useSupervision()
570
- ], MultilevelSensorCCReport);
610
+ type;
611
+ scale;
612
+ value;
613
+ serialize(ctx) {
614
+ this.payload = Bytes.concat([
615
+ Bytes.from([this.type]),
616
+ encodeFloatWithScale(this.value, this.scale),
617
+ ]);
618
+ return super.serialize(ctx);
619
+ }
620
+ toLogEntry(ctx) {
621
+ return {
622
+ ...super.toLogEntry(ctx),
623
+ message: {
624
+ "sensor type": getSensorName(this.type),
625
+ scale: (getSensorScale(this.type, this.scale)
626
+ ?? getUnknownScale(this.scale)).label,
627
+ value: this.value,
628
+ },
629
+ };
630
+ }
631
+ };
632
+ return MultilevelSensorCCReport = _classThis;
633
+ })();
571
634
  export { MultilevelSensorCCReport };
572
635
  const testResponseForMultilevelSensorGet = (sent, received) => {
573
636
  // We expect a Multilevel Sensor Report that matches the requested sensor type (if a type was requested)
574
637
  return sent.sensorType == undefined || received.type === sent.sensorType;
575
638
  };
576
- let MultilevelSensorCCGet = MultilevelSensorCCGet_1 = class MultilevelSensorCCGet extends MultilevelSensorCC {
577
- constructor(options) {
578
- super(options);
579
- if ("sensorType" in options) {
639
+ let MultilevelSensorCCGet = (() => {
640
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.Get), expectedCCResponse(MultilevelSensorCCReport, testResponseForMultilevelSensorGet)];
641
+ let _classDescriptor;
642
+ let _classExtraInitializers = [];
643
+ let _classThis;
644
+ let _classSuper = MultilevelSensorCC;
645
+ var MultilevelSensorCCGet = class extends _classSuper {
646
+ static { _classThis = this; }
647
+ static {
648
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
649
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
650
+ MultilevelSensorCCGet = _classThis = _classDescriptor.value;
651
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
652
+ __runInitializers(_classThis, _classExtraInitializers);
653
+ }
654
+ constructor(options) {
655
+ super(options);
656
+ if ("sensorType" in options) {
657
+ this.sensorType = options.sensorType;
658
+ this.scale = options.scale;
659
+ }
660
+ }
661
+ static from(raw, ctx) {
662
+ if (raw.payload.length >= 2) {
663
+ const sensorType = raw.payload[0];
664
+ const scale = (raw.payload[1] >> 3) & 0b11;
665
+ return new this({
666
+ nodeId: ctx.sourceNodeId,
667
+ sensorType,
668
+ scale,
669
+ });
670
+ }
671
+ else {
672
+ return new this({
673
+ nodeId: ctx.sourceNodeId,
674
+ });
675
+ }
676
+ }
677
+ sensorType;
678
+ scale;
679
+ serialize(ctx) {
680
+ if (this.sensorType != undefined
681
+ && this.scale != undefined) {
682
+ this.payload = Bytes.from([
683
+ this.sensorType,
684
+ (this.scale & 0b11) << 3,
685
+ ]);
686
+ }
687
+ return super.serialize(ctx);
688
+ }
689
+ toLogEntry(ctx) {
690
+ let message = {};
691
+ if (this.sensorType != undefined
692
+ && this.scale != undefined) {
693
+ message = {
694
+ "sensor type": getSensorName(this.sensorType),
695
+ scale: (getSensorScale(this.sensorType, this.scale) ?? getUnknownScale(this.scale)).label,
696
+ };
697
+ }
698
+ return {
699
+ ...super.toLogEntry(ctx),
700
+ message,
701
+ };
702
+ }
703
+ };
704
+ return MultilevelSensorCCGet = _classThis;
705
+ })();
706
+ export { MultilevelSensorCCGet };
707
+ let MultilevelSensorCCSupportedSensorReport = (() => {
708
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.SupportedSensorReport), ccValueProperty("supportedSensorTypes", MultilevelSensorCCValues.supportedSensorTypes)];
709
+ let _classDescriptor;
710
+ let _classExtraInitializers = [];
711
+ let _classThis;
712
+ let _classSuper = MultilevelSensorCC;
713
+ var MultilevelSensorCCSupportedSensorReport = class extends _classSuper {
714
+ static { _classThis = this; }
715
+ static {
716
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
717
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
718
+ MultilevelSensorCCSupportedSensorReport = _classThis = _classDescriptor.value;
719
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
720
+ __runInitializers(_classThis, _classExtraInitializers);
721
+ }
722
+ constructor(options) {
723
+ super(options);
724
+ this.supportedSensorTypes = options.supportedSensorTypes;
725
+ }
726
+ static from(raw, ctx) {
727
+ validatePayload(raw.payload.length >= 1);
728
+ const supportedSensorTypes = parseBitMask(raw.payload);
729
+ return new this({
730
+ nodeId: ctx.sourceNodeId,
731
+ supportedSensorTypes,
732
+ });
733
+ }
734
+ // TODO: Use this during interview to precreate values
735
+ supportedSensorTypes;
736
+ serialize(ctx) {
737
+ this.payload = encodeBitMask(this.supportedSensorTypes);
738
+ return super.serialize(ctx);
739
+ }
740
+ toLogEntry(ctx) {
741
+ return {
742
+ ...super.toLogEntry(ctx),
743
+ message: {
744
+ "supported sensor types": this.supportedSensorTypes
745
+ .map((t) => `\n· ${getSensorName(t)}`)
746
+ .join(""),
747
+ },
748
+ };
749
+ }
750
+ };
751
+ return MultilevelSensorCCSupportedSensorReport = _classThis;
752
+ })();
753
+ export { MultilevelSensorCCSupportedSensorReport };
754
+ let MultilevelSensorCCGetSupportedSensor = (() => {
755
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.GetSupportedSensor), expectedCCResponse(MultilevelSensorCCSupportedSensorReport)];
756
+ let _classDescriptor;
757
+ let _classExtraInitializers = [];
758
+ let _classThis;
759
+ let _classSuper = MultilevelSensorCC;
760
+ var MultilevelSensorCCGetSupportedSensor = class extends _classSuper {
761
+ static { _classThis = this; }
762
+ static {
763
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
764
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
765
+ MultilevelSensorCCGetSupportedSensor = _classThis = _classDescriptor.value;
766
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
767
+ __runInitializers(_classThis, _classExtraInitializers);
768
+ }
769
+ };
770
+ return MultilevelSensorCCGetSupportedSensor = _classThis;
771
+ })();
772
+ export { MultilevelSensorCCGetSupportedSensor };
773
+ let MultilevelSensorCCSupportedScaleReport = (() => {
774
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.SupportedScaleReport), ccValueProperty("supportedScales", MultilevelSensorCCValues.supportedScales, (self) => [self.sensorType])];
775
+ let _classDescriptor;
776
+ let _classExtraInitializers = [];
777
+ let _classThis;
778
+ let _classSuper = MultilevelSensorCC;
779
+ var MultilevelSensorCCSupportedScaleReport = class extends _classSuper {
780
+ static { _classThis = this; }
781
+ static {
782
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
783
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
784
+ MultilevelSensorCCSupportedScaleReport = _classThis = _classDescriptor.value;
785
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
786
+ __runInitializers(_classThis, _classExtraInitializers);
787
+ }
788
+ constructor(options) {
789
+ super(options);
580
790
  this.sensorType = options.sensorType;
581
- this.scale = options.scale;
791
+ this.supportedScales = options.supportedScales;
582
792
  }
583
- }
584
- static from(raw, ctx) {
585
- if (raw.payload.length >= 2) {
793
+ static from(raw, ctx) {
794
+ validatePayload(raw.payload.length >= 2);
586
795
  const sensorType = raw.payload[0];
587
- const scale = (raw.payload[1] >> 3) & 0b11;
588
- return new MultilevelSensorCCGet_1({
796
+ const supportedScales = parseBitMask(Bytes.from([raw.payload[1] & 0b1111]), 0);
797
+ return new this({
589
798
  nodeId: ctx.sourceNodeId,
590
799
  sensorType,
591
- scale,
800
+ supportedScales,
592
801
  });
593
802
  }
594
- else {
595
- return new MultilevelSensorCCGet_1({
803
+ sensorType;
804
+ supportedScales;
805
+ serialize(ctx) {
806
+ this.payload = Bytes.concat([
807
+ Bytes.from([this.sensorType]),
808
+ encodeBitMask(this.supportedScales, 4, 0),
809
+ ]);
810
+ return super.serialize(ctx);
811
+ }
812
+ toLogEntry(ctx) {
813
+ return {
814
+ ...super.toLogEntry(ctx),
815
+ message: {
816
+ "sensor type": getSensorName(this.sensorType),
817
+ "supported scales": this.supportedScales
818
+ .map((s) => `\n· ${(getSensorScale(this.sensorType, s)
819
+ ?? getUnknownScale(s)).label}`)
820
+ .join(""),
821
+ },
822
+ };
823
+ }
824
+ };
825
+ return MultilevelSensorCCSupportedScaleReport = _classThis;
826
+ })();
827
+ export { MultilevelSensorCCSupportedScaleReport };
828
+ let MultilevelSensorCCGetSupportedScale = (() => {
829
+ let _classDecorators = [CCCommand(MultilevelSensorCommand.GetSupportedScale), expectedCCResponse(MultilevelSensorCCSupportedScaleReport)];
830
+ let _classDescriptor;
831
+ let _classExtraInitializers = [];
832
+ let _classThis;
833
+ let _classSuper = MultilevelSensorCC;
834
+ var MultilevelSensorCCGetSupportedScale = class extends _classSuper {
835
+ static { _classThis = this; }
836
+ static {
837
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
838
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
839
+ MultilevelSensorCCGetSupportedScale = _classThis = _classDescriptor.value;
840
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
841
+ __runInitializers(_classThis, _classExtraInitializers);
842
+ }
843
+ constructor(options) {
844
+ super(options);
845
+ this.sensorType = options.sensorType;
846
+ }
847
+ static from(raw, ctx) {
848
+ validatePayload(raw.payload.length >= 1);
849
+ const sensorType = raw.payload[0];
850
+ return new this({
596
851
  nodeId: ctx.sourceNodeId,
852
+ sensorType,
597
853
  });
598
854
  }
599
- }
600
- sensorType;
601
- scale;
602
- serialize(ctx) {
603
- if (this.sensorType != undefined
604
- && this.scale != undefined) {
605
- this.payload = Bytes.from([
606
- this.sensorType,
607
- (this.scale & 0b11) << 3,
608
- ]);
855
+ sensorType;
856
+ serialize(ctx) {
857
+ this.payload = Bytes.from([this.sensorType]);
858
+ return super.serialize(ctx);
609
859
  }
610
- return super.serialize(ctx);
611
- }
612
- toLogEntry(ctx) {
613
- let message = {};
614
- if (this.sensorType != undefined
615
- && this.scale != undefined) {
616
- message = {
617
- "sensor type": getSensorName(this.sensorType),
618
- scale: (getSensorScale(this.sensorType, this.scale) ?? getUnknownScale(this.scale)).label,
860
+ toLogEntry(ctx) {
861
+ return {
862
+ ...super.toLogEntry(ctx),
863
+ message: {
864
+ "sensor type": getSensorName(this.sensorType),
865
+ },
619
866
  };
620
867
  }
621
- return {
622
- ...super.toLogEntry(ctx),
623
- message,
624
- };
625
- }
626
- };
627
- MultilevelSensorCCGet = MultilevelSensorCCGet_1 = __decorate([
628
- CCCommand(MultilevelSensorCommand.Get),
629
- expectedCCResponse(MultilevelSensorCCReport, testResponseForMultilevelSensorGet)
630
- ], MultilevelSensorCCGet);
631
- export { MultilevelSensorCCGet };
632
- let MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport_1 = class MultilevelSensorCCSupportedSensorReport extends MultilevelSensorCC {
633
- constructor(options) {
634
- super(options);
635
- this.supportedSensorTypes = options.supportedSensorTypes;
636
- }
637
- static from(raw, ctx) {
638
- validatePayload(raw.payload.length >= 1);
639
- const supportedSensorTypes = parseBitMask(raw.payload);
640
- return new MultilevelSensorCCSupportedSensorReport_1({
641
- nodeId: ctx.sourceNodeId,
642
- supportedSensorTypes,
643
- });
644
- }
645
- // TODO: Use this during interview to precreate values
646
- supportedSensorTypes;
647
- serialize(ctx) {
648
- this.payload = encodeBitMask(this.supportedSensorTypes);
649
- return super.serialize(ctx);
650
- }
651
- toLogEntry(ctx) {
652
- return {
653
- ...super.toLogEntry(ctx),
654
- message: {
655
- "supported sensor types": this.supportedSensorTypes
656
- .map((t) => `\n· ${getSensorName(t)}`)
657
- .join(""),
658
- },
659
- };
660
- }
661
- };
662
- __decorate([
663
- ccValue(MultilevelSensorCCValues.supportedSensorTypes)
664
- ], MultilevelSensorCCSupportedSensorReport.prototype, "supportedSensorTypes", void 0);
665
- MultilevelSensorCCSupportedSensorReport = MultilevelSensorCCSupportedSensorReport_1 = __decorate([
666
- CCCommand(MultilevelSensorCommand.SupportedSensorReport)
667
- ], MultilevelSensorCCSupportedSensorReport);
668
- export { MultilevelSensorCCSupportedSensorReport };
669
- let MultilevelSensorCCGetSupportedSensor = class MultilevelSensorCCGetSupportedSensor extends MultilevelSensorCC {
670
- };
671
- MultilevelSensorCCGetSupportedSensor = __decorate([
672
- CCCommand(MultilevelSensorCommand.GetSupportedSensor),
673
- expectedCCResponse(MultilevelSensorCCSupportedSensorReport)
674
- ], MultilevelSensorCCGetSupportedSensor);
675
- export { MultilevelSensorCCGetSupportedSensor };
676
- let MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport_1 = class MultilevelSensorCCSupportedScaleReport extends MultilevelSensorCC {
677
- constructor(options) {
678
- super(options);
679
- this.sensorType = options.sensorType;
680
- this.supportedScales = options.supportedScales;
681
- }
682
- static from(raw, ctx) {
683
- validatePayload(raw.payload.length >= 2);
684
- const sensorType = raw.payload[0];
685
- const supportedScales = parseBitMask(Bytes.from([raw.payload[1] & 0b1111]), 0);
686
- return new MultilevelSensorCCSupportedScaleReport_1({
687
- nodeId: ctx.sourceNodeId,
688
- sensorType,
689
- supportedScales,
690
- });
691
- }
692
- sensorType;
693
- supportedScales;
694
- serialize(ctx) {
695
- this.payload = Bytes.concat([
696
- Bytes.from([this.sensorType]),
697
- encodeBitMask(this.supportedScales, 4, 0),
698
- ]);
699
- return super.serialize(ctx);
700
- }
701
- toLogEntry(ctx) {
702
- return {
703
- ...super.toLogEntry(ctx),
704
- message: {
705
- "sensor type": getSensorName(this.sensorType),
706
- "supported scales": this.supportedScales
707
- .map((s) => `\n· ${(getSensorScale(this.sensorType, s)
708
- ?? getUnknownScale(s)).label}`)
709
- .join(""),
710
- },
711
- };
712
- }
713
- };
714
- __decorate([
715
- ccValue(MultilevelSensorCCValues.supportedScales, (self) => [self.sensorType])
716
- ], MultilevelSensorCCSupportedScaleReport.prototype, "supportedScales", void 0);
717
- MultilevelSensorCCSupportedScaleReport = MultilevelSensorCCSupportedScaleReport_1 = __decorate([
718
- CCCommand(MultilevelSensorCommand.SupportedScaleReport)
719
- ], MultilevelSensorCCSupportedScaleReport);
720
- export { MultilevelSensorCCSupportedScaleReport };
721
- let MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale_1 = class MultilevelSensorCCGetSupportedScale extends MultilevelSensorCC {
722
- constructor(options) {
723
- super(options);
724
- this.sensorType = options.sensorType;
725
- }
726
- static from(raw, ctx) {
727
- validatePayload(raw.payload.length >= 1);
728
- const sensorType = raw.payload[0];
729
- return new MultilevelSensorCCGetSupportedScale_1({
730
- nodeId: ctx.sourceNodeId,
731
- sensorType,
732
- });
733
- }
734
- sensorType;
735
- serialize(ctx) {
736
- this.payload = Bytes.from([this.sensorType]);
737
- return super.serialize(ctx);
738
- }
739
- toLogEntry(ctx) {
740
- return {
741
- ...super.toLogEntry(ctx),
742
- message: {
743
- "sensor type": getSensorName(this.sensorType),
744
- },
745
- };
746
- }
747
- };
748
- MultilevelSensorCCGetSupportedScale = MultilevelSensorCCGetSupportedScale_1 = __decorate([
749
- CCCommand(MultilevelSensorCommand.GetSupportedScale),
750
- expectedCCResponse(MultilevelSensorCCSupportedScaleReport)
751
- ], MultilevelSensorCCGetSupportedScale);
868
+ };
869
+ return MultilevelSensorCCGetSupportedScale = _classThis;
870
+ })();
752
871
  export { MultilevelSensorCCGetSupportedScale };
753
872
  //# sourceMappingURL=MultilevelSensorCC.js.map