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

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
@@ -38,13 +38,45 @@ var import_CommandClass = require("../lib/CommandClass.js");
38
38
  var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
39
39
  var import_Values = require("../lib/Values.js");
40
40
  var import_Types = require("../lib/_Types.js");
41
- var __decorate = function(decorators, target, key, desc) {
42
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
43
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
44
- 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;
45
- return c > 3 && r && Object.defineProperty(target, key, r), r;
41
+ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
42
+ function accept(f) {
43
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
44
+ return f;
45
+ }
46
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
47
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
48
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
49
+ var _, done = false;
50
+ for (var i = decorators.length - 1; i >= 0; i--) {
51
+ var context = {};
52
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
53
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
54
+ context.addInitializer = function(f) {
55
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
56
+ extraInitializers.push(accept(f || null));
57
+ };
58
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
59
+ if (kind === "accessor") {
60
+ if (result === void 0) continue;
61
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
62
+ if (_ = accept(result.get)) descriptor.get = _;
63
+ if (_ = accept(result.set)) descriptor.set = _;
64
+ if (_ = accept(result.init)) initializers.unshift(_);
65
+ } else if (_ = accept(result)) {
66
+ if (kind === "field") initializers.unshift(_);
67
+ else descriptor[key] = _;
68
+ }
69
+ }
70
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
71
+ done = true;
72
+ };
73
+ var __runInitializers = function(thisArg, initializers, value) {
74
+ var useValue = arguments.length > 2;
75
+ for (var i = 0; i < initializers.length; i++) {
76
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
77
+ }
78
+ return useValue ? value : void 0;
46
79
  };
47
- var MeterCCReport_1, MeterCCGet_1, MeterCCSupportedReport_1, MeterCCReset_1;
48
80
  function __assertType(argName, typeName, boundHasError) {
49
81
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
50
82
  if (boundHasError()) {
@@ -449,777 +481,865 @@ function isAccumulatedValue(meterType, scale) {
449
481
  }
450
482
  return false;
451
483
  }
452
- let MeterCCAPI = class MeterCCAPI2 extends import_API.PhysicalCCAPI {
453
- supportsCommand(cmd) {
454
- switch (cmd) {
455
- case import_Types.MeterCommand.Get:
456
- case import_Types.MeterCommand.Report:
457
- return true;
458
- // This is mandatory
459
- case import_Types.MeterCommand.SupportedGet:
460
- case import_Types.MeterCommand.SupportedReport:
461
- return this.version >= 2;
462
- case import_Types.MeterCommand.Reset: {
463
- const ret = this.tryGetValueDB()?.getValue({
464
- commandClass: (0, import_CommandClassDecorators.getCommandClass)(this),
465
- endpoint: this.endpoint.index,
466
- property: "supportsReset"
467
- });
468
- return ret === true;
469
- }
484
+ let MeterCCAPI = (() => {
485
+ let _classDecorators = [(0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Meter)];
486
+ let _classDescriptor;
487
+ let _classExtraInitializers = [];
488
+ let _classThis;
489
+ let _classSuper = import_API.PhysicalCCAPI;
490
+ var MeterCCAPI2 = class extends _classSuper {
491
+ static {
492
+ _classThis = this;
470
493
  }
471
- return super.supportsCommand(cmd);
472
- }
473
- get [import_API.POLL_VALUE]() {
474
- return async function({ property, propertyKey }) {
475
- switch (property) {
476
- case "value":
477
- case "previousValue":
478
- case "deltaTime": {
479
- if (propertyKey == void 0) {
480
- (0, import_API.throwMissingPropertyKey)(this.ccId, property);
481
- } else if (typeof propertyKey !== "number") {
482
- (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
483
- }
484
- const { rateType, scale } = splitPropertyKey(propertyKey);
485
- return (await this.get({
486
- rateType,
487
- scale
488
- }))?.[property];
494
+ static {
495
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
496
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
497
+ MeterCCAPI2 = _classThis = _classDescriptor.value;
498
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
499
+ __runInitializers(_classThis, _classExtraInitializers);
500
+ }
501
+ supportsCommand(cmd) {
502
+ switch (cmd) {
503
+ case import_Types.MeterCommand.Get:
504
+ case import_Types.MeterCommand.Report:
505
+ return true;
506
+ // This is mandatory
507
+ case import_Types.MeterCommand.SupportedGet:
508
+ case import_Types.MeterCommand.SupportedReport:
509
+ return this.version >= 2;
510
+ case import_Types.MeterCommand.Reset: {
511
+ const ret = this.tryGetValueDB()?.getValue({
512
+ commandClass: (0, import_CommandClassDecorators.getCommandClass)(this),
513
+ endpoint: this.endpoint.index,
514
+ property: "supportsReset"
515
+ });
516
+ return ret === true;
489
517
  }
490
- default:
491
- (0, import_API.throwUnsupportedProperty)(this.ccId, property);
492
518
  }
493
- };
494
- }
495
- async get(options) {
496
- __assertType("options", "(optional) MeterCCGetOptions", __assertType__optional_MeterCCGetOptions.bind(void 0, options));
497
- this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Get);
498
- const cc = new MeterCCGet({
499
- nodeId: this.endpoint.nodeId,
500
- endpointIndex: this.endpoint.index,
501
- ...options
502
- });
503
- const response = await this.host.sendCommand(cc, this.commandOptions);
504
- if (response) {
505
- return {
506
- type: response.type,
507
- scale: (0, import_core.getMeterScale)(response.type, response.scale) ?? (0, import_core.getUnknownMeterScale)(response.scale),
508
- ...(0, import_safe3.pick)(response, [
509
- "value",
510
- "previousValue",
511
- "rateType",
512
- "deltaTime"
513
- ])
514
- };
519
+ return super.supportsCommand(cmd);
515
520
  }
516
- }
517
- async sendReport(options) {
518
- __assertType("options", "MeterCCReportOptions", __assertType__MeterCCReportOptions.bind(void 0, options));
519
- this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Report);
520
- const cc = new MeterCCReport({
521
- nodeId: this.endpoint.nodeId,
522
- endpointIndex: this.endpoint.index,
523
- ...options
524
- });
525
- return this.host.sendCommand(cc, this.commandOptions);
526
- }
527
- async getAll(accumulatedOnly = false) {
528
- __assertType("accumulatedOnly", "(optional) boolean", __assertType__optional_boolean.bind(void 0, accumulatedOnly));
529
- const valueDB = this.tryGetValueDB();
530
- if (this.version >= 2) {
531
- const meterType = valueDB?.getValue(MeterCCValues.type.endpoint(this.endpoint.index));
532
- const supportedScales = valueDB?.getValue(MeterCCValues.supportedScales.endpoint(this.endpoint.index)) ?? [];
533
- const supportedRateTypes = valueDB?.getValue(MeterCCValues.supportedRateTypes.endpoint(this.endpoint.index)) ?? [];
534
- const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
535
- const ret = [];
536
- for (const rateType of rateTypes) {
537
- for (const scale of supportedScales) {
538
- if (accumulatedOnly && meterType != void 0 && !isAccumulatedValue(meterType, scale)) {
539
- continue;
521
+ get [import_API.POLL_VALUE]() {
522
+ return async function({ property, propertyKey }) {
523
+ switch (property) {
524
+ case "value":
525
+ case "previousValue":
526
+ case "deltaTime": {
527
+ if (propertyKey == void 0) {
528
+ (0, import_API.throwMissingPropertyKey)(this.ccId, property);
529
+ } else if (typeof propertyKey !== "number") {
530
+ (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
531
+ }
532
+ const { rateType, scale } = splitPropertyKey(propertyKey);
533
+ return (await this.get({
534
+ rateType,
535
+ scale
536
+ }))?.[property];
540
537
  }
541
- const response = await this.get({
542
- scale,
543
- rateType
544
- });
545
- if (response)
546
- ret.push(response);
538
+ default:
539
+ (0, import_API.throwUnsupportedProperty)(this.ccId, property);
547
540
  }
541
+ };
542
+ }
543
+ async get(options) {
544
+ __assertType("options", "(optional) MeterCCGetOptions", __assertType__optional_MeterCCGetOptions.bind(void 0, options));
545
+ this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Get);
546
+ const cc = new MeterCCGet({
547
+ nodeId: this.endpoint.nodeId,
548
+ endpointIndex: this.endpoint.index,
549
+ ...options
550
+ });
551
+ const response = await this.host.sendCommand(cc, this.commandOptions);
552
+ if (response) {
553
+ return {
554
+ type: response.type,
555
+ scale: (0, import_core.getMeterScale)(response.type, response.scale) ?? (0, import_core.getUnknownMeterScale)(response.scale),
556
+ ...(0, import_safe3.pick)(response, [
557
+ "value",
558
+ "previousValue",
559
+ "rateType",
560
+ "deltaTime"
561
+ ])
562
+ };
548
563
  }
549
- return ret;
550
- } else {
551
- const response = await this.get();
552
- return response ? [response] : [];
553
564
  }
554
- }
555
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
556
- async getSupported() {
557
- this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedGet);
558
- const cc = new MeterCCSupportedGet({
559
- nodeId: this.endpoint.nodeId,
560
- endpointIndex: this.endpoint.index
561
- });
562
- const response = await this.host.sendCommand(cc, this.commandOptions);
563
- if (response) {
564
- return (0, import_safe3.pick)(response, [
565
- "type",
566
- "supportsReset",
567
- "supportedScales",
568
- "supportedRateTypes"
569
- ]);
565
+ async sendReport(options) {
566
+ __assertType("options", "MeterCCReportOptions", __assertType__MeterCCReportOptions.bind(void 0, options));
567
+ this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Report);
568
+ const cc = new MeterCCReport({
569
+ nodeId: this.endpoint.nodeId,
570
+ endpointIndex: this.endpoint.index,
571
+ ...options
572
+ });
573
+ return this.host.sendCommand(cc, this.commandOptions);
570
574
  }
571
- }
572
- async sendSupportedReport(options) {
573
- __assertType("options", "MeterCCSupportedReportOptions", __assertType__MeterCCSupportedReportOptions.bind(void 0, options));
574
- this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedReport);
575
- const cc = new MeterCCSupportedReport({
576
- nodeId: this.endpoint.nodeId,
577
- endpointIndex: this.endpoint.index,
578
- ...options
579
- });
580
- await this.host.sendCommand(cc, this.commandOptions);
581
- }
582
- async reset(options) {
583
- __assertType("options", "(optional) MeterCCResetOptions", __assertType__optional_MeterCCResetOptions.bind(void 0, options));
584
- this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Reset);
585
- const cc = new MeterCCReset({
586
- nodeId: this.endpoint.nodeId,
587
- endpointIndex: this.endpoint.index,
588
- ...options
589
- });
590
- return this.host.sendCommand(cc, this.commandOptions);
591
- }
592
- get [import_API.SET_VALUE]() {
593
- return async function({ property, propertyKey }, value) {
594
- if (property !== "reset") {
595
- (0, import_API.throwUnsupportedProperty)(this.ccId, property);
596
- } else if (propertyKey != void 0 && typeof propertyKey !== "number") {
597
- (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
598
- } else if (value !== true) {
599
- (0, import_API.throwWrongValueType)(this.ccId, property, "true", value === false ? "false" : typeof value);
600
- }
601
- if (typeof propertyKey === "number") {
602
- const { meterType, scale, rateType } = splitPropertyKey(propertyKey);
603
- return this.reset({
604
- type: meterType,
605
- scale,
606
- rateType,
607
- targetValue: 0
608
- });
575
+ async getAll(accumulatedOnly = false) {
576
+ __assertType("accumulatedOnly", "(optional) boolean", __assertType__optional_boolean.bind(void 0, accumulatedOnly));
577
+ const valueDB = this.tryGetValueDB();
578
+ if (this.version >= 2) {
579
+ const meterType = valueDB?.getValue(MeterCCValues.type.endpoint(this.endpoint.index));
580
+ const supportedScales = valueDB?.getValue(MeterCCValues.supportedScales.endpoint(this.endpoint.index)) ?? [];
581
+ const supportedRateTypes = valueDB?.getValue(MeterCCValues.supportedRateTypes.endpoint(this.endpoint.index)) ?? [];
582
+ const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
583
+ const ret = [];
584
+ for (const rateType of rateTypes) {
585
+ for (const scale of supportedScales) {
586
+ if (accumulatedOnly && meterType != void 0 && !isAccumulatedValue(meterType, scale)) {
587
+ continue;
588
+ }
589
+ const response = await this.get({
590
+ scale,
591
+ rateType
592
+ });
593
+ if (response)
594
+ ret.push(response);
595
+ }
596
+ }
597
+ return ret;
609
598
  } else {
610
- return this.reset();
599
+ const response = await this.get();
600
+ return response ? [response] : [];
611
601
  }
612
- return void 0;
613
- };
614
- }
615
- [import_API.SET_VALUE_HOOKS] = ({ property, propertyKey }, _value, _options) => {
616
- if (property !== "reset")
617
- return;
618
- if (typeof propertyKey === "number") {
619
- const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
620
- const readingValueId = MeterCCValues.value(meterType, rateType, scale).endpoint(this.endpoint.index);
621
- return {
622
- optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
623
- if (!supervisedAndSuccessful)
624
- return;
625
- const valueDB = this.tryGetValueDB();
626
- if (!valueDB)
627
- return;
628
- if (isAccumulatedValue(meterType, scale)) {
629
- valueDB.setValue({
630
- commandClass: this.ccId,
631
- endpoint: this.endpoint.index,
632
- property,
633
- propertyKey
634
- }, 0);
635
- }
636
- },
637
- verifyChanges: () => {
638
- this.schedulePoll(readingValueId, 0, { transition: "fast" });
602
+ }
603
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
604
+ async getSupported() {
605
+ this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedGet);
606
+ const cc = new MeterCCSupportedGet({
607
+ nodeId: this.endpoint.nodeId,
608
+ endpointIndex: this.endpoint.index
609
+ });
610
+ const response = await this.host.sendCommand(cc, this.commandOptions);
611
+ if (response) {
612
+ return (0, import_safe3.pick)(response, [
613
+ "type",
614
+ "supportsReset",
615
+ "supportedScales",
616
+ "supportedRateTypes"
617
+ ]);
618
+ }
619
+ }
620
+ async sendSupportedReport(options) {
621
+ __assertType("options", "MeterCCSupportedReportOptions", __assertType__MeterCCSupportedReportOptions.bind(void 0, options));
622
+ this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.SupportedReport);
623
+ const cc = new MeterCCSupportedReport({
624
+ nodeId: this.endpoint.nodeId,
625
+ endpointIndex: this.endpoint.index,
626
+ ...options
627
+ });
628
+ await this.host.sendCommand(cc, this.commandOptions);
629
+ }
630
+ async reset(options) {
631
+ __assertType("options", "(optional) MeterCCResetOptions", __assertType__optional_MeterCCResetOptions.bind(void 0, options));
632
+ this.assertSupportsCommand(import_Types.MeterCommand, import_Types.MeterCommand.Reset);
633
+ const cc = new MeterCCReset({
634
+ nodeId: this.endpoint.nodeId,
635
+ endpointIndex: this.endpoint.index,
636
+ ...options
637
+ });
638
+ return this.host.sendCommand(cc, this.commandOptions);
639
+ }
640
+ get [import_API.SET_VALUE]() {
641
+ return async function({ property, propertyKey }, value) {
642
+ if (property !== "reset") {
643
+ (0, import_API.throwUnsupportedProperty)(this.ccId, property);
644
+ } else if (propertyKey != void 0 && typeof propertyKey !== "number") {
645
+ (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
646
+ } else if (value !== true) {
647
+ (0, import_API.throwWrongValueType)(this.ccId, property, "true", value === false ? "false" : typeof value);
639
648
  }
649
+ if (typeof propertyKey === "number") {
650
+ const { meterType, scale, rateType } = splitPropertyKey(propertyKey);
651
+ return this.reset({
652
+ type: meterType,
653
+ scale,
654
+ rateType,
655
+ targetValue: 0
656
+ });
657
+ } else {
658
+ return this.reset();
659
+ }
660
+ return void 0;
640
661
  };
641
- } else {
642
- const valueDB = this.tryGetValueDB();
643
- if (!valueDB)
662
+ }
663
+ [import_API.SET_VALUE_HOOKS] = ({ property, propertyKey }, _value, _options) => {
664
+ if (property !== "reset")
644
665
  return;
645
- const accumulatedValues = valueDB.findValues((vid) => vid.commandClass === this.ccId && vid.endpoint === this.endpoint.index && MeterCCValues.value.is(vid)).filter(({ propertyKey: propertyKey2 }) => {
646
- if (typeof propertyKey2 !== "number")
647
- return false;
648
- const { meterType, scale } = splitPropertyKey(propertyKey2);
649
- return isAccumulatedValue(meterType, scale);
650
- });
651
- return {
652
- optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
653
- if (!supervisedAndSuccessful)
654
- return;
655
- for (const value of accumulatedValues) {
656
- valueDB.setValue(value, 0);
666
+ if (typeof propertyKey === "number") {
667
+ const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
668
+ const readingValueId = MeterCCValues.value(meterType, rateType, scale).endpoint(this.endpoint.index);
669
+ return {
670
+ optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
671
+ if (!supervisedAndSuccessful)
672
+ return;
673
+ const valueDB = this.tryGetValueDB();
674
+ if (!valueDB)
675
+ return;
676
+ if (isAccumulatedValue(meterType, scale)) {
677
+ valueDB.setValue({
678
+ commandClass: this.ccId,
679
+ endpoint: this.endpoint.index,
680
+ property,
681
+ propertyKey
682
+ }, 0);
683
+ }
684
+ },
685
+ verifyChanges: () => {
686
+ this.schedulePoll(readingValueId, 0, { transition: "fast" });
657
687
  }
658
- },
659
- verifyChanges: () => {
660
- for (const valueID of accumulatedValues) {
661
- this.schedulePoll(valueID, 0, { transition: "fast" });
688
+ };
689
+ } else {
690
+ const valueDB = this.tryGetValueDB();
691
+ if (!valueDB)
692
+ return;
693
+ const accumulatedValues = valueDB.findValues((vid) => vid.commandClass === this.ccId && vid.endpoint === this.endpoint.index && MeterCCValues.value.is(vid)).filter(({ propertyKey: propertyKey2 }) => {
694
+ if (typeof propertyKey2 !== "number")
695
+ return false;
696
+ const { meterType, scale } = splitPropertyKey(propertyKey2);
697
+ return isAccumulatedValue(meterType, scale);
698
+ });
699
+ return {
700
+ optimisticallyUpdateRelatedValues: (supervisedAndSuccessful) => {
701
+ if (!supervisedAndSuccessful)
702
+ return;
703
+ for (const value of accumulatedValues) {
704
+ valueDB.setValue(value, 0);
705
+ }
706
+ },
707
+ verifyChanges: () => {
708
+ for (const valueID of accumulatedValues) {
709
+ this.schedulePoll(valueID, 0, { transition: "fast" });
710
+ }
662
711
  }
663
- }
664
- };
665
- }
712
+ };
713
+ }
714
+ };
666
715
  };
667
- };
668
- MeterCCAPI = __decorate([
669
- (0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Meter)
670
- ], MeterCCAPI);
671
- let MeterCC = class MeterCC2 extends import_CommandClass.CommandClass {
672
- async interview(ctx) {
673
- const node = this.getNode(ctx);
674
- const endpoint = this.getEndpoint(ctx);
675
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
676
- priority: import_safe.MessagePriority.NodeQuery
677
- });
678
- ctx.logNode(node.id, {
679
- endpoint: this.endpointIndex,
680
- message: `Interviewing ${this.ccName}...`,
681
- direction: "none"
682
- });
683
- if (api.version >= 2) {
716
+ return MeterCCAPI2 = _classThis;
717
+ })();
718
+ let MeterCC = (() => {
719
+ let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Meter), (0, import_CommandClassDecorators.implementedVersion)(6), (0, import_CommandClassDecorators.ccValues)(MeterCCValues)];
720
+ let _classDescriptor;
721
+ let _classExtraInitializers = [];
722
+ let _classThis;
723
+ let _classSuper = import_CommandClass.CommandClass;
724
+ var MeterCC2 = class extends _classSuper {
725
+ static {
726
+ _classThis = this;
727
+ }
728
+ static {
729
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
730
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
731
+ MeterCC2 = _classThis = _classDescriptor.value;
732
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
733
+ __runInitializers(_classThis, _classExtraInitializers);
734
+ }
735
+ async interview(ctx) {
736
+ const node = this.getNode(ctx);
737
+ const endpoint = this.getEndpoint(ctx);
738
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
739
+ priority: import_safe.MessagePriority.NodeQuery
740
+ });
684
741
  ctx.logNode(node.id, {
685
742
  endpoint: this.endpointIndex,
686
- message: "querying meter support...",
687
- direction: "outbound"
743
+ message: `Interviewing ${this.ccName}...`,
744
+ direction: "none"
688
745
  });
689
- const suppResp = await api.getSupported();
690
- if (suppResp) {
691
- const logMessage = `received meter support:
746
+ if (api.version >= 2) {
747
+ ctx.logNode(node.id, {
748
+ endpoint: this.endpointIndex,
749
+ message: "querying meter support...",
750
+ direction: "outbound"
751
+ });
752
+ const suppResp = await api.getSupported();
753
+ if (suppResp) {
754
+ const logMessage = `received meter support:
692
755
  type: ${(0, import_core.getMeterName)(suppResp.type)}
693
756
  supported scales: ${suppResp.supportedScales.map((s) => ((0, import_core.getMeterScale)(suppResp.type, s) ?? (0, import_core.getUnknownMeterScale)(s)).label).map((label) => `
694
757
  \xB7 ${label}`).join("")}
695
758
  supported rate types: ${suppResp.supportedRateTypes.map((rt) => (0, import_safe3.getEnumMemberName)(import_Types.RateType, rt)).map((label) => `
696
759
  \xB7 ${label}`).join("")}
697
760
  supports reset: ${suppResp.supportsReset}`;
761
+ ctx.logNode(node.id, {
762
+ endpoint: this.endpointIndex,
763
+ message: logMessage,
764
+ direction: "inbound"
765
+ });
766
+ } else {
767
+ ctx.logNode(node.id, {
768
+ endpoint: this.endpointIndex,
769
+ message: "Querying meter support timed out, skipping interview...",
770
+ level: "warn"
771
+ });
772
+ return;
773
+ }
774
+ }
775
+ await this.refreshValues(ctx);
776
+ this.setInterviewComplete(ctx, true);
777
+ }
778
+ async refreshValues(ctx) {
779
+ const node = this.getNode(ctx);
780
+ const endpoint = this.getEndpoint(ctx);
781
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
782
+ priority: import_safe.MessagePriority.NodeQuery
783
+ });
784
+ if (api.version === 1) {
698
785
  ctx.logNode(node.id, {
699
786
  endpoint: this.endpointIndex,
700
- message: logMessage,
701
- direction: "inbound"
787
+ message: `querying default meter value...`,
788
+ direction: "outbound"
702
789
  });
790
+ await api.get();
703
791
  } else {
704
- ctx.logNode(node.id, {
705
- endpoint: this.endpointIndex,
706
- message: "Querying meter support timed out, skipping interview...",
707
- level: "warn"
708
- });
709
- return;
792
+ const type = this.getValue(ctx, MeterCCValues.type) ?? 0;
793
+ const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales) ?? [];
794
+ const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes) ?? [];
795
+ const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
796
+ for (const rateType of rateTypes) {
797
+ for (const scale of supportedScales) {
798
+ ctx.logNode(node.id, {
799
+ endpoint: this.endpointIndex,
800
+ message: `querying meter value (type = ${(0, import_core.getMeterName)(type)}, scale = ${((0, import_core.getMeterScale)(type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}${rateType != void 0 ? `, rate type = ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType)}` : ""})...`,
801
+ direction: "outbound"
802
+ });
803
+ await api.get({ scale, rateType });
804
+ }
805
+ }
710
806
  }
711
807
  }
712
- await this.refreshValues(ctx);
713
- this.setInterviewComplete(ctx, true);
714
- }
715
- async refreshValues(ctx) {
716
- const node = this.getNode(ctx);
717
- const endpoint = this.getEndpoint(ctx);
718
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Meter, ctx, endpoint).withOptions({
719
- priority: import_safe.MessagePriority.NodeQuery
720
- });
721
- if (api.version === 1) {
722
- ctx.logNode(node.id, {
723
- endpoint: this.endpointIndex,
724
- message: `querying default meter value...`,
725
- direction: "outbound"
808
+ shouldRefreshValues(ctx) {
809
+ const valueDB = ctx.tryGetValueDB(this.nodeId);
810
+ if (!valueDB)
811
+ return true;
812
+ const values = this.getDefinedValueIDs(ctx).filter((v) => MeterCCValues.value.is(v));
813
+ return values.every((v) => {
814
+ const lastUpdated = valueDB.getTimestamp(v);
815
+ return lastUpdated == void 0 || Date.now() - lastUpdated > import_core.timespan.hours(6);
726
816
  });
727
- await api.get();
728
- } else {
729
- const type = this.getValue(ctx, MeterCCValues.type) ?? 0;
730
- const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales) ?? [];
731
- const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes) ?? [];
732
- const rateTypes = supportedRateTypes.length ? supportedRateTypes : [void 0];
733
- for (const rateType of rateTypes) {
734
- for (const scale of supportedScales) {
735
- ctx.logNode(node.id, {
736
- endpoint: this.endpointIndex,
737
- message: `querying meter value (type = ${(0, import_core.getMeterName)(type)}, scale = ${((0, import_core.getMeterScale)(type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}${rateType != void 0 ? `, rate type = ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType)}` : ""})...`,
738
- direction: "outbound"
739
- });
740
- await api.get({ scale, rateType });
817
+ }
818
+ /**
819
+ * Returns which type this meter has.
820
+ * This only works AFTER the interview process
821
+ */
822
+ static getMeterTypeCached(ctx, endpoint) {
823
+ return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.type.endpoint(endpoint.index));
824
+ }
825
+ /**
826
+ * Returns which scales are supported by this meter.
827
+ * This only works AFTER the interview process
828
+ */
829
+ static getSupportedScalesCached(ctx, endpoint) {
830
+ return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));
831
+ }
832
+ /**
833
+ * Returns whether reset is supported by this meter.
834
+ * This only works AFTER the interview process
835
+ */
836
+ static supportsResetCached(ctx, endpoint) {
837
+ return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));
838
+ }
839
+ /**
840
+ * Returns which rate types are supported by this meter.
841
+ * This only works AFTER the interview process
842
+ */
843
+ static getSupportedRateTypesCached(ctx, endpoint) {
844
+ return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedRateTypes.endpoint(endpoint.index));
845
+ }
846
+ translatePropertyKey(ctx, property, propertyKey) {
847
+ if (property === "value" && typeof propertyKey === "number") {
848
+ const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
849
+ let ret;
850
+ if (meterType !== 0) {
851
+ ret = `${(0, import_core.getMeterName)(meterType)}_${((0, import_core.getMeterScale)(meterType, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`;
852
+ } else {
853
+ ret = "default";
854
+ }
855
+ if (rateType !== import_Types.RateType.Unspecified) {
856
+ ret += "_" + (0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType);
741
857
  }
858
+ return ret;
859
+ } else if (property === "reset" && typeof propertyKey === "number") {
860
+ return (0, import_core.getMeterName)(propertyKey);
742
861
  }
862
+ return super.translatePropertyKey(ctx, property, propertyKey);
743
863
  }
744
- }
745
- shouldRefreshValues(ctx) {
746
- const valueDB = ctx.tryGetValueDB(this.nodeId);
747
- if (!valueDB)
748
- return true;
749
- const values = this.getDefinedValueIDs(ctx).filter((v) => MeterCCValues.value.is(v));
750
- return values.every((v) => {
751
- const lastUpdated = valueDB.getTimestamp(v);
752
- return lastUpdated == void 0 || Date.now() - lastUpdated > import_core.timespan.hours(6);
753
- });
754
- }
755
- /**
756
- * Returns which type this meter has.
757
- * This only works AFTER the interview process
758
- */
759
- static getMeterTypeCached(ctx, endpoint) {
760
- return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.type.endpoint(endpoint.index));
761
- }
762
- /**
763
- * Returns which scales are supported by this meter.
764
- * This only works AFTER the interview process
765
- */
766
- static getSupportedScalesCached(ctx, endpoint) {
767
- return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedScales.endpoint(endpoint.index));
768
- }
769
- /**
770
- * Returns whether reset is supported by this meter.
771
- * This only works AFTER the interview process
772
- */
773
- static supportsResetCached(ctx, endpoint) {
774
- return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportsReset.endpoint(endpoint.index));
775
- }
776
- /**
777
- * Returns which rate types are supported by this meter.
778
- * This only works AFTER the interview process
779
- */
780
- static getSupportedRateTypesCached(ctx, endpoint) {
781
- return ctx.getValueDB(endpoint.nodeId).getValue(MeterCCValues.supportedRateTypes.endpoint(endpoint.index));
782
- }
783
- translatePropertyKey(ctx, property, propertyKey) {
784
- if (property === "value" && typeof propertyKey === "number") {
785
- const { meterType, rateType, scale } = splitPropertyKey(propertyKey);
786
- let ret;
787
- if (meterType !== 0) {
788
- ret = `${(0, import_core.getMeterName)(meterType)}_${((0, import_core.getMeterScale)(meterType, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`;
789
- } else {
790
- ret = "default";
791
- }
792
- if (rateType !== import_Types.RateType.Unspecified) {
793
- ret += "_" + (0, import_safe3.getEnumMemberName)(import_Types.RateType, rateType);
794
- }
795
- return ret;
796
- } else if (property === "reset" && typeof propertyKey === "number") {
797
- return (0, import_core.getMeterName)(propertyKey);
864
+ };
865
+ return MeterCC2 = _classThis;
866
+ })();
867
+ let MeterCCReport = (() => {
868
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Report)];
869
+ let _classDescriptor;
870
+ let _classExtraInitializers = [];
871
+ let _classThis;
872
+ let _classSuper = MeterCC;
873
+ var MeterCCReport2 = class extends _classSuper {
874
+ static {
875
+ _classThis = this;
798
876
  }
799
- return super.translatePropertyKey(ctx, property, propertyKey);
800
- }
801
- };
802
- MeterCC = __decorate([
803
- (0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Meter),
804
- (0, import_CommandClassDecorators.implementedVersion)(6),
805
- (0, import_CommandClassDecorators.ccValues)(MeterCCValues)
806
- ], MeterCC);
807
- let MeterCCReport = MeterCCReport_1 = class MeterCCReport2 extends MeterCC {
808
- constructor(options) {
809
- super(options);
810
- this.type = options.type;
811
- this.scale = options.scale;
812
- this.value = options.value;
813
- this.previousValue = options.previousValue;
814
- this.rateType = options.rateType ?? import_Types.RateType.Unspecified;
815
- this.deltaTime = options.deltaTime ?? import_safe.UNKNOWN_STATE;
816
- }
817
- static from(raw, ctx) {
818
- const { type, rateType, scale1, value, bytesRead } = parseMeterValueAndInfo(raw.payload, 0);
819
- let offset = bytesRead;
820
- const floatSize = bytesRead - 2;
821
- let deltaTime;
822
- let previousValue;
823
- if (raw.payload.length >= offset + 2) {
824
- deltaTime = raw.payload.readUInt16BE(offset);
825
- offset += 2;
826
- if (deltaTime === 65535) {
827
- deltaTime = import_safe.UNKNOWN_STATE;
828
- }
829
- if (
830
- // Previous value is included only if delta time is not 0
831
- deltaTime !== 0 && raw.payload.length >= offset + floatSize
832
- ) {
833
- const { value: prevValue } = (0, import_safe.parseFloatWithScale)(
834
- // This float is split in the payload
835
- import_safe2.Bytes.concat([
836
- import_safe2.Bytes.from([raw.payload[1]]),
837
- raw.payload.subarray(offset)
838
- ])
839
- );
840
- offset += floatSize;
841
- previousValue = prevValue;
842
- }
843
- } else {
844
- deltaTime = 0;
845
- }
846
- const scale = parseScale(scale1, raw.payload, offset);
847
- return new MeterCCReport_1({
848
- nodeId: ctx.sourceNodeId,
849
- type,
850
- rateType,
851
- value,
852
- deltaTime,
853
- previousValue,
854
- scale
855
- });
856
- }
857
- persistValues(ctx) {
858
- if (!super.persistValues(ctx))
859
- return false;
860
- const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
861
- const meter = (0, import_core.getMeter)(this.type);
862
- const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
863
- const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
864
- if (measurementValidation) {
865
- import_safe.validatePayload.withReason(`Unknown meter type ${(0, import_safe3.num2hex)(this.type)} or corrupted data`)(!!meter);
866
- import_safe.validatePayload.withReason(`Unknown meter scale ${(0, import_safe3.num2hex)(this.scale)} or corrupted data`)(scale.label !== (0, import_core.getUnknownMeterScale)(this.scale).label);
867
- if (ccVersion >= 2) {
868
- const expectedType = this.getValue(ctx, MeterCCValues.type);
869
- if (expectedType != void 0) {
870
- import_safe.validatePayload.withReason("Unexpected meter type or corrupted data")(this.type === expectedType);
871
- }
872
- const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales);
873
- if (supportedScales?.length) {
874
- import_safe.validatePayload.withReason(`Unsupported meter scale ${scale.label} or corrupted data`)(supportedScales.includes(this.scale));
877
+ static {
878
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
879
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
880
+ MeterCCReport2 = _classThis = _classDescriptor.value;
881
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
882
+ __runInitializers(_classThis, _classExtraInitializers);
883
+ }
884
+ constructor(options) {
885
+ super(options);
886
+ this.type = options.type;
887
+ this.scale = options.scale;
888
+ this.value = options.value;
889
+ this.previousValue = options.previousValue;
890
+ this.rateType = options.rateType ?? import_Types.RateType.Unspecified;
891
+ this.deltaTime = options.deltaTime ?? import_safe.UNKNOWN_STATE;
892
+ }
893
+ static from(raw, ctx) {
894
+ const { type, rateType, scale1, value, bytesRead } = parseMeterValueAndInfo(raw.payload, 0);
895
+ let offset = bytesRead;
896
+ const floatSize = bytesRead - 2;
897
+ let deltaTime;
898
+ let previousValue;
899
+ if (raw.payload.length >= offset + 2) {
900
+ deltaTime = raw.payload.readUInt16BE(offset);
901
+ offset += 2;
902
+ if (deltaTime === 65535) {
903
+ deltaTime = import_safe.UNKNOWN_STATE;
875
904
  }
876
- const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes);
877
- if (supportedRateTypes?.length) {
878
- import_safe.validatePayload.withReason(`Unsupported rate type ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType)} or corrupted data`)(supportedRateTypes.includes(this.rateType));
905
+ if (
906
+ // Previous value is included only if delta time is not 0
907
+ deltaTime !== 0 && raw.payload.length >= offset + floatSize
908
+ ) {
909
+ const { value: prevValue } = (0, import_safe.parseFloatWithScale)(
910
+ // This float is split in the payload
911
+ import_safe2.Bytes.concat([
912
+ import_safe2.Bytes.from([raw.payload[1]]),
913
+ raw.payload.subarray(offset)
914
+ ])
915
+ );
916
+ offset += floatSize;
917
+ previousValue = prevValue;
879
918
  }
919
+ } else {
920
+ deltaTime = 0;
880
921
  }
922
+ const scale = parseScale(scale1, raw.payload, offset);
923
+ return new this({
924
+ nodeId: ctx.sourceNodeId,
925
+ type,
926
+ rateType,
927
+ value,
928
+ deltaTime,
929
+ previousValue,
930
+ scale
931
+ });
881
932
  }
882
- const valueValue = MeterCCValues.value(this.type, this.rateType, this.scale);
883
- this.setMetadata(ctx, valueValue, {
884
- ...valueValue.meta,
885
- label: getValueLabel(this.type, this.scale, this.rateType),
886
- unit: scale.unit,
887
- ccSpecific: {
888
- meterType: this.type,
889
- scale: this.scale,
890
- rateType: this.rateType
933
+ persistValues(ctx) {
934
+ if (!super.persistValues(ctx))
935
+ return false;
936
+ const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
937
+ const meter = (0, import_core.getMeter)(this.type);
938
+ const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
939
+ const measurementValidation = !ctx.getDeviceConfig?.(this.nodeId)?.compat?.disableStrictMeasurementValidation;
940
+ if (measurementValidation) {
941
+ import_safe.validatePayload.withReason(`Unknown meter type ${(0, import_safe3.num2hex)(this.type)} or corrupted data`)(!!meter);
942
+ import_safe.validatePayload.withReason(`Unknown meter scale ${(0, import_safe3.num2hex)(this.scale)} or corrupted data`)(scale.label !== (0, import_core.getUnknownMeterScale)(this.scale).label);
943
+ if (ccVersion >= 2) {
944
+ const expectedType = this.getValue(ctx, MeterCCValues.type);
945
+ if (expectedType != void 0) {
946
+ import_safe.validatePayload.withReason("Unexpected meter type or corrupted data")(this.type === expectedType);
947
+ }
948
+ const supportedScales = this.getValue(ctx, MeterCCValues.supportedScales);
949
+ if (supportedScales?.length) {
950
+ import_safe.validatePayload.withReason(`Unsupported meter scale ${scale.label} or corrupted data`)(supportedScales.includes(this.scale));
951
+ }
952
+ const supportedRateTypes = this.getValue(ctx, MeterCCValues.supportedRateTypes);
953
+ if (supportedRateTypes?.length) {
954
+ import_safe.validatePayload.withReason(`Unsupported rate type ${(0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType)} or corrupted data`)(supportedRateTypes.includes(this.rateType));
955
+ }
956
+ }
891
957
  }
892
- });
893
- this.setValue(ctx, valueValue, this.value);
894
- return true;
895
- }
896
- type;
897
- scale;
898
- value;
899
- previousValue;
900
- rateType;
901
- deltaTime;
902
- serialize(ctx) {
903
- const { data: typeAndValue, floatParams, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.value);
904
- const deltaTime = this.deltaTime ?? 65535;
905
- const deltaTimeBytes = new import_safe2.Bytes(2);
906
- deltaTimeBytes.writeUInt16BE(deltaTime, 0);
907
- this.payload = import_safe2.Bytes.concat([
908
- typeAndValue,
909
- deltaTimeBytes
910
- ]);
911
- if (this.deltaTime !== 0 && this.previousValue != void 0) {
912
- const prevValueBytes = (0, import_core.encodeFloatWithScale)(
913
- this.previousValue,
914
- 0,
915
- // we discard the scale anyways
916
- floatParams
917
- ).subarray(1);
918
- this.payload = import_safe2.Bytes.concat([
919
- this.payload,
920
- prevValueBytes
921
- ]);
958
+ const valueValue = MeterCCValues.value(this.type, this.rateType, this.scale);
959
+ this.setMetadata(ctx, valueValue, {
960
+ ...valueValue.meta,
961
+ label: getValueLabel(this.type, this.scale, this.rateType),
962
+ unit: scale.unit,
963
+ ccSpecific: {
964
+ meterType: this.type,
965
+ scale: this.scale,
966
+ rateType: this.rateType
967
+ }
968
+ });
969
+ this.setValue(ctx, valueValue, this.value);
970
+ return true;
922
971
  }
923
- if (scale2 != void 0) {
972
+ type;
973
+ scale;
974
+ value;
975
+ previousValue;
976
+ rateType;
977
+ deltaTime;
978
+ serialize(ctx) {
979
+ const { data: typeAndValue, floatParams, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.value);
980
+ const deltaTime = this.deltaTime ?? 65535;
981
+ const deltaTimeBytes = new import_safe2.Bytes(2);
982
+ deltaTimeBytes.writeUInt16BE(deltaTime, 0);
924
983
  this.payload = import_safe2.Bytes.concat([
925
- this.payload,
926
- import_safe2.Bytes.from([scale2])
984
+ typeAndValue,
985
+ deltaTimeBytes
927
986
  ]);
987
+ if (this.deltaTime !== 0 && this.previousValue != void 0) {
988
+ const prevValueBytes = (0, import_core.encodeFloatWithScale)(
989
+ this.previousValue,
990
+ 0,
991
+ // we discard the scale anyways
992
+ floatParams
993
+ ).subarray(1);
994
+ this.payload = import_safe2.Bytes.concat([
995
+ this.payload,
996
+ prevValueBytes
997
+ ]);
998
+ }
999
+ if (scale2 != void 0) {
1000
+ this.payload = import_safe2.Bytes.concat([
1001
+ this.payload,
1002
+ import_safe2.Bytes.from([scale2])
1003
+ ]);
1004
+ }
1005
+ return super.serialize(ctx);
928
1006
  }
929
- return super.serialize(ctx);
930
- }
931
- toLogEntry(ctx) {
932
- const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
933
- const message = {
934
- "meter type": (0, import_core.getMeterName)(this.type),
935
- scale: scale.label,
936
- "rate type": (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType),
937
- value: this.value
938
- };
939
- if (this.deltaTime !== import_safe.UNKNOWN_STATE) {
940
- message["time delta"] = `${this.deltaTime} seconds`;
941
- }
942
- if (this.previousValue != void 0) {
943
- message["prev. value"] = this.previousValue;
1007
+ toLogEntry(ctx) {
1008
+ const scale = (0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale);
1009
+ const message = {
1010
+ "meter type": (0, import_core.getMeterName)(this.type),
1011
+ scale: scale.label,
1012
+ "rate type": (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType),
1013
+ value: this.value
1014
+ };
1015
+ if (this.deltaTime !== import_safe.UNKNOWN_STATE) {
1016
+ message["time delta"] = `${this.deltaTime} seconds`;
1017
+ }
1018
+ if (this.previousValue != void 0) {
1019
+ message["prev. value"] = this.previousValue;
1020
+ }
1021
+ return {
1022
+ ...super.toLogEntry(ctx),
1023
+ message
1024
+ };
944
1025
  }
945
- return {
946
- ...super.toLogEntry(ctx),
947
- message
948
- };
949
- }
950
- };
951
- MeterCCReport = MeterCCReport_1 = __decorate([
952
- (0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Report)
953
- ], MeterCCReport);
1026
+ };
1027
+ return MeterCCReport2 = _classThis;
1028
+ })();
954
1029
  function testResponseForMeterGet(sent, received) {
955
1030
  return (sent.scale == void 0 || sent.scale === received.scale) && (sent.rateType == void 0 || sent.rateType == received.rateType);
956
1031
  }
957
- let MeterCCGet = MeterCCGet_1 = class MeterCCGet2 extends MeterCC {
958
- constructor(options) {
959
- super(options);
960
- this.rateType = options.rateType;
961
- this.scale = options.scale;
962
- }
963
- static from(raw, ctx) {
964
- let rateType;
965
- let scale;
966
- if (raw.payload.length >= 1) {
967
- rateType = (raw.payload[0] & 192) >>> 6;
968
- scale = (raw.payload[0] & 56) >>> 3;
969
- if (scale === 7) {
970
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
971
- scale += raw.payload[1];
972
- }
1032
+ let MeterCCGet = (() => {
1033
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Get), (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCReport, testResponseForMeterGet)];
1034
+ let _classDescriptor;
1035
+ let _classExtraInitializers = [];
1036
+ let _classThis;
1037
+ let _classSuper = MeterCC;
1038
+ var MeterCCGet2 = class extends _classSuper {
1039
+ static {
1040
+ _classThis = this;
973
1041
  }
974
- return new MeterCCGet_1({
975
- nodeId: ctx.sourceNodeId,
976
- rateType,
977
- scale
978
- });
979
- }
980
- rateType;
981
- scale;
982
- serialize(ctx) {
983
- let scale1;
984
- let scale2;
985
- let bufferLength = 0;
986
- const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
987
- if (this.scale == void 0) {
988
- scale1 = 0;
989
- } else if (ccVersion >= 4 && this.scale >= 7) {
990
- scale1 = 7;
991
- scale2 = this.scale >>> 3;
992
- bufferLength = 2;
993
- } else if (ccVersion >= 3) {
994
- scale1 = this.scale & 7;
995
- bufferLength = 1;
996
- } else if (ccVersion >= 2) {
997
- scale1 = this.scale & 3;
998
- bufferLength = 1;
999
- } else {
1000
- scale1 = 0;
1001
- }
1002
- let rateTypeFlags = 0;
1003
- if (ccVersion >= 4 && this.rateType != void 0) {
1004
- rateTypeFlags = this.rateType & 3;
1005
- bufferLength = Math.max(bufferLength, 1);
1006
- }
1007
- this.payload = import_safe2.Bytes.alloc(bufferLength, 0);
1008
- this.payload[0] = rateTypeFlags << 6 | scale1 << 3;
1009
- if (scale2)
1010
- this.payload[1] = scale2;
1011
- return super.serialize(ctx);
1012
- }
1013
- toLogEntry(ctx) {
1014
- const message = {};
1015
- if (this.rateType != void 0) {
1016
- message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
1017
- }
1018
- if (this.scale != void 0) {
1019
- if (ctx) {
1020
- const type = this.getValue(ctx, MeterCCValues.type);
1021
- if (type != void 0) {
1022
- message.scale = ((0, import_core.getMeterScale)(type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
1042
+ static {
1043
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1044
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1045
+ MeterCCGet2 = _classThis = _classDescriptor.value;
1046
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1047
+ __runInitializers(_classThis, _classExtraInitializers);
1048
+ }
1049
+ constructor(options) {
1050
+ super(options);
1051
+ this.rateType = options.rateType;
1052
+ this.scale = options.scale;
1053
+ }
1054
+ static from(raw, ctx) {
1055
+ let rateType;
1056
+ let scale;
1057
+ if (raw.payload.length >= 1) {
1058
+ rateType = (raw.payload[0] & 192) >>> 6;
1059
+ scale = (raw.payload[0] & 56) >>> 3;
1060
+ if (scale === 7) {
1061
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
1062
+ scale += raw.payload[1];
1023
1063
  }
1064
+ }
1065
+ return new this({
1066
+ nodeId: ctx.sourceNodeId,
1067
+ rateType,
1068
+ scale
1069
+ });
1070
+ }
1071
+ rateType;
1072
+ scale;
1073
+ serialize(ctx) {
1074
+ let scale1;
1075
+ let scale2;
1076
+ let bufferLength = 0;
1077
+ const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
1078
+ if (this.scale == void 0) {
1079
+ scale1 = 0;
1080
+ } else if (ccVersion >= 4 && this.scale >= 7) {
1081
+ scale1 = 7;
1082
+ scale2 = this.scale >>> 3;
1083
+ bufferLength = 2;
1084
+ } else if (ccVersion >= 3) {
1085
+ scale1 = this.scale & 7;
1086
+ bufferLength = 1;
1087
+ } else if (ccVersion >= 2) {
1088
+ scale1 = this.scale & 3;
1089
+ bufferLength = 1;
1024
1090
  } else {
1025
- message.scale = this.scale;
1091
+ scale1 = 0;
1026
1092
  }
1093
+ let rateTypeFlags = 0;
1094
+ if (ccVersion >= 4 && this.rateType != void 0) {
1095
+ rateTypeFlags = this.rateType & 3;
1096
+ bufferLength = Math.max(bufferLength, 1);
1097
+ }
1098
+ this.payload = import_safe2.Bytes.alloc(bufferLength, 0);
1099
+ this.payload[0] = rateTypeFlags << 6 | scale1 << 3;
1100
+ if (scale2)
1101
+ this.payload[1] = scale2;
1102
+ return super.serialize(ctx);
1027
1103
  }
1028
- return {
1029
- ...super.toLogEntry(ctx),
1030
- message
1031
- };
1032
- }
1033
- };
1034
- MeterCCGet = MeterCCGet_1 = __decorate([
1035
- (0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Get),
1036
- (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCReport, testResponseForMeterGet)
1037
- ], MeterCCGet);
1038
- let MeterCCSupportedReport = MeterCCSupportedReport_1 = class MeterCCSupportedReport2 extends MeterCC {
1039
- constructor(options) {
1040
- super(options);
1041
- this.type = options.type;
1042
- this.supportsReset = options.supportsReset;
1043
- this.supportedScales = options.supportedScales;
1044
- this.supportedRateTypes = options.supportedRateTypes;
1045
- }
1046
- static from(raw, ctx) {
1047
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
1048
- const type = raw.payload[0] & 31;
1049
- const supportsReset = !!(raw.payload[0] & 128);
1050
- const hasMoreScales = !!(raw.payload[1] & 128);
1051
- let supportedScales;
1052
- if (hasMoreScales) {
1053
- (0, import_safe.validatePayload)(raw.payload.length >= 3);
1054
- const extraBytes = raw.payload[2];
1055
- (0, import_safe.validatePayload)(raw.payload.length >= 3 + extraBytes);
1056
- supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.concat([
1057
- import_safe2.Bytes.from([raw.payload[1] & 127]),
1058
- raw.payload.subarray(3, 3 + extraBytes)
1059
- ]), 0).map((scale) => scale >= 8 ? scale - 1 : scale);
1060
- } else {
1061
- supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([raw.payload[1]]), 0);
1062
- }
1063
- const supportedRateTypes = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([(raw.payload[0] & 96) >>> 5]), 1);
1064
- return new MeterCCSupportedReport_1({
1065
- nodeId: ctx.sourceNodeId,
1066
- type,
1067
- supportsReset,
1068
- supportedScales,
1069
- supportedRateTypes
1070
- });
1071
- }
1072
- type;
1073
- supportsReset;
1074
- supportedScales;
1075
- supportedRateTypes;
1076
- persistValues(ctx) {
1077
- if (!super.persistValues(ctx))
1078
- return false;
1079
- if (!this.supportsReset)
1080
- return true;
1081
- const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
1082
- if (ccVersion < 6) {
1083
- this.ensureMetadata(ctx, MeterCCValues.resetAll);
1084
- } else {
1085
- for (const scale of this.supportedScales) {
1086
- if (!isAccumulatedValue(this.type, scale))
1087
- continue;
1088
- for (const rateType of this.supportedRateTypes) {
1089
- const resetSingleValue = MeterCCValues.resetSingle(this.type, rateType, scale);
1090
- this.ensureMetadata(ctx, resetSingleValue, {
1091
- ...resetSingleValue.meta,
1092
- label: `Reset ${getValueLabel(this.type, scale, rateType)}`
1093
- });
1104
+ toLogEntry(ctx) {
1105
+ const message = {};
1106
+ if (this.rateType != void 0) {
1107
+ message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
1108
+ }
1109
+ if (this.scale != void 0) {
1110
+ if (ctx) {
1111
+ const type = this.getValue(ctx, MeterCCValues.type);
1112
+ if (type != void 0) {
1113
+ message.scale = ((0, import_core.getMeterScale)(type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
1114
+ }
1115
+ } else {
1116
+ message.scale = this.scale;
1094
1117
  }
1095
1118
  }
1119
+ return {
1120
+ ...super.toLogEntry(ctx),
1121
+ message
1122
+ };
1096
1123
  }
1097
- return true;
1098
- }
1099
- serialize(ctx) {
1100
- const typeByte = this.type & 31 | (this.supportedRateTypes.includes(import_Types.RateType.Consumed) ? 32 : 0) | (this.supportedRateTypes.includes(import_Types.RateType.Produced) ? 64 : 0) | (this.supportsReset ? 128 : 0);
1101
- const supportedScales = (0, import_core.encodeBitMask)(
1102
- this.supportedScales,
1103
- void 0,
1104
- // The first byte only has 7 bits for the bitmask,
1105
- // so we add a fake bit for the value -1 and later shift
1106
- // the first byte one to the right
1107
- -1
1108
- );
1109
- const scalesByte1 = supportedScales[0] >>> 1 | (supportedScales.length > 1 ? 128 : 0);
1110
- this.payload = import_safe2.Bytes.from([
1111
- typeByte,
1112
- scalesByte1
1113
- ]);
1114
- if (supportedScales.length > 1) {
1115
- this.payload = import_safe2.Bytes.concat([
1116
- this.payload,
1117
- import_safe2.Bytes.from([supportedScales.length - 1]),
1118
- import_safe2.Bytes.from(supportedScales.subarray(1))
1119
- ]);
1124
+ };
1125
+ return MeterCCGet2 = _classThis;
1126
+ })();
1127
+ let MeterCCSupportedReport = (() => {
1128
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedReport), (0, import_CommandClassDecorators.ccValueProperty)("type", MeterCCValues.type), (0, import_CommandClassDecorators.ccValueProperty)("supportsReset", MeterCCValues.supportsReset), (0, import_CommandClassDecorators.ccValueProperty)("supportedScales", MeterCCValues.supportedScales), (0, import_CommandClassDecorators.ccValueProperty)("supportedRateTypes", MeterCCValues.supportedRateTypes)];
1129
+ let _classDescriptor;
1130
+ let _classExtraInitializers = [];
1131
+ let _classThis;
1132
+ let _classSuper = MeterCC;
1133
+ var MeterCCSupportedReport2 = class extends _classSuper {
1134
+ static {
1135
+ _classThis = this;
1120
1136
  }
1121
- return super.serialize(ctx);
1122
- }
1123
- toLogEntry(ctx) {
1124
- const message = {
1125
- "meter type": (0, import_core.getMeterName)(this.type),
1126
- "supports reset": this.supportsReset,
1127
- "supported scales": `${this.supportedScales.map((scale) => `
1128
- \xB7 ${((0, import_core.getMeterScale)(this.type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`).join("")}`,
1129
- "supported rate types": this.supportedRateTypes.map((rt) => (0, import_safe3.getEnumMemberName)(import_Types.RateType, rt)).join(", ")
1130
- };
1131
- return {
1132
- ...super.toLogEntry(ctx),
1133
- message
1134
- };
1135
- }
1136
- };
1137
- __decorate([
1138
- (0, import_CommandClassDecorators.ccValue)(MeterCCValues.type)
1139
- ], MeterCCSupportedReport.prototype, "type", void 0);
1140
- __decorate([
1141
- (0, import_CommandClassDecorators.ccValue)(MeterCCValues.supportsReset)
1142
- ], MeterCCSupportedReport.prototype, "supportsReset", void 0);
1143
- __decorate([
1144
- (0, import_CommandClassDecorators.ccValue)(MeterCCValues.supportedScales)
1145
- ], MeterCCSupportedReport.prototype, "supportedScales", void 0);
1146
- __decorate([
1147
- (0, import_CommandClassDecorators.ccValue)(MeterCCValues.supportedRateTypes)
1148
- ], MeterCCSupportedReport.prototype, "supportedRateTypes", void 0);
1149
- MeterCCSupportedReport = MeterCCSupportedReport_1 = __decorate([
1150
- (0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedReport)
1151
- ], MeterCCSupportedReport);
1152
- let MeterCCSupportedGet = class MeterCCSupportedGet2 extends MeterCC {
1153
- };
1154
- MeterCCSupportedGet = __decorate([
1155
- (0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedGet),
1156
- (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCSupportedReport)
1157
- ], MeterCCSupportedGet);
1158
- let MeterCCReset = MeterCCReset_1 = class MeterCCReset2 extends MeterCC {
1159
- constructor(options) {
1160
- super(options);
1161
- this.type = options.type;
1162
- this.scale = options.scale;
1163
- this.rateType = options.rateType;
1164
- this.targetValue = options.targetValue;
1165
- }
1166
- static from(raw, ctx) {
1167
- if (raw.payload.length === 0) {
1168
- return new MeterCCReset_1({
1169
- nodeId: ctx.sourceNodeId
1137
+ static {
1138
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1139
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1140
+ MeterCCSupportedReport2 = _classThis = _classDescriptor.value;
1141
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1142
+ __runInitializers(_classThis, _classExtraInitializers);
1143
+ }
1144
+ constructor(options) {
1145
+ super(options);
1146
+ this.type = options.type;
1147
+ this.supportsReset = options.supportsReset;
1148
+ this.supportedScales = options.supportedScales;
1149
+ this.supportedRateTypes = options.supportedRateTypes;
1150
+ }
1151
+ static from(raw, ctx) {
1152
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
1153
+ const type = raw.payload[0] & 31;
1154
+ const supportsReset = !!(raw.payload[0] & 128);
1155
+ const hasMoreScales = !!(raw.payload[1] & 128);
1156
+ let supportedScales;
1157
+ if (hasMoreScales) {
1158
+ (0, import_safe.validatePayload)(raw.payload.length >= 3);
1159
+ const extraBytes = raw.payload[2];
1160
+ (0, import_safe.validatePayload)(raw.payload.length >= 3 + extraBytes);
1161
+ supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.concat([
1162
+ import_safe2.Bytes.from([raw.payload[1] & 127]),
1163
+ raw.payload.subarray(3, 3 + extraBytes)
1164
+ ]), 0).map((scale) => scale >= 8 ? scale - 1 : scale);
1165
+ } else {
1166
+ supportedScales = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([raw.payload[1]]), 0);
1167
+ }
1168
+ const supportedRateTypes = (0, import_safe.parseBitMask)(import_safe2.Bytes.from([(raw.payload[0] & 96) >>> 5]), 1);
1169
+ return new this({
1170
+ nodeId: ctx.sourceNodeId,
1171
+ type,
1172
+ supportsReset,
1173
+ supportedScales,
1174
+ supportedRateTypes
1170
1175
  });
1171
1176
  }
1172
- const { type, rateType, scale1, value: targetValue, bytesRead: scale2Offset } = parseMeterValueAndInfo(raw.payload, 0);
1173
- const scale = parseScale(scale1, raw.payload, scale2Offset);
1174
- return new MeterCCReset_1({
1175
- nodeId: ctx.sourceNodeId,
1176
- type,
1177
- rateType,
1178
- targetValue,
1179
- scale
1180
- });
1181
- }
1182
- type;
1183
- scale;
1184
- rateType;
1185
- targetValue;
1186
- serialize(ctx) {
1187
- if (this.type != void 0 && this.scale != void 0 && this.rateType != void 0 && this.targetValue != void 0) {
1188
- const { data: typeAndValue, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.targetValue);
1189
- this.payload = typeAndValue;
1190
- if (scale2 != void 0) {
1177
+ type;
1178
+ supportsReset;
1179
+ supportedScales;
1180
+ supportedRateTypes;
1181
+ persistValues(ctx) {
1182
+ if (!super.persistValues(ctx))
1183
+ return false;
1184
+ if (!this.supportsReset)
1185
+ return true;
1186
+ const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
1187
+ if (ccVersion < 6) {
1188
+ this.ensureMetadata(ctx, MeterCCValues.resetAll);
1189
+ } else {
1190
+ for (const scale of this.supportedScales) {
1191
+ if (!isAccumulatedValue(this.type, scale))
1192
+ continue;
1193
+ for (const rateType of this.supportedRateTypes) {
1194
+ const resetSingleValue = MeterCCValues.resetSingle(this.type, rateType, scale);
1195
+ this.ensureMetadata(ctx, resetSingleValue, {
1196
+ ...resetSingleValue.meta,
1197
+ label: `Reset ${getValueLabel(this.type, scale, rateType)}`
1198
+ });
1199
+ }
1200
+ }
1201
+ }
1202
+ return true;
1203
+ }
1204
+ serialize(ctx) {
1205
+ const typeByte = this.type & 31 | (this.supportedRateTypes.includes(import_Types.RateType.Consumed) ? 32 : 0) | (this.supportedRateTypes.includes(import_Types.RateType.Produced) ? 64 : 0) | (this.supportsReset ? 128 : 0);
1206
+ const supportedScales = (0, import_core.encodeBitMask)(
1207
+ this.supportedScales,
1208
+ void 0,
1209
+ // The first byte only has 7 bits for the bitmask,
1210
+ // so we add a fake bit for the value -1 and later shift
1211
+ // the first byte one to the right
1212
+ -1
1213
+ );
1214
+ const scalesByte1 = supportedScales[0] >>> 1 | (supportedScales.length > 1 ? 128 : 0);
1215
+ this.payload = import_safe2.Bytes.from([
1216
+ typeByte,
1217
+ scalesByte1
1218
+ ]);
1219
+ if (supportedScales.length > 1) {
1191
1220
  this.payload = import_safe2.Bytes.concat([
1192
1221
  this.payload,
1193
- import_safe2.Bytes.from([scale2])
1222
+ import_safe2.Bytes.from([supportedScales.length - 1]),
1223
+ import_safe2.Bytes.from(supportedScales.subarray(1))
1194
1224
  ]);
1195
1225
  }
1226
+ return super.serialize(ctx);
1196
1227
  }
1197
- return super.serialize(ctx);
1198
- }
1199
- toLogEntry(ctx) {
1200
- const message = {};
1201
- if (this.type != void 0) {
1202
- message.type = (0, import_core.getMeterName)(this.type);
1228
+ toLogEntry(ctx) {
1229
+ const message = {
1230
+ "meter type": (0, import_core.getMeterName)(this.type),
1231
+ "supports reset": this.supportsReset,
1232
+ "supported scales": `${this.supportedScales.map((scale) => `
1233
+ \xB7 ${((0, import_core.getMeterScale)(this.type, scale) ?? (0, import_core.getUnknownMeterScale)(scale)).label}`).join("")}`,
1234
+ "supported rate types": this.supportedRateTypes.map((rt) => (0, import_safe3.getEnumMemberName)(import_Types.RateType, rt)).join(", ")
1235
+ };
1236
+ return {
1237
+ ...super.toLogEntry(ctx),
1238
+ message
1239
+ };
1203
1240
  }
1204
- if (this.rateType != void 0) {
1205
- message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
1241
+ };
1242
+ return MeterCCSupportedReport2 = _classThis;
1243
+ })();
1244
+ let MeterCCSupportedGet = (() => {
1245
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.SupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(MeterCCSupportedReport)];
1246
+ let _classDescriptor;
1247
+ let _classExtraInitializers = [];
1248
+ let _classThis;
1249
+ let _classSuper = MeterCC;
1250
+ var MeterCCSupportedGet2 = class extends _classSuper {
1251
+ static {
1252
+ _classThis = this;
1206
1253
  }
1207
- if (this.type != void 0 && this.scale != void 0) {
1208
- message.scale = ((0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
1254
+ static {
1255
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1256
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1257
+ MeterCCSupportedGet2 = _classThis = _classDescriptor.value;
1258
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1259
+ __runInitializers(_classThis, _classExtraInitializers);
1209
1260
  }
1210
- if (this.targetValue != void 0) {
1211
- message["target value"] = this.targetValue;
1261
+ };
1262
+ return MeterCCSupportedGet2 = _classThis;
1263
+ })();
1264
+ let MeterCCReset = (() => {
1265
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Reset), (0, import_CommandClassDecorators.useSupervision)()];
1266
+ let _classDescriptor;
1267
+ let _classExtraInitializers = [];
1268
+ let _classThis;
1269
+ let _classSuper = MeterCC;
1270
+ var MeterCCReset2 = class extends _classSuper {
1271
+ static {
1272
+ _classThis = this;
1212
1273
  }
1213
- return {
1214
- ...super.toLogEntry(ctx),
1215
- message
1216
- };
1217
- }
1218
- };
1219
- MeterCCReset = MeterCCReset_1 = __decorate([
1220
- (0, import_CommandClassDecorators.CCCommand)(import_Types.MeterCommand.Reset),
1221
- (0, import_CommandClassDecorators.useSupervision)()
1222
- ], MeterCCReset);
1274
+ static {
1275
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1276
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1277
+ MeterCCReset2 = _classThis = _classDescriptor.value;
1278
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1279
+ __runInitializers(_classThis, _classExtraInitializers);
1280
+ }
1281
+ constructor(options) {
1282
+ super(options);
1283
+ this.type = options.type;
1284
+ this.scale = options.scale;
1285
+ this.rateType = options.rateType;
1286
+ this.targetValue = options.targetValue;
1287
+ }
1288
+ static from(raw, ctx) {
1289
+ if (raw.payload.length === 0) {
1290
+ return new this({
1291
+ nodeId: ctx.sourceNodeId
1292
+ });
1293
+ }
1294
+ const { type, rateType, scale1, value: targetValue, bytesRead: scale2Offset } = parseMeterValueAndInfo(raw.payload, 0);
1295
+ const scale = parseScale(scale1, raw.payload, scale2Offset);
1296
+ return new this({
1297
+ nodeId: ctx.sourceNodeId,
1298
+ type,
1299
+ rateType,
1300
+ targetValue,
1301
+ scale
1302
+ });
1303
+ }
1304
+ type;
1305
+ scale;
1306
+ rateType;
1307
+ targetValue;
1308
+ serialize(ctx) {
1309
+ if (this.type != void 0 && this.scale != void 0 && this.rateType != void 0 && this.targetValue != void 0) {
1310
+ const { data: typeAndValue, scale2 } = encodeMeterValueAndInfo(this.type, this.rateType, this.scale, this.targetValue);
1311
+ this.payload = typeAndValue;
1312
+ if (scale2 != void 0) {
1313
+ this.payload = import_safe2.Bytes.concat([
1314
+ this.payload,
1315
+ import_safe2.Bytes.from([scale2])
1316
+ ]);
1317
+ }
1318
+ }
1319
+ return super.serialize(ctx);
1320
+ }
1321
+ toLogEntry(ctx) {
1322
+ const message = {};
1323
+ if (this.type != void 0) {
1324
+ message.type = (0, import_core.getMeterName)(this.type);
1325
+ }
1326
+ if (this.rateType != void 0) {
1327
+ message["rate type"] = (0, import_safe3.getEnumMemberName)(import_Types.RateType, this.rateType);
1328
+ }
1329
+ if (this.type != void 0 && this.scale != void 0) {
1330
+ message.scale = ((0, import_core.getMeterScale)(this.type, this.scale) ?? (0, import_core.getUnknownMeterScale)(this.scale)).label;
1331
+ }
1332
+ if (this.targetValue != void 0) {
1333
+ message["target value"] = this.targetValue;
1334
+ }
1335
+ return {
1336
+ ...super.toLogEntry(ctx),
1337
+ message
1338
+ };
1339
+ }
1340
+ };
1341
+ return MeterCCReset2 = _classThis;
1342
+ })();
1223
1343
  // Annotate the CommonJS export names for ESM import in node:
1224
1344
  0 && (module.exports = {
1225
1345
  MeterCC,