@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 UserCodeCC_1, UserCodeCCSet_1, UserCodeCCReport_1, UserCodeCCGet_1, UserCodeCCUsersNumberReport_1, UserCodeCCCapabilitiesReport_1, UserCodeCCKeypadModeSet_1, UserCodeCCKeypadModeReport_1, UserCodeCCAdminCodeSet_1, UserCodeCCAdminCodeReport_1, UserCodeCCUserCodeChecksumReport_1, UserCodeCCExtendedUserCodeReport_1;
8
35
  function __assertType(argName, typeName, boundHasError) {
9
36
  const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
10
37
  if (boundHasError()) {
@@ -248,7 +275,7 @@ import { Bytes, isUint8Array, uint8ArrayToString } from "@zwave-js/shared/safe";
248
275
  import { getEnumMemberName, isPrintableASCII, isPrintableASCIIWithWhitespace, num2hex, pick, } from "@zwave-js/shared/safe";
249
276
  import { CCAPI, POLL_VALUE, PhysicalCCAPI, SET_VALUE, throwMissingPropertyKey, throwUnsupportedProperty, throwUnsupportedPropertyKey, throwWrongValueType, } from "../lib/API.js";
250
277
  import { CommandClass, getEffectiveCCVersion, } from "../lib/CommandClass.js";
251
- import { API, CCCommand, ccValue, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
278
+ import { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from "../lib/CommandClassDecorators.js";
252
279
  import { V } from "../lib/Values.js";
253
280
  import { KeypadMode, UserCodeCommand, UserIDStatus } from "../lib/_Types.js";
254
281
  export const UserCodeCCValues = Object.freeze({
@@ -391,1305 +418,1516 @@ export function userCodeToLogString(userCode) {
391
418
  return "(empty)";
392
419
  return "*".repeat(userCode.length);
393
420
  }
394
- let UserCodeCCAPI = class UserCodeCCAPI extends PhysicalCCAPI {
395
- supportsCommand(cmd) {
396
- switch (cmd) {
397
- case UserCodeCommand.Get:
398
- case UserCodeCommand.Set:
399
- case UserCodeCommand.UsersNumberGet:
400
- return true; // This is mandatory
401
- case UserCodeCommand.CapabilitiesGet:
402
- case UserCodeCommand.KeypadModeSet:
403
- case UserCodeCommand.KeypadModeGet:
404
- case UserCodeCommand.ExtendedUserCodeSet:
405
- case UserCodeCommand.ExtendedUserCodeGet:
406
- return this.version >= 2;
407
- case UserCodeCommand.AdminCodeSet:
408
- case UserCodeCommand.AdminCodeGet: {
409
- if (this.version < 2)
410
- return false;
411
- return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsAdminCode.endpoint(this.endpoint.index));
412
- }
413
- case UserCodeCommand.UserCodeChecksumGet: {
414
- if (this.version < 2)
415
- return false;
416
- return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsUserCodeChecksum.endpoint(this.endpoint.index));
417
- }
421
+ let UserCodeCCAPI = (() => {
422
+ let _classDecorators = [API(CommandClasses["User Code"])];
423
+ let _classDescriptor;
424
+ let _classExtraInitializers = [];
425
+ let _classThis;
426
+ let _classSuper = PhysicalCCAPI;
427
+ var UserCodeCCAPI = class extends _classSuper {
428
+ static { _classThis = this; }
429
+ static {
430
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
431
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
432
+ UserCodeCCAPI = _classThis = _classDescriptor.value;
433
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
434
+ __runInitializers(_classThis, _classExtraInitializers);
418
435
  }
419
- return super.supportsCommand(cmd);
420
- }
421
- get [SET_VALUE]() {
422
- return async function ({ property, propertyKey }, value) {
423
- let result;
424
- if (property === "keypadMode") {
425
- if (typeof value !== "number") {
426
- throwWrongValueType(this.ccId, property, "number", typeof value);
436
+ supportsCommand(cmd) {
437
+ switch (cmd) {
438
+ case UserCodeCommand.Get:
439
+ case UserCodeCommand.Set:
440
+ case UserCodeCommand.UsersNumberGet:
441
+ return true; // This is mandatory
442
+ case UserCodeCommand.CapabilitiesGet:
443
+ case UserCodeCommand.KeypadModeSet:
444
+ case UserCodeCommand.KeypadModeGet:
445
+ case UserCodeCommand.ExtendedUserCodeSet:
446
+ case UserCodeCommand.ExtendedUserCodeGet:
447
+ return this.version >= 2;
448
+ case UserCodeCommand.AdminCodeSet:
449
+ case UserCodeCommand.AdminCodeGet: {
450
+ if (this.version < 2)
451
+ return false;
452
+ return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsAdminCode.endpoint(this.endpoint.index));
427
453
  }
428
- result = await this.setKeypadMode(value);
429
- }
430
- else if (property === "adminCode"
431
- // Support devices that were interviewed before the rename to adminCode
432
- || property === "masterCode") {
433
- if (typeof value !== "string") {
434
- throwWrongValueType(this.ccId, property, "string", typeof value);
454
+ case UserCodeCommand.UserCodeChecksumGet: {
455
+ if (this.version < 2)
456
+ return false;
457
+ return this.tryGetValueDB()?.getValue(UserCodeCCValues.supportsUserCodeChecksum.endpoint(this.endpoint.index));
435
458
  }
436
- result = await this.setAdminCode(value);
437
459
  }
438
- else if (property === "userIdStatus") {
439
- if (propertyKey == undefined) {
440
- throwMissingPropertyKey(this.ccId, property);
460
+ return super.supportsCommand(cmd);
461
+ }
462
+ get [SET_VALUE]() {
463
+ return async function ({ property, propertyKey }, value) {
464
+ let result;
465
+ if (property === "keypadMode") {
466
+ if (typeof value !== "number") {
467
+ throwWrongValueType(this.ccId, property, "number", typeof value);
468
+ }
469
+ result = await this.setKeypadMode(value);
441
470
  }
442
- else if (typeof propertyKey !== "number") {
443
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
471
+ else if (property === "adminCode"
472
+ // Support devices that were interviewed before the rename to adminCode
473
+ || property === "masterCode") {
474
+ if (typeof value !== "string") {
475
+ throwWrongValueType(this.ccId, property, "string", typeof value);
476
+ }
477
+ result = await this.setAdminCode(value);
444
478
  }
445
- if (typeof value !== "number") {
446
- throwWrongValueType(this.ccId, property, "number", typeof value);
479
+ else if (property === "userIdStatus") {
480
+ if (propertyKey == undefined) {
481
+ throwMissingPropertyKey(this.ccId, property);
482
+ }
483
+ else if (typeof propertyKey !== "number") {
484
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
485
+ }
486
+ if (typeof value !== "number") {
487
+ throwWrongValueType(this.ccId, property, "number", typeof value);
488
+ }
489
+ if (value === UserIDStatus.Available) {
490
+ // Clear Code
491
+ result = await this.clear(propertyKey);
492
+ }
493
+ else {
494
+ // We need to set the user code along with the status
495
+ const userCode = this.getValueDB().getValue(UserCodeCCValues.userCode(propertyKey).endpoint(this.endpoint.index));
496
+ result = await this.set(propertyKey, value, userCode);
497
+ }
447
498
  }
448
- if (value === UserIDStatus.Available) {
449
- // Clear Code
450
- result = await this.clear(propertyKey);
499
+ else if (property === "userCode") {
500
+ if (propertyKey == undefined) {
501
+ throwMissingPropertyKey(this.ccId, property);
502
+ }
503
+ else if (typeof propertyKey !== "number") {
504
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
505
+ }
506
+ if (typeof value !== "string" && !isUint8Array(value)) {
507
+ throwWrongValueType(this.ccId, property, "string or Buffer", typeof value);
508
+ }
509
+ // We need to set the user id status along with the code
510
+ let userIdStatus = this.getValueDB().getValue(UserCodeCCValues.userIdStatus(propertyKey).endpoint(this.endpoint.index));
511
+ if (userIdStatus === UserIDStatus.Available
512
+ || userIdStatus == undefined) {
513
+ userIdStatus = UserIDStatus.Enabled;
514
+ }
515
+ result = await this.set(propertyKey, userIdStatus, value);
451
516
  }
452
517
  else {
453
- // We need to set the user code along with the status
454
- const userCode = this.getValueDB().getValue(UserCodeCCValues.userCode(propertyKey).endpoint(this.endpoint.index));
455
- result = await this.set(propertyKey, value, userCode);
518
+ throwUnsupportedProperty(this.ccId, property);
456
519
  }
457
- }
458
- else if (property === "userCode") {
459
- if (propertyKey == undefined) {
460
- throwMissingPropertyKey(this.ccId, property);
520
+ // Verify the change after a short delay, unless the command was supervised and successful
521
+ if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {
522
+ this.schedulePoll({ property, propertyKey }, value, {
523
+ transition: "fast",
524
+ });
461
525
  }
462
- else if (typeof propertyKey !== "number") {
463
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
526
+ return result;
527
+ };
528
+ }
529
+ get [POLL_VALUE]() {
530
+ return async function ({ property, propertyKey }) {
531
+ switch (property) {
532
+ case "keypadMode":
533
+ return this.getKeypadMode();
534
+ case "adminCode":
535
+ return this.getAdminCode();
536
+ case "userIdStatus":
537
+ case "userCode": {
538
+ if (propertyKey == undefined) {
539
+ throwMissingPropertyKey(this.ccId, property);
540
+ }
541
+ else if (typeof propertyKey !== "number") {
542
+ throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
543
+ }
544
+ return (await this.get(propertyKey))?.[property];
545
+ }
546
+ default:
547
+ throwUnsupportedProperty(this.ccId, property);
548
+ }
549
+ };
550
+ }
551
+ async getUsersCount() {
552
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UsersNumberGet);
553
+ const cc = new UserCodeCCUsersNumberGet({
554
+ nodeId: this.endpoint.nodeId,
555
+ endpointIndex: this.endpoint.index,
556
+ });
557
+ const response = await this.host.sendCommand(cc, this.commandOptions);
558
+ return response?.supportedUsers;
559
+ }
560
+ async get(userId, multiple = false) {
561
+ __assertType("userId", "number", __assertType__number.bind(void 0, userId));
562
+ __assertType("multiple", "(optional) boolean", __assertType__optional_boolean.bind(void 0, multiple));
563
+ if (userId > 255 || multiple) {
564
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeGet);
565
+ const cc = new UserCodeCCExtendedUserCodeGet({
566
+ nodeId: this.endpoint.nodeId,
567
+ endpointIndex: this.endpoint.index,
568
+ userId,
569
+ reportMore: multiple,
570
+ });
571
+ const response = await this.host.sendCommand(cc, this.commandOptions);
572
+ if (!response) {
573
+ return;
464
574
  }
465
- if (typeof value !== "string" && !isUint8Array(value)) {
466
- throwWrongValueType(this.ccId, property, "string or Buffer", typeof value);
575
+ else if (multiple) {
576
+ return pick(response, ["userCodes", "nextUserId"]);
467
577
  }
468
- // We need to set the user id status along with the code
469
- let userIdStatus = this.getValueDB().getValue(UserCodeCCValues.userIdStatus(propertyKey).endpoint(this.endpoint.index));
470
- if (userIdStatus === UserIDStatus.Available
471
- || userIdStatus == undefined) {
472
- userIdStatus = UserIDStatus.Enabled;
578
+ else {
579
+ return pick(response.userCodes[0], [
580
+ "userIdStatus",
581
+ "userCode",
582
+ ]);
473
583
  }
474
- result = await this.set(propertyKey, userIdStatus, value);
475
584
  }
476
585
  else {
477
- throwUnsupportedProperty(this.ccId, property);
478
- }
479
- // Verify the change after a short delay, unless the command was supervised and successful
480
- if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {
481
- this.schedulePoll({ property, propertyKey }, value, {
482
- transition: "fast",
586
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Get);
587
+ const cc = new UserCodeCCGet({
588
+ nodeId: this.endpoint.nodeId,
589
+ endpointIndex: this.endpoint.index,
590
+ userId,
483
591
  });
592
+ const response = await this.host.sendCommand(cc, this.commandOptions);
593
+ if (response)
594
+ return pick(response, ["userIdStatus", "userCode"]);
484
595
  }
485
- return result;
486
- };
487
- }
488
- get [POLL_VALUE]() {
489
- return async function ({ property, propertyKey }) {
490
- switch (property) {
491
- case "keypadMode":
492
- return this.getKeypadMode();
493
- case "adminCode":
494
- return this.getAdminCode();
495
- case "userIdStatus":
496
- case "userCode": {
497
- if (propertyKey == undefined) {
498
- throwMissingPropertyKey(this.ccId, property);
499
- }
500
- else if (typeof propertyKey !== "number") {
501
- throwUnsupportedPropertyKey(this.ccId, property, propertyKey);
502
- }
503
- return (await this.get(propertyKey))?.[property];
504
- }
505
- default:
506
- throwUnsupportedProperty(this.ccId, property);
596
+ }
597
+ /** Configures a single user code */
598
+ async set(userId, userIdStatus, userCode) {
599
+ __assertType("userId", "number", __assertType__number.bind(void 0, userId));
600
+ __assertType("userIdStatus", undefined, __assertType__su__1__2__3__4_eu.bind(void 0, userIdStatus));
601
+ __assertType("userCode", undefined, __assertType__su__string__uint8array_eu.bind(void 0, userCode));
602
+ if (userId > 255) {
603
+ return this.setMany([{ userId, userIdStatus, userCode }]);
507
604
  }
508
- };
509
- }
510
- async getUsersCount() {
511
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UsersNumberGet);
512
- const cc = new UserCodeCCUsersNumberGet({
513
- nodeId: this.endpoint.nodeId,
514
- endpointIndex: this.endpoint.index,
515
- });
516
- const response = await this.host.sendCommand(cc, this.commandOptions);
517
- return response?.supportedUsers;
518
- }
519
- async get(userId, multiple = false) {
520
- __assertType("userId", "number", __assertType__number.bind(void 0, userId));
521
- __assertType("multiple", "(optional) boolean", __assertType__optional_boolean.bind(void 0, multiple));
522
- if (userId > 255 || multiple) {
523
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeGet);
524
- const cc = new UserCodeCCExtendedUserCodeGet({
605
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
606
+ const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
607
+ if (numUsers != undefined && userId > numUsers) {
608
+ throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
609
+ }
610
+ const cc = new UserCodeCCSet({
525
611
  nodeId: this.endpoint.nodeId,
526
612
  endpointIndex: this.endpoint.index,
527
613
  userId,
528
- reportMore: multiple,
614
+ userIdStatus,
615
+ userCode,
529
616
  });
530
- const response = await this.host.sendCommand(cc, this.commandOptions);
531
- if (!response) {
532
- return;
617
+ return this.host.sendCommand(cc, this.commandOptions);
618
+ }
619
+ /** Configures multiple user codes */
620
+ async setMany(codes) {
621
+ __assertType("codes", undefined, __assertType__sa_su__3__4__5_eu_ea_2.bind(void 0, codes));
622
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeSet);
623
+ const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
624
+ const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.host, this.endpoint);
625
+ const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
626
+ const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.host, this.endpoint) ?? false;
627
+ // Validate options
628
+ if (numUsers != undefined) {
629
+ if (codes.some((code) => code.userId < 0 || code.userId > numUsers)) {
630
+ throw new ZWaveError(`All User IDs must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
631
+ }
632
+ }
633
+ else {
634
+ if (codes.some((code) => code.userId < 0)) {
635
+ throw new ZWaveError(`All User IDs must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
636
+ }
637
+ }
638
+ if (codes.some((code) => code.userId === 0) && codes.length > 1) {
639
+ throw new ZWaveError(`If user ID 0 is used, only one code may be set`, ZWaveErrorCodes.Argument_Invalid);
533
640
  }
534
- else if (multiple) {
535
- return pick(response, ["userCodes", "nextUserId"]);
641
+ else if (codes.some((code) => code.userId === 0
642
+ && code.userIdStatus !== UserIDStatus.Available)) {
643
+ throw new ZWaveError(`User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
644
+ }
645
+ else if (codes.length > 1 && !supportsMultipleUserCodeSet) {
646
+ throw new ZWaveError(`The node does not support setting multiple user codes at once`, ZWaveErrorCodes.Argument_Invalid);
647
+ }
648
+ for (const code of codes) {
649
+ if (supportedStatuses != undefined
650
+ && !supportedStatuses.includes(code.userIdStatus)) {
651
+ throw new ZWaveError(`The user ID status ${getEnumMemberName(UserIDStatus, code.userIdStatus)} is not supported by the node`, ZWaveErrorCodes.Argument_Invalid);
652
+ }
653
+ else if (code.userIdStatus === UserIDStatus.Available) {
654
+ code.userCode = undefined;
655
+ }
656
+ else if (supportedASCIIChars) {
657
+ const userCodeString = typeof code.userCode === "string"
658
+ ? code.userCode
659
+ : uint8ArrayToString(code.userCode);
660
+ if (!validateCode(userCodeString, supportedASCIIChars)) {
661
+ throw new ZWaveError(`The user code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
662
+ }
663
+ }
664
+ }
665
+ const cc = new UserCodeCCExtendedUserCodeSet({
666
+ nodeId: this.endpoint.nodeId,
667
+ endpointIndex: this.endpoint.index,
668
+ userCodes: codes,
669
+ });
670
+ return this.host.sendCommand(cc, this.commandOptions);
671
+ }
672
+ /**
673
+ * Clears one or all user code
674
+ * @param userId The user code to clear. If none or 0 is given, all codes are cleared
675
+ */
676
+ async clear(userId = 0) {
677
+ __assertType("userId", "(optional) number", __assertType__optional_number.bind(void 0, userId));
678
+ if (this.version > 1 || userId > 255) {
679
+ return this.setMany([
680
+ { userId, userIdStatus: UserIDStatus.Available },
681
+ ]);
536
682
  }
537
683
  else {
538
- return pick(response.userCodes[0], [
539
- "userIdStatus",
540
- "userCode",
684
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
685
+ const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
686
+ if (numUsers != undefined && userId > numUsers) {
687
+ throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
688
+ }
689
+ const cc = new UserCodeCCSet({
690
+ nodeId: this.endpoint.nodeId,
691
+ endpointIndex: this.endpoint.index,
692
+ userId,
693
+ userIdStatus: UserIDStatus.Available,
694
+ });
695
+ return this.host.sendCommand(cc, this.commandOptions);
696
+ }
697
+ }
698
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
699
+ async getCapabilities() {
700
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.CapabilitiesGet);
701
+ const cc = new UserCodeCCCapabilitiesGet({
702
+ nodeId: this.endpoint.nodeId,
703
+ endpointIndex: this.endpoint.index,
704
+ });
705
+ const response = await this.host.sendCommand(cc, this.commandOptions);
706
+ if (response) {
707
+ return pick(response, [
708
+ "supportsAdminCode",
709
+ "supportsAdminCodeDeactivation",
710
+ "supportsUserCodeChecksum",
711
+ "supportsMultipleUserCodeReport",
712
+ "supportsMultipleUserCodeSet",
713
+ "supportedUserIDStatuses",
714
+ "supportedKeypadModes",
715
+ "supportedASCIIChars",
541
716
  ]);
542
717
  }
543
718
  }
544
- else {
545
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Get);
546
- const cc = new UserCodeCCGet({
719
+ async getKeypadMode() {
720
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeGet);
721
+ const cc = new UserCodeCCKeypadModeGet({
547
722
  nodeId: this.endpoint.nodeId,
548
723
  endpointIndex: this.endpoint.index,
549
- userId,
550
724
  });
551
725
  const response = await this.host.sendCommand(cc, this.commandOptions);
552
- if (response)
553
- return pick(response, ["userIdStatus", "userCode"]);
726
+ return response?.keypadMode;
554
727
  }
555
- }
556
- /** Configures a single user code */
557
- async set(userId, userIdStatus, userCode) {
558
- __assertType("userId", "number", __assertType__number.bind(void 0, userId));
559
- __assertType("userIdStatus", undefined, __assertType__su__1__2__3__4_eu.bind(void 0, userIdStatus));
560
- __assertType("userCode", undefined, __assertType__su__string__uint8array_eu.bind(void 0, userCode));
561
- if (userId > 255) {
562
- return this.setMany([{ userId, userIdStatus, userCode }]);
563
- }
564
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
565
- const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
566
- if (numUsers != undefined && userId > numUsers) {
567
- throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
568
- }
569
- const cc = new UserCodeCCSet({
570
- nodeId: this.endpoint.nodeId,
571
- endpointIndex: this.endpoint.index,
572
- userId,
573
- userIdStatus,
574
- userCode,
575
- });
576
- return this.host.sendCommand(cc, this.commandOptions);
577
- }
578
- /** Configures multiple user codes */
579
- async setMany(codes) {
580
- __assertType("codes", undefined, __assertType__sa_su__3__4__5_eu_ea_2.bind(void 0, codes));
581
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.ExtendedUserCodeSet);
582
- const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
583
- const supportedStatuses = UserCodeCC.getSupportedUserIDStatusesCached(this.host, this.endpoint);
584
- const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
585
- const supportsMultipleUserCodeSet = UserCodeCC.supportsMultipleUserCodeSetCached(this.host, this.endpoint) ?? false;
586
- // Validate options
587
- if (numUsers != undefined) {
588
- if (codes.some((code) => code.userId < 0 || code.userId > numUsers)) {
589
- throw new ZWaveError(`All User IDs must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
728
+ async setKeypadMode(keypadMode) {
729
+ __assertType("keypadMode", "KeypadMode", __assertType__KeypadMode.bind(void 0, keypadMode));
730
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeSet);
731
+ const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.host, this.endpoint);
732
+ if (!supportedModes) {
733
+ throw new ZWaveError(`The keypad mode can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
590
734
  }
591
- }
592
- else {
593
- if (codes.some((code) => code.userId < 0)) {
594
- throw new ZWaveError(`All User IDs must be greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
735
+ else if (!supportedModes.includes(keypadMode)) {
736
+ throw new ZWaveError(`The keypad mode ${getEnumMemberName(KeypadMode, keypadMode)} is not supported by the node!`, ZWaveErrorCodes.Argument_Invalid);
595
737
  }
738
+ const cc = new UserCodeCCKeypadModeSet({
739
+ nodeId: this.endpoint.nodeId,
740
+ endpointIndex: this.endpoint.index,
741
+ keypadMode,
742
+ });
743
+ return this.host.sendCommand(cc, this.commandOptions);
596
744
  }
597
- if (codes.some((code) => code.userId === 0) && codes.length > 1) {
598
- throw new ZWaveError(`If user ID 0 is used, only one code may be set`, ZWaveErrorCodes.Argument_Invalid);
599
- }
600
- else if (codes.some((code) => code.userId === 0
601
- && code.userIdStatus !== UserIDStatus.Available)) {
602
- throw new ZWaveError(`User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
603
- }
604
- else if (codes.length > 1 && !supportsMultipleUserCodeSet) {
605
- throw new ZWaveError(`The node does not support setting multiple user codes at once`, ZWaveErrorCodes.Argument_Invalid);
745
+ async getAdminCode() {
746
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeGet);
747
+ const cc = new UserCodeCCAdminCodeGet({
748
+ nodeId: this.endpoint.nodeId,
749
+ endpointIndex: this.endpoint.index,
750
+ });
751
+ const response = await this.host.sendCommand(cc, this.commandOptions);
752
+ return response?.adminCode;
606
753
  }
607
- for (const code of codes) {
608
- if (supportedStatuses != undefined
609
- && !supportedStatuses.includes(code.userIdStatus)) {
610
- throw new ZWaveError(`The user ID status ${getEnumMemberName(UserIDStatus, code.userIdStatus)} is not supported by the node`, ZWaveErrorCodes.Argument_Invalid);
754
+ async setAdminCode(adminCode) {
755
+ __assertType("adminCode", "string", __assertType__string.bind(void 0, adminCode));
756
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeSet);
757
+ const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
758
+ if (!supportedASCIIChars) {
759
+ throw new ZWaveError(`The admin code can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
611
760
  }
612
- else if (code.userIdStatus === UserIDStatus.Available) {
613
- code.userCode = undefined;
614
- }
615
- else if (supportedASCIIChars) {
616
- const userCodeString = typeof code.userCode === "string"
617
- ? code.userCode
618
- : uint8ArrayToString(code.userCode);
619
- if (!validateCode(userCodeString, supportedASCIIChars)) {
620
- throw new ZWaveError(`The user code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
761
+ // Validate the code
762
+ if (!adminCode) {
763
+ const supportsDeactivation = UserCodeCC
764
+ .supportsAdminCodeDeactivationCached(this.host, this.endpoint);
765
+ if (!supportsDeactivation) {
766
+ throw new ZWaveError(`The node does not support deactivating the admin code!`, ZWaveErrorCodes.Argument_Invalid);
621
767
  }
622
768
  }
623
- }
624
- const cc = new UserCodeCCExtendedUserCodeSet({
625
- nodeId: this.endpoint.nodeId,
626
- endpointIndex: this.endpoint.index,
627
- userCodes: codes,
628
- });
629
- return this.host.sendCommand(cc, this.commandOptions);
630
- }
631
- /**
632
- * Clears one or all user code
633
- * @param userId The user code to clear. If none or 0 is given, all codes are cleared
634
- */
635
- async clear(userId = 0) {
636
- __assertType("userId", "(optional) number", __assertType__optional_number.bind(void 0, userId));
637
- if (this.version > 1 || userId > 255) {
638
- return this.setMany([
639
- { userId, userIdStatus: UserIDStatus.Available },
640
- ]);
641
- }
642
- else {
643
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.Set);
644
- const numUsers = UserCodeCC.getSupportedUsersCached(this.host, this.endpoint);
645
- if (numUsers != undefined && userId > numUsers) {
646
- throw new ZWaveError(`The user ID must be between 0 and the number of supported users ${numUsers}.`, ZWaveErrorCodes.Argument_Invalid);
769
+ else if (!validateCode(adminCode, supportedASCIIChars)) {
770
+ throw new ZWaveError(`The admin code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
647
771
  }
648
- const cc = new UserCodeCCSet({
772
+ const cc = new UserCodeCCAdminCodeSet({
649
773
  nodeId: this.endpoint.nodeId,
650
774
  endpointIndex: this.endpoint.index,
651
- userId,
652
- userIdStatus: UserIDStatus.Available,
775
+ adminCode,
653
776
  });
654
777
  return this.host.sendCommand(cc, this.commandOptions);
655
778
  }
656
- }
657
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
658
- async getCapabilities() {
659
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.CapabilitiesGet);
660
- const cc = new UserCodeCCCapabilitiesGet({
661
- nodeId: this.endpoint.nodeId,
662
- endpointIndex: this.endpoint.index,
663
- });
664
- const response = await this.host.sendCommand(cc, this.commandOptions);
665
- if (response) {
666
- return pick(response, [
667
- "supportsAdminCode",
668
- "supportsAdminCodeDeactivation",
669
- "supportsUserCodeChecksum",
670
- "supportsMultipleUserCodeReport",
671
- "supportsMultipleUserCodeSet",
672
- "supportedUserIDStatuses",
673
- "supportedKeypadModes",
674
- "supportedASCIIChars",
675
- ]);
676
- }
677
- }
678
- async getKeypadMode() {
679
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeGet);
680
- const cc = new UserCodeCCKeypadModeGet({
681
- nodeId: this.endpoint.nodeId,
682
- endpointIndex: this.endpoint.index,
683
- });
684
- const response = await this.host.sendCommand(cc, this.commandOptions);
685
- return response?.keypadMode;
686
- }
687
- async setKeypadMode(keypadMode) {
688
- __assertType("keypadMode", "KeypadMode", __assertType__KeypadMode.bind(void 0, keypadMode));
689
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.KeypadModeSet);
690
- const supportedModes = UserCodeCC.getSupportedKeypadModesCached(this.host, this.endpoint);
691
- if (!supportedModes) {
692
- throw new ZWaveError(`The keypad mode can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
693
- }
694
- else if (!supportedModes.includes(keypadMode)) {
695
- throw new ZWaveError(`The keypad mode ${getEnumMemberName(KeypadMode, keypadMode)} is not supported by the node!`, ZWaveErrorCodes.Argument_Invalid);
696
- }
697
- const cc = new UserCodeCCKeypadModeSet({
698
- nodeId: this.endpoint.nodeId,
699
- endpointIndex: this.endpoint.index,
700
- keypadMode,
701
- });
702
- return this.host.sendCommand(cc, this.commandOptions);
703
- }
704
- async getAdminCode() {
705
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeGet);
706
- const cc = new UserCodeCCAdminCodeGet({
707
- nodeId: this.endpoint.nodeId,
708
- endpointIndex: this.endpoint.index,
709
- });
710
- const response = await this.host.sendCommand(cc, this.commandOptions);
711
- return response?.adminCode;
712
- }
713
- async setAdminCode(adminCode) {
714
- __assertType("adminCode", "string", __assertType__string.bind(void 0, adminCode));
715
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.AdminCodeSet);
716
- const supportedASCIIChars = UserCodeCC.getSupportedASCIICharsCached(this.host, this.endpoint);
717
- if (!supportedASCIIChars) {
718
- throw new ZWaveError(`The admin code can only be set after the interview is complete!`, ZWaveErrorCodes.Argument_Invalid);
719
- }
720
- // Validate the code
721
- if (!adminCode) {
722
- const supportsDeactivation = UserCodeCC
723
- .supportsAdminCodeDeactivationCached(this.host, this.endpoint);
724
- if (!supportsDeactivation) {
725
- throw new ZWaveError(`The node does not support deactivating the admin code!`, ZWaveErrorCodes.Argument_Invalid);
726
- }
727
- }
728
- else if (!validateCode(adminCode, supportedASCIIChars)) {
729
- throw new ZWaveError(`The admin code must consist of 4 to 10 of the following characters: ${supportedASCIIChars}`, ZWaveErrorCodes.Argument_Invalid);
779
+ async getUserCodeChecksum() {
780
+ this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UserCodeChecksumGet);
781
+ const cc = new UserCodeCCUserCodeChecksumGet({
782
+ nodeId: this.endpoint.nodeId,
783
+ endpointIndex: this.endpoint.index,
784
+ });
785
+ const response = await this.host.sendCommand(cc, this.commandOptions);
786
+ return response?.userCodeChecksum;
730
787
  }
731
- const cc = new UserCodeCCAdminCodeSet({
732
- nodeId: this.endpoint.nodeId,
733
- endpointIndex: this.endpoint.index,
734
- adminCode,
735
- });
736
- return this.host.sendCommand(cc, this.commandOptions);
737
- }
738
- async getUserCodeChecksum() {
739
- this.assertSupportsCommand(UserCodeCommand, UserCodeCommand.UserCodeChecksumGet);
740
- const cc = new UserCodeCCUserCodeChecksumGet({
741
- nodeId: this.endpoint.nodeId,
742
- endpointIndex: this.endpoint.index,
743
- });
744
- const response = await this.host.sendCommand(cc, this.commandOptions);
745
- return response?.userCodeChecksum;
746
- }
747
- };
748
- UserCodeCCAPI = __decorate([
749
- API(CommandClasses["User Code"])
750
- ], UserCodeCCAPI);
788
+ };
789
+ return UserCodeCCAPI = _classThis;
790
+ })();
751
791
  export { UserCodeCCAPI };
752
- let UserCodeCC = UserCodeCC_1 = class UserCodeCC extends CommandClass {
753
- async interview(ctx) {
754
- const node = this.getNode(ctx);
755
- const endpoint = this.getEndpoint(ctx);
756
- const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
757
- priority: MessagePriority.NodeQuery,
758
- });
759
- ctx.logNode(node.id, {
760
- endpoint: this.endpointIndex,
761
- message: `Interviewing ${this.ccName}...`,
762
- direction: "none",
763
- });
764
- // Query capabilities first to determine what needs to be done when refreshing
765
- if (api.version >= 2) {
766
- ctx.logNode(node.id, {
767
- message: "querying capabilities...",
768
- direction: "outbound",
769
- });
770
- const caps = await api.getCapabilities();
771
- if (!caps) {
772
- ctx.logNode(node.id, {
773
- endpoint: this.endpointIndex,
774
- message: "User Code capabilities query timed out, skipping interview...",
775
- level: "warn",
776
- });
777
- return;
778
- }
792
+ let UserCodeCC = (() => {
793
+ let _classDecorators = [commandClass(CommandClasses["User Code"]), implementedVersion(2), ccValues(UserCodeCCValues)];
794
+ let _classDescriptor;
795
+ let _classExtraInitializers = [];
796
+ let _classThis;
797
+ let _classSuper = CommandClass;
798
+ var UserCodeCC = class extends _classSuper {
799
+ static { _classThis = this; }
800
+ static {
801
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
802
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
803
+ UserCodeCC = _classThis = _classDescriptor.value;
804
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
805
+ __runInitializers(_classThis, _classExtraInitializers);
779
806
  }
780
- ctx.logNode(node.id, {
781
- message: "querying number of user codes...",
782
- direction: "outbound",
783
- });
784
- const supportedUsers = await api.getUsersCount();
785
- if (supportedUsers == undefined) {
807
+ async interview(ctx) {
808
+ const node = this.getNode(ctx);
809
+ const endpoint = this.getEndpoint(ctx);
810
+ const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
811
+ priority: MessagePriority.NodeQuery,
812
+ });
786
813
  ctx.logNode(node.id, {
787
814
  endpoint: this.endpointIndex,
788
- message: "Querying number of user codes timed out, skipping interview...",
789
- level: "warn",
815
+ message: `Interviewing ${this.ccName}...`,
816
+ direction: "none",
790
817
  });
791
- return;
792
- }
793
- for (let userId = 1; userId <= supportedUsers; userId++) {
794
- setUserCodeMetadata.call(this, ctx, userId);
795
- }
796
- // Synchronize user codes and settings
797
- if (ctx.getInterviewOptions()?.queryAllUserCodes) {
798
- await this.refreshValues(ctx);
799
- }
800
- // Remember that the interview is complete
801
- this.setInterviewComplete(ctx, true);
802
- }
803
- async refreshValues(ctx) {
804
- const node = this.getNode(ctx);
805
- const endpoint = this.getEndpoint(ctx);
806
- const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
807
- priority: MessagePriority.NodeQuery,
808
- });
809
- const supportsAdminCode = UserCodeCC_1.supportsAdminCodeCached(ctx, endpoint);
810
- const supportsUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.supportsUserCodeChecksum) ?? false;
811
- const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes)
812
- ?? [];
813
- const supportedUsers = this.getValue(ctx, UserCodeCCValues.supportedUsers) ?? 0;
814
- const supportsMultipleUserCodeReport = !!this.getValue(ctx, UserCodeCCValues.supportsMultipleUserCodeReport);
815
- // Check for changed values and codes
816
- if (api.version >= 2) {
817
- if (supportsAdminCode) {
818
+ // Query capabilities first to determine what needs to be done when refreshing
819
+ if (api.version >= 2) {
818
820
  ctx.logNode(node.id, {
819
- message: "querying admin code...",
821
+ message: "querying capabilities...",
820
822
  direction: "outbound",
821
823
  });
822
- await api.getAdminCode();
824
+ const caps = await api.getCapabilities();
825
+ if (!caps) {
826
+ ctx.logNode(node.id, {
827
+ endpoint: this.endpointIndex,
828
+ message: "User Code capabilities query timed out, skipping interview...",
829
+ level: "warn",
830
+ });
831
+ return;
832
+ }
823
833
  }
824
- if (supportedKeypadModes.length > 1) {
834
+ ctx.logNode(node.id, {
835
+ message: "querying number of user codes...",
836
+ direction: "outbound",
837
+ });
838
+ const supportedUsers = await api.getUsersCount();
839
+ if (supportedUsers == undefined) {
825
840
  ctx.logNode(node.id, {
826
- message: "querying active keypad mode...",
827
- direction: "outbound",
841
+ endpoint: this.endpointIndex,
842
+ message: "Querying number of user codes timed out, skipping interview...",
843
+ level: "warn",
828
844
  });
829
- await api.getKeypadMode();
845
+ return;
830
846
  }
831
- const storedUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.userCodeChecksum) ?? 0;
832
- let currentUserCodeChecksum = 0;
833
- if (supportsUserCodeChecksum) {
834
- ctx.logNode(node.id, {
835
- message: "retrieving current user code checksum...",
836
- direction: "outbound",
837
- });
838
- currentUserCodeChecksum = await api.getUserCodeChecksum();
847
+ for (let userId = 1; userId <= supportedUsers; userId++) {
848
+ setUserCodeMetadata.call(this, ctx, userId);
839
849
  }
840
- if (!supportsUserCodeChecksum
841
- || currentUserCodeChecksum !== storedUserCodeChecksum) {
842
- ctx.logNode(node.id, {
843
- message: "checksum changed or is not supported, querying all user codes...",
844
- direction: "outbound",
845
- });
846
- if (supportsMultipleUserCodeReport) {
847
- // Query the user codes in bulk
848
- let nextUserId = 1;
849
- while (nextUserId > 0 && nextUserId <= supportedUsers) {
850
- const response = await api.get(nextUserId, true);
851
- if (response) {
852
- nextUserId = response.nextUserId;
850
+ // Synchronize user codes and settings
851
+ if (ctx.getInterviewOptions()?.queryAllUserCodes) {
852
+ await this.refreshValues(ctx);
853
+ }
854
+ // Remember that the interview is complete
855
+ this.setInterviewComplete(ctx, true);
856
+ }
857
+ async refreshValues(ctx) {
858
+ const node = this.getNode(ctx);
859
+ const endpoint = this.getEndpoint(ctx);
860
+ const api = CCAPI.create(CommandClasses["User Code"], ctx, endpoint).withOptions({
861
+ priority: MessagePriority.NodeQuery,
862
+ });
863
+ const supportsAdminCode = UserCodeCC.supportsAdminCodeCached(ctx, endpoint);
864
+ const supportsUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.supportsUserCodeChecksum) ?? false;
865
+ const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes)
866
+ ?? [];
867
+ const supportedUsers = this.getValue(ctx, UserCodeCCValues.supportedUsers) ?? 0;
868
+ const supportsMultipleUserCodeReport = !!this.getValue(ctx, UserCodeCCValues.supportsMultipleUserCodeReport);
869
+ // Check for changed values and codes
870
+ if (api.version >= 2) {
871
+ if (supportsAdminCode) {
872
+ ctx.logNode(node.id, {
873
+ message: "querying admin code...",
874
+ direction: "outbound",
875
+ });
876
+ await api.getAdminCode();
877
+ }
878
+ if (supportedKeypadModes.length > 1) {
879
+ ctx.logNode(node.id, {
880
+ message: "querying active keypad mode...",
881
+ direction: "outbound",
882
+ });
883
+ await api.getKeypadMode();
884
+ }
885
+ const storedUserCodeChecksum = this.getValue(ctx, UserCodeCCValues.userCodeChecksum) ?? 0;
886
+ let currentUserCodeChecksum = 0;
887
+ if (supportsUserCodeChecksum) {
888
+ ctx.logNode(node.id, {
889
+ message: "retrieving current user code checksum...",
890
+ direction: "outbound",
891
+ });
892
+ currentUserCodeChecksum = await api.getUserCodeChecksum();
893
+ }
894
+ if (!supportsUserCodeChecksum
895
+ || currentUserCodeChecksum !== storedUserCodeChecksum) {
896
+ ctx.logNode(node.id, {
897
+ message: "checksum changed or is not supported, querying all user codes...",
898
+ direction: "outbound",
899
+ });
900
+ if (supportsMultipleUserCodeReport) {
901
+ // Query the user codes in bulk
902
+ let nextUserId = 1;
903
+ while (nextUserId > 0 && nextUserId <= supportedUsers) {
904
+ const response = await api.get(nextUserId, true);
905
+ if (response) {
906
+ nextUserId = response.nextUserId;
907
+ }
908
+ else {
909
+ ctx.logNode(node.id, {
910
+ endpoint: this.endpointIndex,
911
+ message: `Querying user code #${nextUserId} timed out, skipping the remaining interview...`,
912
+ level: "warn",
913
+ });
914
+ break;
915
+ }
853
916
  }
854
- else {
855
- ctx.logNode(node.id, {
856
- endpoint: this.endpointIndex,
857
- message: `Querying user code #${nextUserId} timed out, skipping the remaining interview...`,
858
- level: "warn",
859
- });
860
- break;
917
+ }
918
+ else {
919
+ // Query one user code at a time
920
+ for (let userId = 1; userId <= supportedUsers; userId++) {
921
+ await api.get(userId);
861
922
  }
862
923
  }
863
924
  }
864
- else {
865
- // Query one user code at a time
866
- for (let userId = 1; userId <= supportedUsers; userId++) {
867
- await api.get(userId);
868
- }
925
+ }
926
+ else {
927
+ // V1
928
+ ctx.logNode(node.id, {
929
+ message: "querying all user codes...",
930
+ direction: "outbound",
931
+ });
932
+ for (let userId = 1; userId <= supportedUsers; userId++) {
933
+ await api.get(userId);
869
934
  }
870
935
  }
871
936
  }
872
- else {
873
- // V1
874
- ctx.logNode(node.id, {
875
- message: "querying all user codes...",
876
- direction: "outbound",
877
- });
878
- for (let userId = 1; userId <= supportedUsers; userId++) {
879
- await api.get(userId);
880
- }
937
+ /**
938
+ * Returns the number of supported users.
939
+ * This only works AFTER the interview process
940
+ */
941
+ static getSupportedUsersCached(ctx, endpoint) {
942
+ return ctx
943
+ .getValueDB(endpoint.nodeId)
944
+ .getValue(UserCodeCCValues.supportedUsers.endpoint(endpoint.index));
881
945
  }
882
- }
883
- /**
884
- * Returns the number of supported users.
885
- * This only works AFTER the interview process
886
- */
887
- static getSupportedUsersCached(ctx, endpoint) {
888
- return ctx
889
- .getValueDB(endpoint.nodeId)
890
- .getValue(UserCodeCCValues.supportedUsers.endpoint(endpoint.index));
891
- }
892
- /**
893
- * Returns the supported keypad modes.
894
- * This only works AFTER the interview process
895
- */
896
- static getSupportedKeypadModesCached(ctx, endpoint) {
897
- return ctx
898
- .getValueDB(endpoint.nodeId)
899
- .getValue(UserCodeCCValues.supportedKeypadModes.endpoint(endpoint.index));
900
- }
901
- /**
902
- * Returns the supported user ID statuses.
903
- * This only works AFTER the interview process
904
- */
905
- static getSupportedUserIDStatusesCached(ctx, endpoint) {
906
- return ctx
907
- .getValueDB(endpoint.nodeId)
908
- .getValue(UserCodeCCValues.supportedUserIDStatuses.endpoint(endpoint.index));
909
- }
910
- /**
911
- * Returns the supported ASCII characters.
912
- * This only works AFTER the interview process
913
- */
914
- static getSupportedASCIICharsCached(ctx, endpoint) {
915
- return ctx
916
- .getValueDB(endpoint.nodeId)
917
- .getValue(UserCodeCCValues.supportedASCIIChars.endpoint(endpoint.index));
918
- }
919
- /**
920
- * Returns whether the admin code functionality is supported.
921
- * This only works AFTER the interview process
922
- */
923
- static supportsAdminCodeCached(ctx, endpoint) {
924
- const valueDB = ctx
925
- .getValueDB(endpoint.nodeId);
926
- return valueDB.getValue(UserCodeCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCode.endpoint(endpoint.index)) ?? false;
927
- }
928
- /**
929
- * Returns whether deactivating the admin code is supported.
930
- * This only works AFTER the interview process
931
- */
932
- static supportsAdminCodeDeactivationCached(ctx, endpoint) {
933
- const valueDB = ctx
934
- .getValueDB(endpoint.nodeId);
935
- return valueDB.getValue(UserCodeCCValues.supportsAdminCodeDeactivation.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCodeDeactivation
936
- .endpoint(endpoint.index)) ?? false;
937
- }
938
- /**
939
- * Returns whether setting multiple user codes at once is supported.
940
- * This only works AFTER the interview process
941
- */
942
- static supportsMultipleUserCodeSetCached(ctx, endpoint) {
943
- return !!ctx
944
- .getValueDB(endpoint.nodeId)
945
- .getValue(UserCodeCCValues.supportsMultipleUserCodeSet.endpoint(endpoint.index));
946
- }
947
- /**
948
- * Returns the current status of a user ID.
949
- * This only works AFTER the user IDs have been queried.
950
- */
951
- static getUserIdStatusCached(ctx, endpoint, userId) {
952
- return ctx
953
- .getValueDB(endpoint.nodeId)
954
- .getValue(UserCodeCCValues.userIdStatus(userId).endpoint(endpoint.index));
955
- }
956
- /**
957
- * Returns the current code belonging to a user ID.
958
- * This only works AFTER the user IDs have been queried.
959
- */
960
- static getUserCodeCached(ctx, endpoint, userId) {
961
- return ctx
962
- .getValueDB(endpoint.nodeId)
963
- .getValue(UserCodeCCValues.userCode(userId).endpoint(endpoint.index));
964
- }
965
- };
966
- UserCodeCC = UserCodeCC_1 = __decorate([
967
- commandClass(CommandClasses["User Code"]),
968
- implementedVersion(2),
969
- ccValues(UserCodeCCValues)
970
- ], UserCodeCC);
946
+ /**
947
+ * Returns the supported keypad modes.
948
+ * This only works AFTER the interview process
949
+ */
950
+ static getSupportedKeypadModesCached(ctx, endpoint) {
951
+ return ctx
952
+ .getValueDB(endpoint.nodeId)
953
+ .getValue(UserCodeCCValues.supportedKeypadModes.endpoint(endpoint.index));
954
+ }
955
+ /**
956
+ * Returns the supported user ID statuses.
957
+ * This only works AFTER the interview process
958
+ */
959
+ static getSupportedUserIDStatusesCached(ctx, endpoint) {
960
+ return ctx
961
+ .getValueDB(endpoint.nodeId)
962
+ .getValue(UserCodeCCValues.supportedUserIDStatuses.endpoint(endpoint.index));
963
+ }
964
+ /**
965
+ * Returns the supported ASCII characters.
966
+ * This only works AFTER the interview process
967
+ */
968
+ static getSupportedASCIICharsCached(ctx, endpoint) {
969
+ return ctx
970
+ .getValueDB(endpoint.nodeId)
971
+ .getValue(UserCodeCCValues.supportedASCIIChars.endpoint(endpoint.index));
972
+ }
973
+ /**
974
+ * Returns whether the admin code functionality is supported.
975
+ * This only works AFTER the interview process
976
+ */
977
+ static supportsAdminCodeCached(ctx, endpoint) {
978
+ const valueDB = ctx
979
+ .getValueDB(endpoint.nodeId);
980
+ return valueDB.getValue(UserCodeCCValues.supportsAdminCode.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCode.endpoint(endpoint.index)) ?? false;
981
+ }
982
+ /**
983
+ * Returns whether deactivating the admin code is supported.
984
+ * This only works AFTER the interview process
985
+ */
986
+ static supportsAdminCodeDeactivationCached(ctx, endpoint) {
987
+ const valueDB = ctx
988
+ .getValueDB(endpoint.nodeId);
989
+ return valueDB.getValue(UserCodeCCValues.supportsAdminCodeDeactivation.endpoint(endpoint.index)) ?? valueDB.getValue(UserCodeCCValues._deprecated_supportsMasterCodeDeactivation
990
+ .endpoint(endpoint.index)) ?? false;
991
+ }
992
+ /**
993
+ * Returns whether setting multiple user codes at once is supported.
994
+ * This only works AFTER the interview process
995
+ */
996
+ static supportsMultipleUserCodeSetCached(ctx, endpoint) {
997
+ return !!ctx
998
+ .getValueDB(endpoint.nodeId)
999
+ .getValue(UserCodeCCValues.supportsMultipleUserCodeSet.endpoint(endpoint.index));
1000
+ }
1001
+ /**
1002
+ * Returns the current status of a user ID.
1003
+ * This only works AFTER the user IDs have been queried.
1004
+ */
1005
+ static getUserIdStatusCached(ctx, endpoint, userId) {
1006
+ return ctx
1007
+ .getValueDB(endpoint.nodeId)
1008
+ .getValue(UserCodeCCValues.userIdStatus(userId).endpoint(endpoint.index));
1009
+ }
1010
+ /**
1011
+ * Returns the current code belonging to a user ID.
1012
+ * This only works AFTER the user IDs have been queried.
1013
+ */
1014
+ static getUserCodeCached(ctx, endpoint, userId) {
1015
+ return ctx
1016
+ .getValueDB(endpoint.nodeId)
1017
+ .getValue(UserCodeCCValues.userCode(userId).endpoint(endpoint.index));
1018
+ }
1019
+ };
1020
+ return UserCodeCC = _classThis;
1021
+ })();
971
1022
  export { UserCodeCC };
972
- let UserCodeCCSet = UserCodeCCSet_1 = class UserCodeCCSet extends UserCodeCC {
973
- constructor(options) {
974
- super(options);
975
- this.userId = options.userId;
976
- this.userIdStatus = options.userIdStatus;
977
- // Validate options
978
- if (this.userId < 0) {
979
- throw new ZWaveError(`${this.constructor.name}: The user ID must be between greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
980
- }
981
- else if (this.userId === 0
982
- && this.userIdStatus !== UserIDStatus.Available) {
983
- throw new ZWaveError(`${this.constructor.name}: User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
984
- }
985
- else if (this.userIdStatus === UserIDStatus.Available) {
986
- this.userCode = "\0".repeat(4);
987
- }
988
- else {
989
- this.userCode = options.userCode;
990
- // Specs say ASCII 0-9, manufacturers don't care :)
991
- if (this.userCode.length < 4 || this.userCode.length > 10) {
992
- throw new ZWaveError(`${this.constructor.name}: The user code must have a length of 4 to 10 ${typeof this.userCode === "string"
993
- ? "characters"
994
- : "bytes"}`, ZWaveErrorCodes.Argument_Invalid);
1023
+ let UserCodeCCSet = (() => {
1024
+ let _classDecorators = [CCCommand(UserCodeCommand.Set), useSupervision()];
1025
+ let _classDescriptor;
1026
+ let _classExtraInitializers = [];
1027
+ let _classThis;
1028
+ let _classSuper = UserCodeCC;
1029
+ var UserCodeCCSet = class extends _classSuper {
1030
+ static { _classThis = this; }
1031
+ static {
1032
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1033
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1034
+ UserCodeCCSet = _classThis = _classDescriptor.value;
1035
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1036
+ __runInitializers(_classThis, _classExtraInitializers);
1037
+ }
1038
+ constructor(options) {
1039
+ super(options);
1040
+ this.userId = options.userId;
1041
+ this.userIdStatus = options.userIdStatus;
1042
+ // Validate options
1043
+ if (this.userId < 0) {
1044
+ throw new ZWaveError(`${this.constructor.name}: The user ID must be between greater than 0.`, ZWaveErrorCodes.Argument_Invalid);
1045
+ }
1046
+ else if (this.userId === 0
1047
+ && this.userIdStatus !== UserIDStatus.Available) {
1048
+ throw new ZWaveError(`${this.constructor.name}: User ID 0 may only be used to clear all user codes`, ZWaveErrorCodes.Argument_Invalid);
1049
+ }
1050
+ else if (this.userIdStatus === UserIDStatus.Available) {
1051
+ this.userCode = "\0".repeat(4);
1052
+ }
1053
+ else {
1054
+ this.userCode = options.userCode;
1055
+ // Specs say ASCII 0-9, manufacturers don't care :)
1056
+ if (this.userCode.length < 4 || this.userCode.length > 10) {
1057
+ throw new ZWaveError(`${this.constructor.name}: The user code must have a length of 4 to 10 ${typeof this.userCode === "string"
1058
+ ? "characters"
1059
+ : "bytes"}`, ZWaveErrorCodes.Argument_Invalid);
1060
+ }
995
1061
  }
996
1062
  }
997
- }
998
- static from(raw, ctx) {
999
- validatePayload(raw.payload.length >= 2);
1000
- const userId = raw.payload[0];
1001
- const userIdStatus = raw.payload[1];
1002
- if (userIdStatus === UserIDStatus.StatusNotAvailable) {
1003
- validatePayload.fail("Invalid user ID status");
1004
- }
1005
- if (userIdStatus === UserIDStatus.Available) {
1006
- return new UserCodeCCSet_1({
1063
+ static from(raw, ctx) {
1064
+ validatePayload(raw.payload.length >= 2);
1065
+ const userId = raw.payload[0];
1066
+ const userIdStatus = raw.payload[1];
1067
+ if (userIdStatus === UserIDStatus.StatusNotAvailable) {
1068
+ validatePayload.fail("Invalid user ID status");
1069
+ }
1070
+ if (userIdStatus === UserIDStatus.Available) {
1071
+ return new this({
1072
+ nodeId: ctx.sourceNodeId,
1073
+ userId,
1074
+ userIdStatus,
1075
+ });
1076
+ }
1077
+ const userCode = raw.payload.subarray(2);
1078
+ return new this({
1007
1079
  nodeId: ctx.sourceNodeId,
1008
1080
  userId,
1009
1081
  userIdStatus,
1082
+ userCode,
1010
1083
  });
1011
1084
  }
1012
- const userCode = raw.payload.subarray(2);
1013
- return new UserCodeCCSet_1({
1014
- nodeId: ctx.sourceNodeId,
1015
- userId,
1016
- userIdStatus,
1017
- userCode,
1018
- });
1019
- }
1020
- userId;
1021
- userIdStatus;
1022
- userCode;
1023
- serialize(ctx) {
1024
- this.payload = Bytes.concat([
1025
- Bytes.from([this.userId, this.userIdStatus]),
1026
- typeof this.userCode === "string"
1027
- ? Bytes.from(this.userCode, "ascii")
1028
- : this.userCode,
1029
- ]);
1030
- return super.serialize(ctx);
1031
- }
1032
- toLogEntry(ctx) {
1033
- return {
1034
- ...super.toLogEntry(ctx),
1035
- message: {
1036
- "user id": this.userId,
1037
- "id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
1038
- "user code": userCodeToLogString(this.userCode),
1039
- },
1040
- };
1041
- }
1042
- };
1043
- UserCodeCCSet = UserCodeCCSet_1 = __decorate([
1044
- CCCommand(UserCodeCommand.Set),
1045
- useSupervision()
1046
- ], UserCodeCCSet);
1085
+ userId;
1086
+ userIdStatus;
1087
+ userCode;
1088
+ serialize(ctx) {
1089
+ this.payload = Bytes.concat([
1090
+ Bytes.from([this.userId, this.userIdStatus]),
1091
+ typeof this.userCode === "string"
1092
+ ? Bytes.from(this.userCode, "ascii")
1093
+ : this.userCode,
1094
+ ]);
1095
+ return super.serialize(ctx);
1096
+ }
1097
+ toLogEntry(ctx) {
1098
+ return {
1099
+ ...super.toLogEntry(ctx),
1100
+ message: {
1101
+ "user id": this.userId,
1102
+ "id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
1103
+ "user code": userCodeToLogString(this.userCode),
1104
+ },
1105
+ };
1106
+ }
1107
+ };
1108
+ return UserCodeCCSet = _classThis;
1109
+ })();
1047
1110
  export { UserCodeCCSet };
1048
- let UserCodeCCReport = UserCodeCCReport_1 = class UserCodeCCReport extends UserCodeCC {
1049
- constructor(options) {
1050
- super(options);
1051
- this.userId = options.userId;
1052
- this.userIdStatus = options.userIdStatus;
1053
- this.userCode = options.userCode ?? "";
1054
- }
1055
- static from(raw, ctx) {
1056
- validatePayload(raw.payload.length >= 2);
1057
- const userId = raw.payload[0];
1058
- const userIdStatus = raw.payload[1];
1059
- let userCode;
1060
- if (raw.payload.length === 2
1061
- && (userIdStatus === UserIDStatus.Available
1062
- || userIdStatus === UserIDStatus.StatusNotAvailable)) {
1063
- // The user code is not set or not available and this report contains no user code
1064
- userCode = "";
1065
- }
1066
- else {
1067
- // The specs require the user code to be at least 4 digits
1068
- validatePayload(raw.payload.length >= 6);
1069
- let userCodeBuffer = raw.payload.subarray(2);
1070
- // Specs say infer user code from payload length, manufacturers send zero-padded strings
1071
- while (userCodeBuffer.at(-1) === 0) {
1072
- userCodeBuffer = userCodeBuffer.subarray(0, -1);
1111
+ let UserCodeCCReport = (() => {
1112
+ let _classDecorators = [CCCommand(UserCodeCommand.Report)];
1113
+ let _classDescriptor;
1114
+ let _classExtraInitializers = [];
1115
+ let _classThis;
1116
+ let _classSuper = UserCodeCC;
1117
+ var UserCodeCCReport = class extends _classSuper {
1118
+ static { _classThis = this; }
1119
+ static {
1120
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1121
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1122
+ UserCodeCCReport = _classThis = _classDescriptor.value;
1123
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1124
+ __runInitializers(_classThis, _classExtraInitializers);
1125
+ }
1126
+ constructor(options) {
1127
+ super(options);
1128
+ this.userId = options.userId;
1129
+ this.userIdStatus = options.userIdStatus;
1130
+ this.userCode = options.userCode ?? "";
1131
+ }
1132
+ static from(raw, ctx) {
1133
+ validatePayload(raw.payload.length >= 2);
1134
+ const userId = raw.payload[0];
1135
+ const userIdStatus = raw.payload[1];
1136
+ let userCode;
1137
+ if (raw.payload.length === 2
1138
+ && (userIdStatus === UserIDStatus.Available
1139
+ || userIdStatus === UserIDStatus.StatusNotAvailable)) {
1140
+ // The user code is not set or not available and this report contains no user code
1141
+ userCode = "";
1073
1142
  }
1074
- // Specs say ASCII 0-9, manufacturers don't care :)
1075
- // Thus we check if the code is printable using ASCII, if not keep it as a Buffer
1076
- const userCodeString = userCodeBuffer.toString("utf8");
1077
- if (isPrintableASCII(userCodeString)) {
1078
- userCode = userCodeString;
1143
+ else {
1144
+ // The specs require the user code to be at least 4 digits
1145
+ validatePayload(raw.payload.length >= 6);
1146
+ let userCodeBuffer = raw.payload.subarray(2);
1147
+ // Specs say infer user code from payload length, manufacturers send zero-padded strings
1148
+ while (userCodeBuffer.at(-1) === 0) {
1149
+ userCodeBuffer = userCodeBuffer.subarray(0, -1);
1150
+ }
1151
+ // Specs say ASCII 0-9, manufacturers don't care :)
1152
+ // Thus we check if the code is printable using ASCII, if not keep it as a Buffer
1153
+ const userCodeString = userCodeBuffer.toString("utf8");
1154
+ if (isPrintableASCII(userCodeString)) {
1155
+ userCode = userCodeString;
1156
+ }
1157
+ else if (isPrintableASCIIWithWhitespace(userCodeString)) {
1158
+ // Ignore leading and trailing whitespace in V1 reports if the rest is ASCII
1159
+ userCode = userCodeString.trim();
1160
+ }
1161
+ else {
1162
+ userCode = userCodeBuffer;
1163
+ }
1079
1164
  }
1080
- else if (isPrintableASCIIWithWhitespace(userCodeString)) {
1081
- // Ignore leading and trailing whitespace in V1 reports if the rest is ASCII
1082
- userCode = userCodeString.trim();
1165
+ return new this({
1166
+ nodeId: ctx.sourceNodeId,
1167
+ userId,
1168
+ userIdStatus,
1169
+ userCode,
1170
+ });
1171
+ }
1172
+ userId;
1173
+ userIdStatus;
1174
+ userCode;
1175
+ persistValues(ctx) {
1176
+ if (!super.persistValues(ctx))
1177
+ return false;
1178
+ persistUserCode.call(this, ctx, this.userId, this.userIdStatus, this.userCode);
1179
+ return true;
1180
+ }
1181
+ serialize(ctx) {
1182
+ let userCodeBuffer;
1183
+ if (typeof this.userCode === "string") {
1184
+ userCodeBuffer = Bytes.from(this.userCode, "ascii");
1083
1185
  }
1084
1186
  else {
1085
- userCode = userCodeBuffer;
1187
+ userCodeBuffer = this.userCode;
1086
1188
  }
1189
+ this.payload = Bytes.concat([
1190
+ Bytes.from([this.userId, this.userIdStatus]),
1191
+ userCodeBuffer,
1192
+ ]);
1193
+ return super.serialize(ctx);
1087
1194
  }
1088
- return new UserCodeCCReport_1({
1089
- nodeId: ctx.sourceNodeId,
1090
- userId,
1091
- userIdStatus,
1092
- userCode,
1093
- });
1094
- }
1095
- userId;
1096
- userIdStatus;
1097
- userCode;
1098
- persistValues(ctx) {
1099
- if (!super.persistValues(ctx))
1100
- return false;
1101
- persistUserCode.call(this, ctx, this.userId, this.userIdStatus, this.userCode);
1102
- return true;
1103
- }
1104
- serialize(ctx) {
1105
- let userCodeBuffer;
1106
- if (typeof this.userCode === "string") {
1107
- userCodeBuffer = Bytes.from(this.userCode, "ascii");
1108
- }
1109
- else {
1110
- userCodeBuffer = this.userCode;
1111
- }
1112
- this.payload = Bytes.concat([
1113
- Bytes.from([this.userId, this.userIdStatus]),
1114
- userCodeBuffer,
1115
- ]);
1116
- return super.serialize(ctx);
1117
- }
1118
- toLogEntry(ctx) {
1119
- return {
1120
- ...super.toLogEntry(ctx),
1121
- message: {
1122
- "user id": this.userId,
1123
- "id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
1124
- "user code": userCodeToLogString(this.userCode),
1125
- },
1126
- };
1127
- }
1128
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1129
- toNotificationEventParameters() {
1130
- return { userId: this.userId };
1131
- }
1132
- };
1133
- UserCodeCCReport = UserCodeCCReport_1 = __decorate([
1134
- CCCommand(UserCodeCommand.Report)
1135
- ], UserCodeCCReport);
1195
+ toLogEntry(ctx) {
1196
+ return {
1197
+ ...super.toLogEntry(ctx),
1198
+ message: {
1199
+ "user id": this.userId,
1200
+ "id status": getEnumMemberName(UserIDStatus, this.userIdStatus),
1201
+ "user code": userCodeToLogString(this.userCode),
1202
+ },
1203
+ };
1204
+ }
1205
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1206
+ toNotificationEventParameters() {
1207
+ return { userId: this.userId };
1208
+ }
1209
+ };
1210
+ return UserCodeCCReport = _classThis;
1211
+ })();
1136
1212
  export { UserCodeCCReport };
1137
- let UserCodeCCGet = UserCodeCCGet_1 = class UserCodeCCGet extends UserCodeCC {
1138
- constructor(options) {
1139
- super(options);
1140
- this.userId = options.userId;
1141
- }
1142
- static from(raw, ctx) {
1143
- validatePayload(raw.payload.length >= 1);
1144
- const userId = raw.payload[0];
1145
- return new UserCodeCCGet_1({
1146
- nodeId: ctx.sourceNodeId,
1147
- userId,
1148
- });
1149
- }
1150
- userId;
1151
- serialize(ctx) {
1152
- this.payload = Bytes.from([this.userId]);
1153
- return super.serialize(ctx);
1154
- }
1155
- toLogEntry(ctx) {
1156
- return {
1157
- ...super.toLogEntry(ctx),
1158
- message: { "user id": this.userId },
1159
- };
1160
- }
1161
- };
1162
- UserCodeCCGet = UserCodeCCGet_1 = __decorate([
1163
- CCCommand(UserCodeCommand.Get),
1164
- expectedCCResponse(UserCodeCCReport)
1165
- ], UserCodeCCGet);
1213
+ let UserCodeCCGet = (() => {
1214
+ let _classDecorators = [CCCommand(UserCodeCommand.Get), expectedCCResponse(UserCodeCCReport)];
1215
+ let _classDescriptor;
1216
+ let _classExtraInitializers = [];
1217
+ let _classThis;
1218
+ let _classSuper = UserCodeCC;
1219
+ var UserCodeCCGet = class extends _classSuper {
1220
+ static { _classThis = this; }
1221
+ static {
1222
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1223
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1224
+ UserCodeCCGet = _classThis = _classDescriptor.value;
1225
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1226
+ __runInitializers(_classThis, _classExtraInitializers);
1227
+ }
1228
+ constructor(options) {
1229
+ super(options);
1230
+ this.userId = options.userId;
1231
+ }
1232
+ static from(raw, ctx) {
1233
+ validatePayload(raw.payload.length >= 1);
1234
+ const userId = raw.payload[0];
1235
+ return new this({
1236
+ nodeId: ctx.sourceNodeId,
1237
+ userId,
1238
+ });
1239
+ }
1240
+ userId;
1241
+ serialize(ctx) {
1242
+ this.payload = Bytes.from([this.userId]);
1243
+ return super.serialize(ctx);
1244
+ }
1245
+ toLogEntry(ctx) {
1246
+ return {
1247
+ ...super.toLogEntry(ctx),
1248
+ message: { "user id": this.userId },
1249
+ };
1250
+ }
1251
+ };
1252
+ return UserCodeCCGet = _classThis;
1253
+ })();
1166
1254
  export { UserCodeCCGet };
1167
- let UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport_1 = class UserCodeCCUsersNumberReport extends UserCodeCC {
1168
- constructor(options) {
1169
- super(options);
1170
- this.supportedUsers = options.supportedUsers;
1171
- }
1172
- static from(raw, ctx) {
1173
- validatePayload(raw.payload.length >= 1);
1174
- let supportedUsers;
1175
- if (raw.payload.length >= 3) {
1176
- // V2+
1177
- supportedUsers = raw.payload.readUInt16BE(1);
1178
- }
1179
- else {
1180
- // V1
1181
- supportedUsers = raw.payload[0];
1182
- }
1183
- return new UserCodeCCUsersNumberReport_1({
1184
- nodeId: ctx.sourceNodeId,
1185
- supportedUsers,
1186
- });
1187
- }
1188
- supportedUsers;
1189
- serialize(ctx) {
1190
- this.payload = new Bytes(3);
1191
- // If the node implements more than 255 users, this field MUST be set to 255
1192
- this.payload[0] = Math.min(255, this.supportedUsers);
1193
- this.payload.writeUInt16BE(this.supportedUsers, 1);
1194
- return super.serialize(ctx);
1195
- }
1196
- toLogEntry(ctx) {
1197
- return {
1198
- ...super.toLogEntry(ctx),
1199
- message: { "supported users": this.supportedUsers },
1200
- };
1201
- }
1202
- };
1203
- __decorate([
1204
- ccValue(UserCodeCCValues.supportedUsers)
1205
- ], UserCodeCCUsersNumberReport.prototype, "supportedUsers", void 0);
1206
- UserCodeCCUsersNumberReport = UserCodeCCUsersNumberReport_1 = __decorate([
1207
- CCCommand(UserCodeCommand.UsersNumberReport)
1208
- ], UserCodeCCUsersNumberReport);
1255
+ let UserCodeCCUsersNumberReport = (() => {
1256
+ let _classDecorators = [CCCommand(UserCodeCommand.UsersNumberReport), ccValueProperty("supportedUsers", UserCodeCCValues.supportedUsers)];
1257
+ let _classDescriptor;
1258
+ let _classExtraInitializers = [];
1259
+ let _classThis;
1260
+ let _classSuper = UserCodeCC;
1261
+ var UserCodeCCUsersNumberReport = class extends _classSuper {
1262
+ static { _classThis = this; }
1263
+ static {
1264
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1265
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1266
+ UserCodeCCUsersNumberReport = _classThis = _classDescriptor.value;
1267
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1268
+ __runInitializers(_classThis, _classExtraInitializers);
1269
+ }
1270
+ constructor(options) {
1271
+ super(options);
1272
+ this.supportedUsers = options.supportedUsers;
1273
+ }
1274
+ static from(raw, ctx) {
1275
+ validatePayload(raw.payload.length >= 1);
1276
+ let supportedUsers;
1277
+ if (raw.payload.length >= 3) {
1278
+ // V2+
1279
+ supportedUsers = raw.payload.readUInt16BE(1);
1280
+ }
1281
+ else {
1282
+ // V1
1283
+ supportedUsers = raw.payload[0];
1284
+ }
1285
+ return new this({
1286
+ nodeId: ctx.sourceNodeId,
1287
+ supportedUsers,
1288
+ });
1289
+ }
1290
+ supportedUsers;
1291
+ serialize(ctx) {
1292
+ this.payload = new Bytes(3);
1293
+ // If the node implements more than 255 users, this field MUST be set to 255
1294
+ this.payload[0] = Math.min(255, this.supportedUsers);
1295
+ this.payload.writeUInt16BE(this.supportedUsers, 1);
1296
+ return super.serialize(ctx);
1297
+ }
1298
+ toLogEntry(ctx) {
1299
+ return {
1300
+ ...super.toLogEntry(ctx),
1301
+ message: { "supported users": this.supportedUsers },
1302
+ };
1303
+ }
1304
+ };
1305
+ return UserCodeCCUsersNumberReport = _classThis;
1306
+ })();
1209
1307
  export { UserCodeCCUsersNumberReport };
1210
- let UserCodeCCUsersNumberGet = class UserCodeCCUsersNumberGet extends UserCodeCC {
1211
- };
1212
- UserCodeCCUsersNumberGet = __decorate([
1213
- CCCommand(UserCodeCommand.UsersNumberGet),
1214
- expectedCCResponse(UserCodeCCUsersNumberReport)
1215
- ], UserCodeCCUsersNumberGet);
1308
+ let UserCodeCCUsersNumberGet = (() => {
1309
+ let _classDecorators = [CCCommand(UserCodeCommand.UsersNumberGet), expectedCCResponse(UserCodeCCUsersNumberReport)];
1310
+ let _classDescriptor;
1311
+ let _classExtraInitializers = [];
1312
+ let _classThis;
1313
+ let _classSuper = UserCodeCC;
1314
+ var UserCodeCCUsersNumberGet = class extends _classSuper {
1315
+ static { _classThis = this; }
1316
+ static {
1317
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1318
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1319
+ UserCodeCCUsersNumberGet = _classThis = _classDescriptor.value;
1320
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1321
+ __runInitializers(_classThis, _classExtraInitializers);
1322
+ }
1323
+ };
1324
+ return UserCodeCCUsersNumberGet = _classThis;
1325
+ })();
1216
1326
  export { UserCodeCCUsersNumberGet };
1217
- let UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport_1 = class UserCodeCCCapabilitiesReport extends UserCodeCC {
1218
- constructor(options) {
1219
- super(options);
1220
- this.supportsAdminCode = options.supportsAdminCode;
1221
- this.supportsAdminCodeDeactivation =
1222
- options.supportsAdminCodeDeactivation;
1223
- this.supportsUserCodeChecksum = options.supportsUserCodeChecksum;
1224
- this.supportsMultipleUserCodeReport =
1225
- options.supportsMultipleUserCodeReport;
1226
- this.supportsMultipleUserCodeSet = options.supportsMultipleUserCodeSet;
1227
- this.supportedUserIDStatuses = options.supportedUserIDStatuses;
1228
- this.supportedKeypadModes = options.supportedKeypadModes;
1229
- this.supportedASCIIChars = options.supportedASCIIChars;
1230
- }
1231
- static from(raw, ctx) {
1232
- let offset = 0;
1233
- validatePayload(raw.payload.length >= offset + 1);
1234
- const supportsAdminCode = !!(raw.payload[offset] & 0b100_00000);
1235
- const supportsAdminCodeDeactivation = !!(raw.payload[offset] & 0b010_00000);
1236
- const statusBitMaskLength = raw.payload[offset] & 0b000_11111;
1237
- offset += 1;
1238
- validatePayload(raw.payload.length >= offset + statusBitMaskLength + 1);
1239
- const supportedUserIDStatuses = parseBitMask(raw.payload.subarray(offset, offset + statusBitMaskLength), UserIDStatus.Available);
1240
- offset += statusBitMaskLength;
1241
- const supportsUserCodeChecksum = !!(raw.payload[offset] & 0b100_00000);
1242
- const supportsMultipleUserCodeReport = !!(raw.payload[offset] & 0b010_00000);
1243
- const supportsMultipleUserCodeSet = !!(raw.payload[offset] & 0b001_00000);
1244
- const keypadModesBitMaskLength = raw.payload[offset] & 0b000_11111;
1245
- offset += 1;
1246
- validatePayload(raw.payload.length >= offset + keypadModesBitMaskLength + 1);
1247
- const supportedKeypadModes = parseBitMask(raw.payload.subarray(offset, offset + keypadModesBitMaskLength), KeypadMode.Normal);
1248
- offset += keypadModesBitMaskLength;
1249
- const keysBitMaskLength = raw.payload[offset] & 0b000_11111;
1250
- offset += 1;
1251
- validatePayload(raw.payload.length >= offset + keysBitMaskLength);
1252
- const supportedASCIIChars = Bytes.from(parseBitMask(raw.payload.subarray(offset, offset + keysBitMaskLength), 0)).toString("ascii");
1253
- return new UserCodeCCCapabilitiesReport_1({
1254
- nodeId: ctx.sourceNodeId,
1255
- supportsAdminCode,
1256
- supportsAdminCodeDeactivation,
1257
- supportedUserIDStatuses,
1258
- supportsUserCodeChecksum,
1259
- supportsMultipleUserCodeReport,
1260
- supportsMultipleUserCodeSet,
1261
- supportedKeypadModes,
1262
- supportedASCIIChars,
1263
- });
1264
- }
1265
- supportsAdminCode;
1266
- supportsAdminCodeDeactivation;
1267
- supportsUserCodeChecksum;
1268
- supportsMultipleUserCodeReport;
1269
- supportsMultipleUserCodeSet;
1270
- supportedUserIDStatuses;
1271
- supportedKeypadModes;
1272
- supportedASCIIChars;
1273
- serialize(ctx) {
1274
- const supportedStatusesBitmask = encodeBitMask(this.supportedUserIDStatuses, undefined, UserIDStatus.Available);
1275
- const controlByte1 = (this.supportsAdminCode ? 0b100_00000 : 0)
1276
- | (this.supportsAdminCodeDeactivation ? 0b010_00000 : 0)
1277
- | (supportedStatusesBitmask.length & 0b000_11111);
1278
- const supportedKeypadModesBitmask = encodeBitMask(this.supportedKeypadModes, undefined, KeypadMode.Normal);
1279
- const controlByte2 = (this.supportsUserCodeChecksum ? 0b100_00000 : 0)
1280
- | (this.supportsMultipleUserCodeReport ? 0b010_00000 : 0)
1281
- | (this.supportsMultipleUserCodeSet ? 0b001_00000 : 0)
1282
- | (supportedKeypadModesBitmask.length & 0b000_11111);
1283
- const keysAsNumbers = [...this.supportedASCIIChars].map((char) => char.charCodeAt(0));
1284
- const supportedKeysBitmask = encodeBitMask(keysAsNumbers, undefined, 0);
1285
- const controlByte3 = supportedKeysBitmask.length & 0b000_11111;
1286
- this.payload = Bytes.concat([
1287
- Bytes.from([controlByte1]),
1288
- supportedStatusesBitmask,
1289
- Bytes.from([controlByte2]),
1290
- supportedKeypadModesBitmask,
1291
- Bytes.from([controlByte3]),
1292
- supportedKeysBitmask,
1293
- ]);
1294
- return super.serialize(ctx);
1295
- }
1296
- toLogEntry(ctx) {
1297
- return {
1298
- ...super.toLogEntry(ctx),
1299
- message: {
1300
- "supports admin code": this.supportsAdminCode,
1301
- "supports admin code deactivation": this.supportsAdminCodeDeactivation,
1302
- "supports user code checksum": this.supportsUserCodeChecksum,
1303
- "supports multiple codes in report": this.supportsMultipleUserCodeReport,
1304
- "supports multiple codes in set": this.supportsMultipleUserCodeSet,
1305
- "supported user id statuses": this.supportedUserIDStatuses
1306
- .map((status) => `\n· ${getEnumMemberName(UserIDStatus, status)}`)
1307
- .join(""),
1308
- "supported keypad modes": this.supportedKeypadModes
1309
- .map((mode) => `\n· ${getEnumMemberName(KeypadMode, mode)}`)
1310
- .join(""),
1311
- "supported ASCII chars": this.supportedASCIIChars,
1312
- },
1313
- };
1314
- }
1315
- };
1316
- __decorate([
1317
- ccValue(UserCodeCCValues.supportsAdminCode)
1318
- ], UserCodeCCCapabilitiesReport.prototype, "supportsAdminCode", void 0);
1319
- __decorate([
1320
- ccValue(UserCodeCCValues.supportsAdminCodeDeactivation)
1321
- ], UserCodeCCCapabilitiesReport.prototype, "supportsAdminCodeDeactivation", void 0);
1322
- __decorate([
1323
- ccValue(UserCodeCCValues.supportsUserCodeChecksum)
1324
- ], UserCodeCCCapabilitiesReport.prototype, "supportsUserCodeChecksum", void 0);
1325
- __decorate([
1326
- ccValue(UserCodeCCValues.supportsMultipleUserCodeReport)
1327
- ], UserCodeCCCapabilitiesReport.prototype, "supportsMultipleUserCodeReport", void 0);
1328
- __decorate([
1329
- ccValue(UserCodeCCValues.supportsMultipleUserCodeSet)
1330
- ], UserCodeCCCapabilitiesReport.prototype, "supportsMultipleUserCodeSet", void 0);
1331
- __decorate([
1332
- ccValue(UserCodeCCValues.supportedUserIDStatuses)
1333
- ], UserCodeCCCapabilitiesReport.prototype, "supportedUserIDStatuses", void 0);
1334
- __decorate([
1335
- ccValue(UserCodeCCValues.supportedKeypadModes)
1336
- ], UserCodeCCCapabilitiesReport.prototype, "supportedKeypadModes", void 0);
1337
- __decorate([
1338
- ccValue(UserCodeCCValues.supportedASCIIChars)
1339
- ], UserCodeCCCapabilitiesReport.prototype, "supportedASCIIChars", void 0);
1340
- UserCodeCCCapabilitiesReport = UserCodeCCCapabilitiesReport_1 = __decorate([
1341
- CCCommand(UserCodeCommand.CapabilitiesReport)
1342
- ], UserCodeCCCapabilitiesReport);
1327
+ let UserCodeCCCapabilitiesReport = (() => {
1328
+ let _classDecorators = [CCCommand(UserCodeCommand.CapabilitiesReport), ccValueProperty("supportsAdminCode", UserCodeCCValues.supportsAdminCode), ccValueProperty("supportsAdminCodeDeactivation", UserCodeCCValues.supportsAdminCodeDeactivation), ccValueProperty("supportsUserCodeChecksum", UserCodeCCValues.supportsUserCodeChecksum), ccValueProperty("supportsMultipleUserCodeReport", UserCodeCCValues.supportsMultipleUserCodeReport), ccValueProperty("supportsMultipleUserCodeSet", UserCodeCCValues.supportsMultipleUserCodeSet), ccValueProperty("supportedUserIDStatuses", UserCodeCCValues.supportedUserIDStatuses), ccValueProperty("supportedKeypadModes", UserCodeCCValues.supportedKeypadModes), ccValueProperty("supportedASCIIChars", UserCodeCCValues.supportedASCIIChars)];
1329
+ let _classDescriptor;
1330
+ let _classExtraInitializers = [];
1331
+ let _classThis;
1332
+ let _classSuper = UserCodeCC;
1333
+ var UserCodeCCCapabilitiesReport = class extends _classSuper {
1334
+ static { _classThis = this; }
1335
+ static {
1336
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1337
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1338
+ UserCodeCCCapabilitiesReport = _classThis = _classDescriptor.value;
1339
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1340
+ __runInitializers(_classThis, _classExtraInitializers);
1341
+ }
1342
+ constructor(options) {
1343
+ super(options);
1344
+ this.supportsAdminCode = options.supportsAdminCode;
1345
+ this.supportsAdminCodeDeactivation =
1346
+ options.supportsAdminCodeDeactivation;
1347
+ this.supportsUserCodeChecksum = options.supportsUserCodeChecksum;
1348
+ this.supportsMultipleUserCodeReport =
1349
+ options.supportsMultipleUserCodeReport;
1350
+ this.supportsMultipleUserCodeSet = options.supportsMultipleUserCodeSet;
1351
+ this.supportedUserIDStatuses = options.supportedUserIDStatuses;
1352
+ this.supportedKeypadModes = options.supportedKeypadModes;
1353
+ this.supportedASCIIChars = options.supportedASCIIChars;
1354
+ }
1355
+ static from(raw, ctx) {
1356
+ let offset = 0;
1357
+ validatePayload(raw.payload.length >= offset + 1);
1358
+ const supportsAdminCode = !!(raw.payload[offset] & 0b100_00000);
1359
+ const supportsAdminCodeDeactivation = !!(raw.payload[offset] & 0b010_00000);
1360
+ const statusBitMaskLength = raw.payload[offset] & 0b000_11111;
1361
+ offset += 1;
1362
+ validatePayload(raw.payload.length >= offset + statusBitMaskLength + 1);
1363
+ const supportedUserIDStatuses = parseBitMask(raw.payload.subarray(offset, offset + statusBitMaskLength), UserIDStatus.Available);
1364
+ offset += statusBitMaskLength;
1365
+ const supportsUserCodeChecksum = !!(raw.payload[offset] & 0b100_00000);
1366
+ const supportsMultipleUserCodeReport = !!(raw.payload[offset] & 0b010_00000);
1367
+ const supportsMultipleUserCodeSet = !!(raw.payload[offset] & 0b001_00000);
1368
+ const keypadModesBitMaskLength = raw.payload[offset] & 0b000_11111;
1369
+ offset += 1;
1370
+ validatePayload(raw.payload.length >= offset + keypadModesBitMaskLength + 1);
1371
+ const supportedKeypadModes = parseBitMask(raw.payload.subarray(offset, offset + keypadModesBitMaskLength), KeypadMode.Normal);
1372
+ offset += keypadModesBitMaskLength;
1373
+ const keysBitMaskLength = raw.payload[offset] & 0b000_11111;
1374
+ offset += 1;
1375
+ validatePayload(raw.payload.length >= offset + keysBitMaskLength);
1376
+ const supportedASCIIChars = Bytes.from(parseBitMask(raw.payload.subarray(offset, offset + keysBitMaskLength), 0)).toString("ascii");
1377
+ return new this({
1378
+ nodeId: ctx.sourceNodeId,
1379
+ supportsAdminCode,
1380
+ supportsAdminCodeDeactivation,
1381
+ supportedUserIDStatuses,
1382
+ supportsUserCodeChecksum,
1383
+ supportsMultipleUserCodeReport,
1384
+ supportsMultipleUserCodeSet,
1385
+ supportedKeypadModes,
1386
+ supportedASCIIChars,
1387
+ });
1388
+ }
1389
+ supportsAdminCode;
1390
+ supportsAdminCodeDeactivation;
1391
+ supportsUserCodeChecksum;
1392
+ supportsMultipleUserCodeReport;
1393
+ supportsMultipleUserCodeSet;
1394
+ supportedUserIDStatuses;
1395
+ supportedKeypadModes;
1396
+ supportedASCIIChars;
1397
+ serialize(ctx) {
1398
+ const supportedStatusesBitmask = encodeBitMask(this.supportedUserIDStatuses, undefined, UserIDStatus.Available);
1399
+ const controlByte1 = (this.supportsAdminCode ? 0b100_00000 : 0)
1400
+ | (this.supportsAdminCodeDeactivation ? 0b010_00000 : 0)
1401
+ | (supportedStatusesBitmask.length & 0b000_11111);
1402
+ const supportedKeypadModesBitmask = encodeBitMask(this.supportedKeypadModes, undefined, KeypadMode.Normal);
1403
+ const controlByte2 = (this.supportsUserCodeChecksum ? 0b100_00000 : 0)
1404
+ | (this.supportsMultipleUserCodeReport ? 0b010_00000 : 0)
1405
+ | (this.supportsMultipleUserCodeSet ? 0b001_00000 : 0)
1406
+ | (supportedKeypadModesBitmask.length & 0b000_11111);
1407
+ const keysAsNumbers = [...this.supportedASCIIChars].map((char) => char.charCodeAt(0));
1408
+ const supportedKeysBitmask = encodeBitMask(keysAsNumbers, undefined, 0);
1409
+ const controlByte3 = supportedKeysBitmask.length & 0b000_11111;
1410
+ this.payload = Bytes.concat([
1411
+ Bytes.from([controlByte1]),
1412
+ supportedStatusesBitmask,
1413
+ Bytes.from([controlByte2]),
1414
+ supportedKeypadModesBitmask,
1415
+ Bytes.from([controlByte3]),
1416
+ supportedKeysBitmask,
1417
+ ]);
1418
+ return super.serialize(ctx);
1419
+ }
1420
+ toLogEntry(ctx) {
1421
+ return {
1422
+ ...super.toLogEntry(ctx),
1423
+ message: {
1424
+ "supports admin code": this.supportsAdminCode,
1425
+ "supports admin code deactivation": this.supportsAdminCodeDeactivation,
1426
+ "supports user code checksum": this.supportsUserCodeChecksum,
1427
+ "supports multiple codes in report": this.supportsMultipleUserCodeReport,
1428
+ "supports multiple codes in set": this.supportsMultipleUserCodeSet,
1429
+ "supported user id statuses": this.supportedUserIDStatuses
1430
+ .map((status) => `\n· ${getEnumMemberName(UserIDStatus, status)}`)
1431
+ .join(""),
1432
+ "supported keypad modes": this.supportedKeypadModes
1433
+ .map((mode) => `\n· ${getEnumMemberName(KeypadMode, mode)}`)
1434
+ .join(""),
1435
+ "supported ASCII chars": this.supportedASCIIChars,
1436
+ },
1437
+ };
1438
+ }
1439
+ };
1440
+ return UserCodeCCCapabilitiesReport = _classThis;
1441
+ })();
1343
1442
  export { UserCodeCCCapabilitiesReport };
1344
- let UserCodeCCCapabilitiesGet = class UserCodeCCCapabilitiesGet extends UserCodeCC {
1345
- };
1346
- UserCodeCCCapabilitiesGet = __decorate([
1347
- CCCommand(UserCodeCommand.CapabilitiesGet),
1348
- expectedCCResponse(UserCodeCCCapabilitiesReport)
1349
- ], UserCodeCCCapabilitiesGet);
1443
+ let UserCodeCCCapabilitiesGet = (() => {
1444
+ let _classDecorators = [CCCommand(UserCodeCommand.CapabilitiesGet), expectedCCResponse(UserCodeCCCapabilitiesReport)];
1445
+ let _classDescriptor;
1446
+ let _classExtraInitializers = [];
1447
+ let _classThis;
1448
+ let _classSuper = UserCodeCC;
1449
+ var UserCodeCCCapabilitiesGet = class extends _classSuper {
1450
+ static { _classThis = this; }
1451
+ static {
1452
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1453
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1454
+ UserCodeCCCapabilitiesGet = _classThis = _classDescriptor.value;
1455
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1456
+ __runInitializers(_classThis, _classExtraInitializers);
1457
+ }
1458
+ };
1459
+ return UserCodeCCCapabilitiesGet = _classThis;
1460
+ })();
1350
1461
  export { UserCodeCCCapabilitiesGet };
1351
- let UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet_1 = class UserCodeCCKeypadModeSet extends UserCodeCC {
1352
- constructor(options) {
1353
- super(options);
1354
- this.keypadMode = options.keypadMode;
1355
- }
1356
- static from(raw, ctx) {
1357
- validatePayload(raw.payload.length >= 1);
1358
- const keypadMode = raw.payload[0];
1359
- return new UserCodeCCKeypadModeSet_1({
1360
- nodeId: ctx.sourceNodeId,
1361
- keypadMode,
1362
- });
1363
- }
1364
- keypadMode;
1365
- serialize(ctx) {
1366
- this.payload = Bytes.from([this.keypadMode]);
1367
- return super.serialize(ctx);
1368
- }
1369
- toLogEntry(ctx) {
1370
- return {
1371
- ...super.toLogEntry(ctx),
1372
- message: { mode: getEnumMemberName(KeypadMode, this.keypadMode) },
1373
- };
1374
- }
1375
- };
1376
- UserCodeCCKeypadModeSet = UserCodeCCKeypadModeSet_1 = __decorate([
1377
- CCCommand(UserCodeCommand.KeypadModeSet),
1378
- useSupervision()
1379
- ], UserCodeCCKeypadModeSet);
1462
+ let UserCodeCCKeypadModeSet = (() => {
1463
+ let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeSet), useSupervision()];
1464
+ let _classDescriptor;
1465
+ let _classExtraInitializers = [];
1466
+ let _classThis;
1467
+ let _classSuper = UserCodeCC;
1468
+ var UserCodeCCKeypadModeSet = class extends _classSuper {
1469
+ static { _classThis = this; }
1470
+ static {
1471
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1472
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1473
+ UserCodeCCKeypadModeSet = _classThis = _classDescriptor.value;
1474
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1475
+ __runInitializers(_classThis, _classExtraInitializers);
1476
+ }
1477
+ constructor(options) {
1478
+ super(options);
1479
+ this.keypadMode = options.keypadMode;
1480
+ }
1481
+ static from(raw, ctx) {
1482
+ validatePayload(raw.payload.length >= 1);
1483
+ const keypadMode = raw.payload[0];
1484
+ return new this({
1485
+ nodeId: ctx.sourceNodeId,
1486
+ keypadMode,
1487
+ });
1488
+ }
1489
+ keypadMode;
1490
+ serialize(ctx) {
1491
+ this.payload = Bytes.from([this.keypadMode]);
1492
+ return super.serialize(ctx);
1493
+ }
1494
+ toLogEntry(ctx) {
1495
+ return {
1496
+ ...super.toLogEntry(ctx),
1497
+ message: { mode: getEnumMemberName(KeypadMode, this.keypadMode) },
1498
+ };
1499
+ }
1500
+ };
1501
+ return UserCodeCCKeypadModeSet = _classThis;
1502
+ })();
1380
1503
  export { UserCodeCCKeypadModeSet };
1381
- let UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport_1 = class UserCodeCCKeypadModeReport extends UserCodeCC {
1382
- constructor(options) {
1383
- super(options);
1384
- this.keypadMode = options.keypadMode;
1385
- }
1386
- static from(raw, ctx) {
1387
- validatePayload(raw.payload.length >= 1);
1388
- const keypadMode = raw.payload[0];
1389
- return new UserCodeCCKeypadModeReport_1({
1390
- nodeId: ctx.sourceNodeId,
1391
- keypadMode,
1392
- });
1393
- }
1394
- persistValues(ctx) {
1395
- if (!super.persistValues(ctx))
1396
- return false;
1397
- // Update the keypad modes metadata
1398
- const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes) ?? [this.keypadMode];
1399
- const keypadModeValue = UserCodeCCValues.keypadMode;
1400
- this.setMetadata(ctx, keypadModeValue, {
1401
- ...keypadModeValue.meta,
1402
- states: enumValuesToMetadataStates(KeypadMode, supportedKeypadModes),
1403
- });
1404
- return true;
1405
- }
1406
- keypadMode;
1407
- serialize(ctx) {
1408
- this.payload = Bytes.from([this.keypadMode]);
1409
- return super.serialize(ctx);
1410
- }
1411
- toLogEntry(ctx) {
1412
- return {
1413
- ...super.toLogEntry(ctx),
1414
- message: {
1415
- keypadMode: getEnumMemberName(KeypadMode, this.keypadMode),
1416
- },
1417
- };
1418
- }
1419
- };
1420
- __decorate([
1421
- ccValue(UserCodeCCValues.keypadMode)
1422
- ], UserCodeCCKeypadModeReport.prototype, "keypadMode", void 0);
1423
- UserCodeCCKeypadModeReport = UserCodeCCKeypadModeReport_1 = __decorate([
1424
- CCCommand(UserCodeCommand.KeypadModeReport)
1425
- ], UserCodeCCKeypadModeReport);
1504
+ let UserCodeCCKeypadModeReport = (() => {
1505
+ let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeReport), ccValueProperty("keypadMode", UserCodeCCValues.keypadMode)];
1506
+ let _classDescriptor;
1507
+ let _classExtraInitializers = [];
1508
+ let _classThis;
1509
+ let _classSuper = UserCodeCC;
1510
+ var UserCodeCCKeypadModeReport = class extends _classSuper {
1511
+ static { _classThis = this; }
1512
+ static {
1513
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1514
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1515
+ UserCodeCCKeypadModeReport = _classThis = _classDescriptor.value;
1516
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1517
+ __runInitializers(_classThis, _classExtraInitializers);
1518
+ }
1519
+ constructor(options) {
1520
+ super(options);
1521
+ this.keypadMode = options.keypadMode;
1522
+ }
1523
+ static from(raw, ctx) {
1524
+ validatePayload(raw.payload.length >= 1);
1525
+ const keypadMode = raw.payload[0];
1526
+ return new this({
1527
+ nodeId: ctx.sourceNodeId,
1528
+ keypadMode,
1529
+ });
1530
+ }
1531
+ persistValues(ctx) {
1532
+ if (!super.persistValues(ctx))
1533
+ return false;
1534
+ // Update the keypad modes metadata
1535
+ const supportedKeypadModes = this.getValue(ctx, UserCodeCCValues.supportedKeypadModes) ?? [this.keypadMode];
1536
+ const keypadModeValue = UserCodeCCValues.keypadMode;
1537
+ this.setMetadata(ctx, keypadModeValue, {
1538
+ ...keypadModeValue.meta,
1539
+ states: enumValuesToMetadataStates(KeypadMode, supportedKeypadModes),
1540
+ });
1541
+ return true;
1542
+ }
1543
+ keypadMode;
1544
+ serialize(ctx) {
1545
+ this.payload = Bytes.from([this.keypadMode]);
1546
+ return super.serialize(ctx);
1547
+ }
1548
+ toLogEntry(ctx) {
1549
+ return {
1550
+ ...super.toLogEntry(ctx),
1551
+ message: {
1552
+ keypadMode: getEnumMemberName(KeypadMode, this.keypadMode),
1553
+ },
1554
+ };
1555
+ }
1556
+ };
1557
+ return UserCodeCCKeypadModeReport = _classThis;
1558
+ })();
1426
1559
  export { UserCodeCCKeypadModeReport };
1427
- let UserCodeCCKeypadModeGet = class UserCodeCCKeypadModeGet extends UserCodeCC {
1428
- };
1429
- UserCodeCCKeypadModeGet = __decorate([
1430
- CCCommand(UserCodeCommand.KeypadModeGet),
1431
- expectedCCResponse(UserCodeCCKeypadModeReport)
1432
- ], UserCodeCCKeypadModeGet);
1560
+ let UserCodeCCKeypadModeGet = (() => {
1561
+ let _classDecorators = [CCCommand(UserCodeCommand.KeypadModeGet), expectedCCResponse(UserCodeCCKeypadModeReport)];
1562
+ let _classDescriptor;
1563
+ let _classExtraInitializers = [];
1564
+ let _classThis;
1565
+ let _classSuper = UserCodeCC;
1566
+ var UserCodeCCKeypadModeGet = class extends _classSuper {
1567
+ static { _classThis = this; }
1568
+ static {
1569
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1570
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1571
+ UserCodeCCKeypadModeGet = _classThis = _classDescriptor.value;
1572
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1573
+ __runInitializers(_classThis, _classExtraInitializers);
1574
+ }
1575
+ };
1576
+ return UserCodeCCKeypadModeGet = _classThis;
1577
+ })();
1433
1578
  export { UserCodeCCKeypadModeGet };
1434
- let UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet_1 = class UserCodeCCAdminCodeSet extends UserCodeCC {
1435
- constructor(options) {
1436
- super(options);
1437
- this.adminCode = options.adminCode;
1438
- }
1439
- static from(raw, ctx) {
1440
- validatePayload(raw.payload.length >= 1);
1441
- const codeLength = raw.payload[0] & 0b1111;
1442
- validatePayload(raw.payload.length >= 1 + codeLength);
1443
- const adminCode = raw.payload
1444
- .subarray(1, 1 + codeLength)
1445
- .toString("ascii");
1446
- return new UserCodeCCAdminCodeSet_1({
1447
- nodeId: ctx.sourceNodeId,
1448
- adminCode,
1449
- });
1450
- }
1451
- adminCode;
1452
- serialize(ctx) {
1453
- this.payload = Bytes.concat([
1454
- Bytes.from([this.adminCode.length & 0b1111]),
1455
- Bytes.from(this.adminCode, "ascii"),
1456
- ]);
1457
- return super.serialize(ctx);
1458
- }
1459
- toLogEntry(ctx) {
1460
- return {
1461
- ...super.toLogEntry(ctx),
1462
- message: { "admin code": userCodeToLogString(this.adminCode) },
1463
- };
1464
- }
1465
- };
1466
- UserCodeCCAdminCodeSet = UserCodeCCAdminCodeSet_1 = __decorate([
1467
- CCCommand(UserCodeCommand.AdminCodeSet),
1468
- useSupervision()
1469
- ], UserCodeCCAdminCodeSet);
1579
+ let UserCodeCCAdminCodeSet = (() => {
1580
+ let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeSet), useSupervision()];
1581
+ let _classDescriptor;
1582
+ let _classExtraInitializers = [];
1583
+ let _classThis;
1584
+ let _classSuper = UserCodeCC;
1585
+ var UserCodeCCAdminCodeSet = class extends _classSuper {
1586
+ static { _classThis = this; }
1587
+ static {
1588
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1589
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1590
+ UserCodeCCAdminCodeSet = _classThis = _classDescriptor.value;
1591
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1592
+ __runInitializers(_classThis, _classExtraInitializers);
1593
+ }
1594
+ constructor(options) {
1595
+ super(options);
1596
+ this.adminCode = options.adminCode;
1597
+ }
1598
+ static from(raw, ctx) {
1599
+ validatePayload(raw.payload.length >= 1);
1600
+ const codeLength = raw.payload[0] & 0b1111;
1601
+ validatePayload(raw.payload.length >= 1 + codeLength);
1602
+ const adminCode = raw.payload
1603
+ .subarray(1, 1 + codeLength)
1604
+ .toString("ascii");
1605
+ return new this({
1606
+ nodeId: ctx.sourceNodeId,
1607
+ adminCode,
1608
+ });
1609
+ }
1610
+ adminCode;
1611
+ serialize(ctx) {
1612
+ this.payload = Bytes.concat([
1613
+ Bytes.from([this.adminCode.length & 0b1111]),
1614
+ Bytes.from(this.adminCode, "ascii"),
1615
+ ]);
1616
+ return super.serialize(ctx);
1617
+ }
1618
+ toLogEntry(ctx) {
1619
+ return {
1620
+ ...super.toLogEntry(ctx),
1621
+ message: { "admin code": userCodeToLogString(this.adminCode) },
1622
+ };
1623
+ }
1624
+ };
1625
+ return UserCodeCCAdminCodeSet = _classThis;
1626
+ })();
1470
1627
  export { UserCodeCCAdminCodeSet };
1471
- let UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport_1 = class UserCodeCCAdminCodeReport extends UserCodeCC {
1472
- constructor(options) {
1473
- super(options);
1474
- this.adminCode = options.adminCode;
1475
- }
1476
- static from(raw, ctx) {
1477
- validatePayload(raw.payload.length >= 1);
1478
- const codeLength = raw.payload[0] & 0b1111;
1479
- validatePayload(raw.payload.length >= 1 + codeLength);
1480
- const adminCode = raw.payload
1481
- .subarray(1, 1 + codeLength)
1482
- .toString("ascii");
1483
- return new UserCodeCCAdminCodeReport_1({
1484
- nodeId: ctx.sourceNodeId,
1485
- adminCode,
1486
- });
1487
- }
1488
- adminCode;
1489
- serialize(ctx) {
1490
- this.payload = Bytes.concat([
1491
- Bytes.from([this.adminCode.length & 0b1111]),
1492
- Bytes.from(this.adminCode, "ascii"),
1493
- ]);
1494
- return super.serialize(ctx);
1495
- }
1496
- toLogEntry(ctx) {
1497
- return {
1498
- ...super.toLogEntry(ctx),
1499
- message: { "admin code": userCodeToLogString(this.adminCode) },
1500
- };
1501
- }
1502
- };
1503
- __decorate([
1504
- ccValue(UserCodeCCValues.adminCode)
1505
- ], UserCodeCCAdminCodeReport.prototype, "adminCode", void 0);
1506
- UserCodeCCAdminCodeReport = UserCodeCCAdminCodeReport_1 = __decorate([
1507
- CCCommand(UserCodeCommand.AdminCodeReport)
1508
- ], UserCodeCCAdminCodeReport);
1628
+ let UserCodeCCAdminCodeReport = (() => {
1629
+ let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeReport), ccValueProperty("adminCode", UserCodeCCValues.adminCode)];
1630
+ let _classDescriptor;
1631
+ let _classExtraInitializers = [];
1632
+ let _classThis;
1633
+ let _classSuper = UserCodeCC;
1634
+ var UserCodeCCAdminCodeReport = class extends _classSuper {
1635
+ static { _classThis = this; }
1636
+ static {
1637
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1638
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1639
+ UserCodeCCAdminCodeReport = _classThis = _classDescriptor.value;
1640
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1641
+ __runInitializers(_classThis, _classExtraInitializers);
1642
+ }
1643
+ constructor(options) {
1644
+ super(options);
1645
+ this.adminCode = options.adminCode;
1646
+ }
1647
+ static from(raw, ctx) {
1648
+ validatePayload(raw.payload.length >= 1);
1649
+ const codeLength = raw.payload[0] & 0b1111;
1650
+ validatePayload(raw.payload.length >= 1 + codeLength);
1651
+ const adminCode = raw.payload
1652
+ .subarray(1, 1 + codeLength)
1653
+ .toString("ascii");
1654
+ return new this({
1655
+ nodeId: ctx.sourceNodeId,
1656
+ adminCode,
1657
+ });
1658
+ }
1659
+ adminCode;
1660
+ serialize(ctx) {
1661
+ this.payload = Bytes.concat([
1662
+ Bytes.from([this.adminCode.length & 0b1111]),
1663
+ Bytes.from(this.adminCode, "ascii"),
1664
+ ]);
1665
+ return super.serialize(ctx);
1666
+ }
1667
+ toLogEntry(ctx) {
1668
+ return {
1669
+ ...super.toLogEntry(ctx),
1670
+ message: { "admin code": userCodeToLogString(this.adminCode) },
1671
+ };
1672
+ }
1673
+ };
1674
+ return UserCodeCCAdminCodeReport = _classThis;
1675
+ })();
1509
1676
  export { UserCodeCCAdminCodeReport };
1510
- let UserCodeCCAdminCodeGet = class UserCodeCCAdminCodeGet extends UserCodeCC {
1511
- };
1512
- UserCodeCCAdminCodeGet = __decorate([
1513
- CCCommand(UserCodeCommand.AdminCodeGet),
1514
- expectedCCResponse(UserCodeCCAdminCodeReport)
1515
- ], UserCodeCCAdminCodeGet);
1677
+ let UserCodeCCAdminCodeGet = (() => {
1678
+ let _classDecorators = [CCCommand(UserCodeCommand.AdminCodeGet), expectedCCResponse(UserCodeCCAdminCodeReport)];
1679
+ let _classDescriptor;
1680
+ let _classExtraInitializers = [];
1681
+ let _classThis;
1682
+ let _classSuper = UserCodeCC;
1683
+ var UserCodeCCAdminCodeGet = class extends _classSuper {
1684
+ static { _classThis = this; }
1685
+ static {
1686
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1687
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1688
+ UserCodeCCAdminCodeGet = _classThis = _classDescriptor.value;
1689
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1690
+ __runInitializers(_classThis, _classExtraInitializers);
1691
+ }
1692
+ };
1693
+ return UserCodeCCAdminCodeGet = _classThis;
1694
+ })();
1516
1695
  export { UserCodeCCAdminCodeGet };
1517
- let UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport_1 = class UserCodeCCUserCodeChecksumReport extends UserCodeCC {
1518
- constructor(options) {
1519
- super(options);
1520
- this.userCodeChecksum = options.userCodeChecksum;
1521
- }
1522
- static from(raw, ctx) {
1523
- validatePayload(raw.payload.length >= 2);
1524
- const userCodeChecksum = raw.payload.readUInt16BE(0);
1525
- return new UserCodeCCUserCodeChecksumReport_1({
1526
- nodeId: ctx.sourceNodeId,
1527
- userCodeChecksum,
1528
- });
1529
- }
1530
- userCodeChecksum;
1531
- serialize(ctx) {
1532
- this.payload = new Bytes(2);
1533
- this.payload.writeUInt16BE(this.userCodeChecksum, 0);
1534
- return super.serialize(ctx);
1535
- }
1536
- toLogEntry(ctx) {
1537
- return {
1538
- ...super.toLogEntry(ctx),
1539
- message: { "user code checksum": num2hex(this.userCodeChecksum) },
1540
- };
1541
- }
1542
- };
1543
- __decorate([
1544
- ccValue(UserCodeCCValues.userCodeChecksum)
1545
- ], UserCodeCCUserCodeChecksumReport.prototype, "userCodeChecksum", void 0);
1546
- UserCodeCCUserCodeChecksumReport = UserCodeCCUserCodeChecksumReport_1 = __decorate([
1547
- CCCommand(UserCodeCommand.UserCodeChecksumReport)
1548
- ], UserCodeCCUserCodeChecksumReport);
1696
+ let UserCodeCCUserCodeChecksumReport = (() => {
1697
+ let _classDecorators = [CCCommand(UserCodeCommand.UserCodeChecksumReport), ccValueProperty("userCodeChecksum", UserCodeCCValues.userCodeChecksum)];
1698
+ let _classDescriptor;
1699
+ let _classExtraInitializers = [];
1700
+ let _classThis;
1701
+ let _classSuper = UserCodeCC;
1702
+ var UserCodeCCUserCodeChecksumReport = class extends _classSuper {
1703
+ static { _classThis = this; }
1704
+ static {
1705
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1706
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1707
+ UserCodeCCUserCodeChecksumReport = _classThis = _classDescriptor.value;
1708
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1709
+ __runInitializers(_classThis, _classExtraInitializers);
1710
+ }
1711
+ constructor(options) {
1712
+ super(options);
1713
+ this.userCodeChecksum = options.userCodeChecksum;
1714
+ }
1715
+ static from(raw, ctx) {
1716
+ validatePayload(raw.payload.length >= 2);
1717
+ const userCodeChecksum = raw.payload.readUInt16BE(0);
1718
+ return new this({
1719
+ nodeId: ctx.sourceNodeId,
1720
+ userCodeChecksum,
1721
+ });
1722
+ }
1723
+ userCodeChecksum;
1724
+ serialize(ctx) {
1725
+ this.payload = new Bytes(2);
1726
+ this.payload.writeUInt16BE(this.userCodeChecksum, 0);
1727
+ return super.serialize(ctx);
1728
+ }
1729
+ toLogEntry(ctx) {
1730
+ return {
1731
+ ...super.toLogEntry(ctx),
1732
+ message: { "user code checksum": num2hex(this.userCodeChecksum) },
1733
+ };
1734
+ }
1735
+ };
1736
+ return UserCodeCCUserCodeChecksumReport = _classThis;
1737
+ })();
1549
1738
  export { UserCodeCCUserCodeChecksumReport };
1550
- let UserCodeCCUserCodeChecksumGet = class UserCodeCCUserCodeChecksumGet extends UserCodeCC {
1551
- };
1552
- UserCodeCCUserCodeChecksumGet = __decorate([
1553
- CCCommand(UserCodeCommand.UserCodeChecksumGet),
1554
- expectedCCResponse(UserCodeCCUserCodeChecksumReport)
1555
- ], UserCodeCCUserCodeChecksumGet);
1739
+ let UserCodeCCUserCodeChecksumGet = (() => {
1740
+ let _classDecorators = [CCCommand(UserCodeCommand.UserCodeChecksumGet), expectedCCResponse(UserCodeCCUserCodeChecksumReport)];
1741
+ let _classDescriptor;
1742
+ let _classExtraInitializers = [];
1743
+ let _classThis;
1744
+ let _classSuper = UserCodeCC;
1745
+ var UserCodeCCUserCodeChecksumGet = class extends _classSuper {
1746
+ static { _classThis = this; }
1747
+ static {
1748
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1749
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1750
+ UserCodeCCUserCodeChecksumGet = _classThis = _classDescriptor.value;
1751
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1752
+ __runInitializers(_classThis, _classExtraInitializers);
1753
+ }
1754
+ };
1755
+ return UserCodeCCUserCodeChecksumGet = _classThis;
1756
+ })();
1556
1757
  export { UserCodeCCUserCodeChecksumGet };
1557
- let UserCodeCCExtendedUserCodeSet = class UserCodeCCExtendedUserCodeSet extends UserCodeCC {
1558
- constructor(options) {
1559
- super(options);
1560
- this.userCodes = options.userCodes;
1561
- }
1562
- static from(_raw, _ctx) {
1563
- // TODO: Deserialize payload
1564
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1565
- // return new UserCodeCCExtendedUserCodeSet({
1566
- // nodeId: ctx.sourceNodeId,
1567
- // });
1568
- }
1569
- userCodes;
1570
- serialize(ctx) {
1571
- const userCodeBuffers = this.userCodes.map((code) => {
1572
- const ret = Bytes.concat([
1573
- Bytes.from([
1574
- 0,
1575
- 0,
1576
- code.userIdStatus,
1577
- code.userCode?.length ?? 0,
1578
- ]),
1579
- isUint8Array(code.userCode)
1580
- ? code.userCode
1581
- : Bytes.from(code.userCode ?? "", "ascii"),
1758
+ let UserCodeCCExtendedUserCodeSet = (() => {
1759
+ let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeSet), useSupervision()];
1760
+ let _classDescriptor;
1761
+ let _classExtraInitializers = [];
1762
+ let _classThis;
1763
+ let _classSuper = UserCodeCC;
1764
+ var UserCodeCCExtendedUserCodeSet = class extends _classSuper {
1765
+ static { _classThis = this; }
1766
+ static {
1767
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1768
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1769
+ UserCodeCCExtendedUserCodeSet = _classThis = _classDescriptor.value;
1770
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1771
+ __runInitializers(_classThis, _classExtraInitializers);
1772
+ }
1773
+ constructor(options) {
1774
+ super(options);
1775
+ this.userCodes = options.userCodes;
1776
+ }
1777
+ static from(_raw, _ctx) {
1778
+ // TODO: Deserialize payload
1779
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1780
+ // return new UserCodeCCExtendedUserCodeSet({
1781
+ // nodeId: ctx.sourceNodeId,
1782
+ // });
1783
+ }
1784
+ userCodes;
1785
+ serialize(ctx) {
1786
+ const userCodeBuffers = this.userCodes.map((code) => {
1787
+ const ret = Bytes.concat([
1788
+ Bytes.from([
1789
+ 0,
1790
+ 0,
1791
+ code.userIdStatus,
1792
+ code.userCode?.length ?? 0,
1793
+ ]),
1794
+ isUint8Array(code.userCode)
1795
+ ? code.userCode
1796
+ : Bytes.from(code.userCode ?? "", "ascii"),
1797
+ ]);
1798
+ ret.writeUInt16BE(code.userId, 0);
1799
+ return ret;
1800
+ });
1801
+ this.payload = Bytes.concat([
1802
+ Bytes.from([this.userCodes.length]),
1803
+ ...userCodeBuffers,
1582
1804
  ]);
1583
- ret.writeUInt16BE(code.userId, 0);
1584
- return ret;
1585
- });
1586
- this.payload = Bytes.concat([
1587
- Bytes.from([this.userCodes.length]),
1588
- ...userCodeBuffers,
1589
- ]);
1590
- return super.serialize(ctx);
1591
- }
1592
- toLogEntry(ctx) {
1593
- const message = {};
1594
- for (const { userId, userIdStatus, userCode } of this.userCodes) {
1595
- message[`code #${userId}`] = `${userCodeToLogString(userCode ?? "")} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
1596
- }
1597
- return {
1598
- ...super.toLogEntry(ctx),
1599
- message,
1600
- };
1601
- }
1602
- };
1603
- UserCodeCCExtendedUserCodeSet = __decorate([
1604
- CCCommand(UserCodeCommand.ExtendedUserCodeSet),
1605
- useSupervision()
1606
- ], UserCodeCCExtendedUserCodeSet);
1805
+ return super.serialize(ctx);
1806
+ }
1807
+ toLogEntry(ctx) {
1808
+ const message = {};
1809
+ for (const { userId, userIdStatus, userCode } of this.userCodes) {
1810
+ message[`code #${userId}`] = `${userCodeToLogString(userCode ?? "")} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
1811
+ }
1812
+ return {
1813
+ ...super.toLogEntry(ctx),
1814
+ message,
1815
+ };
1816
+ }
1817
+ };
1818
+ return UserCodeCCExtendedUserCodeSet = _classThis;
1819
+ })();
1607
1820
  export { UserCodeCCExtendedUserCodeSet };
1608
- let UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport_1 = class UserCodeCCExtendedUserCodeReport extends UserCodeCC {
1609
- constructor(options) {
1610
- super(options);
1611
- // TODO: Check implementation:
1612
- this.userCodes = options.userCodes;
1613
- this.nextUserId = options.nextUserId;
1614
- }
1615
- static from(raw, ctx) {
1616
- validatePayload(raw.payload.length >= 1);
1617
- const numCodes = raw.payload[0];
1618
- let offset = 1;
1619
- const userCodes = [];
1620
- // parse each user code
1621
- for (let i = 0; i < numCodes; i++) {
1622
- const { code, bytesRead } = parseExtendedUserCode(raw.payload.subarray(offset));
1623
- userCodes.push(code);
1624
- offset += bytesRead;
1625
- }
1626
- validatePayload(raw.payload.length >= offset + 2);
1627
- const nextUserId = raw.payload.readUInt16BE(offset);
1628
- return new UserCodeCCExtendedUserCodeReport_1({
1629
- nodeId: ctx.sourceNodeId,
1630
- userCodes,
1631
- nextUserId,
1632
- });
1633
- }
1634
- persistValues(ctx) {
1635
- if (!super.persistValues(ctx))
1636
- return false;
1637
- for (const { userId, userIdStatus, userCode } of this.userCodes) {
1638
- persistUserCode.call(this, ctx, userId, userIdStatus, userCode);
1821
+ let UserCodeCCExtendedUserCodeReport = (() => {
1822
+ let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeReport)];
1823
+ let _classDescriptor;
1824
+ let _classExtraInitializers = [];
1825
+ let _classThis;
1826
+ let _classSuper = UserCodeCC;
1827
+ var UserCodeCCExtendedUserCodeReport = class extends _classSuper {
1828
+ static { _classThis = this; }
1829
+ static {
1830
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1831
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1832
+ UserCodeCCExtendedUserCodeReport = _classThis = _classDescriptor.value;
1833
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1834
+ __runInitializers(_classThis, _classExtraInitializers);
1639
1835
  }
1640
- return true;
1641
- }
1642
- userCodes;
1643
- nextUserId;
1644
- toLogEntry(ctx) {
1645
- const message = {};
1646
- for (const { userId, userIdStatus, userCode } of this.userCodes) {
1647
- message[`code #${userId}`] = `${userCodeToLogString(userCode)} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
1648
- }
1649
- message["next user id"] = this.nextUserId;
1650
- return {
1651
- ...super.toLogEntry(ctx),
1652
- message,
1653
- };
1654
- }
1655
- };
1656
- UserCodeCCExtendedUserCodeReport = UserCodeCCExtendedUserCodeReport_1 = __decorate([
1657
- CCCommand(UserCodeCommand.ExtendedUserCodeReport)
1658
- ], UserCodeCCExtendedUserCodeReport);
1836
+ constructor(options) {
1837
+ super(options);
1838
+ // TODO: Check implementation:
1839
+ this.userCodes = options.userCodes;
1840
+ this.nextUserId = options.nextUserId;
1841
+ }
1842
+ static from(raw, ctx) {
1843
+ validatePayload(raw.payload.length >= 1);
1844
+ const numCodes = raw.payload[0];
1845
+ let offset = 1;
1846
+ const userCodes = [];
1847
+ // parse each user code
1848
+ for (let i = 0; i < numCodes; i++) {
1849
+ const { code, bytesRead } = parseExtendedUserCode(raw.payload.subarray(offset));
1850
+ userCodes.push(code);
1851
+ offset += bytesRead;
1852
+ }
1853
+ validatePayload(raw.payload.length >= offset + 2);
1854
+ const nextUserId = raw.payload.readUInt16BE(offset);
1855
+ return new this({
1856
+ nodeId: ctx.sourceNodeId,
1857
+ userCodes,
1858
+ nextUserId,
1859
+ });
1860
+ }
1861
+ persistValues(ctx) {
1862
+ if (!super.persistValues(ctx))
1863
+ return false;
1864
+ for (const { userId, userIdStatus, userCode } of this.userCodes) {
1865
+ persistUserCode.call(this, ctx, userId, userIdStatus, userCode);
1866
+ }
1867
+ return true;
1868
+ }
1869
+ userCodes;
1870
+ nextUserId;
1871
+ toLogEntry(ctx) {
1872
+ const message = {};
1873
+ for (const { userId, userIdStatus, userCode } of this.userCodes) {
1874
+ message[`code #${userId}`] = `${userCodeToLogString(userCode)} (status: ${getEnumMemberName(UserIDStatus, userIdStatus)})`;
1875
+ }
1876
+ message["next user id"] = this.nextUserId;
1877
+ return {
1878
+ ...super.toLogEntry(ctx),
1879
+ message,
1880
+ };
1881
+ }
1882
+ };
1883
+ return UserCodeCCExtendedUserCodeReport = _classThis;
1884
+ })();
1659
1885
  export { UserCodeCCExtendedUserCodeReport };
1660
- let UserCodeCCExtendedUserCodeGet = class UserCodeCCExtendedUserCodeGet extends UserCodeCC {
1661
- constructor(options) {
1662
- super(options);
1663
- this.userId = options.userId;
1664
- this.reportMore = !!options.reportMore;
1665
- }
1666
- static from(_raw, _ctx) {
1667
- // TODO: Deserialize payload
1668
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1669
- // return new UserCodeCCExtendedUserCodeGet({
1670
- // nodeId: ctx.sourceNodeId,
1671
- // });
1672
- }
1673
- userId;
1674
- reportMore;
1675
- serialize(ctx) {
1676
- this.payload = Bytes.from([0, 0, this.reportMore ? 1 : 0]);
1677
- this.payload.writeUInt16BE(this.userId, 0);
1678
- return super.serialize(ctx);
1679
- }
1680
- toLogEntry(ctx) {
1681
- return {
1682
- ...super.toLogEntry(ctx),
1683
- message: {
1684
- "user id": this.userId,
1685
- "report more": this.reportMore,
1686
- },
1687
- };
1688
- }
1689
- };
1690
- UserCodeCCExtendedUserCodeGet = __decorate([
1691
- CCCommand(UserCodeCommand.ExtendedUserCodeGet),
1692
- expectedCCResponse(UserCodeCCExtendedUserCodeReport)
1693
- ], UserCodeCCExtendedUserCodeGet);
1886
+ let UserCodeCCExtendedUserCodeGet = (() => {
1887
+ let _classDecorators = [CCCommand(UserCodeCommand.ExtendedUserCodeGet), expectedCCResponse(UserCodeCCExtendedUserCodeReport)];
1888
+ let _classDescriptor;
1889
+ let _classExtraInitializers = [];
1890
+ let _classThis;
1891
+ let _classSuper = UserCodeCC;
1892
+ var UserCodeCCExtendedUserCodeGet = class extends _classSuper {
1893
+ static { _classThis = this; }
1894
+ static {
1895
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1896
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1897
+ UserCodeCCExtendedUserCodeGet = _classThis = _classDescriptor.value;
1898
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1899
+ __runInitializers(_classThis, _classExtraInitializers);
1900
+ }
1901
+ constructor(options) {
1902
+ super(options);
1903
+ this.userId = options.userId;
1904
+ this.reportMore = !!options.reportMore;
1905
+ }
1906
+ static from(_raw, _ctx) {
1907
+ // TODO: Deserialize payload
1908
+ throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
1909
+ // return new UserCodeCCExtendedUserCodeGet({
1910
+ // nodeId: ctx.sourceNodeId,
1911
+ // });
1912
+ }
1913
+ userId;
1914
+ reportMore;
1915
+ serialize(ctx) {
1916
+ this.payload = Bytes.from([0, 0, this.reportMore ? 1 : 0]);
1917
+ this.payload.writeUInt16BE(this.userId, 0);
1918
+ return super.serialize(ctx);
1919
+ }
1920
+ toLogEntry(ctx) {
1921
+ return {
1922
+ ...super.toLogEntry(ctx),
1923
+ message: {
1924
+ "user id": this.userId,
1925
+ "report more": this.reportMore,
1926
+ },
1927
+ };
1928
+ }
1929
+ };
1930
+ return UserCodeCCExtendedUserCodeGet = _classThis;
1931
+ })();
1694
1932
  export { UserCodeCCExtendedUserCodeGet };
1695
1933
  //# sourceMappingURL=UserCodeCC.js.map