@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
@@ -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 ColorSwitchCCSupportedReport_1, ColorSwitchCCReport_1, ColorSwitchCCGet_1, ColorSwitchCCSet_1, ColorSwitchCCStartLevelChange_1, ColorSwitchCCStopLevelChange_1;
8
35
  function __assertType(argName, typeName, boundHasError) {
9
36
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
10
37
  if (boundHasError()) {
@@ -353,7 +380,7 @@ import { clamp } from "alcalzone-shared/math/index.js";
353
380
  import { isObject } from "alcalzone-shared/typeguards/index.js";
354
381
  import { CCAPI, POLL_VALUE, SET_VALUE, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from "../lib/API.js";
355
382
  import { CommandClass, getEffectiveCCVersion, } from "../lib/CommandClass.js";
356
- import { API, CCCommand, ccValue, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
383
+ import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
357
384
  import { V } from "../lib/Values.js";
358
385
  import { ColorComponent, ColorComponentMap, ColorSwitchCommand, LevelChangeDirection, } from "../lib/_Types.js";
359
386
  const hexColorRegex = /^#?(?<red>[0-9a-f]{2})(?<green>[0-9a-f]{2})(?<blue>[0-9a-f]{2})$/i;
@@ -431,719 +458,817 @@ export const ColorSwitchCCValues = Object.freeze({
431
458
  }),
432
459
  }),
433
460
  });
434
- let ColorSwitchCCAPI = class ColorSwitchCCAPI extends CCAPI {
435
- supportsCommand(cmd) {
436
- switch (cmd) {
437
- case ColorSwitchCommand.SupportedGet:
438
- case ColorSwitchCommand.Get:
439
- return this.isSinglecast();
440
- case ColorSwitchCommand.Set:
441
- case ColorSwitchCommand.StartLevelChange:
442
- case ColorSwitchCommand.StopLevelChange:
443
- return true; // These are mandatory
444
- }
445
- return super.supportsCommand(cmd);
446
- }
447
- async getSupported() {
448
- this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.SupportedGet);
449
- const cc = new ColorSwitchCCSupportedGet({
450
- nodeId: this.endpoint.nodeId,
451
- endpointIndex: this.endpoint.index,
452
- });
453
- const response = await this.host.sendCommand(cc, this.commandOptions);
454
- return response?.supportedColorComponents;
455
- }
456
- async get(component) {
457
- __assertType("component", "ColorComponent", __assertType__ColorComponent.bind(void 0, component));
458
- this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);
459
- const cc = new ColorSwitchCCGet({
460
- nodeId: this.endpoint.nodeId,
461
- endpointIndex: this.endpoint.index,
462
- colorComponent: component,
463
- });
464
- const response = await this.host.sendCommand(cc, this.commandOptions);
465
- if (response) {
466
- return pick(response, ["currentValue", "targetValue", "duration"]);
461
+ let ColorSwitchCCAPI = (() => {
462
+ let _classDecorators = [API(CommandClasses["Color Switch"])];
463
+ let _classDescriptor;
464
+ let _classExtraInitializers = [];
465
+ let _classThis;
466
+ let _classSuper = CCAPI;
467
+ var ColorSwitchCCAPI = class extends _classSuper {
468
+ static { _classThis = this; }
469
+ static {
470
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
471
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
472
+ ColorSwitchCCAPI = _classThis = _classDescriptor.value;
473
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
474
+ __runInitializers(_classThis, _classExtraInitializers);
475
+ }
476
+ supportsCommand(cmd) {
477
+ switch (cmd) {
478
+ case ColorSwitchCommand.SupportedGet:
479
+ case ColorSwitchCommand.Get:
480
+ return this.isSinglecast();
481
+ case ColorSwitchCommand.Set:
482
+ case ColorSwitchCommand.StartLevelChange:
483
+ case ColorSwitchCommand.StopLevelChange:
484
+ return true; // These are mandatory
485
+ }
486
+ return super.supportsCommand(cmd);
467
487
  }
468
- }
469
- async set(options) {
470
- __assertType("options", "ColorSwitchCCSetOptions", __assertType__ColorSwitchCCSetOptions.bind(void 0, options));
471
- this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);
472
- const cc = new ColorSwitchCCSet({
473
- nodeId: this.endpoint.nodeId,
474
- endpointIndex: this.endpoint.index,
475
- ...options,
476
- });
477
- const result = await this.host.sendCommand(cc, this.commandOptions);
478
- if (isUnsupervisedOrSucceeded(result)) {
479
- // If the command did not fail, assume that it succeeded and update the values accordingly
480
- // TODO: The API methods should not modify the value DB directly, but to do so
481
- // this requires a nicer way of synchronizing hexColor with the others
482
- if (this.isSinglecast()) {
483
- // Update each color component separately and record the changes to the compound value
484
- this.updateCurrentColor(this.getValueDB(), cc.colorTable);
488
+ async getSupported() {
489
+ this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.SupportedGet);
490
+ const cc = new ColorSwitchCCSupportedGet({
491
+ nodeId: this.endpoint.nodeId,
492
+ endpointIndex: this.endpoint.index,
493
+ });
494
+ const response = await this.host.sendCommand(cc, this.commandOptions);
495
+ return response?.supportedColorComponents;
496
+ }
497
+ async get(component) {
498
+ __assertType("component", "ColorComponent", __assertType__ColorComponent.bind(void 0, component));
499
+ this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Get);
500
+ const cc = new ColorSwitchCCGet({
501
+ nodeId: this.endpoint.nodeId,
502
+ endpointIndex: this.endpoint.index,
503
+ colorComponent: component,
504
+ });
505
+ const response = await this.host.sendCommand(cc, this.commandOptions);
506
+ if (response) {
507
+ return pick(response, ["currentValue", "targetValue", "duration"]);
485
508
  }
486
- else if (this.isMulticast()) {
487
- // Figure out which nodes were affected by this command
488
- const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => node
489
- .getEndpoint(this.endpoint.index)
490
- ?.supportsCC(this.ccId));
491
- // and optimistically update the currentColor
492
- for (const node of affectedNodes) {
493
- const valueDB = this.host.tryGetValueDB(node.id);
494
- if (valueDB) {
495
- this.updateCurrentColor(valueDB, cc.colorTable);
509
+ }
510
+ async set(options) {
511
+ __assertType("options", "ColorSwitchCCSetOptions", __assertType__ColorSwitchCCSetOptions.bind(void 0, options));
512
+ this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.Set);
513
+ const cc = new ColorSwitchCCSet({
514
+ nodeId: this.endpoint.nodeId,
515
+ endpointIndex: this.endpoint.index,
516
+ ...options,
517
+ });
518
+ const result = await this.host.sendCommand(cc, this.commandOptions);
519
+ if (isUnsupervisedOrSucceeded(result)) {
520
+ // If the command did not fail, assume that it succeeded and update the values accordingly
521
+ // TODO: The API methods should not modify the value DB directly, but to do so
522
+ // this requires a nicer way of synchronizing hexColor with the others
523
+ if (this.isSinglecast()) {
524
+ // Update each color component separately and record the changes to the compound value
525
+ this.updateCurrentColor(this.getValueDB(), cc.colorTable);
526
+ }
527
+ else if (this.isMulticast()) {
528
+ // Figure out which nodes were affected by this command
529
+ const affectedNodes = this.endpoint.node.physicalNodes.filter((node) => node
530
+ .getEndpoint(this.endpoint.index)
531
+ ?.supportsCC(this.ccId));
532
+ // and optimistically update the currentColor
533
+ for (const node of affectedNodes) {
534
+ const valueDB = this.host.tryGetValueDB(node.id);
535
+ if (valueDB) {
536
+ this.updateCurrentColor(valueDB, cc.colorTable);
537
+ }
496
538
  }
497
539
  }
498
540
  }
499
- }
500
- return result;
501
- }
502
- /** Updates the current color for a given node by merging in the given changes */
503
- updateCurrentColor(valueDB, colorTable) {
504
- let updatedRGB = false;
505
- const currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(this.endpoint.index);
506
- const targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(this.endpoint.index);
507
- const currentCompoundColor = valueDB.getValue(currentColorValueId) ?? {};
508
- const targetCompoundColor = valueDB.getValue(targetColorValueId) ?? {};
509
- for (const [key, value] of Object.entries(colorTable)) {
510
- const component = colorTableKeyToComponent(key);
511
- if (component === ColorComponent.Red
512
- || component === ColorComponent.Green
513
- || component === ColorComponent.Blue) {
514
- updatedRGB = true;
541
+ return result;
542
+ }
543
+ /** Updates the current color for a given node by merging in the given changes */
544
+ updateCurrentColor(valueDB, colorTable) {
545
+ let updatedRGB = false;
546
+ const currentColorValueId = ColorSwitchCCValues.currentColor.endpoint(this.endpoint.index);
547
+ const targetColorValueId = ColorSwitchCCValues.targetColor.endpoint(this.endpoint.index);
548
+ const currentCompoundColor = valueDB.getValue(currentColorValueId) ?? {};
549
+ const targetCompoundColor = valueDB.getValue(targetColorValueId) ?? {};
550
+ for (const [key, value] of Object.entries(colorTable)) {
551
+ const component = colorTableKeyToComponent(key);
552
+ if (component === ColorComponent.Red
553
+ || component === ColorComponent.Green
554
+ || component === ColorComponent.Blue) {
555
+ updatedRGB = true;
556
+ }
557
+ valueDB.setValue(ColorSwitchCCValues.currentColorChannel(component).endpoint(this.endpoint.index), value);
558
+ // Update the compound value
559
+ if (key in ColorComponentMap) {
560
+ currentCompoundColor[key] = value;
561
+ targetCompoundColor[key] = value;
562
+ }
515
563
  }
516
- valueDB.setValue(ColorSwitchCCValues.currentColorChannel(component).endpoint(this.endpoint.index), value);
517
- // Update the compound value
518
- if (key in ColorComponentMap) {
519
- currentCompoundColor[key] = value;
520
- targetCompoundColor[key] = value;
564
+ // And store the updated compound values
565
+ valueDB.setValue(currentColorValueId, currentCompoundColor);
566
+ valueDB.setValue(targetColorValueId, targetCompoundColor);
567
+ // and hex color if necessary
568
+ const supportsHex = valueDB.getValue(ColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index));
569
+ if (supportsHex && updatedRGB) {
570
+ const hexValueId = ColorSwitchCCValues.hexColor.endpoint(this.endpoint.index);
571
+ const [r, g, b] = [
572
+ ColorComponent.Red,
573
+ ColorComponent.Green,
574
+ ColorComponent.Blue,
575
+ ].map((c) => valueDB.getValue(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);
576
+ const hexValue = (r << 16) | (g << 8) | b;
577
+ valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, "0"));
521
578
  }
522
579
  }
523
- // And store the updated compound values
524
- valueDB.setValue(currentColorValueId, currentCompoundColor);
525
- valueDB.setValue(targetColorValueId, targetCompoundColor);
526
- // and hex color if necessary
527
- const supportsHex = valueDB.getValue(ColorSwitchCCValues.supportsHexColor.endpoint(this.endpoint.index));
528
- if (supportsHex && updatedRGB) {
529
- const hexValueId = ColorSwitchCCValues.hexColor.endpoint(this.endpoint.index);
530
- const [r, g, b] = [
531
- ColorComponent.Red,
532
- ColorComponent.Green,
533
- ColorComponent.Blue,
534
- ].map((c) => valueDB.getValue(ColorSwitchCCValues.currentColorChannel(c).endpoint(this.endpoint.index)) ?? 0);
535
- const hexValue = (r << 16) | (g << 8) | b;
536
- valueDB.setValue(hexValueId, hexValue.toString(16).padStart(6, "0"));
537
- }
538
- }
539
- async startLevelChange(options) {
540
- __assertType("options", "ColorSwitchCCStartLevelChangeOptions", __assertType__ColorSwitchCCStartLevelChangeOptions.bind(void 0, options));
541
- this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StartLevelChange);
542
- const cc = new ColorSwitchCCStartLevelChange({
543
- nodeId: this.endpoint.nodeId,
544
- endpointIndex: this.endpoint.index,
545
- ...options,
546
- });
547
- return this.host.sendCommand(cc, this.commandOptions);
548
- }
549
- async stopLevelChange(colorComponent) {
550
- __assertType("colorComponent", "ColorComponent", __assertType__ColorComponent.bind(void 0, colorComponent));
551
- this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StopLevelChange);
552
- const cc = new ColorSwitchCCStopLevelChange({
553
- nodeId: this.endpoint.nodeId,
554
- endpointIndex: this.endpoint.index,
555
- colorComponent,
556
- });
557
- return this.host.sendCommand(cc, this.commandOptions);
558
- }
559
- get [SET_VALUE]() {
560
- return async function ({ property, propertyKey }, value, options) {
561
- if (property === "targetColor") {
562
- const duration = Duration.from(options?.transitionDuration);
563
- if (propertyKey != undefined) {
564
- // Single color component, only accepts numbers
565
- if (typeof propertyKey !== "number") {
566
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
567
- }
568
- else if (typeof value !== "number") {
569
- throwWrongValueType(this.ccId, property, "number", typeof value);
570
- }
571
- const result = await this.set({
572
- [propertyKey]: value,
573
- duration,
574
- });
575
- if (this.isSinglecast()
576
- && !supervisedCommandSucceeded(result)) {
577
- // Verify the current value after a (short) delay, unless the command was supervised and successful
578
- this.schedulePoll({ property, propertyKey }, value, {
580
+ async startLevelChange(options) {
581
+ __assertType("options", "ColorSwitchCCStartLevelChangeOptions", __assertType__ColorSwitchCCStartLevelChangeOptions.bind(void 0, options));
582
+ this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StartLevelChange);
583
+ const cc = new ColorSwitchCCStartLevelChange({
584
+ nodeId: this.endpoint.nodeId,
585
+ endpointIndex: this.endpoint.index,
586
+ ...options,
587
+ });
588
+ return this.host.sendCommand(cc, this.commandOptions);
589
+ }
590
+ async stopLevelChange(colorComponent) {
591
+ __assertType("colorComponent", "ColorComponent", __assertType__ColorComponent.bind(void 0, colorComponent));
592
+ this.assertSupportsCommand(ColorSwitchCommand, ColorSwitchCommand.StopLevelChange);
593
+ const cc = new ColorSwitchCCStopLevelChange({
594
+ nodeId: this.endpoint.nodeId,
595
+ endpointIndex: this.endpoint.index,
596
+ colorComponent,
597
+ });
598
+ return this.host.sendCommand(cc, this.commandOptions);
599
+ }
600
+ get [SET_VALUE]() {
601
+ return async function ({ property, propertyKey }, value, options) {
602
+ if (property === "targetColor") {
603
+ const duration = Duration.from(options?.transitionDuration);
604
+ if (propertyKey != undefined) {
605
+ // Single color component, only accepts numbers
606
+ if (typeof propertyKey !== "number") {
607
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
608
+ }
609
+ else if (typeof value !== "number") {
610
+ throwWrongValueType(this.ccId, property, "number", typeof value);
611
+ }
612
+ const result = await this.set({
613
+ [propertyKey]: value,
579
614
  duration,
580
- transition: "fast",
581
615
  });
582
- }
583
- return result;
584
- }
585
- else {
586
- // Set the compound color object
587
- // Ensure the value is an object with only valid keys
588
- if (!isObject(value)
589
- || !Object.keys(value).every((key) => key in ColorComponentMap)) {
590
- throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be set to an object which specifies each color channel`, ZWaveErrorCodes.Argument_Invalid);
591
- }
592
- // Ensure that each property is numeric
593
- for (const [key, val] of Object.entries(value)) {
594
- if (typeof val !== "number") {
595
- throwWrongValueType(this.ccId, `${property}.${key}`, "number", typeof val);
616
+ if (this.isSinglecast()
617
+ && !supervisedCommandSucceeded(result)) {
618
+ // Verify the current value after a (short) delay, unless the command was supervised and successful
619
+ this.schedulePoll({ property, propertyKey }, value, {
620
+ duration,
621
+ transition: "fast",
622
+ });
596
623
  }
624
+ return result;
597
625
  }
598
- // GH#2527: strip unsupported color components, because some devices don't react otherwise
599
- if (this.isSinglecast()) {
600
- const supportedColors = this.tryGetValueDB()?.getValue(ColorSwitchCCValues.supportedColorComponents
601
- .endpoint(this.endpoint.index));
602
- if (supportedColors) {
603
- value = pick(value, supportedColors
604
- .map((c) => colorComponentToTableKey(c))
605
- .filter((c) => !!c));
626
+ else {
627
+ // Set the compound color object
628
+ // Ensure the value is an object with only valid keys
629
+ if (!isObject(value)
630
+ || !Object.keys(value).every((key) => key in ColorComponentMap)) {
631
+ throw new ZWaveError(`${CommandClasses[this.ccId]}: "${property}" must be set to an object which specifies each color channel`, ZWaveErrorCodes.Argument_Invalid);
606
632
  }
633
+ // Ensure that each property is numeric
634
+ for (const [key, val] of Object.entries(value)) {
635
+ if (typeof val !== "number") {
636
+ throwWrongValueType(this.ccId, `${property}.${key}`, "number", typeof val);
637
+ }
638
+ }
639
+ // GH#2527: strip unsupported color components, because some devices don't react otherwise
640
+ if (this.isSinglecast()) {
641
+ const supportedColors = this.tryGetValueDB()?.getValue(ColorSwitchCCValues.supportedColorComponents
642
+ .endpoint(this.endpoint.index));
643
+ if (supportedColors) {
644
+ value = pick(value, supportedColors
645
+ .map((c) => colorComponentToTableKey(c))
646
+ .filter((c) => !!c));
647
+ }
648
+ }
649
+ // Avoid sending empty commands
650
+ if (Object.keys(value).length === 0)
651
+ return;
652
+ return this.set({ ...value, duration });
653
+ // We're not going to poll each color component separately
607
654
  }
608
- // Avoid sending empty commands
609
- if (Object.keys(value).length === 0)
610
- return;
611
- return this.set({ ...value, duration });
612
- // We're not going to poll each color component separately
613
655
  }
614
- }
615
- else if (property === "hexColor") {
616
- // No property key, this is the hex color #rrggbb
617
- if (typeof value !== "string") {
618
- throwWrongValueType(this.ccId, property, "string", typeof value);
656
+ else if (property === "hexColor") {
657
+ // No property key, this is the hex color #rrggbb
658
+ if (typeof value !== "string") {
659
+ throwWrongValueType(this.ccId, property, "string", typeof value);
660
+ }
661
+ const duration = Duration.from(options?.transitionDuration);
662
+ return this.set({ hexColor: value, duration });
619
663
  }
620
- const duration = Duration.from(options?.transitionDuration);
621
- return this.set({ hexColor: value, duration });
622
- }
623
- else {
624
- throwUnsupportedProperty(this.ccId, property);
625
- }
626
- };
627
- }
628
- isSetValueOptimistic(_valueId) {
629
- return false; // Color Switch CC handles updating the value DB itself
630
- }
631
- get [POLL_VALUE]() {
632
- return async function ({ property, propertyKey }) {
633
- if (propertyKey == undefined) {
634
- throwMissingPropertyKey(this.ccId, property);
635
- }
636
- else if (typeof propertyKey !== "number") {
637
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
638
- }
639
- switch (property) {
640
- case "currentColor":
641
- return (await this.get(propertyKey))?.currentValue;
642
- case "targetColor":
643
- return (await this.get(propertyKey))?.targetValue;
644
- case "duration":
645
- return (await this.get(propertyKey))?.duration;
646
- default:
664
+ else {
647
665
  throwUnsupportedProperty(this.ccId, property);
648
- }
649
- };
650
- }
651
- };
652
- ColorSwitchCCAPI = __decorate([
653
- API(CommandClasses["Color Switch"])
654
- ], ColorSwitchCCAPI);
666
+ }
667
+ };
668
+ }
669
+ isSetValueOptimistic(_valueId) {
670
+ return false; // Color Switch CC handles updating the value DB itself
671
+ }
672
+ get [POLL_VALUE]() {
673
+ return async function ({ property, propertyKey }) {
674
+ if (propertyKey == undefined) {
675
+ throwMissingPropertyKey(this.ccId, property);
676
+ }
677
+ else if (typeof propertyKey !== "number") {
678
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
679
+ }
680
+ switch (property) {
681
+ case "currentColor":
682
+ return (await this.get(propertyKey))?.currentValue;
683
+ case "targetColor":
684
+ return (await this.get(propertyKey))?.targetValue;
685
+ case "duration":
686
+ return (await this.get(propertyKey))?.duration;
687
+ default:
688
+ throwUnsupportedProperty(this.ccId, property);
689
+ }
690
+ };
691
+ }
692
+ };
693
+ return ColorSwitchCCAPI = _classThis;
694
+ })();
655
695
  export { ColorSwitchCCAPI };
656
- let ColorSwitchCC = class ColorSwitchCC extends CommandClass {
657
- async interview(ctx) {
658
- const node = this.getNode(ctx);
659
- const endpoint = this.getEndpoint(ctx);
660
- const api = CCAPI.create(CommandClasses["Color Switch"], ctx, endpoint).withOptions({
661
- priority: MessagePriority.NodeQuery,
662
- });
663
- ctx.logNode(node.id, {
664
- endpoint: this.endpointIndex,
665
- message: `Interviewing ${this.ccName}...`,
666
- direction: "none",
667
- });
668
- ctx.logNode(node.id, {
669
- endpoint: this.endpointIndex,
670
- message: "querying supported colors...",
671
- direction: "outbound",
672
- });
673
- const supportedColors = await api.getSupported();
674
- if (!supportedColors) {
696
+ let ColorSwitchCC = (() => {
697
+ let _classDecorators = [commandClass(CommandClasses["Color Switch"]), implementedVersion(3), ccValues(ColorSwitchCCValues)];
698
+ let _classDescriptor;
699
+ let _classExtraInitializers = [];
700
+ let _classThis;
701
+ let _classSuper = CommandClass;
702
+ var ColorSwitchCC = class extends _classSuper {
703
+ static { _classThis = this; }
704
+ static {
705
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
706
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
707
+ ColorSwitchCC = _classThis = _classDescriptor.value;
708
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
709
+ __runInitializers(_classThis, _classExtraInitializers);
710
+ }
711
+ async interview(ctx) {
712
+ const node = this.getNode(ctx);
713
+ const endpoint = this.getEndpoint(ctx);
714
+ const api = CCAPI.create(CommandClasses["Color Switch"], ctx, endpoint).withOptions({
715
+ priority: MessagePriority.NodeQuery,
716
+ });
675
717
  ctx.logNode(node.id, {
676
718
  endpoint: this.endpointIndex,
677
- message: "Querying supported colors timed out, skipping interview...",
678
- level: "warn",
719
+ message: `Interviewing ${this.ccName}...`,
720
+ direction: "none",
679
721
  });
680
- return;
681
- }
682
- ctx.logNode(node.id, {
683
- endpoint: this.endpointIndex,
684
- message: `received supported colors:${supportedColors
685
- .map((c) => `\n· ${getEnumMemberName(ColorComponent, c)}`)
686
- .join("")}`,
687
- direction: "outbound",
688
- });
689
- // Create metadata for the separate color channels
690
- for (const color of supportedColors) {
691
- const currentColorChannelValue = ColorSwitchCCValues
692
- .currentColorChannel(color);
693
- this.setMetadata(ctx, currentColorChannelValue);
694
- const targetColorChannelValue = ColorSwitchCCValues
695
- .targetColorChannel(color);
696
- this.setMetadata(ctx, targetColorChannelValue);
697
- }
698
- // And the compound one
699
- const currentColorValue = ColorSwitchCCValues.currentColor;
700
- this.setMetadata(ctx, currentColorValue);
701
- const targetColorValue = ColorSwitchCCValues.targetColor;
702
- this.setMetadata(ctx, targetColorValue);
703
- // Create the collective HEX color values
704
- const supportsHex = [
705
- ColorComponent.Red,
706
- ColorComponent.Green,
707
- ColorComponent.Blue,
708
- ].every((c) => supportedColors.includes(c));
709
- this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);
710
- if (supportsHex) {
711
- const hexColorValue = ColorSwitchCCValues.hexColor;
712
- this.setMetadata(ctx, hexColorValue);
713
- }
714
- // Query all color components
715
- await this.refreshValues(ctx);
716
- // Remember that the interview is complete
717
- this.setInterviewComplete(ctx, true);
718
- }
719
- async refreshValues(ctx) {
720
- const node = this.getNode(ctx);
721
- const endpoint = this.getEndpoint(ctx);
722
- const api = CCAPI.create(CommandClasses["Color Switch"], ctx, endpoint).withOptions({
723
- priority: MessagePriority.NodeQuery,
724
- });
725
- const supportedColors = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents) ?? [];
726
- for (const color of supportedColors) {
727
- // Some devices report invalid colors, but the CC API checks
728
- // for valid values and throws otherwise.
729
- if (!isEnumMember(ColorComponent, color))
730
- continue;
731
- const colorName = getEnumMemberName(ColorComponent, color);
732
722
  ctx.logNode(node.id, {
733
723
  endpoint: this.endpointIndex,
734
- message: `querying current color state (${colorName})`,
724
+ message: "querying supported colors...",
735
725
  direction: "outbound",
736
726
  });
737
- await api.get(color);
727
+ const supportedColors = await api.getSupported();
728
+ if (!supportedColors) {
729
+ ctx.logNode(node.id, {
730
+ endpoint: this.endpointIndex,
731
+ message: "Querying supported colors timed out, skipping interview...",
732
+ level: "warn",
733
+ });
734
+ return;
735
+ }
736
+ ctx.logNode(node.id, {
737
+ endpoint: this.endpointIndex,
738
+ message: `received supported colors:${supportedColors
739
+ .map((c) => `\n· ${getEnumMemberName(ColorComponent, c)}`)
740
+ .join("")}`,
741
+ direction: "outbound",
742
+ });
743
+ // Create metadata for the separate color channels
744
+ for (const color of supportedColors) {
745
+ const currentColorChannelValue = ColorSwitchCCValues
746
+ .currentColorChannel(color);
747
+ this.setMetadata(ctx, currentColorChannelValue);
748
+ const targetColorChannelValue = ColorSwitchCCValues
749
+ .targetColorChannel(color);
750
+ this.setMetadata(ctx, targetColorChannelValue);
751
+ }
752
+ // And the compound one
753
+ const currentColorValue = ColorSwitchCCValues.currentColor;
754
+ this.setMetadata(ctx, currentColorValue);
755
+ const targetColorValue = ColorSwitchCCValues.targetColor;
756
+ this.setMetadata(ctx, targetColorValue);
757
+ // Create the collective HEX color values
758
+ const supportsHex = [
759
+ ColorComponent.Red,
760
+ ColorComponent.Green,
761
+ ColorComponent.Blue,
762
+ ].every((c) => supportedColors.includes(c));
763
+ this.setValue(ctx, ColorSwitchCCValues.supportsHexColor, supportsHex);
764
+ if (supportsHex) {
765
+ const hexColorValue = ColorSwitchCCValues.hexColor;
766
+ this.setMetadata(ctx, hexColorValue);
767
+ }
768
+ // Query all color components
769
+ await this.refreshValues(ctx);
770
+ // Remember that the interview is complete
771
+ this.setInterviewComplete(ctx, true);
772
+ }
773
+ async refreshValues(ctx) {
774
+ const node = this.getNode(ctx);
775
+ const endpoint = this.getEndpoint(ctx);
776
+ const api = CCAPI.create(CommandClasses["Color Switch"], ctx, endpoint).withOptions({
777
+ priority: MessagePriority.NodeQuery,
778
+ });
779
+ const supportedColors = this.getValue(ctx, ColorSwitchCCValues.supportedColorComponents) ?? [];
780
+ for (const color of supportedColors) {
781
+ // Some devices report invalid colors, but the CC API checks
782
+ // for valid values and throws otherwise.
783
+ if (!isEnumMember(ColorComponent, color))
784
+ continue;
785
+ const colorName = getEnumMemberName(ColorComponent, color);
786
+ ctx.logNode(node.id, {
787
+ endpoint: this.endpointIndex,
788
+ message: `querying current color state (${colorName})`,
789
+ direction: "outbound",
790
+ });
791
+ await api.get(color);
792
+ }
738
793
  }
739
- }
740
- translatePropertyKey(ctx, property, propertyKey) {
741
- if ((property === "currentColor" || property === "targetColor")
742
- && typeof propertyKey === "number") {
743
- const translated = ColorComponent[propertyKey];
744
- if (translated)
745
- return translated;
746
- }
747
- return super.translatePropertyKey(ctx, property, propertyKey);
748
- }
749
- };
750
- ColorSwitchCC = __decorate([
751
- commandClass(CommandClasses["Color Switch"]),
752
- implementedVersion(3),
753
- ccValues(ColorSwitchCCValues)
754
- ], ColorSwitchCC);
794
+ translatePropertyKey(ctx, property, propertyKey) {
795
+ if ((property === "currentColor" || property === "targetColor")
796
+ && typeof propertyKey === "number") {
797
+ const translated = ColorComponent[propertyKey];
798
+ if (translated)
799
+ return translated;
800
+ }
801
+ return super.translatePropertyKey(ctx, property, propertyKey);
802
+ }
803
+ };
804
+ return ColorSwitchCC = _classThis;
805
+ })();
755
806
  export { ColorSwitchCC };
756
- let ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport_1 = class ColorSwitchCCSupportedReport extends ColorSwitchCC {
757
- constructor(options) {
758
- super(options);
759
- this.supportedColorComponents = options.supportedColorComponents;
760
- }
761
- static from(raw, ctx) {
762
- // Docs say 'variable length', but the table shows 2 bytes.
763
- validatePayload(raw.payload.length >= 2);
764
- const supportedColorComponents = parseBitMask(raw.payload.subarray(0, 2), ColorComponent["Warm White"]);
765
- return new ColorSwitchCCSupportedReport_1({
766
- nodeId: ctx.sourceNodeId,
767
- supportedColorComponents,
768
- });
769
- }
770
- supportedColorComponents;
771
- serialize(ctx) {
772
- this.payload = encodeBitMask(this.supportedColorComponents, 15, // fixed 2 bytes
773
- ColorComponent["Warm White"]);
774
- return super.serialize(ctx);
775
- }
776
- toLogEntry(ctx) {
777
- return {
778
- ...super.toLogEntry(ctx),
779
- message: {
780
- "supported color components": this.supportedColorComponents
781
- .map((c) => `\n· ${getEnumMemberName(ColorComponent, c)}`)
782
- .join(""),
783
- },
784
- };
785
- }
786
- };
787
- __decorate([
788
- ccValue(ColorSwitchCCValues.supportedColorComponents)
789
- ], ColorSwitchCCSupportedReport.prototype, "supportedColorComponents", void 0);
790
- ColorSwitchCCSupportedReport = ColorSwitchCCSupportedReport_1 = __decorate([
791
- CCCommand(ColorSwitchCommand.SupportedReport)
792
- ], ColorSwitchCCSupportedReport);
807
+ let ColorSwitchCCSupportedReport = (() => {
808
+ let _classDecorators = [CCCommand(ColorSwitchCommand.SupportedReport), ccValueProperty("supportedColorComponents", ColorSwitchCCValues.supportedColorComponents)];
809
+ let _classDescriptor;
810
+ let _classExtraInitializers = [];
811
+ let _classThis;
812
+ let _classSuper = ColorSwitchCC;
813
+ var ColorSwitchCCSupportedReport = class extends _classSuper {
814
+ static { _classThis = this; }
815
+ static {
816
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
817
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
818
+ ColorSwitchCCSupportedReport = _classThis = _classDescriptor.value;
819
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
820
+ __runInitializers(_classThis, _classExtraInitializers);
821
+ }
822
+ constructor(options) {
823
+ super(options);
824
+ this.supportedColorComponents = options.supportedColorComponents;
825
+ }
826
+ static from(raw, ctx) {
827
+ // Docs say 'variable length', but the table shows 2 bytes.
828
+ validatePayload(raw.payload.length >= 2);
829
+ const supportedColorComponents = parseBitMask(raw.payload.subarray(0, 2), ColorComponent["Warm White"]);
830
+ return new this({
831
+ nodeId: ctx.sourceNodeId,
832
+ supportedColorComponents,
833
+ });
834
+ }
835
+ supportedColorComponents;
836
+ serialize(ctx) {
837
+ this.payload = encodeBitMask(this.supportedColorComponents, 15, // fixed 2 bytes
838
+ ColorComponent["Warm White"]);
839
+ return super.serialize(ctx);
840
+ }
841
+ toLogEntry(ctx) {
842
+ return {
843
+ ...super.toLogEntry(ctx),
844
+ message: {
845
+ "supported color components": this.supportedColorComponents
846
+ .map((c) => `\n· ${getEnumMemberName(ColorComponent, c)}`)
847
+ .join(""),
848
+ },
849
+ };
850
+ }
851
+ };
852
+ return ColorSwitchCCSupportedReport = _classThis;
853
+ })();
793
854
  export { ColorSwitchCCSupportedReport };
794
- let ColorSwitchCCSupportedGet = class ColorSwitchCCSupportedGet extends ColorSwitchCC {
795
- };
796
- ColorSwitchCCSupportedGet = __decorate([
797
- CCCommand(ColorSwitchCommand.SupportedGet),
798
- expectedCCResponse(ColorSwitchCCSupportedReport)
799
- ], ColorSwitchCCSupportedGet);
855
+ let ColorSwitchCCSupportedGet = (() => {
856
+ let _classDecorators = [CCCommand(ColorSwitchCommand.SupportedGet), expectedCCResponse(ColorSwitchCCSupportedReport)];
857
+ let _classDescriptor;
858
+ let _classExtraInitializers = [];
859
+ let _classThis;
860
+ let _classSuper = ColorSwitchCC;
861
+ var ColorSwitchCCSupportedGet = class extends _classSuper {
862
+ static { _classThis = this; }
863
+ static {
864
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
865
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
866
+ ColorSwitchCCSupportedGet = _classThis = _classDescriptor.value;
867
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
868
+ __runInitializers(_classThis, _classExtraInitializers);
869
+ }
870
+ };
871
+ return ColorSwitchCCSupportedGet = _classThis;
872
+ })();
800
873
  export { ColorSwitchCCSupportedGet };
801
- let ColorSwitchCCReport = ColorSwitchCCReport_1 = class ColorSwitchCCReport extends ColorSwitchCC {
802
- constructor(options) {
803
- super(options);
804
- this.colorComponent = options.colorComponent;
805
- this.currentValue = options.currentValue;
806
- this.targetValue = options.targetValue;
807
- this.duration = Duration.from(options.duration);
808
- }
809
- static from(raw, ctx) {
810
- validatePayload(raw.payload.length >= 2);
811
- const colorComponent = raw.payload[0];
812
- const currentValue = raw.payload[1];
813
- let targetValue;
814
- let duration;
815
- if (raw.payload.length >= 4) {
816
- targetValue = raw.payload[2];
817
- duration = Duration.parseReport(raw.payload[3]);
818
- }
819
- return new ColorSwitchCCReport_1({
820
- nodeId: ctx.sourceNodeId,
821
- colorComponent,
822
- currentValue,
823
- targetValue,
824
- duration,
825
- });
826
- }
827
- persistValues(ctx) {
828
- // Duration is stored globally instead of per component
829
- if (!super.persistValues(ctx))
830
- return false;
831
- // Update compound current value
832
- const colorTableKey = colorComponentToTableKey(this.colorComponent);
833
- if (colorTableKey) {
834
- const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;
835
- const compoundCurrentColor = this.getValue(ctx, compoundCurrentColorValue) ?? {};
836
- compoundCurrentColor[colorTableKey] = this.currentValue;
837
- this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);
838
- // and target value
839
- if (this.targetValue != undefined) {
840
- const compoundTargetColorValue = ColorSwitchCCValues.targetColor;
841
- const compoundTargetColor = this.getValue(ctx, compoundTargetColorValue) ?? {};
842
- compoundTargetColor[colorTableKey] = this.targetValue;
843
- this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);
874
+ let ColorSwitchCCReport = (() => {
875
+ let _classDecorators = [CCCommand(ColorSwitchCommand.Report), ccValueProperty("currentValue", ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent]), ccValueProperty("targetValue", ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent]), ccValueProperty("duration", ColorSwitchCCValues.duration)];
876
+ let _classDescriptor;
877
+ let _classExtraInitializers = [];
878
+ let _classThis;
879
+ let _classSuper = ColorSwitchCC;
880
+ var ColorSwitchCCReport = class extends _classSuper {
881
+ static { _classThis = this; }
882
+ static {
883
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
884
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
885
+ ColorSwitchCCReport = _classThis = _classDescriptor.value;
886
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
887
+ __runInitializers(_classThis, _classExtraInitializers);
888
+ }
889
+ constructor(options) {
890
+ super(options);
891
+ this.colorComponent = options.colorComponent;
892
+ this.currentValue = options.currentValue;
893
+ this.targetValue = options.targetValue;
894
+ this.duration = Duration.from(options.duration);
895
+ }
896
+ static from(raw, ctx) {
897
+ validatePayload(raw.payload.length >= 2);
898
+ const colorComponent = raw.payload[0];
899
+ const currentValue = raw.payload[1];
900
+ let targetValue;
901
+ let duration;
902
+ if (raw.payload.length >= 4) {
903
+ targetValue = raw.payload[2];
904
+ duration = Duration.parseReport(raw.payload[3]);
844
905
  }
906
+ return new this({
907
+ nodeId: ctx.sourceNodeId,
908
+ colorComponent,
909
+ currentValue,
910
+ targetValue,
911
+ duration,
912
+ });
845
913
  }
846
- // Update collective hex value if required
847
- const supportsHex = !!this.getValue(ctx, ColorSwitchCCValues.supportsHexColor);
848
- if (supportsHex
849
- && (this.colorComponent === ColorComponent.Red
850
- || this.colorComponent === ColorComponent.Green
851
- || this.colorComponent === ColorComponent.Blue)) {
852
- const hexColorValue = ColorSwitchCCValues.hexColor;
853
- const hexValue = this.getValue(ctx, hexColorValue)
854
- ?? "000000";
855
- const byteOffset = ColorComponent.Blue - this.colorComponent;
856
- const byteMask = 0xff << (byteOffset * 8);
857
- let hexValueNumeric = parseInt(hexValue, 16);
858
- hexValueNumeric = (hexValueNumeric & ~byteMask)
859
- | (this.currentValue << (byteOffset * 8));
860
- this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, "0"));
861
- }
862
- return true;
863
- }
864
- colorComponent;
865
- currentValue;
866
- targetValue;
867
- duration;
868
- serialize(ctx) {
869
- this.payload = Bytes.from([
870
- this.colorComponent,
871
- this.currentValue,
872
- ]);
873
- if (this.targetValue != undefined && this.duration != undefined) {
874
- this.payload = Bytes.concat([
875
- this.payload,
876
- Bytes.from([
877
- this.targetValue ?? 0xfe,
878
- (this.duration ?? Duration.default()).serializeReport(),
879
- ]),
914
+ persistValues(ctx) {
915
+ // Duration is stored globally instead of per component
916
+ if (!super.persistValues(ctx))
917
+ return false;
918
+ // Update compound current value
919
+ const colorTableKey = colorComponentToTableKey(this.colorComponent);
920
+ if (colorTableKey) {
921
+ const compoundCurrentColorValue = ColorSwitchCCValues.currentColor;
922
+ const compoundCurrentColor = this.getValue(ctx, compoundCurrentColorValue) ?? {};
923
+ compoundCurrentColor[colorTableKey] = this.currentValue;
924
+ this.setValue(ctx, compoundCurrentColorValue, compoundCurrentColor);
925
+ // and target value
926
+ if (this.targetValue != undefined) {
927
+ const compoundTargetColorValue = ColorSwitchCCValues.targetColor;
928
+ const compoundTargetColor = this.getValue(ctx, compoundTargetColorValue) ?? {};
929
+ compoundTargetColor[colorTableKey] = this.targetValue;
930
+ this.setValue(ctx, compoundTargetColorValue, compoundTargetColor);
931
+ }
932
+ }
933
+ // Update collective hex value if required
934
+ const supportsHex = !!this.getValue(ctx, ColorSwitchCCValues.supportsHexColor);
935
+ if (supportsHex
936
+ && (this.colorComponent === ColorComponent.Red
937
+ || this.colorComponent === ColorComponent.Green
938
+ || this.colorComponent === ColorComponent.Blue)) {
939
+ const hexColorValue = ColorSwitchCCValues.hexColor;
940
+ const hexValue = this.getValue(ctx, hexColorValue)
941
+ ?? "000000";
942
+ const byteOffset = ColorComponent.Blue - this.colorComponent;
943
+ const byteMask = 0xff << (byteOffset * 8);
944
+ let hexValueNumeric = parseInt(hexValue, 16);
945
+ hexValueNumeric = (hexValueNumeric & ~byteMask)
946
+ | (this.currentValue << (byteOffset * 8));
947
+ this.setValue(ctx, hexColorValue, hexValueNumeric.toString(16).padStart(6, "0"));
948
+ }
949
+ return true;
950
+ }
951
+ colorComponent;
952
+ currentValue;
953
+ targetValue;
954
+ duration;
955
+ serialize(ctx) {
956
+ this.payload = Bytes.from([
957
+ this.colorComponent,
958
+ this.currentValue,
880
959
  ]);
960
+ if (this.targetValue != undefined && this.duration != undefined) {
961
+ this.payload = Bytes.concat([
962
+ this.payload,
963
+ Bytes.from([
964
+ this.targetValue ?? 0xfe,
965
+ (this.duration ?? Duration.default()).serializeReport(),
966
+ ]),
967
+ ]);
968
+ }
969
+ return super.serialize(ctx);
881
970
  }
882
- return super.serialize(ctx);
883
- }
884
- toLogEntry(ctx) {
885
- const message = {
886
- "color component": getEnumMemberName(ColorComponent, this.colorComponent),
887
- "current value": this.currentValue,
888
- };
889
- if (this.targetValue != undefined) {
890
- message["target value"] = this.targetValue;
891
- }
892
- if (this.duration != undefined) {
893
- message.duration = this.duration.toString();
894
- }
895
- return {
896
- ...super.toLogEntry(ctx),
897
- message,
898
- };
899
- }
900
- };
901
- __decorate([
902
- ccValue(ColorSwitchCCValues.currentColorChannel, (self) => [self.colorComponent])
903
- ], ColorSwitchCCReport.prototype, "currentValue", void 0);
904
- __decorate([
905
- ccValue(ColorSwitchCCValues.targetColorChannel, (self) => [self.colorComponent])
906
- ], ColorSwitchCCReport.prototype, "targetValue", void 0);
907
- __decorate([
908
- ccValue(ColorSwitchCCValues.duration)
909
- ], ColorSwitchCCReport.prototype, "duration", void 0);
910
- ColorSwitchCCReport = ColorSwitchCCReport_1 = __decorate([
911
- CCCommand(ColorSwitchCommand.Report)
912
- ], ColorSwitchCCReport);
971
+ toLogEntry(ctx) {
972
+ const message = {
973
+ "color component": getEnumMemberName(ColorComponent, this.colorComponent),
974
+ "current value": this.currentValue,
975
+ };
976
+ if (this.targetValue != undefined) {
977
+ message["target value"] = this.targetValue;
978
+ }
979
+ if (this.duration != undefined) {
980
+ message.duration = this.duration.toString();
981
+ }
982
+ return {
983
+ ...super.toLogEntry(ctx),
984
+ message,
985
+ };
986
+ }
987
+ };
988
+ return ColorSwitchCCReport = _classThis;
989
+ })();
913
990
  export { ColorSwitchCCReport };
914
991
  function testResponseForColorSwitchGet(sent, received) {
915
992
  return sent.colorComponent === received.colorComponent;
916
993
  }
917
- let ColorSwitchCCGet = ColorSwitchCCGet_1 = class ColorSwitchCCGet extends ColorSwitchCC {
918
- constructor(options) {
919
- super(options);
920
- this._colorComponent = options.colorComponent;
921
- }
922
- static from(raw, ctx) {
923
- validatePayload(raw.payload.length >= 1);
924
- const colorComponent = raw.payload[0];
925
- return new ColorSwitchCCGet_1({
926
- nodeId: ctx.sourceNodeId,
927
- colorComponent,
928
- });
929
- }
930
- _colorComponent;
931
- get colorComponent() {
932
- return this._colorComponent;
933
- }
934
- set colorComponent(value) {
935
- if (!ColorComponent[value]) {
936
- throw new ZWaveError("colorComponent must be a valid color component index.", ZWaveErrorCodes.Argument_Invalid);
994
+ let ColorSwitchCCGet = (() => {
995
+ let _classDecorators = [CCCommand(ColorSwitchCommand.Get), expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)];
996
+ let _classDescriptor;
997
+ let _classExtraInitializers = [];
998
+ let _classThis;
999
+ let _classSuper = ColorSwitchCC;
1000
+ var ColorSwitchCCGet = class extends _classSuper {
1001
+ static { _classThis = this; }
1002
+ static {
1003
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1004
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1005
+ ColorSwitchCCGet = _classThis = _classDescriptor.value;
1006
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1007
+ __runInitializers(_classThis, _classExtraInitializers);
1008
+ }
1009
+ constructor(options) {
1010
+ super(options);
1011
+ this._colorComponent = options.colorComponent;
1012
+ }
1013
+ static from(raw, ctx) {
1014
+ validatePayload(raw.payload.length >= 1);
1015
+ const colorComponent = raw.payload[0];
1016
+ return new this({
1017
+ nodeId: ctx.sourceNodeId,
1018
+ colorComponent,
1019
+ });
937
1020
  }
938
- this._colorComponent = value;
939
- }
940
- serialize(ctx) {
941
- this.payload = Bytes.from([this._colorComponent]);
942
- return super.serialize(ctx);
943
- }
944
- toLogEntry(ctx) {
945
- return {
946
- ...super.toLogEntry(ctx),
947
- message: {
948
- "color component": getEnumMemberName(ColorComponent, this.colorComponent),
949
- },
950
- };
951
- }
952
- };
953
- ColorSwitchCCGet = ColorSwitchCCGet_1 = __decorate([
954
- CCCommand(ColorSwitchCommand.Get),
955
- expectedCCResponse(ColorSwitchCCReport, testResponseForColorSwitchGet)
956
- ], ColorSwitchCCGet);
957
- export { ColorSwitchCCGet };
958
- let ColorSwitchCCSet = ColorSwitchCCSet_1 = class ColorSwitchCCSet extends ColorSwitchCC {
959
- constructor(options) {
960
- super(options);
961
- // Populate properties from options object
962
- if ("hexColor" in options) {
963
- const match = hexColorRegex.exec(options.hexColor);
964
- if (!match) {
965
- throw new ZWaveError(`${options.hexColor} is not a valid HEX color string`, ZWaveErrorCodes.Argument_Invalid);
1021
+ _colorComponent;
1022
+ get colorComponent() {
1023
+ return this._colorComponent;
1024
+ }
1025
+ set colorComponent(value) {
1026
+ if (!ColorComponent[value]) {
1027
+ throw new ZWaveError("colorComponent must be a valid color component index.", ZWaveErrorCodes.Argument_Invalid);
966
1028
  }
967
- this.colorTable = {
968
- red: parseInt(match.groups.red, 16),
969
- green: parseInt(match.groups.green, 16),
970
- blue: parseInt(match.groups.blue, 16),
1029
+ this._colorComponent = value;
1030
+ }
1031
+ serialize(ctx) {
1032
+ this.payload = Bytes.from([this._colorComponent]);
1033
+ return super.serialize(ctx);
1034
+ }
1035
+ toLogEntry(ctx) {
1036
+ return {
1037
+ ...super.toLogEntry(ctx),
1038
+ message: {
1039
+ "color component": getEnumMemberName(ColorComponent, this.colorComponent),
1040
+ },
971
1041
  };
972
1042
  }
973
- else {
974
- this.colorTable = pick(options, colorTableKeys);
1043
+ };
1044
+ return ColorSwitchCCGet = _classThis;
1045
+ })();
1046
+ export { ColorSwitchCCGet };
1047
+ let ColorSwitchCCSet = (() => {
1048
+ let _classDecorators = [CCCommand(ColorSwitchCommand.Set), useSupervision()];
1049
+ let _classDescriptor;
1050
+ let _classExtraInitializers = [];
1051
+ let _classThis;
1052
+ let _classSuper = ColorSwitchCC;
1053
+ var ColorSwitchCCSet = class extends _classSuper {
1054
+ static { _classThis = this; }
1055
+ static {
1056
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1057
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1058
+ ColorSwitchCCSet = _classThis = _classDescriptor.value;
1059
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1060
+ __runInitializers(_classThis, _classExtraInitializers);
1061
+ }
1062
+ constructor(options) {
1063
+ super(options);
1064
+ // Populate properties from options object
1065
+ if ("hexColor" in options) {
1066
+ const match = hexColorRegex.exec(options.hexColor);
1067
+ if (!match) {
1068
+ throw new ZWaveError(`${options.hexColor} is not a valid HEX color string`, ZWaveErrorCodes.Argument_Invalid);
1069
+ }
1070
+ this.colorTable = {
1071
+ red: parseInt(match.groups.red, 16),
1072
+ green: parseInt(match.groups.green, 16),
1073
+ blue: parseInt(match.groups.blue, 16),
1074
+ };
1075
+ }
1076
+ else {
1077
+ this.colorTable = pick(options, colorTableKeys);
1078
+ }
1079
+ this.duration = Duration.from(options.duration);
1080
+ }
1081
+ static from(raw, ctx) {
1082
+ validatePayload(raw.payload.length >= 1);
1083
+ const populatedColorCount = raw.payload[0] & 0b11111;
1084
+ validatePayload(raw.payload.length >= 1 + populatedColorCount * 2);
1085
+ const colorTable = {};
1086
+ let offset = 1;
1087
+ for (let color = 0; color < populatedColorCount; color++) {
1088
+ const component = raw.payload[offset];
1089
+ const value = raw.payload[offset + 1];
1090
+ const key = colorComponentToTableKey(component);
1091
+ // @ts-expect-error
1092
+ if (key)
1093
+ this.colorTable[key] = value;
1094
+ offset += 2;
1095
+ }
1096
+ let duration;
1097
+ if (raw.payload.length > offset) {
1098
+ duration = Duration.parseSet(raw.payload[offset]);
1099
+ }
1100
+ return new this({
1101
+ nodeId: ctx.sourceNodeId,
1102
+ ...colorTable,
1103
+ duration,
1104
+ });
1105
+ }
1106
+ colorTable;
1107
+ duration;
1108
+ serialize(ctx) {
1109
+ const populatedColorCount = Object.keys(this.colorTable).length;
1110
+ this.payload = new Bytes(1 + populatedColorCount * 2 + 1);
1111
+ this.payload[0] = populatedColorCount & 0b11111;
1112
+ let i = 1;
1113
+ for (const [key, value] of Object.entries(this.colorTable)) {
1114
+ const component = colorTableKeyToComponent(key);
1115
+ this.payload[i] = component;
1116
+ this.payload[i + 1] = clamp(value, 0, 0xff);
1117
+ i += 2;
1118
+ }
1119
+ this.payload[i] = (this.duration ?? Duration.default()).serializeSet();
1120
+ const ccVersion = getEffectiveCCVersion(ctx, this);
1121
+ if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
1122
+ // When forcing CC version 1, omit the duration byte
1123
+ this.payload = this.payload.subarray(0, -1);
1124
+ }
1125
+ return super.serialize(ctx);
1126
+ }
1127
+ toLogEntry(ctx) {
1128
+ const message = {};
1129
+ for (const [key, value] of Object.entries(this.colorTable)) {
1130
+ const realKey = key in ColorComponentMap
1131
+ ? ColorComponent[ColorComponentMap[key]]
1132
+ : ColorComponent[key];
1133
+ message[realKey] = value;
1134
+ }
1135
+ if (this.duration != undefined) {
1136
+ message.duration = this.duration.toString();
1137
+ }
1138
+ return {
1139
+ ...super.toLogEntry(ctx),
1140
+ message,
1141
+ };
975
1142
  }
976
- this.duration = Duration.from(options.duration);
977
- }
978
- static from(raw, ctx) {
979
- validatePayload(raw.payload.length >= 1);
980
- const populatedColorCount = raw.payload[0] & 0b11111;
981
- validatePayload(raw.payload.length >= 1 + populatedColorCount * 2);
982
- const colorTable = {};
983
- let offset = 1;
984
- for (let color = 0; color < populatedColorCount; color++) {
985
- const component = raw.payload[offset];
986
- const value = raw.payload[offset + 1];
987
- const key = colorComponentToTableKey(component);
988
- // @ts-expect-error
989
- if (key)
990
- this.colorTable[key] = value;
991
- offset += 2;
992
- }
993
- let duration;
994
- if (raw.payload.length > offset) {
995
- duration = Duration.parseSet(raw.payload[offset]);
996
- }
997
- return new ColorSwitchCCSet_1({
998
- nodeId: ctx.sourceNodeId,
999
- ...colorTable,
1000
- duration,
1001
- });
1002
- }
1003
- colorTable;
1004
- duration;
1005
- serialize(ctx) {
1006
- const populatedColorCount = Object.keys(this.colorTable).length;
1007
- this.payload = new Bytes(1 + populatedColorCount * 2 + 1);
1008
- this.payload[0] = populatedColorCount & 0b11111;
1009
- let i = 1;
1010
- for (const [key, value] of Object.entries(this.colorTable)) {
1011
- const component = colorTableKeyToComponent(key);
1012
- this.payload[i] = component;
1013
- this.payload[i + 1] = clamp(value, 0, 0xff);
1014
- i += 2;
1015
- }
1016
- this.payload[i] = (this.duration ?? Duration.default()).serializeSet();
1017
- const ccVersion = getEffectiveCCVersion(ctx, this);
1018
- if (ccVersion < 2 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
1019
- // When forcing CC version 1, omit the duration byte
1020
- this.payload = this.payload.subarray(0, -1);
1021
- }
1022
- return super.serialize(ctx);
1023
- }
1024
- toLogEntry(ctx) {
1025
- const message = {};
1026
- for (const [key, value] of Object.entries(this.colorTable)) {
1027
- const realKey = key in ColorComponentMap
1028
- ? ColorComponent[ColorComponentMap[key]]
1029
- : ColorComponent[key];
1030
- message[realKey] = value;
1031
- }
1032
- if (this.duration != undefined) {
1033
- message.duration = this.duration.toString();
1034
- }
1035
- return {
1036
- ...super.toLogEntry(ctx),
1037
- message,
1038
- };
1039
- }
1040
- };
1041
- ColorSwitchCCSet = ColorSwitchCCSet_1 = __decorate([
1042
- CCCommand(ColorSwitchCommand.Set),
1043
- useSupervision()
1044
- ], ColorSwitchCCSet);
1143
+ };
1144
+ return ColorSwitchCCSet = _classThis;
1145
+ })();
1045
1146
  export { ColorSwitchCCSet };
1046
- let ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange_1 = class ColorSwitchCCStartLevelChange extends ColorSwitchCC {
1047
- constructor(options) {
1048
- super(options);
1049
- this.duration = Duration.from(options.duration);
1050
- this.ignoreStartLevel = options.ignoreStartLevel;
1051
- this.startLevel = options.startLevel ?? 0;
1052
- this.direction = options.direction;
1053
- this.colorComponent = options.colorComponent;
1054
- }
1055
- static from(raw, ctx) {
1056
- validatePayload(raw.payload.length >= 3);
1057
- const ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);
1058
- const direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)
1059
- ? "down"
1060
- : "up";
1061
- const colorComponent = raw.payload[1];
1062
- const startLevel = raw.payload[2];
1063
- let duration;
1064
- if (raw.payload.length >= 4) {
1065
- duration = Duration.parseSet(raw.payload[3]);
1066
- }
1067
- return new ColorSwitchCCStartLevelChange_1({
1068
- nodeId: ctx.sourceNodeId,
1069
- ignoreStartLevel,
1070
- direction,
1071
- colorComponent,
1072
- startLevel,
1073
- duration,
1074
- });
1075
- }
1076
- duration;
1077
- startLevel;
1078
- ignoreStartLevel;
1079
- direction;
1080
- colorComponent;
1081
- serialize(ctx) {
1082
- const controlByte = (LevelChangeDirection[this.direction] << 6)
1083
- | (this.ignoreStartLevel ? 0b0010_0000 : 0);
1084
- this.payload = Bytes.from([
1085
- controlByte,
1086
- this.colorComponent,
1087
- this.startLevel,
1088
- (this.duration ?? Duration.default()).serializeSet(),
1089
- ]);
1090
- const ccVersion = getEffectiveCCVersion(ctx, this);
1091
- if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
1092
- // When forcing CC version 1 or 2, omit the duration byte
1093
- this.payload = this.payload.subarray(0, -1);
1094
- }
1095
- return super.serialize(ctx);
1096
- }
1097
- toLogEntry(ctx) {
1098
- const message = {
1099
- "color component": getEnumMemberName(ColorComponent, this.colorComponent),
1100
- "start level": `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
1101
- direction: this.direction,
1102
- };
1103
- if (this.duration != undefined) {
1104
- message.duration = this.duration.toString();
1105
- }
1106
- return {
1107
- ...super.toLogEntry(ctx),
1108
- message,
1109
- };
1110
- }
1111
- };
1112
- ColorSwitchCCStartLevelChange = ColorSwitchCCStartLevelChange_1 = __decorate([
1113
- CCCommand(ColorSwitchCommand.StartLevelChange),
1114
- useSupervision()
1115
- ], ColorSwitchCCStartLevelChange);
1116
- export { ColorSwitchCCStartLevelChange };
1117
- let ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange_1 = class ColorSwitchCCStopLevelChange extends ColorSwitchCC {
1118
- constructor(options) {
1119
- super(options);
1120
- this.colorComponent = options.colorComponent;
1121
- }
1122
- static from(raw, ctx) {
1123
- validatePayload(raw.payload.length >= 1);
1124
- const colorComponent = raw.payload[0];
1125
- return new ColorSwitchCCStopLevelChange_1({
1126
- nodeId: ctx.sourceNodeId,
1127
- colorComponent,
1128
- });
1129
- }
1130
- colorComponent;
1131
- serialize(ctx) {
1132
- this.payload = Bytes.from([this.colorComponent]);
1133
- return super.serialize(ctx);
1134
- }
1135
- toLogEntry(ctx) {
1136
- return {
1137
- ...super.toLogEntry(ctx),
1138
- message: {
1147
+ let ColorSwitchCCStartLevelChange = (() => {
1148
+ let _classDecorators = [CCCommand(ColorSwitchCommand.StartLevelChange), useSupervision()];
1149
+ let _classDescriptor;
1150
+ let _classExtraInitializers = [];
1151
+ let _classThis;
1152
+ let _classSuper = ColorSwitchCC;
1153
+ var ColorSwitchCCStartLevelChange = class extends _classSuper {
1154
+ static { _classThis = this; }
1155
+ static {
1156
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1157
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1158
+ ColorSwitchCCStartLevelChange = _classThis = _classDescriptor.value;
1159
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1160
+ __runInitializers(_classThis, _classExtraInitializers);
1161
+ }
1162
+ constructor(options) {
1163
+ super(options);
1164
+ this.duration = Duration.from(options.duration);
1165
+ this.ignoreStartLevel = options.ignoreStartLevel;
1166
+ this.startLevel = options.startLevel ?? 0;
1167
+ this.direction = options.direction;
1168
+ this.colorComponent = options.colorComponent;
1169
+ }
1170
+ static from(raw, ctx) {
1171
+ validatePayload(raw.payload.length >= 3);
1172
+ const ignoreStartLevel = !!((raw.payload[0] & 0b0_0_1_00000) >>> 5);
1173
+ const direction = ((raw.payload[0] & 0b0_1_0_00000) >>> 6)
1174
+ ? "down"
1175
+ : "up";
1176
+ const colorComponent = raw.payload[1];
1177
+ const startLevel = raw.payload[2];
1178
+ let duration;
1179
+ if (raw.payload.length >= 4) {
1180
+ duration = Duration.parseSet(raw.payload[3]);
1181
+ }
1182
+ return new this({
1183
+ nodeId: ctx.sourceNodeId,
1184
+ ignoreStartLevel,
1185
+ direction,
1186
+ colorComponent,
1187
+ startLevel,
1188
+ duration,
1189
+ });
1190
+ }
1191
+ duration;
1192
+ startLevel;
1193
+ ignoreStartLevel;
1194
+ direction;
1195
+ colorComponent;
1196
+ serialize(ctx) {
1197
+ const controlByte = (LevelChangeDirection[this.direction] << 6)
1198
+ | (this.ignoreStartLevel ? 0b0010_0000 : 0);
1199
+ this.payload = Bytes.from([
1200
+ controlByte,
1201
+ this.colorComponent,
1202
+ this.startLevel,
1203
+ (this.duration ?? Duration.default()).serializeSet(),
1204
+ ]);
1205
+ const ccVersion = getEffectiveCCVersion(ctx, this);
1206
+ if (ccVersion < 3 && ctx.getDeviceConfig?.(this.nodeId)?.compat?.encodeCCsUsingTargetVersion) {
1207
+ // When forcing CC version 1 or 2, omit the duration byte
1208
+ this.payload = this.payload.subarray(0, -1);
1209
+ }
1210
+ return super.serialize(ctx);
1211
+ }
1212
+ toLogEntry(ctx) {
1213
+ const message = {
1139
1214
  "color component": getEnumMemberName(ColorComponent, this.colorComponent),
1140
- },
1141
- };
1142
- }
1143
- };
1144
- ColorSwitchCCStopLevelChange = ColorSwitchCCStopLevelChange_1 = __decorate([
1145
- CCCommand(ColorSwitchCommand.StopLevelChange),
1146
- useSupervision()
1147
- ], ColorSwitchCCStopLevelChange);
1215
+ "start level": `${this.startLevel}${this.ignoreStartLevel ? " (ignored)" : ""}`,
1216
+ direction: this.direction,
1217
+ };
1218
+ if (this.duration != undefined) {
1219
+ message.duration = this.duration.toString();
1220
+ }
1221
+ return {
1222
+ ...super.toLogEntry(ctx),
1223
+ message,
1224
+ };
1225
+ }
1226
+ };
1227
+ return ColorSwitchCCStartLevelChange = _classThis;
1228
+ })();
1229
+ export { ColorSwitchCCStartLevelChange };
1230
+ let ColorSwitchCCStopLevelChange = (() => {
1231
+ let _classDecorators = [CCCommand(ColorSwitchCommand.StopLevelChange), useSupervision()];
1232
+ let _classDescriptor;
1233
+ let _classExtraInitializers = [];
1234
+ let _classThis;
1235
+ let _classSuper = ColorSwitchCC;
1236
+ var ColorSwitchCCStopLevelChange = class extends _classSuper {
1237
+ static { _classThis = this; }
1238
+ static {
1239
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1240
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1241
+ ColorSwitchCCStopLevelChange = _classThis = _classDescriptor.value;
1242
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1243
+ __runInitializers(_classThis, _classExtraInitializers);
1244
+ }
1245
+ constructor(options) {
1246
+ super(options);
1247
+ this.colorComponent = options.colorComponent;
1248
+ }
1249
+ static from(raw, ctx) {
1250
+ validatePayload(raw.payload.length >= 1);
1251
+ const colorComponent = raw.payload[0];
1252
+ return new this({
1253
+ nodeId: ctx.sourceNodeId,
1254
+ colorComponent,
1255
+ });
1256
+ }
1257
+ colorComponent;
1258
+ serialize(ctx) {
1259
+ this.payload = Bytes.from([this.colorComponent]);
1260
+ return super.serialize(ctx);
1261
+ }
1262
+ toLogEntry(ctx) {
1263
+ return {
1264
+ ...super.toLogEntry(ctx),
1265
+ message: {
1266
+ "color component": getEnumMemberName(ColorComponent, this.colorComponent),
1267
+ },
1268
+ };
1269
+ }
1270
+ };
1271
+ return ColorSwitchCCStopLevelChange = _classThis;
1272
+ })();
1148
1273
  export { ColorSwitchCCStopLevelChange };
1149
1274
  //# sourceMappingURL=ColorSwitchCC.js.map