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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -48,13 +48,45 @@ var import_CommandClass = require("../lib/CommandClass.js");
48
48
  var import_CommandClassDecorators = require("../lib/CommandClassDecorators.js");
49
49
  var import_Values = require("../lib/Values.js");
50
50
  var import_Types = require("../lib/_Types.js");
51
- var __decorate = function(decorators, target, key, desc) {
52
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
53
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
54
- 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;
55
- return c > 3 && r && Object.defineProperty(target, key, r), r;
51
+ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
52
+ function accept(f) {
53
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
54
+ return f;
55
+ }
56
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
57
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
58
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
59
+ var _, done = false;
60
+ for (var i = decorators.length - 1; i >= 0; i--) {
61
+ var context = {};
62
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
63
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
64
+ context.addInitializer = function(f) {
65
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
66
+ extraInitializers.push(accept(f || null));
67
+ };
68
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
69
+ if (kind === "accessor") {
70
+ if (result === void 0) continue;
71
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
72
+ if (_ = accept(result.get)) descriptor.get = _;
73
+ if (_ = accept(result.set)) descriptor.set = _;
74
+ if (_ = accept(result.init)) initializers.unshift(_);
75
+ } else if (_ = accept(result)) {
76
+ if (kind === "field") initializers.unshift(_);
77
+ else descriptor[key] = _;
78
+ }
79
+ }
80
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
81
+ done = true;
82
+ };
83
+ var __runInitializers = function(thisArg, initializers, value) {
84
+ var useValue = arguments.length > 2;
85
+ for (var i = 0; i < initializers.length; i++) {
86
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
87
+ }
88
+ return useValue ? value : void 0;
56
89
  };
57
- var ConfigurationCCReport_1, ConfigurationCCGet_1, ConfigurationCCSet_1, ConfigurationCCBulkReport_1, ConfigurationCCNameReport_1, ConfigurationCCNameGet_1, ConfigurationCCInfoReport_1, ConfigurationCCInfoGet_1, ConfigurationCCPropertiesReport_1, ConfigurationCCPropertiesGet_1;
58
90
  function __assertType(argName, typeName, boundHasError) {
59
91
  const { ZWaveError: ZWaveError2, ZWaveErrorCodes: ZWaveErrorCodes2 } = require("@zwave-js/core");
60
92
  if (boundHasError()) {
@@ -551,526 +583,557 @@ function getParamInformationFromConfigFile(ctx, nodeId, endpointIndex) {
551
583
  return deviceConfig?.endpoints?.get(endpointIndex)?.paramInformation;
552
584
  }
553
585
  }
554
- let ConfigurationCCAPI = class ConfigurationCCAPI2 extends import_API.CCAPI {
555
- supportsCommand(cmd) {
556
- switch (cmd) {
557
- case import_Types.ConfigurationCommand.Get:
558
- case import_Types.ConfigurationCommand.Set:
559
- return true;
560
- // This is mandatory
561
- case import_Types.ConfigurationCommand.BulkGet:
562
- case import_Types.ConfigurationCommand.BulkSet:
563
- return this.version >= 2;
564
- case import_Types.ConfigurationCommand.NameGet:
565
- case import_Types.ConfigurationCommand.InfoGet:
566
- case import_Types.ConfigurationCommand.PropertiesGet:
567
- return this.version >= 3;
568
- case import_Types.ConfigurationCommand.DefaultReset:
569
- return this.version >= 4;
570
- }
571
- return super.supportsCommand(cmd);
572
- }
573
- get [import_API.SET_VALUE]() {
574
- return async function({ property, propertyKey }, value) {
575
- if (typeof property !== "number") {
576
- (0, import_API.throwUnsupportedProperty)(this.ccId, property);
577
- }
578
- if (propertyKey != void 0 && typeof propertyKey !== "number") {
579
- (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
580
- }
581
- if (typeof value !== "number") {
582
- (0, import_API.throwWrongValueType)(this.ccId, property, "number", typeof value);
586
+ let ConfigurationCCAPI = (() => {
587
+ let _classDecorators = [(0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Configuration)];
588
+ let _classDescriptor;
589
+ let _classExtraInitializers = [];
590
+ let _classThis;
591
+ let _classSuper = import_API.CCAPI;
592
+ var ConfigurationCCAPI2 = class extends _classSuper {
593
+ static {
594
+ _classThis = this;
595
+ }
596
+ static {
597
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
598
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
599
+ ConfigurationCCAPI2 = _classThis = _classDescriptor.value;
600
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
601
+ __runInitializers(_classThis, _classExtraInitializers);
602
+ }
603
+ supportsCommand(cmd) {
604
+ switch (cmd) {
605
+ case import_Types.ConfigurationCommand.Get:
606
+ case import_Types.ConfigurationCommand.Set:
607
+ return true;
608
+ // This is mandatory
609
+ case import_Types.ConfigurationCommand.BulkGet:
610
+ case import_Types.ConfigurationCommand.BulkSet:
611
+ return this.version >= 2;
612
+ case import_Types.ConfigurationCommand.NameGet:
613
+ case import_Types.ConfigurationCommand.InfoGet:
614
+ case import_Types.ConfigurationCommand.PropertiesGet:
615
+ return this.version >= 3;
616
+ case import_Types.ConfigurationCommand.DefaultReset:
617
+ return this.version >= 4;
583
618
  }
584
- let ccInstance;
585
- const applHost = this.host;
586
- if (this.isSinglecast()) {
587
- ccInstance = createConfigurationCCInstance(this.endpoint);
588
- } else if (this.isMulticast()) {
589
- const nodes = this.endpoint.node.physicalNodes;
590
- if (!nodes.every((node) => node.getEndpoint(this.endpoint.index)?.supportsCC(import_safe.CommandClasses.Configuration))) {
591
- throw new import_safe.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target endpoints to support Configuration CC!`, import_safe.ZWaveErrorCodes.CC_Invalid);
619
+ return super.supportsCommand(cmd);
620
+ }
621
+ get [import_API.SET_VALUE]() {
622
+ return async function({ property, propertyKey }, value) {
623
+ if (typeof property !== "number") {
624
+ (0, import_API.throwUnsupportedProperty)(this.ccId, property);
592
625
  }
593
- const paramInfos = this.endpoint.node.physicalNodes.map((node) => createConfigurationCCInstance(node.getEndpoint(this.endpoint.index)).getParamInformation(this.host, property, propertyKey));
594
- if (!paramInfos.length || !paramInfos.every((info, index) => {
595
- if (index === 0)
596
- return true;
597
- return info.valueSize === paramInfos[0].valueSize && info.format === paramInfos[0].format;
598
- })) {
599
- throw new import_safe.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target nodes to have the same parameter definition!`, import_safe.ZWaveErrorCodes.CC_Invalid);
626
+ if (propertyKey != void 0 && typeof propertyKey !== "number") {
627
+ (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
600
628
  }
601
- ccInstance = createConfigurationCCInstance(this.endpoint);
602
- } else {
603
- throw new import_safe.ZWaveError(`The setValue API for Configuration CC is not supported via broadcast!`, import_safe.ZWaveErrorCodes.CC_NotSupported);
604
- }
605
- let { valueSize, format: valueFormat = import_safe.ConfigValueFormat.SignedInteger } = ccInstance.getParamInformation(applHost, property);
606
- let targetValue;
607
- if (propertyKey) {
608
- if (!valueSize) {
609
- valueSize = ccInstance.getParamInformation(applHost, property, propertyKey).valueSize;
629
+ if (typeof value !== "number") {
630
+ (0, import_API.throwWrongValueType)(this.ccId, property, "number", typeof value);
631
+ }
632
+ let ccInstance;
633
+ const applHost = this.host;
634
+ if (this.isSinglecast()) {
635
+ ccInstance = createConfigurationCCInstance(this.endpoint);
636
+ } else if (this.isMulticast()) {
637
+ const nodes = this.endpoint.node.physicalNodes;
638
+ if (!nodes.every((node) => node.getEndpoint(this.endpoint.index)?.supportsCC(import_safe.CommandClasses.Configuration))) {
639
+ throw new import_safe.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target endpoints to support Configuration CC!`, import_safe.ZWaveErrorCodes.CC_Invalid);
640
+ }
641
+ const paramInfos = this.endpoint.node.physicalNodes.map((node) => createConfigurationCCInstance(node.getEndpoint(this.endpoint.index)).getParamInformation(this.host, property, propertyKey));
642
+ if (!paramInfos.length || !paramInfos.every((info, index) => {
643
+ if (index === 0)
644
+ return true;
645
+ return info.valueSize === paramInfos[0].valueSize && info.format === paramInfos[0].format;
646
+ })) {
647
+ throw new import_safe.ZWaveError(`The multicast setValue API for Configuration CC requires all virtual target nodes to have the same parameter definition!`, import_safe.ZWaveErrorCodes.CC_Invalid);
648
+ }
649
+ ccInstance = createConfigurationCCInstance(this.endpoint);
650
+ } else {
651
+ throw new import_safe.ZWaveError(`The setValue API for Configuration CC is not supported via broadcast!`, import_safe.ZWaveErrorCodes.CC_NotSupported);
652
+ }
653
+ let { valueSize, format: valueFormat = import_safe.ConfigValueFormat.SignedInteger } = ccInstance.getParamInformation(applHost, property);
654
+ let targetValue;
655
+ if (propertyKey) {
656
+ if (!valueSize) {
657
+ valueSize = ccInstance.getParamInformation(applHost, property, propertyKey).valueSize;
658
+ }
659
+ targetValue = ccInstance.composePartialParamValue(applHost, property, propertyKey, value);
660
+ valueFormat = import_safe.ConfigValueFormat.UnsignedInteger;
661
+ } else {
662
+ targetValue = value;
610
663
  }
611
- targetValue = ccInstance.composePartialParamValue(applHost, property, propertyKey, value);
612
- valueFormat = import_safe.ConfigValueFormat.UnsignedInteger;
613
- } else {
614
- targetValue = value;
615
- }
616
- if (!valueSize) {
617
- valueSize = (0, import_safe.getMinIntegerSize)(targetValue, valueFormat === import_safe.ConfigValueFormat.SignedInteger);
618
664
  if (!valueSize) {
619
- throw new import_safe.ZWaveError(`The value ${targetValue} is not valid for configuration parameters!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
665
+ valueSize = (0, import_safe.getMinIntegerSize)(targetValue, valueFormat === import_safe.ConfigValueFormat.SignedInteger);
666
+ if (!valueSize) {
667
+ throw new import_safe.ZWaveError(`The value ${targetValue} is not valid for configuration parameters!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
668
+ }
669
+ }
670
+ if (!isSafeValue(targetValue, valueSize, valueFormat)) {
671
+ throwInvalidValueError(targetValue, property, valueSize, valueFormat);
672
+ }
673
+ const result = await this.set({
674
+ parameter: property,
675
+ value: targetValue,
676
+ valueSize,
677
+ valueFormat
678
+ });
679
+ if (!(0, import_safe.supervisedCommandSucceeded)(result) && this.isSinglecast()) {
680
+ this.schedulePoll(
681
+ { property, propertyKey },
682
+ targetValue,
683
+ // Configuration changes are instant
684
+ { transition: "fast" }
685
+ );
686
+ }
687
+ return result;
688
+ };
689
+ }
690
+ get [import_API.POLL_VALUE]() {
691
+ return async function({ property, propertyKey }) {
692
+ if (typeof property !== "number") {
693
+ (0, import_API.throwUnsupportedProperty)(this.ccId, property);
694
+ }
695
+ if (propertyKey != void 0 && typeof propertyKey !== "number") {
696
+ (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
620
697
  }
698
+ return this.get(property, { valueBitMask: propertyKey });
699
+ };
700
+ }
701
+ /**
702
+ * Requests the current value of a given config parameter from the device.
703
+ * This may timeout and return `undefined` if the node does not respond.
704
+ * If the node replied with a different parameter number, a `ConfigurationCCError`
705
+ * is thrown with the `argument` property set to the reported parameter number.
706
+ */
707
+ async get(parameter, options) {
708
+ __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
709
+ __assertType("options", void 0, __assertType__optional__0.bind(void 0, options));
710
+ this.assertPhysicalEndpoint(this.endpoint);
711
+ if (parameter > 255) {
712
+ const result = await this.getBulk([
713
+ {
714
+ parameter,
715
+ bitMask: options?.valueBitMask
716
+ }
717
+ ]);
718
+ return result.find((r) => r.parameter === parameter)?.value;
621
719
  }
622
- if (!isSafeValue(targetValue, valueSize, valueFormat)) {
623
- throwInvalidValueError(targetValue, property, valueSize, valueFormat);
720
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Get);
721
+ const { valueBitMask, allowUnexpectedResponse } = options ?? {};
722
+ const cc = new ConfigurationCCGet({
723
+ nodeId: this.endpoint.nodeId,
724
+ endpointIndex: this.endpoint.index,
725
+ parameter,
726
+ allowUnexpectedResponse
727
+ });
728
+ const response = await this.host.sendCommand(cc, this.commandOptions);
729
+ if (!response)
730
+ return;
731
+ if (response.parameter === parameter) {
732
+ if (!valueBitMask)
733
+ return response.value;
734
+ const paramInfo = cc.getParamInformation(this.host, response.parameter, valueBitMask);
735
+ return (0, import_safe.parsePartial)(response.value, valueBitMask, isSignedPartial(valueBitMask, paramInfo.format));
624
736
  }
625
- const result = await this.set({
626
- parameter: property,
627
- value: targetValue,
628
- valueSize,
629
- valueFormat
737
+ this.host.logNode(this.endpoint.nodeId, {
738
+ endpoint: this.endpoint.index,
739
+ message: `Received unexpected ConfigurationReport (param = ${response.parameter}, value = ${response.value.toString()})`,
740
+ direction: "inbound",
741
+ level: "error"
630
742
  });
631
- if (!(0, import_safe.supervisedCommandSucceeded)(result) && this.isSinglecast()) {
632
- this.schedulePoll(
633
- { property, propertyKey },
634
- targetValue,
635
- // Configuration changes are instant
636
- { transition: "fast" }
637
- );
743
+ throw new ConfigurationCCError(`The first existing parameter on this node is ${response.parameter}`, import_safe.ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber, response.parameter);
744
+ }
745
+ /**
746
+ * Requests the current value of the config parameters from the device.
747
+ * When the node does not respond due to a timeout, the `value` in the returned array will be `undefined`.
748
+ */
749
+ async getBulk(options) {
750
+ __assertType("options", void 0, __assertType__sa__2_ea_2.bind(void 0, options));
751
+ this.assertPhysicalEndpoint(this.endpoint);
752
+ let values;
753
+ const distinctParameters = (0, import_arrays.distinct)(options.map((o) => o.parameter));
754
+ if (this.supportsCommand(import_Types.ConfigurationCommand.BulkGet) && (0, import_safe.isConsecutiveArray)(distinctParameters)) {
755
+ const cc2 = new ConfigurationCCBulkGet({
756
+ nodeId: this.endpoint.nodeId,
757
+ endpointIndex: this.endpoint.index,
758
+ parameters: distinctParameters
759
+ });
760
+ const response = await this.host.sendCommand(cc2, this.commandOptions);
761
+ if (response)
762
+ values = response.values;
763
+ } else {
764
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Get);
765
+ const _values = /* @__PURE__ */ new Map();
766
+ for (const parameter of distinctParameters) {
767
+ const cc2 = new ConfigurationCCGet({
768
+ nodeId: this.endpoint.nodeId,
769
+ endpointIndex: this.endpoint.index,
770
+ parameter
771
+ });
772
+ const response = await this.host.sendCommand(cc2, this.commandOptions);
773
+ if (response) {
774
+ _values.set(response.parameter, response.value);
775
+ }
776
+ }
777
+ values = _values;
638
778
  }
639
- return result;
640
- };
641
- }
642
- get [import_API.POLL_VALUE]() {
643
- return async function({ property, propertyKey }) {
644
- if (typeof property !== "number") {
645
- (0, import_API.throwUnsupportedProperty)(this.ccId, property);
779
+ const cc = createConfigurationCCInstance(this.endpoint);
780
+ return options.map((o) => {
781
+ let value = values?.get(o.parameter);
782
+ if (typeof value === "number" && o.bitMask) {
783
+ const paramInfo = cc.getParamInformation(this.host, o.parameter, o.bitMask);
784
+ value = (0, import_safe.parsePartial)(value, o.bitMask, isSignedPartial(o.bitMask, paramInfo.format));
785
+ }
786
+ return { ...o, value };
787
+ });
788
+ }
789
+ /**
790
+ * Sets a new value for a given config parameter of the device.
791
+ */
792
+ async set(options) {
793
+ __assertType("options", "ConfigurationCCAPISetOptions", __assertType__ConfigurationCCAPISetOptions.bind(void 0, options));
794
+ if (options.parameter > 255) {
795
+ return this.setBulk([options]);
646
796
  }
647
- if (propertyKey != void 0 && typeof propertyKey !== "number") {
648
- (0, import_API.throwUnsupportedPropertyKey)(this.ccId, property, propertyKey);
797
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
798
+ const normalized = normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, options);
799
+ let value = normalized.value;
800
+ if (normalized.bitMask) {
801
+ const ccc = createConfigurationCCInstance(this.endpoint);
802
+ value = ccc.composePartialParamValue(this.host, normalized.parameter, normalized.bitMask, normalized.value);
649
803
  }
650
- return this.get(property, { valueBitMask: propertyKey });
651
- };
652
- }
653
- /**
654
- * Requests the current value of a given config parameter from the device.
655
- * This may timeout and return `undefined` if the node does not respond.
656
- * If the node replied with a different parameter number, a `ConfigurationCCError`
657
- * is thrown with the `argument` property set to the reported parameter number.
658
- */
659
- async get(parameter, options) {
660
- __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
661
- __assertType("options", void 0, __assertType__optional__0.bind(void 0, options));
662
- this.assertPhysicalEndpoint(this.endpoint);
663
- if (parameter > 255) {
664
- const result = await this.getBulk([
665
- {
666
- parameter,
667
- bitMask: options?.valueBitMask
668
- }
669
- ]);
670
- return result.find((r) => r.parameter === parameter)?.value;
671
- }
672
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Get);
673
- const { valueBitMask, allowUnexpectedResponse } = options ?? {};
674
- const cc = new ConfigurationCCGet({
675
- nodeId: this.endpoint.nodeId,
676
- endpointIndex: this.endpoint.index,
677
- parameter,
678
- allowUnexpectedResponse
679
- });
680
- const response = await this.host.sendCommand(cc, this.commandOptions);
681
- if (!response)
682
- return;
683
- if (response.parameter === parameter) {
684
- if (!valueBitMask)
685
- return response.value;
686
- const paramInfo = cc.getParamInformation(this.host, response.parameter, valueBitMask);
687
- return (0, import_safe.parsePartial)(response.value, valueBitMask, isSignedPartial(valueBitMask, paramInfo.format));
688
- }
689
- this.host.logNode(this.endpoint.nodeId, {
690
- endpoint: this.endpoint.index,
691
- message: `Received unexpected ConfigurationReport (param = ${response.parameter}, value = ${response.value.toString()})`,
692
- direction: "inbound",
693
- level: "error"
694
- });
695
- throw new ConfigurationCCError(`The first existing parameter on this node is ${response.parameter}`, import_safe.ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber, response.parameter);
696
- }
697
- /**
698
- * Requests the current value of the config parameters from the device.
699
- * When the node does not respond due to a timeout, the `value` in the returned array will be `undefined`.
700
- */
701
- async getBulk(options) {
702
- __assertType("options", void 0, __assertType__sa__2_ea_2.bind(void 0, options));
703
- this.assertPhysicalEndpoint(this.endpoint);
704
- let values;
705
- const distinctParameters = (0, import_arrays.distinct)(options.map((o) => o.parameter));
706
- if (this.supportsCommand(import_Types.ConfigurationCommand.BulkGet) && (0, import_safe.isConsecutiveArray)(distinctParameters)) {
707
- const cc2 = new ConfigurationCCBulkGet({
804
+ const cc = new ConfigurationCCSet({
708
805
  nodeId: this.endpoint.nodeId,
709
806
  endpointIndex: this.endpoint.index,
710
- parameters: distinctParameters
807
+ resetToDefault: false,
808
+ parameter: normalized.parameter,
809
+ value,
810
+ valueSize: normalized.valueSize,
811
+ valueFormat: normalized.valueFormat
711
812
  });
712
- const response = await this.host.sendCommand(cc2, this.commandOptions);
713
- if (response)
714
- values = response.values;
715
- } else {
716
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Get);
717
- const _values = /* @__PURE__ */ new Map();
718
- for (const parameter of distinctParameters) {
719
- const cc2 = new ConfigurationCCGet({
813
+ return this.host.sendCommand(cc, this.commandOptions);
814
+ }
815
+ /**
816
+ * Sets new values for multiple config parameters of the device. Uses the `BulkSet` command if supported, otherwise falls back to individual `Set` commands.
817
+ */
818
+ async setBulk(values) {
819
+ __assertType("values", void 0, __assertType__sa_su_si__4__5_ei_si__4__7_ei_si__4__9_ei_eu_ea_2.bind(void 0, values));
820
+ const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, v));
821
+ const allParams = bulkMergePartialParamValues(this.host, this.endpoint, normalized);
822
+ const canUseBulkSet = this.supportsCommand(import_Types.ConfigurationCommand.BulkSet) && (0, import_safe.isConsecutiveArray)(allParams.map((v) => v.parameter)) && new Set(allParams.map((v) => v.valueFormat)).size === 1 && new Set(allParams.map((v) => v.valueSize)).size === 1;
823
+ if (canUseBulkSet) {
824
+ const cc = new ConfigurationCCBulkSet({
720
825
  nodeId: this.endpoint.nodeId,
721
826
  endpointIndex: this.endpoint.index,
722
- parameter
827
+ parameters: allParams.map((v) => v.parameter),
828
+ valueSize: allParams[0].valueSize,
829
+ valueFormat: allParams[0].valueFormat,
830
+ values: allParams.map((v) => v.value),
831
+ handshake: true
723
832
  });
724
- const response = await this.host.sendCommand(cc2, this.commandOptions);
725
- if (response) {
726
- _values.set(response.parameter, response.value);
833
+ const result = await this.host.sendCommand(cc, this.commandOptions);
834
+ if (result) {
835
+ const sentValues = cc.values;
836
+ const receivedValues = [...result.values.values()];
837
+ const success = sentValues.length === receivedValues.length && sentValues.every((v, i) => v === receivedValues[i]);
838
+ return {
839
+ status: success ? import_safe.SupervisionStatus.Success : import_safe.SupervisionStatus.Fail
840
+ };
841
+ } else {
842
+ return void 0;
843
+ }
844
+ } else {
845
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
846
+ const supervisionResults = [];
847
+ for (const { parameter, value, valueSize, valueFormat } of allParams) {
848
+ const cc = new ConfigurationCCSet({
849
+ nodeId: this.endpoint.nodeId,
850
+ endpointIndex: this.endpoint.index,
851
+ parameter,
852
+ value,
853
+ valueSize,
854
+ valueFormat
855
+ });
856
+ supervisionResults.push(await this.host.sendCommand(cc, this.commandOptions));
727
857
  }
858
+ return (0, import_safe.mergeSupervisionResults)(supervisionResults);
728
859
  }
729
- values = _values;
730
- }
731
- const cc = createConfigurationCCInstance(this.endpoint);
732
- return options.map((o) => {
733
- let value = values?.get(o.parameter);
734
- if (typeof value === "number" && o.bitMask) {
735
- const paramInfo = cc.getParamInformation(this.host, o.parameter, o.bitMask);
736
- value = (0, import_safe.parsePartial)(value, o.bitMask, isSignedPartial(o.bitMask, paramInfo.format));
860
+ }
861
+ /**
862
+ * Resets a configuration parameter to its default value.
863
+ *
864
+ * WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
865
+ */
866
+ async reset(parameter) {
867
+ __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
868
+ if (parameter > 255) {
869
+ return this.resetBulk([parameter]);
737
870
  }
738
- return { ...o, value };
739
- });
740
- }
741
- /**
742
- * Sets a new value for a given config parameter of the device.
743
- */
744
- async set(options) {
745
- __assertType("options", "ConfigurationCCAPISetOptions", __assertType__ConfigurationCCAPISetOptions.bind(void 0, options));
746
- if (options.parameter > 255) {
747
- return this.setBulk([options]);
748
- }
749
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
750
- const normalized = normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, options);
751
- let value = normalized.value;
752
- if (normalized.bitMask) {
753
- const ccc = createConfigurationCCInstance(this.endpoint);
754
- value = ccc.composePartialParamValue(this.host, normalized.parameter, normalized.bitMask, normalized.value);
755
- }
756
- const cc = new ConfigurationCCSet({
757
- nodeId: this.endpoint.nodeId,
758
- endpointIndex: this.endpoint.index,
759
- resetToDefault: false,
760
- parameter: normalized.parameter,
761
- value,
762
- valueSize: normalized.valueSize,
763
- valueFormat: normalized.valueFormat
764
- });
765
- return this.host.sendCommand(cc, this.commandOptions);
766
- }
767
- /**
768
- * Sets new values for multiple config parameters of the device. Uses the `BulkSet` command if supported, otherwise falls back to individual `Set` commands.
769
- */
770
- async setBulk(values) {
771
- __assertType("values", void 0, __assertType__sa_su_si__4__5_ei_si__4__7_ei_si__4__9_ei_eu_ea_2.bind(void 0, values));
772
- const normalized = values.map((v) => normalizeConfigurationCCAPISetOptions(this.host, this.endpoint, v));
773
- const allParams = bulkMergePartialParamValues(this.host, this.endpoint, normalized);
774
- const canUseBulkSet = this.supportsCommand(import_Types.ConfigurationCommand.BulkSet) && (0, import_safe.isConsecutiveArray)(allParams.map((v) => v.parameter)) && new Set(allParams.map((v) => v.valueFormat)).size === 1 && new Set(allParams.map((v) => v.valueSize)).size === 1;
775
- if (canUseBulkSet) {
776
- const cc = new ConfigurationCCBulkSet({
871
+ if (this.version <= 3) {
872
+ throw new import_safe.ZWaveError(`Resetting configuration parameters to default MUST not be done on nodes implementing ConfigurationCC V3 or below!`, import_safe.ZWaveErrorCodes.ConfigurationCC_NoResetToDefaultOnLegacyDevices);
873
+ }
874
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
875
+ const cc = new ConfigurationCCSet({
777
876
  nodeId: this.endpoint.nodeId,
778
877
  endpointIndex: this.endpoint.index,
779
- parameters: allParams.map((v) => v.parameter),
780
- valueSize: allParams[0].valueSize,
781
- valueFormat: allParams[0].valueFormat,
782
- values: allParams.map((v) => v.value),
783
- handshake: true
878
+ parameter,
879
+ resetToDefault: true
784
880
  });
785
- const result = await this.host.sendCommand(cc, this.commandOptions);
786
- if (result) {
787
- const sentValues = cc.values;
788
- const receivedValues = [...result.values.values()];
789
- const success = sentValues.length === receivedValues.length && sentValues.every((v, i) => v === receivedValues[i]);
790
- return {
791
- status: success ? import_safe.SupervisionStatus.Success : import_safe.SupervisionStatus.Fail
792
- };
881
+ return this.host.sendCommand(cc, this.commandOptions);
882
+ }
883
+ /**
884
+ * Resets multiple configuration parameters to their default value. Uses BulkSet if supported, otherwise falls back to individual Set commands.
885
+ *
886
+ * WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
887
+ */
888
+ async resetBulk(parameters) {
889
+ __assertType("parameters", void 0, __assertType__sa__number_ea_2.bind(void 0, parameters));
890
+ if ((0, import_safe.isConsecutiveArray)(parameters) && this.supportsCommand(import_Types.ConfigurationCommand.BulkSet)) {
891
+ const cc = new ConfigurationCCBulkSet({
892
+ nodeId: this.endpoint.nodeId,
893
+ endpointIndex: this.endpoint.index,
894
+ parameters,
895
+ resetToDefault: true
896
+ });
897
+ return this.host.sendCommand(cc, this.commandOptions);
793
898
  } else {
794
- return void 0;
795
- }
796
- } else {
797
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
798
- const supervisionResults = [];
799
- for (const { parameter, value, valueSize, valueFormat } of allParams) {
800
- const cc = new ConfigurationCCSet({
899
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
900
+ const CCs = (0, import_arrays.distinct)(parameters).map((parameter) => new ConfigurationCCSet({
801
901
  nodeId: this.endpoint.nodeId,
802
902
  endpointIndex: this.endpoint.index,
803
903
  parameter,
804
- value,
805
- valueSize,
806
- valueFormat
807
- });
808
- supervisionResults.push(await this.host.sendCommand(cc, this.commandOptions));
904
+ resetToDefault: true
905
+ }));
906
+ for (const cc of CCs) {
907
+ await this.host.sendCommand(cc, this.commandOptions);
908
+ }
809
909
  }
810
- return (0, import_safe.mergeSupervisionResults)(supervisionResults);
811
910
  }
812
- }
813
- /**
814
- * Resets a configuration parameter to its default value.
815
- *
816
- * WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
817
- */
818
- async reset(parameter) {
819
- __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
820
- if (parameter > 255) {
821
- return this.resetBulk([parameter]);
822
- }
823
- if (this.version <= 3) {
824
- throw new import_safe.ZWaveError(`Resetting configuration parameters to default MUST not be done on nodes implementing ConfigurationCC V3 or below!`, import_safe.ZWaveErrorCodes.ConfigurationCC_NoResetToDefaultOnLegacyDevices);
825
- }
826
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
827
- const cc = new ConfigurationCCSet({
828
- nodeId: this.endpoint.nodeId,
829
- endpointIndex: this.endpoint.index,
830
- parameter,
831
- resetToDefault: true
832
- });
833
- return this.host.sendCommand(cc, this.commandOptions);
834
- }
835
- /**
836
- * Resets multiple configuration parameters to their default value. Uses BulkSet if supported, otherwise falls back to individual Set commands.
837
- *
838
- * WARNING: This will throw on legacy devices (ConfigurationCC v3 and below)
839
- */
840
- async resetBulk(parameters) {
841
- __assertType("parameters", void 0, __assertType__sa__number_ea_2.bind(void 0, parameters));
842
- if ((0, import_safe.isConsecutiveArray)(parameters) && this.supportsCommand(import_Types.ConfigurationCommand.BulkSet)) {
843
- const cc = new ConfigurationCCBulkSet({
911
+ /** Resets all configuration parameters to their default value */
912
+ async resetAll() {
913
+ this.assertPhysicalEndpoint(this.endpoint);
914
+ this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.DefaultReset);
915
+ const cc = new ConfigurationCCDefaultReset({
844
916
  nodeId: this.endpoint.nodeId,
845
- endpointIndex: this.endpoint.index,
846
- parameters,
847
- resetToDefault: true
917
+ endpointIndex: this.endpoint.index
848
918
  });
849
- return this.host.sendCommand(cc, this.commandOptions);
850
- } else {
851
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.Set);
852
- const CCs = (0, import_arrays.distinct)(parameters).map((parameter) => new ConfigurationCCSet({
919
+ await this.host.sendCommand(cc, this.commandOptions);
920
+ }
921
+ async getProperties(parameter) {
922
+ __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
923
+ this.assertPhysicalEndpoint(this.endpoint);
924
+ const cc = new ConfigurationCCPropertiesGet({
853
925
  nodeId: this.endpoint.nodeId,
854
926
  endpointIndex: this.endpoint.index,
855
- parameter,
856
- resetToDefault: true
857
- }));
858
- for (const cc of CCs) {
859
- await this.host.sendCommand(cc, this.commandOptions);
927
+ parameter
928
+ });
929
+ const response = await this.host.sendCommand(cc, this.commandOptions);
930
+ if (response) {
931
+ return (0, import_safe3.pick)(response, [
932
+ "valueSize",
933
+ "valueFormat",
934
+ "minValue",
935
+ "maxValue",
936
+ "defaultValue",
937
+ "nextParameter",
938
+ "altersCapabilities",
939
+ "isReadonly",
940
+ "isAdvanced",
941
+ "noBulkSupport"
942
+ ]);
860
943
  }
861
944
  }
862
- }
863
- /** Resets all configuration parameters to their default value */
864
- async resetAll() {
865
- this.assertPhysicalEndpoint(this.endpoint);
866
- this.assertSupportsCommand(import_Types.ConfigurationCommand, import_Types.ConfigurationCommand.DefaultReset);
867
- const cc = new ConfigurationCCDefaultReset({
868
- nodeId: this.endpoint.nodeId,
869
- endpointIndex: this.endpoint.index
870
- });
871
- await this.host.sendCommand(cc, this.commandOptions);
872
- }
873
- async getProperties(parameter) {
874
- __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
875
- this.assertPhysicalEndpoint(this.endpoint);
876
- const cc = new ConfigurationCCPropertiesGet({
877
- nodeId: this.endpoint.nodeId,
878
- endpointIndex: this.endpoint.index,
879
- parameter
880
- });
881
- const response = await this.host.sendCommand(cc, this.commandOptions);
882
- if (response) {
883
- return (0, import_safe3.pick)(response, [
884
- "valueSize",
885
- "valueFormat",
886
- "minValue",
887
- "maxValue",
888
- "defaultValue",
889
- "nextParameter",
890
- "altersCapabilities",
891
- "isReadonly",
892
- "isAdvanced",
893
- "noBulkSupport"
894
- ]);
895
- }
896
- }
897
- /** Requests the name of a configuration parameter from the node */
898
- async getName(parameter) {
899
- __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
900
- this.assertPhysicalEndpoint(this.endpoint);
901
- const cc = new ConfigurationCCNameGet({
902
- nodeId: this.endpoint.nodeId,
903
- endpointIndex: this.endpoint.index,
904
- parameter
905
- });
906
- const response = await this.host.sendCommand(cc, this.commandOptions);
907
- return response?.name;
908
- }
909
- /** Requests usage info for a configuration parameter from the node */
910
- async getInfo(parameter) {
911
- __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
912
- this.assertPhysicalEndpoint(this.endpoint);
913
- const cc = new ConfigurationCCInfoGet({
914
- nodeId: this.endpoint.nodeId,
915
- endpointIndex: this.endpoint.index,
916
- parameter
917
- });
918
- const response = await this.host.sendCommand(cc, this.commandOptions);
919
- return response?.info;
920
- }
921
- /**
922
- * This scans the node for the existing parameters. Found parameters will be reported
923
- * through the `value added` and `value updated` events.
924
- *
925
- * WARNING: This method throws for newer devices.
926
- *
927
- * WARNING: On nodes implementing V1 and V2, this process may take
928
- * **up to an hour**, depending on the configured timeout.
929
- *
930
- * WARNING: On nodes implementing V2, all parameters after 255 will be ignored.
931
- */
932
- async scanParametersLegacy() {
933
- if (this.version >= 3) {
934
- throw new import_safe.ZWaveError("Use ConfigurationCC.interview instead of scanning parameters for versions 3 and above.", import_safe.ZWaveErrorCodes.ConfigurationCC_NoLegacyScanOnNewDevices);
935
- }
936
- this.assertPhysicalEndpoint(this.endpoint);
937
- this.host.logNode(this.endpoint.nodeId, {
938
- endpoint: this.endpoint.index,
939
- message: `Scanning available parameters...`
940
- });
941
- const ccInstance = createConfigurationCCInstance(this.endpoint);
942
- for (let param = 1; param <= 255; param++) {
943
- let originalValue;
945
+ /** Requests the name of a configuration parameter from the node */
946
+ async getName(parameter) {
947
+ __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
948
+ this.assertPhysicalEndpoint(this.endpoint);
949
+ const cc = new ConfigurationCCNameGet({
950
+ nodeId: this.endpoint.nodeId,
951
+ endpointIndex: this.endpoint.index,
952
+ parameter
953
+ });
954
+ const response = await this.host.sendCommand(cc, this.commandOptions);
955
+ return response?.name;
956
+ }
957
+ /** Requests usage info for a configuration parameter from the node */
958
+ async getInfo(parameter) {
959
+ __assertType("parameter", "number", __assertType__number.bind(void 0, parameter));
960
+ this.assertPhysicalEndpoint(this.endpoint);
961
+ const cc = new ConfigurationCCInfoGet({
962
+ nodeId: this.endpoint.nodeId,
963
+ endpointIndex: this.endpoint.index,
964
+ parameter
965
+ });
966
+ const response = await this.host.sendCommand(cc, this.commandOptions);
967
+ return response?.info;
968
+ }
969
+ /**
970
+ * This scans the node for the existing parameters. Found parameters will be reported
971
+ * through the `value added` and `value updated` events.
972
+ *
973
+ * WARNING: This method throws for newer devices.
974
+ *
975
+ * WARNING: On nodes implementing V1 and V2, this process may take
976
+ * **up to an hour**, depending on the configured timeout.
977
+ *
978
+ * WARNING: On nodes implementing V2, all parameters after 255 will be ignored.
979
+ */
980
+ async scanParametersLegacy() {
981
+ if (this.version >= 3) {
982
+ throw new import_safe.ZWaveError("Use ConfigurationCC.interview instead of scanning parameters for versions 3 and above.", import_safe.ZWaveErrorCodes.ConfigurationCC_NoLegacyScanOnNewDevices);
983
+ }
984
+ this.assertPhysicalEndpoint(this.endpoint);
944
985
  this.host.logNode(this.endpoint.nodeId, {
945
986
  endpoint: this.endpoint.index,
946
- message: ` trying param ${param}...`,
947
- direction: "outbound"
987
+ message: `Scanning available parameters...`
948
988
  });
949
- try {
950
- originalValue = await this.get(param, {
951
- // When requesting a non-existing parameter, a node SHOULD respond with the
952
- // first available parameter. We use this for the first param only,
953
- // because delayed responses might otherwise confuse the interview process
954
- allowUnexpectedResponse: param === 1
989
+ const ccInstance = createConfigurationCCInstance(this.endpoint);
990
+ for (let param = 1; param <= 255; param++) {
991
+ let originalValue;
992
+ this.host.logNode(this.endpoint.nodeId, {
993
+ endpoint: this.endpoint.index,
994
+ message: ` trying param ${param}...`,
995
+ direction: "outbound"
955
996
  });
956
- if (originalValue != void 0) {
957
- const logMessage = ` Param ${param}:
997
+ try {
998
+ originalValue = await this.get(param, {
999
+ // When requesting a non-existing parameter, a node SHOULD respond with the
1000
+ // first available parameter. We use this for the first param only,
1001
+ // because delayed responses might otherwise confuse the interview process
1002
+ allowUnexpectedResponse: param === 1
1003
+ });
1004
+ if (originalValue != void 0) {
1005
+ const logMessage = ` Param ${param}:
958
1006
  readable = true
959
1007
  valueSize = ${ccInstance.getParamInformation(this.host, param).valueSize}
960
1008
  value = ${originalValue.toString()}`;
961
- this.host.logNode(this.endpoint.nodeId, {
962
- endpoint: this.endpoint.index,
963
- message: logMessage,
964
- direction: "inbound"
965
- });
966
- }
967
- } catch (e) {
968
- if (e instanceof ConfigurationCCError && e.code === import_safe.ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber) {
969
- if (e.argument - 1 > param)
970
- param = e.argument - 1;
971
- continue;
1009
+ this.host.logNode(this.endpoint.nodeId, {
1010
+ endpoint: this.endpoint.index,
1011
+ message: logMessage,
1012
+ direction: "inbound"
1013
+ });
1014
+ }
1015
+ } catch (e) {
1016
+ if (e instanceof ConfigurationCCError && e.code === import_safe.ZWaveErrorCodes.ConfigurationCC_FirstParameterNumber) {
1017
+ if (e.argument - 1 > param)
1018
+ param = e.argument - 1;
1019
+ continue;
1020
+ }
1021
+ throw e;
972
1022
  }
973
- throw e;
974
1023
  }
975
1024
  }
976
- }
977
- };
978
- ConfigurationCCAPI = __decorate([
979
- (0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Configuration)
980
- ], ConfigurationCCAPI);
981
- let ConfigurationCC = class ConfigurationCC2 extends import_CommandClass.CommandClass {
982
- async interview(ctx) {
983
- const node = this.getNode(ctx);
984
- const endpoint = this.getEndpoint(ctx);
985
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Configuration, ctx, endpoint).withOptions({
986
- priority: import_safe.MessagePriority.NodeQuery
987
- });
988
- ctx.logNode(node.id, {
989
- endpoint: this.endpointIndex,
990
- message: `Interviewing ${this.ccName}...`,
991
- direction: "none"
992
- });
993
- const deviceConfig = ctx.getDeviceConfig?.(node.id);
994
- const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
995
- if (paramInfo) {
996
- ctx.logNode(node.id, {
997
- endpoint: this.endpointIndex,
998
- message: `${this.constructor.name}: Loading configuration parameters from device config`,
999
- direction: "none"
1025
+ };
1026
+ return ConfigurationCCAPI2 = _classThis;
1027
+ })();
1028
+ let ConfigurationCC = (() => {
1029
+ let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Configuration), (0, import_CommandClassDecorators.implementedVersion)(4), (0, import_CommandClassDecorators.ccValues)(ConfigurationCCValues)];
1030
+ let _classDescriptor;
1031
+ let _classExtraInitializers = [];
1032
+ let _classThis;
1033
+ let _classSuper = import_CommandClass.CommandClass;
1034
+ var ConfigurationCC2 = class extends _classSuper {
1035
+ static {
1036
+ _classThis = this;
1037
+ }
1038
+ static {
1039
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1040
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1041
+ ConfigurationCC2 = _classThis = _classDescriptor.value;
1042
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1043
+ __runInitializers(_classThis, _classExtraInitializers);
1044
+ }
1045
+ async interview(ctx) {
1046
+ const node = this.getNode(ctx);
1047
+ const endpoint = this.getEndpoint(ctx);
1048
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Configuration, ctx, endpoint).withOptions({
1049
+ priority: import_safe.MessagePriority.NodeQuery
1000
1050
  });
1001
- this.deserializeParamInformationFromConfig(ctx, paramInfo);
1002
- }
1003
- const documentedParamNumbers = new Set(Array.from(paramInfo?.keys() ?? []).map((k) => k.parameter));
1004
- if (api.version >= 3) {
1005
1051
  ctx.logNode(node.id, {
1006
1052
  endpoint: this.endpointIndex,
1007
- message: "finding first configuration parameter...",
1008
- direction: "outbound"
1053
+ message: `Interviewing ${this.ccName}...`,
1054
+ direction: "none"
1009
1055
  });
1010
- const param0props = await api.getProperties(0);
1011
- let param;
1012
- if (param0props) {
1013
- param = param0props.nextParameter;
1014
- if (param === 0) {
1015
- ctx.logNode(node.id, {
1016
- endpoint: this.endpointIndex,
1017
- message: `didn't report any config params, trying #1 just to be sure...`,
1018
- direction: "inbound"
1019
- });
1020
- param = 1;
1021
- }
1022
- } else {
1056
+ const deviceConfig = ctx.getDeviceConfig?.(node.id);
1057
+ const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
1058
+ if (paramInfo) {
1023
1059
  ctx.logNode(node.id, {
1024
1060
  endpoint: this.endpointIndex,
1025
- message: "Finding first configuration parameter timed out, skipping interview...",
1026
- level: "warn"
1061
+ message: `${this.constructor.name}: Loading configuration parameters from device config`,
1062
+ direction: "none"
1027
1063
  });
1028
- return;
1064
+ this.deserializeParamInformationFromConfig(ctx, paramInfo);
1029
1065
  }
1030
- while (param > 0) {
1066
+ const documentedParamNumbers = new Set(Array.from(paramInfo?.keys() ?? []).map((k) => k.parameter));
1067
+ if (api.version >= 3) {
1031
1068
  ctx.logNode(node.id, {
1032
1069
  endpoint: this.endpointIndex,
1033
- message: `querying parameter #${param} information...`,
1070
+ message: "finding first configuration parameter...",
1034
1071
  direction: "outbound"
1035
1072
  });
1036
- const props = await api.getProperties(param).catch(
1037
- // If querying the properties fails, don't abort the entire interview
1038
- () => void 0
1039
- );
1040
- if (!props) {
1073
+ const param0props = await api.getProperties(0);
1074
+ let param;
1075
+ if (param0props) {
1076
+ param = param0props.nextParameter;
1077
+ if (param === 0) {
1078
+ ctx.logNode(node.id, {
1079
+ endpoint: this.endpointIndex,
1080
+ message: `didn't report any config params, trying #1 just to be sure...`,
1081
+ direction: "inbound"
1082
+ });
1083
+ param = 1;
1084
+ }
1085
+ } else {
1041
1086
  ctx.logNode(node.id, {
1042
1087
  endpoint: this.endpointIndex,
1043
- message: `Querying parameter #${param} information timed out, skipping scan...`,
1088
+ message: "Finding first configuration parameter timed out, skipping interview...",
1044
1089
  level: "warn"
1045
1090
  });
1046
- break;
1091
+ return;
1047
1092
  }
1048
- const { nextParameter, ...properties } = props;
1049
- let logMessage;
1050
- if (properties.valueSize === 0) {
1051
- logMessage = `Parameter #${param} is unsupported. Next parameter: ${nextParameter}`;
1052
- } else {
1053
- let name;
1054
- if (!documentedParamNumbers.has(param)) {
1055
- if (!deviceConfig?.compat?.skipConfigurationNameQuery) {
1056
- name = await api.getName(param).catch(
1057
- // If querying the name fails, don't abort the entire interview
1058
- () => void 0
1059
- );
1093
+ while (param > 0) {
1094
+ ctx.logNode(node.id, {
1095
+ endpoint: this.endpointIndex,
1096
+ message: `querying parameter #${param} information...`,
1097
+ direction: "outbound"
1098
+ });
1099
+ const props = await api.getProperties(param).catch(
1100
+ // If querying the properties fails, don't abort the entire interview
1101
+ () => void 0
1102
+ );
1103
+ if (!props) {
1104
+ ctx.logNode(node.id, {
1105
+ endpoint: this.endpointIndex,
1106
+ message: `Querying parameter #${param} information timed out, skipping scan...`,
1107
+ level: "warn"
1108
+ });
1109
+ break;
1110
+ }
1111
+ const { nextParameter, ...properties } = props;
1112
+ let logMessage;
1113
+ if (properties.valueSize === 0) {
1114
+ logMessage = `Parameter #${param} is unsupported. Next parameter: ${nextParameter}`;
1115
+ } else {
1116
+ let name;
1117
+ if (!documentedParamNumbers.has(param)) {
1118
+ if (!deviceConfig?.compat?.skipConfigurationNameQuery) {
1119
+ name = await api.getName(param).catch(
1120
+ // If querying the name fails, don't abort the entire interview
1121
+ () => void 0
1122
+ );
1123
+ }
1124
+ if (!deviceConfig?.compat?.skipConfigurationInfoQuery) {
1125
+ await api.getInfo(param).catch(
1126
+ // If querying the info fails, don't abort the entire interview
1127
+ () => void 0
1128
+ );
1129
+ }
1060
1130
  }
1061
- if (!deviceConfig?.compat?.skipConfigurationInfoQuery) {
1062
- await api.getInfo(param).catch(
1063
- // If querying the info fails, don't abort the entire interview
1064
- () => void 0
1065
- );
1131
+ logMessage = `received information for parameter #${param}:`;
1132
+ if (name) {
1133
+ logMessage += `
1134
+ parameter name: ${name}`;
1066
1135
  }
1067
- }
1068
- logMessage = `received information for parameter #${param}:`;
1069
- if (name) {
1070
1136
  logMessage += `
1071
- parameter name: ${name}`;
1072
- }
1073
- logMessage += `
1074
1137
  value format: ${(0, import_safe3.getEnumMemberName)(import_safe.ConfigValueFormat, properties.valueFormat)}
1075
1138
  value size: ${properties.valueSize} bytes
1076
1139
  min value: ${properties.minValue?.toString() ?? "undefined"}
@@ -1080,1082 +1143,1266 @@ is read-only: ${!!properties.isReadonly}
1080
1143
  is advanced (UI): ${!!properties.isAdvanced}
1081
1144
  has bulk support: ${!properties.noBulkSupport}
1082
1145
  alters capabilities: ${!!properties.altersCapabilities}`;
1083
- }
1084
- ctx.logNode(node.id, {
1085
- endpoint: this.endpointIndex,
1086
- message: logMessage,
1087
- direction: "inbound"
1088
- });
1089
- if (nextParameter > param) {
1090
- param = nextParameter;
1091
- } else {
1092
- break;
1146
+ }
1147
+ ctx.logNode(node.id, {
1148
+ endpoint: this.endpointIndex,
1149
+ message: logMessage,
1150
+ direction: "inbound"
1151
+ });
1152
+ if (nextParameter > param) {
1153
+ param = nextParameter;
1154
+ } else {
1155
+ break;
1156
+ }
1093
1157
  }
1094
1158
  }
1095
- }
1096
- await this.refreshValues(ctx);
1097
- this.setInterviewComplete(ctx, true);
1098
- }
1099
- async refreshValues(ctx) {
1100
- const node = this.getNode(ctx);
1101
- const endpoint = this.getEndpoint(ctx);
1102
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Configuration, ctx, endpoint).withOptions({
1103
- priority: import_safe.MessagePriority.NodeQuery
1104
- });
1105
- if (api.version < 3) {
1106
- const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
1107
- if (paramInfo?.size) {
1108
- const alreadyQueried = /* @__PURE__ */ new Set();
1109
- for (const param of paramInfo.keys()) {
1110
- if (paramInfo.get(param)?.writeOnly)
1111
- continue;
1112
- if (alreadyQueried.has(param.parameter))
1113
- continue;
1114
- alreadyQueried.add(param.parameter);
1159
+ await this.refreshValues(ctx);
1160
+ this.setInterviewComplete(ctx, true);
1161
+ }
1162
+ async refreshValues(ctx) {
1163
+ const node = this.getNode(ctx);
1164
+ const endpoint = this.getEndpoint(ctx);
1165
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Configuration, ctx, endpoint).withOptions({
1166
+ priority: import_safe.MessagePriority.NodeQuery
1167
+ });
1168
+ if (api.version < 3) {
1169
+ const paramInfo = getParamInformationFromConfigFile(ctx, node.id, this.endpointIndex);
1170
+ if (paramInfo?.size) {
1171
+ const alreadyQueried = /* @__PURE__ */ new Set();
1172
+ for (const param of paramInfo.keys()) {
1173
+ if (paramInfo.get(param)?.writeOnly)
1174
+ continue;
1175
+ if (alreadyQueried.has(param.parameter))
1176
+ continue;
1177
+ alreadyQueried.add(param.parameter);
1178
+ ctx.logNode(node.id, {
1179
+ endpoint: this.endpointIndex,
1180
+ message: `querying parameter #${param.parameter} value...`,
1181
+ direction: "outbound"
1182
+ });
1183
+ const paramValue = await api.get(param.parameter);
1184
+ if (typeof paramValue === "number") {
1185
+ ctx.logNode(node.id, {
1186
+ endpoint: this.endpointIndex,
1187
+ message: `parameter #${param.parameter} has value: ${paramValue}`,
1188
+ direction: "inbound"
1189
+ });
1190
+ } else if (!paramValue) {
1191
+ ctx.logNode(node.id, {
1192
+ endpoint: this.endpointIndex,
1193
+ message: `received no value for parameter #${param.parameter}`,
1194
+ direction: "inbound",
1195
+ level: "warn"
1196
+ });
1197
+ }
1198
+ }
1199
+ } else {
1115
1200
  ctx.logNode(node.id, {
1116
1201
  endpoint: this.endpointIndex,
1117
- message: `querying parameter #${param.parameter} value...`,
1118
- direction: "outbound"
1202
+ message: `${this.constructor.name}: skipping interview because CC version is < 3 and there is no config file`,
1203
+ direction: "none"
1119
1204
  });
1120
- const paramValue = await api.get(param.parameter);
1121
- if (typeof paramValue === "number") {
1205
+ }
1206
+ } else {
1207
+ const parameters = (0, import_arrays.distinct)(this.getDefinedValueIDs(ctx).map((v) => v.property).filter((p) => typeof p === "number"));
1208
+ for (const param of parameters) {
1209
+ if (this.getParamInformation(ctx, param).readable !== false) {
1122
1210
  ctx.logNode(node.id, {
1123
1211
  endpoint: this.endpointIndex,
1124
- message: `parameter #${param.parameter} has value: ${paramValue}`,
1125
- direction: "inbound"
1212
+ message: `querying parameter #${param} value...`,
1213
+ direction: "outbound"
1126
1214
  });
1127
- } else if (!paramValue) {
1215
+ await api.get(param);
1216
+ } else {
1128
1217
  ctx.logNode(node.id, {
1129
1218
  endpoint: this.endpointIndex,
1130
- message: `received no value for parameter #${param.parameter}`,
1131
- direction: "inbound",
1132
- level: "warn"
1219
+ message: `not querying parameter #${param} value, because it is writeonly`,
1220
+ direction: "none"
1133
1221
  });
1134
1222
  }
1135
1223
  }
1136
- } else {
1137
- ctx.logNode(node.id, {
1138
- endpoint: this.endpointIndex,
1139
- message: `${this.constructor.name}: skipping interview because CC version is < 3 and there is no config file`,
1140
- direction: "none"
1141
- });
1142
1224
  }
1143
- } else {
1144
- const parameters = (0, import_arrays.distinct)(this.getDefinedValueIDs(ctx).map((v) => v.property).filter((p) => typeof p === "number"));
1145
- for (const param of parameters) {
1146
- if (this.getParamInformation(ctx, param).readable !== false) {
1147
- ctx.logNode(node.id, {
1148
- endpoint: this.endpointIndex,
1149
- message: `querying parameter #${param} value...`,
1150
- direction: "outbound"
1151
- });
1152
- await api.get(param);
1153
- } else {
1154
- ctx.logNode(node.id, {
1155
- endpoint: this.endpointIndex,
1156
- message: `not querying parameter #${param} value, because it is writeonly`,
1157
- direction: "none"
1158
- });
1225
+ }
1226
+ /**
1227
+ * Whether this node's param information was loaded from a config file.
1228
+ * If this is true, we don't trust what the node reports
1229
+ */
1230
+ paramExistsInConfigFile(ctx, parameter, valueBitMask) {
1231
+ if (this.getValue(ctx, ConfigurationCCValues.isParamInformationFromConfig) !== true) {
1232
+ return false;
1233
+ }
1234
+ const paramInformation = getParamInformationFromConfigFile(ctx, this.nodeId, this.endpointIndex);
1235
+ if (!paramInformation)
1236
+ return false;
1237
+ if (paramInformation.has({ parameter, valueBitMask })) {
1238
+ return true;
1239
+ } else if (valueBitMask == void 0) {
1240
+ for (const key of paramInformation.keys()) {
1241
+ if (key.parameter === parameter)
1242
+ return true;
1159
1243
  }
1160
1244
  }
1161
- }
1162
- }
1163
- /**
1164
- * Whether this node's param information was loaded from a config file.
1165
- * If this is true, we don't trust what the node reports
1166
- */
1167
- paramExistsInConfigFile(ctx, parameter, valueBitMask) {
1168
- if (this.getValue(ctx, ConfigurationCCValues.isParamInformationFromConfig) !== true) {
1169
1245
  return false;
1170
1246
  }
1171
- const paramInformation = getParamInformationFromConfigFile(ctx, this.nodeId, this.endpointIndex);
1172
- if (!paramInformation)
1173
- return false;
1174
- if (paramInformation.has({ parameter, valueBitMask })) {
1175
- return true;
1176
- } else if (valueBitMask == void 0) {
1177
- for (const key of paramInformation.keys()) {
1178
- if (key.parameter === parameter)
1179
- return true;
1247
+ /**
1248
+ * @internal
1249
+ * Stores config parameter metadata for this CC's node
1250
+ */
1251
+ extendParamInformation(ctx, parameter, valueBitMask, info) {
1252
+ if (valueBitMask === void 0 && this.paramExistsInConfigFile(ctx, parameter)) {
1253
+ return;
1180
1254
  }
1255
+ const metadata = this.getParamInformation(ctx, parameter, valueBitMask);
1256
+ Object.assign(metadata, info);
1257
+ this.setMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
1258
+ }
1259
+ /**
1260
+ * @internal
1261
+ * Returns stored config parameter metadata for this CC's node
1262
+ */
1263
+ getParamInformation(ctx, parameter, valueBitMask) {
1264
+ return this.getMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
1265
+ ...import_safe.ValueMetadata.Any
1266
+ };
1181
1267
  }
1182
- return false;
1183
- }
1184
- /**
1185
- * @internal
1186
- * Stores config parameter metadata for this CC's node
1187
- */
1188
- extendParamInformation(ctx, parameter, valueBitMask, info) {
1189
- if (valueBitMask === void 0 && this.paramExistsInConfigFile(ctx, parameter)) {
1190
- return;
1268
+ /**
1269
+ * **INTERNAL:** Returns the param info that was queried for this node. This returns the information that was returned by the node
1270
+ * and does not include partial parameters.
1271
+ */
1272
+ getQueriedParamInfos(ctx) {
1273
+ const parameters = (0, import_arrays.distinct)(this.getDefinedValueIDs(ctx).map((v) => v.property).filter((p) => typeof p === "number"));
1274
+ return (0, import_objects.composeObject)(parameters.map((p) => [
1275
+ p,
1276
+ this.getParamInformation(ctx, p)
1277
+ ]));
1278
+ }
1279
+ /**
1280
+ * Returns stored config parameter metadata for all partial config params addressed with the given parameter number
1281
+ */
1282
+ getPartialParamInfos(ctx, parameter) {
1283
+ const valueDB = this.getValueDB(ctx);
1284
+ return valueDB.findMetadata((id) => id.commandClass === this.ccId && (id.endpoint ?? 0) === this.endpointIndex && id.property === parameter && id.propertyKey != void 0);
1285
+ }
1286
+ /**
1287
+ * Computes the full value of a parameter after applying a partial param value
1288
+ */
1289
+ composePartialParamValue(ctx, parameter, bitMask, partialValue) {
1290
+ return this.composePartialParamValues(ctx, parameter, [
1291
+ { bitMask, partialValue }
1292
+ ]);
1191
1293
  }
1192
- const metadata = this.getParamInformation(ctx, parameter, valueBitMask);
1193
- Object.assign(metadata, info);
1194
- this.setMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask), metadata);
1195
- }
1196
- /**
1197
- * @internal
1198
- * Returns stored config parameter metadata for this CC's node
1199
- */
1200
- getParamInformation(ctx, parameter, valueBitMask) {
1201
- return this.getMetadata(ctx, ConfigurationCCValues.paramInformation(parameter, valueBitMask)) ?? {
1202
- ...import_safe.ValueMetadata.Any
1203
- };
1204
- }
1205
- /**
1206
- * **INTERNAL:** Returns the param info that was queried for this node. This returns the information that was returned by the node
1207
- * and does not include partial parameters.
1208
- */
1209
- getQueriedParamInfos(ctx) {
1210
- const parameters = (0, import_arrays.distinct)(this.getDefinedValueIDs(ctx).map((v) => v.property).filter((p) => typeof p === "number"));
1211
- return (0, import_objects.composeObject)(parameters.map((p) => [
1212
- p,
1213
- this.getParamInformation(ctx, p)
1214
- ]));
1215
- }
1216
- /**
1217
- * Returns stored config parameter metadata for all partial config params addressed with the given parameter number
1218
- */
1219
- getPartialParamInfos(ctx, parameter) {
1220
- const valueDB = this.getValueDB(ctx);
1221
- return valueDB.findMetadata((id) => id.commandClass === this.ccId && (id.endpoint ?? 0) === this.endpointIndex && id.property === parameter && id.propertyKey != void 0);
1222
- }
1223
- /**
1224
- * Computes the full value of a parameter after applying a partial param value
1225
- */
1226
- composePartialParamValue(ctx, parameter, bitMask, partialValue) {
1227
- return this.composePartialParamValues(ctx, parameter, [
1228
- { bitMask, partialValue }
1229
- ]);
1230
- }
1231
- /**
1232
- * Computes the full value of a parameter after applying multiple partial param values
1233
- */
1234
- composePartialParamValues(ctx, parameter, partials) {
1235
- const valueDB = this.getValueDB(ctx);
1236
- const otherValues = valueDB.findValues((id) => id.commandClass === this.ccId && (id.endpoint ?? 0) === this.endpointIndex && id.property === parameter && id.propertyKey != void 0 && !partials.some((p) => id.propertyKey === p.bitMask));
1237
- let ret = 0;
1238
- for (const { propertyKey: bitMask, value: partialValue } of otherValues) {
1239
- ret = (0, import_safe.encodePartial)(ret, partialValue, bitMask);
1240
- }
1241
- for (const { bitMask, partialValue } of partials) {
1242
- ret = (0, import_safe.encodePartial)(ret, partialValue, bitMask);
1243
- }
1244
- return ret;
1245
- }
1246
- /** Deserializes the config parameter info from a config file */
1247
- deserializeParamInformationFromConfig(ctx, config) {
1248
- const valueDB = this.getValueDB(ctx);
1249
- for (const meta of valueDB.getAllMetadata(this.ccId)) {
1250
- if (typeof meta.property === "number" && (meta.endpoint ?? 0) === this.endpointIndex) {
1251
- valueDB.setMetadata(
1252
- meta,
1253
- void 0,
1254
- // Don't emit the added/updated events, as this will spam applications with untranslated events
1255
- { noEvent: true }
1256
- );
1294
+ /**
1295
+ * Computes the full value of a parameter after applying multiple partial param values
1296
+ */
1297
+ composePartialParamValues(ctx, parameter, partials) {
1298
+ const valueDB = this.getValueDB(ctx);
1299
+ const otherValues = valueDB.findValues((id) => id.commandClass === this.ccId && (id.endpoint ?? 0) === this.endpointIndex && id.property === parameter && id.propertyKey != void 0 && !partials.some((p) => id.propertyKey === p.bitMask));
1300
+ let ret = 0;
1301
+ for (const { propertyKey: bitMask, value: partialValue } of otherValues) {
1302
+ ret = (0, import_safe.encodePartial)(ret, partialValue, bitMask);
1257
1303
  }
1258
- }
1259
- this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, false);
1260
- for (const [param, info] of config.entries()) {
1261
- const paramInfo = (0, import_safe.stripUndefined)({
1262
- // TODO: Make this smarter! (0...1 ==> boolean)
1263
- type: "number",
1264
- valueSize: info.valueSize,
1265
- min: info.minValue,
1266
- max: info.maxValue,
1267
- default: info.defaultValue,
1268
- unit: info.unit,
1269
- format: info.unsigned ? import_safe.ConfigValueFormat.UnsignedInteger : import_safe.ConfigValueFormat.SignedInteger,
1270
- readable: !info.writeOnly,
1271
- writeable: !info.readOnly,
1272
- allowManualEntry: info.allowManualEntry,
1273
- states: info.options.length > 0 ? (0, import_objects.composeObject)(info.options.map(({ label, value }) => [
1274
- value.toString(),
1275
- label
1276
- ])) : void 0,
1277
- label: info.label,
1278
- description: info.description,
1279
- isFromConfig: true
1280
- });
1281
- this.extendParamInformation(ctx, param.parameter, param.valueBitMask, paramInfo);
1282
- }
1283
- this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, true);
1284
- }
1285
- translatePropertyKey(ctx, property, propertyKey) {
1286
- if (typeof property === "number" && (propertyKey == void 0 || typeof propertyKey === "number")) {
1287
- return void 0;
1288
- }
1289
- return super.translateProperty(ctx, property, propertyKey);
1290
- }
1291
- translateProperty(ctx, property, propertyKey) {
1292
- if (typeof property === "number" && (propertyKey == void 0 || typeof propertyKey === "number")) {
1293
- const paramInfo = this.getParamInformation(ctx, property, propertyKey);
1294
- if (paramInfo.label)
1295
- return paramInfo.label;
1296
- let ret = `param${(0, import_strings.padStart)(property.toString(), 3, "0")}`;
1297
- if (propertyKey != void 0) {
1298
- ret += "_" + propertyKey.toString();
1304
+ for (const { bitMask, partialValue } of partials) {
1305
+ ret = (0, import_safe.encodePartial)(ret, partialValue, bitMask);
1299
1306
  }
1300
1307
  return ret;
1301
1308
  }
1302
- return super.translateProperty(ctx, property, propertyKey);
1303
- }
1304
- };
1305
- ConfigurationCC = __decorate([
1306
- (0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Configuration),
1307
- (0, import_CommandClassDecorators.implementedVersion)(4),
1308
- (0, import_CommandClassDecorators.ccValues)(ConfigurationCCValues)
1309
- ], ConfigurationCC);
1310
- let ConfigurationCCReport = ConfigurationCCReport_1 = class ConfigurationCCReport2 extends ConfigurationCC {
1311
- constructor(options) {
1312
- super(options);
1313
- this.parameter = options.parameter;
1314
- this.value = options.value;
1315
- this.valueSize = options.valueSize;
1316
- this.valueFormat = options.valueFormat;
1317
- }
1318
- static from(raw, ctx) {
1319
- (0, import_safe.validatePayload)(raw.payload.length > 2);
1320
- const parameter = raw.payload[0];
1321
- const valueSize = raw.payload[1] & 7;
1322
- (0, import_safe.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1323
- const value = parseValue(raw.payload.subarray(2), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1324
- return new ConfigurationCCReport_1({
1325
- nodeId: ctx.sourceNodeId,
1326
- parameter,
1327
- valueSize,
1328
- value
1329
- });
1330
- }
1331
- parameter;
1332
- value;
1333
- valueSize;
1334
- valueFormat;
1335
- // only used for serialization
1336
- persistValues(ctx) {
1337
- if (!super.persistValues(ctx))
1338
- return false;
1339
- const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
1340
- const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1341
- let cachedValueFormat;
1342
- if (partialParams.length > 0) {
1343
- cachedValueFormat = partialParams[0].metadata.format;
1344
- } else {
1345
- const oldParamInformation = this.getParamInformation(ctx, this.parameter);
1346
- cachedValueFormat = oldParamInformation.format;
1347
- this.extendParamInformation(ctx, this.parameter, void 0, {
1348
- valueSize: this.valueSize
1349
- });
1350
- if (ccVersion < 3 && !this.paramExistsInConfigFile(ctx, this.parameter) && oldParamInformation.min == void 0 && oldParamInformation.max == void 0) {
1351
- const isSigned = oldParamInformation.format == void 0 || oldParamInformation.format === import_safe.ConfigValueFormat.SignedInteger;
1352
- this.extendParamInformation(ctx, this.parameter, void 0, (0, import_safe.getIntegerLimits)(this.valueSize, isSigned));
1309
+ /** Deserializes the config parameter info from a config file */
1310
+ deserializeParamInformationFromConfig(ctx, config) {
1311
+ const valueDB = this.getValueDB(ctx);
1312
+ for (const meta of valueDB.getAllMetadata(this.ccId)) {
1313
+ if (typeof meta.property === "number" && (meta.endpoint ?? 0) === this.endpointIndex) {
1314
+ valueDB.setMetadata(
1315
+ meta,
1316
+ void 0,
1317
+ // Don't emit the added/updated events, as this will spam applications with untranslated events
1318
+ { noEvent: true }
1319
+ );
1320
+ }
1353
1321
  }
1322
+ this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, false);
1323
+ for (const [param, info] of config.entries()) {
1324
+ const paramInfo = (0, import_safe.stripUndefined)({
1325
+ // TODO: Make this smarter! (0...1 ==> boolean)
1326
+ type: "number",
1327
+ valueSize: info.valueSize,
1328
+ min: info.minValue,
1329
+ max: info.maxValue,
1330
+ default: info.defaultValue,
1331
+ unit: info.unit,
1332
+ format: info.unsigned ? import_safe.ConfigValueFormat.UnsignedInteger : import_safe.ConfigValueFormat.SignedInteger,
1333
+ readable: !info.writeOnly,
1334
+ writeable: !info.readOnly,
1335
+ allowManualEntry: info.allowManualEntry,
1336
+ states: info.options.length > 0 ? (0, import_objects.composeObject)(info.options.map(({ label, value }) => [
1337
+ value.toString(),
1338
+ label
1339
+ ])) : void 0,
1340
+ label: info.label,
1341
+ description: info.description,
1342
+ isFromConfig: true
1343
+ });
1344
+ this.extendParamInformation(ctx, param.parameter, param.valueBitMask, paramInfo);
1345
+ }
1346
+ this.setValue(ctx, ConfigurationCCValues.isParamInformationFromConfig, true);
1354
1347
  }
1355
- if (cachedValueFormat != void 0 && cachedValueFormat !== import_safe.ConfigValueFormat.SignedInteger) {
1356
- this.value = reInterpretSignedValue(this.value, this.valueSize, cachedValueFormat);
1357
- }
1358
- if (partialParams.length > 0) {
1359
- for (const param of partialParams) {
1360
- if (typeof param.propertyKey === "number") {
1361
- this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), (0, import_safe.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1348
+ translatePropertyKey(ctx, property, propertyKey) {
1349
+ if (typeof property === "number" && (propertyKey == void 0 || typeof propertyKey === "number")) {
1350
+ return void 0;
1351
+ }
1352
+ return super.translateProperty(ctx, property, propertyKey);
1353
+ }
1354
+ translateProperty(ctx, property, propertyKey) {
1355
+ if (typeof property === "number" && (propertyKey == void 0 || typeof propertyKey === "number")) {
1356
+ const paramInfo = this.getParamInformation(ctx, property, propertyKey);
1357
+ if (paramInfo.label)
1358
+ return paramInfo.label;
1359
+ let ret = `param${(0, import_strings.padStart)(property.toString(), 3, "0")}`;
1360
+ if (propertyKey != void 0) {
1361
+ ret += "_" + propertyKey.toString();
1362
1362
  }
1363
+ return ret;
1363
1364
  }
1364
- } else {
1365
- this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter), this.value);
1366
- }
1367
- return true;
1368
- }
1369
- serialize(ctx) {
1370
- this.payload = import_safe2.Bytes.concat([
1371
- import_safe2.Bytes.from([this.parameter, this.valueSize & 7]),
1372
- new import_safe2.Bytes(this.valueSize)
1373
- ]);
1374
- serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger, this.value);
1375
- return super.serialize(ctx);
1376
- }
1377
- toLogEntry(ctx) {
1378
- return {
1379
- ...super.toLogEntry(ctx),
1380
- message: {
1381
- "parameter #": this.parameter,
1382
- "value size": this.valueSize,
1383
- value: configValueToString(this.value)
1365
+ return super.translateProperty(ctx, property, propertyKey);
1366
+ }
1367
+ };
1368
+ return ConfigurationCC2 = _classThis;
1369
+ })();
1370
+ let ConfigurationCCReport = (() => {
1371
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Report)];
1372
+ let _classDescriptor;
1373
+ let _classExtraInitializers = [];
1374
+ let _classThis;
1375
+ let _classSuper = ConfigurationCC;
1376
+ var ConfigurationCCReport2 = class extends _classSuper {
1377
+ static {
1378
+ _classThis = this;
1379
+ }
1380
+ static {
1381
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1382
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1383
+ ConfigurationCCReport2 = _classThis = _classDescriptor.value;
1384
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1385
+ __runInitializers(_classThis, _classExtraInitializers);
1386
+ }
1387
+ constructor(options) {
1388
+ super(options);
1389
+ this.parameter = options.parameter;
1390
+ this.value = options.value;
1391
+ this.valueSize = options.valueSize;
1392
+ this.valueFormat = options.valueFormat;
1393
+ }
1394
+ static from(raw, ctx) {
1395
+ (0, import_safe.validatePayload)(raw.payload.length > 2);
1396
+ const parameter = raw.payload[0];
1397
+ const valueSize = raw.payload[1] & 7;
1398
+ (0, import_safe.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1399
+ const value = parseValue(raw.payload.subarray(2), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1400
+ return new this({
1401
+ nodeId: ctx.sourceNodeId,
1402
+ parameter,
1403
+ valueSize,
1404
+ value
1405
+ });
1406
+ }
1407
+ parameter;
1408
+ value;
1409
+ valueSize;
1410
+ valueFormat;
1411
+ // only used for serialization
1412
+ persistValues(ctx) {
1413
+ if (!super.persistValues(ctx))
1414
+ return false;
1415
+ const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
1416
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1417
+ let cachedValueFormat;
1418
+ if (partialParams.length > 0) {
1419
+ cachedValueFormat = partialParams[0].metadata.format;
1420
+ } else {
1421
+ const oldParamInformation = this.getParamInformation(ctx, this.parameter);
1422
+ cachedValueFormat = oldParamInformation.format;
1423
+ this.extendParamInformation(ctx, this.parameter, void 0, {
1424
+ valueSize: this.valueSize
1425
+ });
1426
+ if (ccVersion < 3 && !this.paramExistsInConfigFile(ctx, this.parameter) && oldParamInformation.min == void 0 && oldParamInformation.max == void 0) {
1427
+ const isSigned = oldParamInformation.format == void 0 || oldParamInformation.format === import_safe.ConfigValueFormat.SignedInteger;
1428
+ this.extendParamInformation(ctx, this.parameter, void 0, (0, import_safe.getIntegerLimits)(this.valueSize, isSigned));
1429
+ }
1384
1430
  }
1385
- };
1386
- }
1387
- };
1388
- ConfigurationCCReport = ConfigurationCCReport_1 = __decorate([
1389
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Report)
1390
- ], ConfigurationCCReport);
1431
+ if (cachedValueFormat != void 0 && cachedValueFormat !== import_safe.ConfigValueFormat.SignedInteger) {
1432
+ this.value = reInterpretSignedValue(this.value, this.valueSize, cachedValueFormat);
1433
+ }
1434
+ if (partialParams.length > 0) {
1435
+ for (const param of partialParams) {
1436
+ if (typeof param.propertyKey === "number") {
1437
+ this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter, param.propertyKey), (0, import_safe.parsePartial)(this.value, param.propertyKey, isSignedPartial(param.propertyKey, param.metadata.format)));
1438
+ }
1439
+ }
1440
+ } else {
1441
+ this.setValue(ctx, ConfigurationCCValues.paramInformation(this.parameter), this.value);
1442
+ }
1443
+ return true;
1444
+ }
1445
+ serialize(ctx) {
1446
+ this.payload = import_safe2.Bytes.concat([
1447
+ import_safe2.Bytes.from([this.parameter, this.valueSize & 7]),
1448
+ new import_safe2.Bytes(this.valueSize)
1449
+ ]);
1450
+ serializeValue(this.payload, 2, this.valueSize, this.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger, this.value);
1451
+ return super.serialize(ctx);
1452
+ }
1453
+ toLogEntry(ctx) {
1454
+ return {
1455
+ ...super.toLogEntry(ctx),
1456
+ message: {
1457
+ "parameter #": this.parameter,
1458
+ "value size": this.valueSize,
1459
+ value: configValueToString(this.value)
1460
+ }
1461
+ };
1462
+ }
1463
+ };
1464
+ return ConfigurationCCReport2 = _classThis;
1465
+ })();
1391
1466
  function testResponseForConfigurationGet(sent, received) {
1392
1467
  return sent.parameter === received.parameter || sent.allowUnexpectedResponse;
1393
1468
  }
1394
- let ConfigurationCCGet = ConfigurationCCGet_1 = class ConfigurationCCGet2 extends ConfigurationCC {
1395
- constructor(options) {
1396
- super(options);
1397
- this.parameter = options.parameter;
1398
- this.allowUnexpectedResponse = options.allowUnexpectedResponse ?? false;
1399
- }
1400
- static from(raw, ctx) {
1401
- (0, import_safe.validatePayload)(raw.payload.length >= 1);
1402
- const parameter = raw.payload[0];
1403
- return new ConfigurationCCGet_1({
1404
- nodeId: ctx.sourceNodeId,
1405
- parameter
1406
- });
1407
- }
1408
- parameter;
1409
- allowUnexpectedResponse;
1410
- serialize(ctx) {
1411
- this.payload = import_safe2.Bytes.from([this.parameter]);
1412
- return super.serialize(ctx);
1413
- }
1414
- toLogEntry(ctx) {
1415
- return {
1416
- ...super.toLogEntry(ctx),
1417
- message: { "parameter #": this.parameter }
1418
- };
1419
- }
1420
- };
1421
- ConfigurationCCGet = ConfigurationCCGet_1 = __decorate([
1422
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Get),
1423
- (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCReport, testResponseForConfigurationGet)
1424
- ], ConfigurationCCGet);
1425
- let ConfigurationCCSet = ConfigurationCCSet_1 = class ConfigurationCCSet2 extends ConfigurationCC {
1426
- constructor(options) {
1427
- super(options);
1428
- this.parameter = options.parameter;
1429
- this.resetToDefault = !!options.resetToDefault;
1430
- if (!options.resetToDefault) {
1431
- this.valueSize = options.valueSize;
1432
- this.valueFormat = options.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger;
1433
- this.value = options.value;
1469
+ let ConfigurationCCGet = (() => {
1470
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Get), (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCReport, testResponseForConfigurationGet)];
1471
+ let _classDescriptor;
1472
+ let _classExtraInitializers = [];
1473
+ let _classThis;
1474
+ let _classSuper = ConfigurationCC;
1475
+ var ConfigurationCCGet2 = class extends _classSuper {
1476
+ static {
1477
+ _classThis = this;
1478
+ }
1479
+ static {
1480
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1481
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1482
+ ConfigurationCCGet2 = _classThis = _classDescriptor.value;
1483
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1484
+ __runInitializers(_classThis, _classExtraInitializers);
1485
+ }
1486
+ constructor(options) {
1487
+ super(options);
1488
+ this.parameter = options.parameter;
1489
+ this.allowUnexpectedResponse = options.allowUnexpectedResponse ?? false;
1490
+ }
1491
+ static from(raw, ctx) {
1492
+ (0, import_safe.validatePayload)(raw.payload.length >= 1);
1493
+ const parameter = raw.payload[0];
1494
+ return new this({
1495
+ nodeId: ctx.sourceNodeId,
1496
+ parameter
1497
+ });
1434
1498
  }
1435
- }
1436
- static from(raw, ctx) {
1437
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
1438
- const parameter = raw.payload[0];
1439
- const resetToDefault = !!(raw.payload[1] & 128);
1440
- const valueSize = raw.payload[1] & 7;
1441
- (0, import_safe.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1442
- const value = parseValue(raw.payload.subarray(2), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1443
- return new ConfigurationCCSet_1({
1444
- nodeId: ctx.sourceNodeId,
1445
- parameter,
1446
- resetToDefault,
1447
- valueSize,
1448
- value
1449
- });
1450
- }
1451
- resetToDefault;
1452
- parameter;
1453
- valueSize;
1454
- valueFormat;
1455
- value;
1456
- serialize(ctx) {
1457
- const valueSize = this.resetToDefault ? 1 : this.valueSize;
1458
- const payloadLength = 2 + valueSize;
1459
- this.payload = import_safe2.Bytes.alloc(payloadLength, 0);
1460
- this.payload[0] = this.parameter;
1461
- this.payload[1] = (this.resetToDefault ? 128 : 0) | valueSize & 7;
1462
- if (!this.resetToDefault) {
1463
- if (typeof this.value === "number" && !isSafeValue(this.value, valueSize, this.valueFormat)) {
1464
- throwInvalidValueError(this.value, this.parameter, valueSize, this.valueFormat);
1465
- }
1466
- try {
1467
- serializeValue(this.payload, 2, valueSize, this.valueFormat, this.value);
1468
- } catch (e) {
1469
- tryCatchOutOfBoundsError(e, this.value, this.parameter, valueSize, this.valueFormat);
1499
+ parameter;
1500
+ allowUnexpectedResponse;
1501
+ serialize(ctx) {
1502
+ this.payload = import_safe2.Bytes.from([this.parameter]);
1503
+ return super.serialize(ctx);
1504
+ }
1505
+ toLogEntry(ctx) {
1506
+ return {
1507
+ ...super.toLogEntry(ctx),
1508
+ message: { "parameter #": this.parameter }
1509
+ };
1510
+ }
1511
+ };
1512
+ return ConfigurationCCGet2 = _classThis;
1513
+ })();
1514
+ let ConfigurationCCSet = (() => {
1515
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Set), (0, import_CommandClassDecorators.useSupervision)()];
1516
+ let _classDescriptor;
1517
+ let _classExtraInitializers = [];
1518
+ let _classThis;
1519
+ let _classSuper = ConfigurationCC;
1520
+ var ConfigurationCCSet2 = class extends _classSuper {
1521
+ static {
1522
+ _classThis = this;
1523
+ }
1524
+ static {
1525
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1526
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1527
+ ConfigurationCCSet2 = _classThis = _classDescriptor.value;
1528
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1529
+ __runInitializers(_classThis, _classExtraInitializers);
1530
+ }
1531
+ constructor(options) {
1532
+ super(options);
1533
+ this.parameter = options.parameter;
1534
+ this.resetToDefault = !!options.resetToDefault;
1535
+ if (!options.resetToDefault) {
1536
+ this.valueSize = options.valueSize;
1537
+ this.valueFormat = options.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger;
1538
+ this.value = options.value;
1470
1539
  }
1471
1540
  }
1472
- return super.serialize(ctx);
1473
- }
1474
- toLogEntry(ctx) {
1475
- const message = {
1476
- "parameter #": this.parameter,
1477
- "reset to default": this.resetToDefault
1478
- };
1479
- if (this.valueSize != void 0) {
1480
- message["value size"] = this.valueSize;
1541
+ static from(raw, ctx) {
1542
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
1543
+ const parameter = raw.payload[0];
1544
+ const resetToDefault = !!(raw.payload[1] & 128);
1545
+ const valueSize = raw.payload[1] & 7;
1546
+ (0, import_safe.validatePayload)(valueSize >= 1, valueSize <= 4, raw.payload.length >= 2 + valueSize);
1547
+ const value = parseValue(raw.payload.subarray(2), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1548
+ return new this({
1549
+ nodeId: ctx.sourceNodeId,
1550
+ parameter,
1551
+ resetToDefault,
1552
+ valueSize,
1553
+ value
1554
+ });
1481
1555
  }
1482
- if (this.valueFormat != void 0) {
1483
- message["value format"] = (0, import_safe3.getEnumMemberName)(import_safe.ConfigValueFormat, this.valueFormat);
1556
+ resetToDefault;
1557
+ parameter;
1558
+ valueSize;
1559
+ valueFormat;
1560
+ value;
1561
+ serialize(ctx) {
1562
+ const valueSize = this.resetToDefault ? 1 : this.valueSize;
1563
+ const payloadLength = 2 + valueSize;
1564
+ this.payload = import_safe2.Bytes.alloc(payloadLength, 0);
1565
+ this.payload[0] = this.parameter;
1566
+ this.payload[1] = (this.resetToDefault ? 128 : 0) | valueSize & 7;
1567
+ if (!this.resetToDefault) {
1568
+ if (typeof this.value === "number" && !isSafeValue(this.value, valueSize, this.valueFormat)) {
1569
+ throwInvalidValueError(this.value, this.parameter, valueSize, this.valueFormat);
1570
+ }
1571
+ try {
1572
+ serializeValue(this.payload, 2, valueSize, this.valueFormat, this.value);
1573
+ } catch (e) {
1574
+ tryCatchOutOfBoundsError(e, this.value, this.parameter, valueSize, this.valueFormat);
1575
+ }
1576
+ }
1577
+ return super.serialize(ctx);
1484
1578
  }
1485
- if (this.value != void 0) {
1486
- message.value = configValueToString(this.value);
1579
+ toLogEntry(ctx) {
1580
+ const message = {
1581
+ "parameter #": this.parameter,
1582
+ "reset to default": this.resetToDefault
1583
+ };
1584
+ if (this.valueSize != void 0) {
1585
+ message["value size"] = this.valueSize;
1586
+ }
1587
+ if (this.valueFormat != void 0) {
1588
+ message["value format"] = (0, import_safe3.getEnumMemberName)(import_safe.ConfigValueFormat, this.valueFormat);
1589
+ }
1590
+ if (this.value != void 0) {
1591
+ message.value = configValueToString(this.value);
1592
+ }
1593
+ return {
1594
+ ...super.toLogEntry(ctx),
1595
+ message
1596
+ };
1487
1597
  }
1488
- return {
1489
- ...super.toLogEntry(ctx),
1490
- message
1491
- };
1492
- }
1493
- };
1494
- ConfigurationCCSet = ConfigurationCCSet_1 = __decorate([
1495
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.Set),
1496
- (0, import_CommandClassDecorators.useSupervision)()
1497
- ], ConfigurationCCSet);
1598
+ };
1599
+ return ConfigurationCCSet2 = _classThis;
1600
+ })();
1498
1601
  function getResponseForBulkSet(cc) {
1499
1602
  return cc.handshake ? ConfigurationCCBulkReport : void 0;
1500
1603
  }
1501
- let ConfigurationCCBulkSet = class ConfigurationCCBulkSet2 extends ConfigurationCC {
1502
- constructor(options) {
1503
- super(options);
1504
- this._parameters = options.parameters;
1505
- if (this._parameters.length < 1) {
1506
- throw new import_safe.ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, import_safe.ZWaveErrorCodes.CC_Invalid);
1507
- } else if (!(0, import_safe.isConsecutiveArray)(this._parameters)) {
1508
- throw new import_safe.ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, import_safe.ZWaveErrorCodes.CC_Invalid);
1509
- }
1510
- this._handshake = !!options.handshake;
1511
- this._resetToDefault = !!options.resetToDefault;
1512
- if (!!options.resetToDefault) {
1513
- this._valueSize = 1;
1514
- this._valueFormat = import_safe.ConfigValueFormat.SignedInteger;
1515
- this._values = this._parameters.map(() => 0);
1516
- } else {
1517
- this._valueSize = options.valueSize;
1518
- this._valueFormat = options.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger;
1519
- this._values = options.values;
1604
+ let ConfigurationCCBulkSet = (() => {
1605
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkSet), (0, import_CommandClassDecorators.expectedCCResponse)(getResponseForBulkSet), (0, import_CommandClassDecorators.useSupervision)()];
1606
+ let _classDescriptor;
1607
+ let _classExtraInitializers = [];
1608
+ let _classThis;
1609
+ let _classSuper = ConfigurationCC;
1610
+ var ConfigurationCCBulkSet2 = class extends _classSuper {
1611
+ static {
1612
+ _classThis = this;
1613
+ }
1614
+ static {
1615
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1616
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1617
+ ConfigurationCCBulkSet2 = _classThis = _classDescriptor.value;
1618
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1619
+ __runInitializers(_classThis, _classExtraInitializers);
1620
+ }
1621
+ constructor(options) {
1622
+ super(options);
1623
+ this._parameters = options.parameters;
1624
+ if (this._parameters.length < 1) {
1625
+ throw new import_safe.ZWaveError(`In a ConfigurationCC.BulkSet, parameters must be a non-empty array`, import_safe.ZWaveErrorCodes.CC_Invalid);
1626
+ } else if (!(0, import_safe.isConsecutiveArray)(this._parameters)) {
1627
+ throw new import_safe.ZWaveError(`A ConfigurationCC.BulkSet can only be used for consecutive parameters`, import_safe.ZWaveErrorCodes.CC_Invalid);
1628
+ }
1629
+ this._handshake = !!options.handshake;
1630
+ this._resetToDefault = !!options.resetToDefault;
1631
+ if (!!options.resetToDefault) {
1632
+ this._valueSize = 1;
1633
+ this._valueFormat = import_safe.ConfigValueFormat.SignedInteger;
1634
+ this._values = this._parameters.map(() => 0);
1635
+ } else {
1636
+ this._valueSize = options.valueSize;
1637
+ this._valueFormat = options.valueFormat ?? import_safe.ConfigValueFormat.SignedInteger;
1638
+ this._values = options.values;
1639
+ }
1520
1640
  }
1521
- }
1522
- static from(_raw, _ctx) {
1523
- throw new import_safe.ZWaveError(`${this.name}: deserialization not implemented`, import_safe.ZWaveErrorCodes.Deserialization_NotImplemented);
1524
- }
1525
- _parameters;
1526
- get parameters() {
1527
- return this._parameters;
1528
- }
1529
- _resetToDefault;
1530
- get resetToDefault() {
1531
- return this._resetToDefault;
1532
- }
1533
- _valueSize;
1534
- get valueSize() {
1535
- return this._valueSize;
1536
- }
1537
- _valueFormat;
1538
- get valueFormat() {
1539
- return this._valueFormat;
1540
- }
1541
- _values;
1542
- get values() {
1543
- return this._values;
1544
- }
1545
- _handshake;
1546
- get handshake() {
1547
- return this._handshake;
1548
- }
1549
- serialize(ctx) {
1550
- const valueSize = this._resetToDefault ? 1 : this.valueSize;
1551
- const payloadLength = 4 + valueSize * this.parameters.length;
1552
- this.payload = import_safe2.Bytes.alloc(payloadLength, 0);
1553
- this.payload.writeUInt16BE(this.parameters[0], 0);
1554
- this.payload[2] = this.parameters.length;
1555
- this.payload[3] = (this._resetToDefault ? 128 : 0) | (this.handshake ? 64 : 0) | valueSize & 7;
1556
- if (!this._resetToDefault) {
1557
- for (let i = 0; i < this.parameters.length; i++) {
1558
- const value = this._values[i];
1559
- const param = this._parameters[i];
1560
- if (!isSafeValue(value, valueSize, this._valueFormat)) {
1561
- throwInvalidValueError(value, param, valueSize, this._valueFormat);
1562
- }
1563
- try {
1564
- serializeValue(this.payload, 4 + i * valueSize, valueSize, this._valueFormat, value);
1565
- } catch (e) {
1566
- tryCatchOutOfBoundsError(e, value, param, valueSize, this._valueFormat);
1641
+ static from(_raw, _ctx) {
1642
+ throw new import_safe.ZWaveError(`${this.name}: deserialization not implemented`, import_safe.ZWaveErrorCodes.Deserialization_NotImplemented);
1643
+ }
1644
+ _parameters;
1645
+ get parameters() {
1646
+ return this._parameters;
1647
+ }
1648
+ _resetToDefault;
1649
+ get resetToDefault() {
1650
+ return this._resetToDefault;
1651
+ }
1652
+ _valueSize;
1653
+ get valueSize() {
1654
+ return this._valueSize;
1655
+ }
1656
+ _valueFormat;
1657
+ get valueFormat() {
1658
+ return this._valueFormat;
1659
+ }
1660
+ _values;
1661
+ get values() {
1662
+ return this._values;
1663
+ }
1664
+ _handshake;
1665
+ get handshake() {
1666
+ return this._handshake;
1667
+ }
1668
+ serialize(ctx) {
1669
+ const valueSize = this._resetToDefault ? 1 : this.valueSize;
1670
+ const payloadLength = 4 + valueSize * this.parameters.length;
1671
+ this.payload = import_safe2.Bytes.alloc(payloadLength, 0);
1672
+ this.payload.writeUInt16BE(this.parameters[0], 0);
1673
+ this.payload[2] = this.parameters.length;
1674
+ this.payload[3] = (this._resetToDefault ? 128 : 0) | (this.handshake ? 64 : 0) | valueSize & 7;
1675
+ if (!this._resetToDefault) {
1676
+ for (let i = 0; i < this.parameters.length; i++) {
1677
+ const value = this._values[i];
1678
+ const param = this._parameters[i];
1679
+ if (!isSafeValue(value, valueSize, this._valueFormat)) {
1680
+ throwInvalidValueError(value, param, valueSize, this._valueFormat);
1681
+ }
1682
+ try {
1683
+ serializeValue(this.payload, 4 + i * valueSize, valueSize, this._valueFormat, value);
1684
+ } catch (e) {
1685
+ tryCatchOutOfBoundsError(e, value, param, valueSize, this._valueFormat);
1686
+ }
1567
1687
  }
1568
1688
  }
1689
+ return super.serialize(ctx);
1569
1690
  }
1570
- return super.serialize(ctx);
1571
- }
1572
- toLogEntry(ctx) {
1573
- const message = {
1574
- handshake: this.handshake,
1575
- "reset to default": this.resetToDefault,
1576
- "value size": this.valueSize
1577
- };
1578
- if (this._values.length > 0) {
1579
- message.values = this._values.map((value, i) => `
1691
+ toLogEntry(ctx) {
1692
+ const message = {
1693
+ handshake: this.handshake,
1694
+ "reset to default": this.resetToDefault,
1695
+ "value size": this.valueSize
1696
+ };
1697
+ if (this._values.length > 0) {
1698
+ message.values = this._values.map((value, i) => `
1580
1699
  \xB7 #${this._parameters[i]}: ${configValueToString(value)}`).join("");
1700
+ }
1701
+ return {
1702
+ ...super.toLogEntry(ctx),
1703
+ message
1704
+ };
1581
1705
  }
1582
- return {
1583
- ...super.toLogEntry(ctx),
1584
- message
1585
- };
1586
- }
1587
- };
1588
- ConfigurationCCBulkSet = __decorate([
1589
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkSet),
1590
- (0, import_CommandClassDecorators.expectedCCResponse)(getResponseForBulkSet),
1591
- (0, import_CommandClassDecorators.useSupervision)()
1592
- ], ConfigurationCCBulkSet);
1593
- let ConfigurationCCBulkReport = ConfigurationCCBulkReport_1 = class ConfigurationCCBulkReport2 extends ConfigurationCC {
1594
- constructor(options) {
1595
- super(options);
1596
- this.reportsToFollow = options.reportsToFollow;
1597
- this.defaultValues = options.defaultValues;
1598
- this.isHandshakeResponse = options.isHandshakeResponse;
1599
- this.valueSize = options.valueSize;
1600
- for (const [param, value] of Object.entries(options.values)) {
1601
- this._values.set(parseInt(param), value);
1706
+ };
1707
+ return ConfigurationCCBulkSet2 = _classThis;
1708
+ })();
1709
+ let ConfigurationCCBulkReport = (() => {
1710
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkReport)];
1711
+ let _classDescriptor;
1712
+ let _classExtraInitializers = [];
1713
+ let _classThis;
1714
+ let _classSuper = ConfigurationCC;
1715
+ var ConfigurationCCBulkReport2 = class extends _classSuper {
1716
+ static {
1717
+ _classThis = this;
1718
+ }
1719
+ static {
1720
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1721
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1722
+ ConfigurationCCBulkReport2 = _classThis = _classDescriptor.value;
1723
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1724
+ __runInitializers(_classThis, _classExtraInitializers);
1725
+ }
1726
+ constructor(options) {
1727
+ super(options);
1728
+ this.reportsToFollow = options.reportsToFollow;
1729
+ this.defaultValues = options.defaultValues;
1730
+ this.isHandshakeResponse = options.isHandshakeResponse;
1731
+ this.valueSize = options.valueSize;
1732
+ for (const [param, value] of Object.entries(options.values)) {
1733
+ this._values.set(parseInt(param), value);
1734
+ }
1602
1735
  }
1603
- }
1604
- static from(raw, ctx) {
1605
- (0, import_safe.validatePayload)(raw.payload.length >= 5);
1606
- const firstParameter = raw.payload.readUInt16BE(0);
1607
- const numParams = raw.payload[2];
1608
- const reportsToFollow = raw.payload[3];
1609
- const defaultValues = !!(raw.payload[4] & 128);
1610
- const isHandshakeResponse = !!(raw.payload[4] & 64);
1611
- const valueSize = raw.payload[4] & 7;
1612
- (0, import_safe.validatePayload)(raw.payload.length >= 5 + numParams * valueSize);
1613
- const values = {};
1614
- for (let i = 0; i < numParams; i++) {
1615
- const param = firstParameter + i;
1616
- values[param] = parseValue(raw.payload.subarray(5 + i * valueSize), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1617
- }
1618
- return new ConfigurationCCBulkReport_1({
1619
- nodeId: ctx.sourceNodeId,
1620
- reportsToFollow,
1621
- defaultValues,
1622
- isHandshakeResponse,
1623
- valueSize,
1624
- values
1625
- });
1626
- }
1627
- persistValues(ctx) {
1628
- if (!super.persistValues(ctx))
1629
- return false;
1630
- for (let [parameter, value] of this._values.entries()) {
1631
- const oldParamInformation = this.getParamInformation(ctx, parameter);
1632
- if (oldParamInformation.format != void 0 && oldParamInformation.format !== import_safe.ConfigValueFormat.SignedInteger) {
1633
- value = reInterpretSignedValue(value, this.valueSize, oldParamInformation.format);
1634
- this._values.set(parameter, value);
1736
+ static from(raw, ctx) {
1737
+ (0, import_safe.validatePayload)(raw.payload.length >= 5);
1738
+ const firstParameter = raw.payload.readUInt16BE(0);
1739
+ const numParams = raw.payload[2];
1740
+ const reportsToFollow = raw.payload[3];
1741
+ const defaultValues = !!(raw.payload[4] & 128);
1742
+ const isHandshakeResponse = !!(raw.payload[4] & 64);
1743
+ const valueSize = raw.payload[4] & 7;
1744
+ (0, import_safe.validatePayload)(raw.payload.length >= 5 + numParams * valueSize);
1745
+ const values = {};
1746
+ for (let i = 0; i < numParams; i++) {
1747
+ const param = firstParameter + i;
1748
+ values[param] = parseValue(raw.payload.subarray(5 + i * valueSize), valueSize, import_safe.ConfigValueFormat.SignedInteger);
1635
1749
  }
1636
- this.setValue(ctx, ConfigurationCCValues.paramInformation(parameter), value);
1750
+ return new this({
1751
+ nodeId: ctx.sourceNodeId,
1752
+ reportsToFollow,
1753
+ defaultValues,
1754
+ isHandshakeResponse,
1755
+ valueSize,
1756
+ values
1757
+ });
1637
1758
  }
1638
- return true;
1639
- }
1640
- reportsToFollow;
1641
- defaultValues;
1642
- isHandshakeResponse;
1643
- valueSize;
1644
- _values = /* @__PURE__ */ new Map();
1645
- get values() {
1646
- return this._values;
1647
- }
1648
- getPartialCCSessionId() {
1649
- return {};
1650
- }
1651
- expectMoreMessages() {
1652
- return this.reportsToFollow > 0;
1653
- }
1654
- toLogEntry(ctx) {
1655
- const message = {
1656
- "handshake response": this.isHandshakeResponse,
1657
- "default values": this.defaultValues,
1658
- "value size": this.valueSize,
1659
- "reports to follow": this.reportsToFollow
1660
- };
1661
- if (this._values.size > 0) {
1662
- message.values = [...this._values].map(([param, value]) => `
1759
+ persistValues(ctx) {
1760
+ if (!super.persistValues(ctx))
1761
+ return false;
1762
+ for (let [parameter, value] of this._values.entries()) {
1763
+ const oldParamInformation = this.getParamInformation(ctx, parameter);
1764
+ if (oldParamInformation.format != void 0 && oldParamInformation.format !== import_safe.ConfigValueFormat.SignedInteger) {
1765
+ value = reInterpretSignedValue(value, this.valueSize, oldParamInformation.format);
1766
+ this._values.set(parameter, value);
1767
+ }
1768
+ this.setValue(ctx, ConfigurationCCValues.paramInformation(parameter), value);
1769
+ }
1770
+ return true;
1771
+ }
1772
+ reportsToFollow;
1773
+ defaultValues;
1774
+ isHandshakeResponse;
1775
+ valueSize;
1776
+ _values = /* @__PURE__ */ new Map();
1777
+ get values() {
1778
+ return this._values;
1779
+ }
1780
+ getPartialCCSessionId() {
1781
+ return {};
1782
+ }
1783
+ expectMoreMessages() {
1784
+ return this.reportsToFollow > 0;
1785
+ }
1786
+ toLogEntry(ctx) {
1787
+ const message = {
1788
+ "handshake response": this.isHandshakeResponse,
1789
+ "default values": this.defaultValues,
1790
+ "value size": this.valueSize,
1791
+ "reports to follow": this.reportsToFollow
1792
+ };
1793
+ if (this._values.size > 0) {
1794
+ message.values = [...this._values].map(([param, value]) => `
1663
1795
  \xB7 #${param}: ${configValueToString(value)}`).join("");
1796
+ }
1797
+ return {
1798
+ ...super.toLogEntry(ctx),
1799
+ message
1800
+ };
1664
1801
  }
1665
- return {
1666
- ...super.toLogEntry(ctx),
1667
- message
1668
- };
1669
- }
1670
- };
1671
- ConfigurationCCBulkReport = ConfigurationCCBulkReport_1 = __decorate([
1672
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkReport)
1673
- ], ConfigurationCCBulkReport);
1674
- let ConfigurationCCBulkGet = class ConfigurationCCBulkGet2 extends ConfigurationCC {
1675
- constructor(options) {
1676
- super(options);
1677
- this._parameters = options.parameters.sort();
1678
- if (!(0, import_safe.isConsecutiveArray)(this.parameters)) {
1679
- throw new import_safe.ZWaveError(`A ConfigurationCC.BulkGet can only be used for consecutive parameters`, import_safe.ZWaveErrorCodes.CC_Invalid);
1802
+ };
1803
+ return ConfigurationCCBulkReport2 = _classThis;
1804
+ })();
1805
+ let ConfigurationCCBulkGet = (() => {
1806
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkGet), (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCBulkReport)];
1807
+ let _classDescriptor;
1808
+ let _classExtraInitializers = [];
1809
+ let _classThis;
1810
+ let _classSuper = ConfigurationCC;
1811
+ var ConfigurationCCBulkGet2 = class extends _classSuper {
1812
+ static {
1813
+ _classThis = this;
1814
+ }
1815
+ static {
1816
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1817
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1818
+ ConfigurationCCBulkGet2 = _classThis = _classDescriptor.value;
1819
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1820
+ __runInitializers(_classThis, _classExtraInitializers);
1821
+ }
1822
+ constructor(options) {
1823
+ super(options);
1824
+ this._parameters = options.parameters.sort();
1825
+ if (!(0, import_safe.isConsecutiveArray)(this.parameters)) {
1826
+ throw new import_safe.ZWaveError(`A ConfigurationCC.BulkGet can only be used for consecutive parameters`, import_safe.ZWaveErrorCodes.CC_Invalid);
1827
+ }
1680
1828
  }
1681
- }
1682
- static from(_raw, _ctx) {
1683
- throw new import_safe.ZWaveError(`${this.name}: deserialization not implemented`, import_safe.ZWaveErrorCodes.Deserialization_NotImplemented);
1684
- }
1685
- _parameters;
1686
- get parameters() {
1687
- return this._parameters;
1688
- }
1689
- serialize(ctx) {
1690
- this.payload = new import_safe2.Bytes(3);
1691
- this.payload.writeUInt16BE(this.parameters[0], 0);
1692
- this.payload[2] = this.parameters.length;
1693
- return super.serialize(ctx);
1694
- }
1695
- toLogEntry(ctx) {
1696
- return {
1697
- ...super.toLogEntry(ctx),
1698
- message: { parameters: this.parameters.join(", ") }
1699
- };
1700
- }
1701
- };
1702
- ConfigurationCCBulkGet = __decorate([
1703
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.BulkGet),
1704
- (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCBulkReport)
1705
- ], ConfigurationCCBulkGet);
1706
- let ConfigurationCCNameReport = ConfigurationCCNameReport_1 = class ConfigurationCCNameReport2 extends ConfigurationCC {
1707
- constructor(options) {
1708
- super(options);
1709
- this.parameter = options.parameter;
1710
- this.name = options.name;
1711
- this.reportsToFollow = options.reportsToFollow;
1712
- }
1713
- static from(raw, ctx) {
1714
- (0, import_safe.validatePayload)(raw.payload.length >= 3);
1715
- const parameter = raw.payload.readUInt16BE(0);
1716
- const reportsToFollow = raw.payload[2];
1717
- if (reportsToFollow > 0) {
1718
- (0, import_safe.validatePayload)(raw.payload.length >= 4);
1719
- }
1720
- const name = raw.payload.subarray(3).toString("utf8");
1721
- return new ConfigurationCCNameReport_1({
1722
- nodeId: ctx.sourceNodeId,
1723
- parameter,
1724
- reportsToFollow,
1725
- name
1726
- });
1727
- }
1728
- parameter;
1729
- name;
1730
- reportsToFollow;
1731
- persistValues(ctx) {
1732
- if (!super.persistValues(ctx))
1733
- return false;
1734
- const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1735
- if (partialParams.length === 0) {
1736
- this.extendParamInformation(ctx, this.parameter, void 0, {
1737
- label: this.name
1829
+ static from(_raw, _ctx) {
1830
+ throw new import_safe.ZWaveError(`${this.name}: deserialization not implemented`, import_safe.ZWaveErrorCodes.Deserialization_NotImplemented);
1831
+ }
1832
+ _parameters;
1833
+ get parameters() {
1834
+ return this._parameters;
1835
+ }
1836
+ serialize(ctx) {
1837
+ this.payload = new import_safe2.Bytes(3);
1838
+ this.payload.writeUInt16BE(this.parameters[0], 0);
1839
+ this.payload[2] = this.parameters.length;
1840
+ return super.serialize(ctx);
1841
+ }
1842
+ toLogEntry(ctx) {
1843
+ return {
1844
+ ...super.toLogEntry(ctx),
1845
+ message: { parameters: this.parameters.join(", ") }
1846
+ };
1847
+ }
1848
+ };
1849
+ return ConfigurationCCBulkGet2 = _classThis;
1850
+ })();
1851
+ let ConfigurationCCNameReport = (() => {
1852
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.NameReport)];
1853
+ let _classDescriptor;
1854
+ let _classExtraInitializers = [];
1855
+ let _classThis;
1856
+ let _classSuper = ConfigurationCC;
1857
+ var ConfigurationCCNameReport2 = class extends _classSuper {
1858
+ static {
1859
+ _classThis = this;
1860
+ }
1861
+ static {
1862
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1863
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1864
+ ConfigurationCCNameReport2 = _classThis = _classDescriptor.value;
1865
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1866
+ __runInitializers(_classThis, _classExtraInitializers);
1867
+ }
1868
+ constructor(options) {
1869
+ super(options);
1870
+ this.parameter = options.parameter;
1871
+ this.name = options.name;
1872
+ this.reportsToFollow = options.reportsToFollow;
1873
+ }
1874
+ static from(raw, ctx) {
1875
+ (0, import_safe.validatePayload)(raw.payload.length >= 3);
1876
+ const parameter = raw.payload.readUInt16BE(0);
1877
+ const reportsToFollow = raw.payload[2];
1878
+ if (reportsToFollow > 0) {
1879
+ (0, import_safe.validatePayload)(raw.payload.length >= 4);
1880
+ }
1881
+ const name = raw.payload.subarray(3).toString("utf8");
1882
+ return new this({
1883
+ nodeId: ctx.sourceNodeId,
1884
+ parameter,
1885
+ reportsToFollow,
1886
+ name
1738
1887
  });
1739
- } else {
1740
- for (const param of partialParams) {
1741
- const paramNumber = param.property;
1742
- const bitMask = param.propertyKey;
1743
- const bitNumber = Math.log2(bitMask) % 1 === 0 ? Math.log2(bitMask) : void 0;
1744
- let label = `${this.name} - ${bitMask}`;
1745
- if (bitNumber != void 0) {
1746
- label += ` (bit ${bitNumber})`;
1747
- }
1748
- this.extendParamInformation(ctx, paramNumber, bitMask, {
1749
- label
1888
+ }
1889
+ parameter;
1890
+ name;
1891
+ reportsToFollow;
1892
+ persistValues(ctx) {
1893
+ if (!super.persistValues(ctx))
1894
+ return false;
1895
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter);
1896
+ if (partialParams.length === 0) {
1897
+ this.extendParamInformation(ctx, this.parameter, void 0, {
1898
+ label: this.name
1750
1899
  });
1900
+ } else {
1901
+ for (const param of partialParams) {
1902
+ const paramNumber = param.property;
1903
+ const bitMask = param.propertyKey;
1904
+ const bitNumber = Math.log2(bitMask) % 1 === 0 ? Math.log2(bitMask) : void 0;
1905
+ let label = `${this.name} - ${bitMask}`;
1906
+ if (bitNumber != void 0) {
1907
+ label += ` (bit ${bitNumber})`;
1908
+ }
1909
+ this.extendParamInformation(ctx, paramNumber, bitMask, {
1910
+ label
1911
+ });
1912
+ }
1751
1913
  }
1914
+ return true;
1752
1915
  }
1753
- return true;
1754
- }
1755
- serialize(ctx) {
1756
- const nameBuffer = import_safe2.Bytes.from(this.name, "utf8");
1757
- this.payload = new import_safe2.Bytes(3 + nameBuffer.length);
1758
- this.payload.writeUInt16BE(this.parameter, 0);
1759
- this.payload[2] = this.reportsToFollow;
1760
- this.payload.set(nameBuffer, 3);
1761
- return super.serialize(ctx);
1762
- }
1763
- getPartialCCSessionId() {
1764
- return { parameter: this.parameter };
1765
- }
1766
- expectMoreMessages() {
1767
- return this.reportsToFollow > 0;
1768
- }
1769
- mergePartialCCs(partials, _ctx) {
1770
- this.name = [...partials, this].map((report) => report.name).reduce((prev, cur) => prev + cur, "");
1771
- }
1772
- toLogEntry(ctx) {
1773
- return {
1774
- ...super.toLogEntry(ctx),
1775
- message: {
1776
- "parameter #": this.parameter,
1777
- name: this.name,
1778
- "reports to follow": this.reportsToFollow
1916
+ serialize(ctx) {
1917
+ const nameBuffer = import_safe2.Bytes.from(this.name, "utf8");
1918
+ this.payload = new import_safe2.Bytes(3 + nameBuffer.length);
1919
+ this.payload.writeUInt16BE(this.parameter, 0);
1920
+ this.payload[2] = this.reportsToFollow;
1921
+ this.payload.set(nameBuffer, 3);
1922
+ return super.serialize(ctx);
1923
+ }
1924
+ getPartialCCSessionId() {
1925
+ return { parameter: this.parameter };
1926
+ }
1927
+ expectMoreMessages() {
1928
+ return this.reportsToFollow > 0;
1929
+ }
1930
+ mergePartialCCs(partials, _ctx) {
1931
+ this.name = [...partials, this].map((report) => report.name).reduce((prev, cur) => prev + cur, "");
1932
+ }
1933
+ toLogEntry(ctx) {
1934
+ return {
1935
+ ...super.toLogEntry(ctx),
1936
+ message: {
1937
+ "parameter #": this.parameter,
1938
+ name: this.name,
1939
+ "reports to follow": this.reportsToFollow
1940
+ }
1941
+ };
1942
+ }
1943
+ };
1944
+ return ConfigurationCCNameReport2 = _classThis;
1945
+ })();
1946
+ let ConfigurationCCNameGet = (() => {
1947
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.NameGet), (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCNameReport)];
1948
+ let _classDescriptor;
1949
+ let _classExtraInitializers = [];
1950
+ let _classThis;
1951
+ let _classSuper = ConfigurationCC;
1952
+ var ConfigurationCCNameGet2 = class extends _classSuper {
1953
+ static {
1954
+ _classThis = this;
1955
+ }
1956
+ static {
1957
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1958
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1959
+ ConfigurationCCNameGet2 = _classThis = _classDescriptor.value;
1960
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1961
+ __runInitializers(_classThis, _classExtraInitializers);
1962
+ }
1963
+ constructor(options) {
1964
+ super(options);
1965
+ this.parameter = options.parameter;
1966
+ }
1967
+ static from(raw, ctx) {
1968
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
1969
+ const parameter = raw.payload.readUInt16BE(0);
1970
+ return new this({
1971
+ nodeId: ctx.sourceNodeId,
1972
+ parameter
1973
+ });
1974
+ }
1975
+ parameter;
1976
+ serialize(ctx) {
1977
+ this.payload = new import_safe2.Bytes(2);
1978
+ this.payload.writeUInt16BE(this.parameter, 0);
1979
+ return super.serialize(ctx);
1980
+ }
1981
+ toLogEntry(ctx) {
1982
+ return {
1983
+ ...super.toLogEntry(ctx),
1984
+ message: { "parameter #": this.parameter }
1985
+ };
1986
+ }
1987
+ };
1988
+ return ConfigurationCCNameGet2 = _classThis;
1989
+ })();
1990
+ let ConfigurationCCInfoReport = (() => {
1991
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.InfoReport)];
1992
+ let _classDescriptor;
1993
+ let _classExtraInitializers = [];
1994
+ let _classThis;
1995
+ let _classSuper = ConfigurationCC;
1996
+ var ConfigurationCCInfoReport2 = class extends _classSuper {
1997
+ static {
1998
+ _classThis = this;
1999
+ }
2000
+ static {
2001
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2002
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2003
+ ConfigurationCCInfoReport2 = _classThis = _classDescriptor.value;
2004
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2005
+ __runInitializers(_classThis, _classExtraInitializers);
2006
+ }
2007
+ constructor(options) {
2008
+ super(options);
2009
+ this.parameter = options.parameter;
2010
+ this.info = options.info;
2011
+ this.reportsToFollow = options.reportsToFollow;
2012
+ }
2013
+ static from(raw, ctx) {
2014
+ (0, import_safe.validatePayload)(raw.payload.length >= 3);
2015
+ const parameter = raw.payload.readUInt16BE(0);
2016
+ const reportsToFollow = raw.payload[2];
2017
+ if (reportsToFollow > 0) {
2018
+ (0, import_safe.validatePayload)(raw.payload.length >= 4);
1779
2019
  }
1780
- };
1781
- }
1782
- };
1783
- ConfigurationCCNameReport = ConfigurationCCNameReport_1 = __decorate([
1784
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.NameReport)
1785
- ], ConfigurationCCNameReport);
1786
- let ConfigurationCCNameGet = ConfigurationCCNameGet_1 = class ConfigurationCCNameGet2 extends ConfigurationCC {
1787
- constructor(options) {
1788
- super(options);
1789
- this.parameter = options.parameter;
1790
- }
1791
- static from(raw, ctx) {
1792
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
1793
- const parameter = raw.payload.readUInt16BE(0);
1794
- return new ConfigurationCCNameGet_1({
1795
- nodeId: ctx.sourceNodeId,
1796
- parameter
1797
- });
1798
- }
1799
- parameter;
1800
- serialize(ctx) {
1801
- this.payload = new import_safe2.Bytes(2);
1802
- this.payload.writeUInt16BE(this.parameter, 0);
1803
- return super.serialize(ctx);
1804
- }
1805
- toLogEntry(ctx) {
1806
- return {
1807
- ...super.toLogEntry(ctx),
1808
- message: { "parameter #": this.parameter }
1809
- };
1810
- }
1811
- };
1812
- ConfigurationCCNameGet = ConfigurationCCNameGet_1 = __decorate([
1813
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.NameGet),
1814
- (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCNameReport)
1815
- ], ConfigurationCCNameGet);
1816
- let ConfigurationCCInfoReport = ConfigurationCCInfoReport_1 = class ConfigurationCCInfoReport2 extends ConfigurationCC {
1817
- constructor(options) {
1818
- super(options);
1819
- this.parameter = options.parameter;
1820
- this.info = options.info;
1821
- this.reportsToFollow = options.reportsToFollow;
1822
- }
1823
- static from(raw, ctx) {
1824
- (0, import_safe.validatePayload)(raw.payload.length >= 3);
1825
- const parameter = raw.payload.readUInt16BE(0);
1826
- const reportsToFollow = raw.payload[2];
1827
- if (reportsToFollow > 0) {
1828
- (0, import_safe.validatePayload)(raw.payload.length >= 4);
1829
- }
1830
- const info = raw.payload.subarray(3).toString("utf8");
1831
- return new ConfigurationCCInfoReport_1({
1832
- nodeId: ctx.sourceNodeId,
1833
- parameter,
1834
- reportsToFollow,
1835
- info
1836
- });
1837
- }
1838
- parameter;
1839
- info;
1840
- reportsToFollow;
1841
- persistValues(ctx) {
1842
- if (!super.persistValues(ctx))
1843
- return false;
1844
- const partialParams = this.getPartialParamInfos(ctx, this.parameter).sort((a, b) => (a.propertyKey ?? 0) - (b.propertyKey ?? 0));
1845
- if (partialParams.length === 0) {
1846
- this.extendParamInformation(ctx, this.parameter, void 0, {
1847
- description: this.info
2020
+ const info = raw.payload.subarray(3).toString("utf8");
2021
+ return new this({
2022
+ nodeId: ctx.sourceNodeId,
2023
+ parameter,
2024
+ reportsToFollow,
2025
+ info
1848
2026
  });
1849
- } else {
1850
- let firstParamLabel;
1851
- for (const param of partialParams) {
1852
- const paramNumber = param.property;
1853
- const bitMask = param.propertyKey;
1854
- const description = firstParamLabel ? `Refer to ${firstParamLabel}` : this.info;
1855
- this.extendParamInformation(ctx, paramNumber, bitMask, {
1856
- description
2027
+ }
2028
+ parameter;
2029
+ info;
2030
+ reportsToFollow;
2031
+ persistValues(ctx) {
2032
+ if (!super.persistValues(ctx))
2033
+ return false;
2034
+ const partialParams = this.getPartialParamInfos(ctx, this.parameter).sort((a, b) => (a.propertyKey ?? 0) - (b.propertyKey ?? 0));
2035
+ if (partialParams.length === 0) {
2036
+ this.extendParamInformation(ctx, this.parameter, void 0, {
2037
+ description: this.info
1857
2038
  });
1858
- if (firstParamLabel == void 0) {
1859
- firstParamLabel = this.getParamInformation(ctx, paramNumber, bitMask).label ?? `parameter ${paramNumber} - ${bitMask}`;
2039
+ } else {
2040
+ let firstParamLabel;
2041
+ for (const param of partialParams) {
2042
+ const paramNumber = param.property;
2043
+ const bitMask = param.propertyKey;
2044
+ const description = firstParamLabel ? `Refer to ${firstParamLabel}` : this.info;
2045
+ this.extendParamInformation(ctx, paramNumber, bitMask, {
2046
+ description
2047
+ });
2048
+ if (firstParamLabel == void 0) {
2049
+ firstParamLabel = this.getParamInformation(ctx, paramNumber, bitMask).label ?? `parameter ${paramNumber} - ${bitMask}`;
2050
+ }
1860
2051
  }
1861
2052
  }
2053
+ return true;
1862
2054
  }
1863
- return true;
1864
- }
1865
- serialize(ctx) {
1866
- const infoBuffer = import_safe2.Bytes.from(this.info, "utf8");
1867
- this.payload = new import_safe2.Bytes(3 + infoBuffer.length);
1868
- this.payload.writeUInt16BE(this.parameter, 0);
1869
- this.payload[2] = this.reportsToFollow;
1870
- this.payload.set(infoBuffer, 3);
1871
- return super.serialize(ctx);
1872
- }
1873
- getPartialCCSessionId() {
1874
- return { parameter: this.parameter };
1875
- }
1876
- expectMoreMessages() {
1877
- return this.reportsToFollow > 0;
1878
- }
1879
- mergePartialCCs(partials, _ctx) {
1880
- this.info = [...partials, this].map((report) => report.info).reduce((prev, cur) => prev + cur, "");
1881
- }
1882
- toLogEntry(ctx) {
1883
- return {
1884
- ...super.toLogEntry(ctx),
1885
- message: {
1886
- "parameter #": this.parameter,
1887
- info: this.info,
1888
- "reports to follow": this.reportsToFollow
2055
+ serialize(ctx) {
2056
+ const infoBuffer = import_safe2.Bytes.from(this.info, "utf8");
2057
+ this.payload = new import_safe2.Bytes(3 + infoBuffer.length);
2058
+ this.payload.writeUInt16BE(this.parameter, 0);
2059
+ this.payload[2] = this.reportsToFollow;
2060
+ this.payload.set(infoBuffer, 3);
2061
+ return super.serialize(ctx);
2062
+ }
2063
+ getPartialCCSessionId() {
2064
+ return { parameter: this.parameter };
2065
+ }
2066
+ expectMoreMessages() {
2067
+ return this.reportsToFollow > 0;
2068
+ }
2069
+ mergePartialCCs(partials, _ctx) {
2070
+ this.info = [...partials, this].map((report) => report.info).reduce((prev, cur) => prev + cur, "");
2071
+ }
2072
+ toLogEntry(ctx) {
2073
+ return {
2074
+ ...super.toLogEntry(ctx),
2075
+ message: {
2076
+ "parameter #": this.parameter,
2077
+ info: this.info,
2078
+ "reports to follow": this.reportsToFollow
2079
+ }
2080
+ };
2081
+ }
2082
+ };
2083
+ return ConfigurationCCInfoReport2 = _classThis;
2084
+ })();
2085
+ let ConfigurationCCInfoGet = (() => {
2086
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.InfoGet), (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCInfoReport)];
2087
+ let _classDescriptor;
2088
+ let _classExtraInitializers = [];
2089
+ let _classThis;
2090
+ let _classSuper = ConfigurationCC;
2091
+ var ConfigurationCCInfoGet2 = class extends _classSuper {
2092
+ static {
2093
+ _classThis = this;
2094
+ }
2095
+ static {
2096
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2097
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2098
+ ConfigurationCCInfoGet2 = _classThis = _classDescriptor.value;
2099
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2100
+ __runInitializers(_classThis, _classExtraInitializers);
2101
+ }
2102
+ constructor(options) {
2103
+ super(options);
2104
+ this.parameter = options.parameter;
2105
+ }
2106
+ static from(raw, ctx) {
2107
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
2108
+ const parameter = raw.payload.readUInt16BE(0);
2109
+ return new this({
2110
+ nodeId: ctx.sourceNodeId,
2111
+ parameter
2112
+ });
2113
+ }
2114
+ parameter;
2115
+ serialize(ctx) {
2116
+ this.payload = new import_safe2.Bytes(2);
2117
+ this.payload.writeUInt16BE(this.parameter, 0);
2118
+ return super.serialize(ctx);
2119
+ }
2120
+ toLogEntry(ctx) {
2121
+ return {
2122
+ ...super.toLogEntry(ctx),
2123
+ message: { "parameter #": this.parameter }
2124
+ };
2125
+ }
2126
+ };
2127
+ return ConfigurationCCInfoGet2 = _classThis;
2128
+ })();
2129
+ let ConfigurationCCPropertiesReport = (() => {
2130
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.PropertiesReport)];
2131
+ let _classDescriptor;
2132
+ let _classExtraInitializers = [];
2133
+ let _classThis;
2134
+ let _classSuper = ConfigurationCC;
2135
+ var ConfigurationCCPropertiesReport2 = class extends _classSuper {
2136
+ static {
2137
+ _classThis = this;
2138
+ }
2139
+ static {
2140
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2141
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2142
+ ConfigurationCCPropertiesReport2 = _classThis = _classDescriptor.value;
2143
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2144
+ __runInitializers(_classThis, _classExtraInitializers);
2145
+ }
2146
+ constructor(options) {
2147
+ super(options);
2148
+ this.parameter = options.parameter;
2149
+ this.valueSize = options.valueSize;
2150
+ this.valueFormat = options.valueFormat;
2151
+ if (this.valueSize > 0) {
2152
+ if (options.minValue == void 0) {
2153
+ throw new import_safe.ZWaveError("The minimum value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
2154
+ } else if (options.maxValue == void 0) {
2155
+ throw new import_safe.ZWaveError("The maximum value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
2156
+ } else if (options.defaultValue == void 0) {
2157
+ throw new import_safe.ZWaveError("The default value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
2158
+ }
2159
+ this.minValue = options.minValue;
2160
+ this.maxValue = options.maxValue;
2161
+ this.defaultValue = options.defaultValue;
1889
2162
  }
1890
- };
1891
- }
1892
- };
1893
- ConfigurationCCInfoReport = ConfigurationCCInfoReport_1 = __decorate([
1894
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.InfoReport)
1895
- ], ConfigurationCCInfoReport);
1896
- let ConfigurationCCInfoGet = ConfigurationCCInfoGet_1 = class ConfigurationCCInfoGet2 extends ConfigurationCC {
1897
- constructor(options) {
1898
- super(options);
1899
- this.parameter = options.parameter;
1900
- }
1901
- static from(raw, ctx) {
1902
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
1903
- const parameter = raw.payload.readUInt16BE(0);
1904
- return new ConfigurationCCInfoGet_1({
1905
- nodeId: ctx.sourceNodeId,
1906
- parameter
1907
- });
1908
- }
1909
- parameter;
1910
- serialize(ctx) {
1911
- this.payload = new import_safe2.Bytes(2);
1912
- this.payload.writeUInt16BE(this.parameter, 0);
1913
- return super.serialize(ctx);
1914
- }
1915
- toLogEntry(ctx) {
1916
- return {
1917
- ...super.toLogEntry(ctx),
1918
- message: { "parameter #": this.parameter }
1919
- };
1920
- }
1921
- };
1922
- ConfigurationCCInfoGet = ConfigurationCCInfoGet_1 = __decorate([
1923
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.InfoGet),
1924
- (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCInfoReport)
1925
- ], ConfigurationCCInfoGet);
1926
- let ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport_1 = class ConfigurationCCPropertiesReport2 extends ConfigurationCC {
1927
- constructor(options) {
1928
- super(options);
1929
- this.parameter = options.parameter;
1930
- this.valueSize = options.valueSize;
1931
- this.valueFormat = options.valueFormat;
1932
- if (this.valueSize > 0) {
1933
- if (options.minValue == void 0) {
1934
- throw new import_safe.ZWaveError("The minimum value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
1935
- } else if (options.maxValue == void 0) {
1936
- throw new import_safe.ZWaveError("The maximum value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
1937
- } else if (options.defaultValue == void 0) {
1938
- throw new import_safe.ZWaveError("The default value must be set when the value size is non-zero", import_safe.ZWaveErrorCodes.Argument_Invalid);
2163
+ this.nextParameter = options.nextParameter;
2164
+ this.altersCapabilities = options.altersCapabilities;
2165
+ this.isReadonly = options.isReadonly;
2166
+ this.isAdvanced = options.isAdvanced;
2167
+ this.noBulkSupport = options.noBulkSupport;
2168
+ }
2169
+ static from(raw, ctx) {
2170
+ (0, import_safe.validatePayload)(raw.payload.length >= 3);
2171
+ const parameter = raw.payload.readUInt16BE(0);
2172
+ const valueFormat = (raw.payload[2] & 56) >>> 3;
2173
+ const valueSize = raw.payload[2] & 7;
2174
+ let nextParameter;
2175
+ if (valueSize === 0 && raw.payload.length < 5) {
2176
+ nextParameter = 0;
2177
+ return new this({
2178
+ nodeId: ctx.sourceNodeId,
2179
+ parameter,
2180
+ valueFormat,
2181
+ valueSize,
2182
+ nextParameter
2183
+ });
1939
2184
  }
1940
- this.minValue = options.minValue;
1941
- this.maxValue = options.maxValue;
1942
- this.defaultValue = options.defaultValue;
1943
- }
1944
- this.nextParameter = options.nextParameter;
1945
- this.altersCapabilities = options.altersCapabilities;
1946
- this.isReadonly = options.isReadonly;
1947
- this.isAdvanced = options.isAdvanced;
1948
- this.noBulkSupport = options.noBulkSupport;
1949
- }
1950
- static from(raw, ctx) {
1951
- (0, import_safe.validatePayload)(raw.payload.length >= 3);
1952
- const parameter = raw.payload.readUInt16BE(0);
1953
- const valueFormat = (raw.payload[2] & 56) >>> 3;
1954
- const valueSize = raw.payload[2] & 7;
1955
- let nextParameter;
1956
- if (valueSize === 0 && raw.payload.length < 5) {
1957
- nextParameter = 0;
1958
- return new ConfigurationCCPropertiesReport_1({
2185
+ const nextParameterOffset = 3 + 3 * valueSize;
2186
+ (0, import_safe.validatePayload)(raw.payload.length >= nextParameterOffset + 2);
2187
+ let minValue;
2188
+ let maxValue;
2189
+ let defaultValue;
2190
+ if (valueSize > 0) {
2191
+ if (valueFormat === import_safe.ConfigValueFormat.BitField) {
2192
+ minValue = 0;
2193
+ } else {
2194
+ minValue = parseValue(raw.payload.subarray(3), valueSize, valueFormat);
2195
+ }
2196
+ maxValue = parseValue(raw.payload.subarray(3 + valueSize), valueSize, valueFormat);
2197
+ defaultValue = parseValue(raw.payload.subarray(3 + 2 * valueSize), valueSize, valueFormat);
2198
+ }
2199
+ nextParameter = raw.payload.readUInt16BE(nextParameterOffset);
2200
+ let altersCapabilities;
2201
+ let isReadonly;
2202
+ let isAdvanced;
2203
+ let noBulkSupport;
2204
+ if (raw.payload.length >= nextParameterOffset + 3) {
2205
+ const options1 = raw.payload[2];
2206
+ const options2 = raw.payload[3 + 3 * valueSize + 2];
2207
+ altersCapabilities = !!(options1 & 128);
2208
+ isReadonly = !!(options1 & 64);
2209
+ isAdvanced = !!(options2 & 1);
2210
+ noBulkSupport = !!(options2 & 2);
2211
+ }
2212
+ return new this({
1959
2213
  nodeId: ctx.sourceNodeId,
1960
2214
  parameter,
1961
2215
  valueFormat,
1962
2216
  valueSize,
1963
- nextParameter
2217
+ nextParameter,
2218
+ minValue,
2219
+ maxValue,
2220
+ defaultValue,
2221
+ altersCapabilities,
2222
+ isReadonly,
2223
+ isAdvanced,
2224
+ noBulkSupport
1964
2225
  });
1965
2226
  }
1966
- const nextParameterOffset = 3 + 3 * valueSize;
1967
- (0, import_safe.validatePayload)(raw.payload.length >= nextParameterOffset + 2);
1968
- let minValue;
1969
- let maxValue;
1970
- let defaultValue;
1971
- if (valueSize > 0) {
1972
- if (valueFormat === import_safe.ConfigValueFormat.BitField) {
1973
- minValue = 0;
1974
- } else {
1975
- minValue = parseValue(raw.payload.subarray(3), valueSize, valueFormat);
1976
- }
1977
- maxValue = parseValue(raw.payload.subarray(3 + valueSize), valueSize, valueFormat);
1978
- defaultValue = parseValue(raw.payload.subarray(3 + 2 * valueSize), valueSize, valueFormat);
1979
- }
1980
- nextParameter = raw.payload.readUInt16BE(nextParameterOffset);
1981
- let altersCapabilities;
1982
- let isReadonly;
1983
- let isAdvanced;
1984
- let noBulkSupport;
1985
- if (raw.payload.length >= nextParameterOffset + 3) {
1986
- const options1 = raw.payload[2];
1987
- const options2 = raw.payload[3 + 3 * valueSize + 2];
1988
- altersCapabilities = !!(options1 & 128);
1989
- isReadonly = !!(options1 & 64);
1990
- isAdvanced = !!(options2 & 1);
1991
- noBulkSupport = !!(options2 & 2);
1992
- }
1993
- return new ConfigurationCCPropertiesReport_1({
1994
- nodeId: ctx.sourceNodeId,
1995
- parameter,
1996
- valueFormat,
1997
- valueSize,
1998
- nextParameter,
1999
- minValue,
2000
- maxValue,
2001
- defaultValue,
2002
- altersCapabilities,
2003
- isReadonly,
2004
- isAdvanced,
2005
- noBulkSupport
2006
- });
2007
- }
2008
- persistValues(ctx) {
2009
- if (!super.persistValues(ctx))
2010
- return false;
2011
- if (this.valueSize > 0) {
2012
- const baseInfo = {
2013
- type: "number",
2014
- format: this.valueFormat,
2015
- valueSize: this.valueSize,
2016
- requiresReInclusion: this.altersCapabilities,
2017
- readable: true,
2018
- writeable: !this.isReadonly,
2019
- allowManualEntry: true,
2020
- isAdvanced: this.isAdvanced,
2021
- noBulkSupport: this.noBulkSupport,
2022
- isFromConfig: false
2023
- };
2024
- if (this.valueFormat !== import_safe.ConfigValueFormat.BitField) {
2025
- if (!this.paramExistsInConfigFile(ctx, this.parameter)) {
2026
- const paramInfo = (0, import_safe.stripUndefined)({
2027
- ...baseInfo,
2028
- min: this.minValue,
2029
- max: this.maxValue,
2030
- default: this.defaultValue
2031
- });
2032
- this.extendParamInformation(ctx, this.parameter, void 0, paramInfo);
2033
- }
2034
- } else {
2035
- const bits = this.maxValue;
2036
- let mask = 1;
2037
- while (mask <= bits) {
2038
- if (
2039
- // Only create partials that exist
2040
- !!(mask & bits) && !this.paramExistsInConfigFile(ctx, this.parameter, mask)
2041
- ) {
2227
+ persistValues(ctx) {
2228
+ if (!super.persistValues(ctx))
2229
+ return false;
2230
+ if (this.valueSize > 0) {
2231
+ const baseInfo = {
2232
+ type: "number",
2233
+ format: this.valueFormat,
2234
+ valueSize: this.valueSize,
2235
+ requiresReInclusion: this.altersCapabilities,
2236
+ readable: true,
2237
+ writeable: !this.isReadonly,
2238
+ allowManualEntry: true,
2239
+ isAdvanced: this.isAdvanced,
2240
+ noBulkSupport: this.noBulkSupport,
2241
+ isFromConfig: false
2242
+ };
2243
+ if (this.valueFormat !== import_safe.ConfigValueFormat.BitField) {
2244
+ if (!this.paramExistsInConfigFile(ctx, this.parameter)) {
2042
2245
  const paramInfo = (0, import_safe.stripUndefined)({
2043
2246
  ...baseInfo,
2044
- min: 0,
2045
- max: 1,
2046
- default: this.defaultValue & mask ? 1 : 0
2247
+ min: this.minValue,
2248
+ max: this.maxValue,
2249
+ default: this.defaultValue
2047
2250
  });
2048
- this.extendParamInformation(ctx, this.parameter, mask, paramInfo);
2251
+ this.extendParamInformation(ctx, this.parameter, void 0, paramInfo);
2252
+ }
2253
+ } else {
2254
+ const bits = this.maxValue;
2255
+ let mask = 1;
2256
+ while (mask <= bits) {
2257
+ if (
2258
+ // Only create partials that exist
2259
+ !!(mask & bits) && !this.paramExistsInConfigFile(ctx, this.parameter, mask)
2260
+ ) {
2261
+ const paramInfo = (0, import_safe.stripUndefined)({
2262
+ ...baseInfo,
2263
+ min: 0,
2264
+ max: 1,
2265
+ default: this.defaultValue & mask ? 1 : 0
2266
+ });
2267
+ this.extendParamInformation(ctx, this.parameter, mask, paramInfo);
2268
+ }
2269
+ mask *= 2;
2049
2270
  }
2050
- mask *= 2;
2051
2271
  }
2052
2272
  }
2273
+ return true;
2053
2274
  }
2054
- return true;
2055
- }
2056
- parameter;
2057
- valueSize;
2058
- valueFormat;
2059
- minValue;
2060
- maxValue;
2061
- defaultValue;
2062
- nextParameter;
2063
- altersCapabilities;
2064
- isReadonly;
2065
- isAdvanced;
2066
- noBulkSupport;
2067
- serialize(ctx) {
2068
- this.payload = new import_safe2.Bytes(3 + 3 * this.valueSize + 2 + 1);
2069
- this.payload.writeUInt16BE(this.parameter, 0);
2070
- const options1 = (this.altersCapabilities ? 128 : 0) | (this.isReadonly ? 64 : 0) | (this.valueFormat & 7) << 3 | this.valueSize & 7;
2071
- this.payload[2] = options1;
2072
- let offset = 3;
2073
- if (this.valueSize > 0) {
2074
- serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.minValue);
2075
- offset += this.valueSize;
2076
- serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.maxValue);
2077
- offset += this.valueSize;
2078
- serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.defaultValue);
2079
- offset += this.valueSize;
2080
- }
2081
- this.payload.writeUInt16BE(this.nextParameter, offset);
2082
- offset += 2;
2083
- const options2 = (this.isAdvanced ? 1 : 0) | (this.noBulkSupport ? 2 : 0);
2084
- this.payload[offset] = options2;
2085
- return super.serialize(ctx);
2086
- }
2087
- toLogEntry(ctx) {
2088
- const message = {
2089
- "parameter #": this.parameter,
2090
- "next param #": this.nextParameter,
2091
- "value size": this.valueSize,
2092
- "value format": (0, import_safe3.getEnumMemberName)(import_safe.ConfigValueFormat, this.valueFormat)
2093
- };
2094
- if (this.minValue != void 0) {
2095
- message["min value"] = configValueToString(this.minValue);
2096
- }
2097
- if (this.maxValue != void 0) {
2098
- message["max value"] = configValueToString(this.maxValue);
2099
- }
2100
- if (this.defaultValue != void 0) {
2101
- message["default value"] = configValueToString(this.defaultValue);
2102
- }
2103
- if (this.altersCapabilities != void 0) {
2104
- message["alters capabilities"] = this.altersCapabilities;
2275
+ parameter;
2276
+ valueSize;
2277
+ valueFormat;
2278
+ minValue;
2279
+ maxValue;
2280
+ defaultValue;
2281
+ nextParameter;
2282
+ altersCapabilities;
2283
+ isReadonly;
2284
+ isAdvanced;
2285
+ noBulkSupport;
2286
+ serialize(ctx) {
2287
+ this.payload = new import_safe2.Bytes(3 + 3 * this.valueSize + 2 + 1);
2288
+ this.payload.writeUInt16BE(this.parameter, 0);
2289
+ const options1 = (this.altersCapabilities ? 128 : 0) | (this.isReadonly ? 64 : 0) | (this.valueFormat & 7) << 3 | this.valueSize & 7;
2290
+ this.payload[2] = options1;
2291
+ let offset = 3;
2292
+ if (this.valueSize > 0) {
2293
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.minValue);
2294
+ offset += this.valueSize;
2295
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.maxValue);
2296
+ offset += this.valueSize;
2297
+ serializeValue(this.payload, offset, this.valueSize, this.valueFormat, this.defaultValue);
2298
+ offset += this.valueSize;
2299
+ }
2300
+ this.payload.writeUInt16BE(this.nextParameter, offset);
2301
+ offset += 2;
2302
+ const options2 = (this.isAdvanced ? 1 : 0) | (this.noBulkSupport ? 2 : 0);
2303
+ this.payload[offset] = options2;
2304
+ return super.serialize(ctx);
2305
+ }
2306
+ toLogEntry(ctx) {
2307
+ const message = {
2308
+ "parameter #": this.parameter,
2309
+ "next param #": this.nextParameter,
2310
+ "value size": this.valueSize,
2311
+ "value format": (0, import_safe3.getEnumMemberName)(import_safe.ConfigValueFormat, this.valueFormat)
2312
+ };
2313
+ if (this.minValue != void 0) {
2314
+ message["min value"] = configValueToString(this.minValue);
2315
+ }
2316
+ if (this.maxValue != void 0) {
2317
+ message["max value"] = configValueToString(this.maxValue);
2318
+ }
2319
+ if (this.defaultValue != void 0) {
2320
+ message["default value"] = configValueToString(this.defaultValue);
2321
+ }
2322
+ if (this.altersCapabilities != void 0) {
2323
+ message["alters capabilities"] = this.altersCapabilities;
2324
+ }
2325
+ if (this.isReadonly != void 0) {
2326
+ message.readonly = this.isReadonly;
2327
+ }
2328
+ if (this.isAdvanced != void 0) {
2329
+ message.advanced = this.isAdvanced;
2330
+ }
2331
+ if (this.noBulkSupport != void 0) {
2332
+ message["bulk support"] = !this.noBulkSupport;
2333
+ }
2334
+ return {
2335
+ ...super.toLogEntry(ctx),
2336
+ message
2337
+ };
2105
2338
  }
2106
- if (this.isReadonly != void 0) {
2107
- message.readonly = this.isReadonly;
2339
+ };
2340
+ return ConfigurationCCPropertiesReport2 = _classThis;
2341
+ })();
2342
+ let ConfigurationCCPropertiesGet = (() => {
2343
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.PropertiesGet), (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCPropertiesReport)];
2344
+ let _classDescriptor;
2345
+ let _classExtraInitializers = [];
2346
+ let _classThis;
2347
+ let _classSuper = ConfigurationCC;
2348
+ var ConfigurationCCPropertiesGet2 = class extends _classSuper {
2349
+ static {
2350
+ _classThis = this;
2351
+ }
2352
+ static {
2353
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2354
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2355
+ ConfigurationCCPropertiesGet2 = _classThis = _classDescriptor.value;
2356
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2357
+ __runInitializers(_classThis, _classExtraInitializers);
2358
+ }
2359
+ constructor(options) {
2360
+ super(options);
2361
+ this.parameter = options.parameter;
2362
+ }
2363
+ static from(raw, ctx) {
2364
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
2365
+ const parameter = raw.payload.readUInt16BE(0);
2366
+ return new this({
2367
+ nodeId: ctx.sourceNodeId,
2368
+ parameter
2369
+ });
2108
2370
  }
2109
- if (this.isAdvanced != void 0) {
2110
- message.advanced = this.isAdvanced;
2371
+ parameter;
2372
+ serialize(ctx) {
2373
+ this.payload = new import_safe2.Bytes(2);
2374
+ this.payload.writeUInt16BE(this.parameter, 0);
2375
+ return super.serialize(ctx);
2111
2376
  }
2112
- if (this.noBulkSupport != void 0) {
2113
- message["bulk support"] = !this.noBulkSupport;
2377
+ toLogEntry(ctx) {
2378
+ return {
2379
+ ...super.toLogEntry(ctx),
2380
+ message: { "parameter #": this.parameter }
2381
+ };
2114
2382
  }
2115
- return {
2116
- ...super.toLogEntry(ctx),
2117
- message
2118
- };
2119
- }
2120
- };
2121
- ConfigurationCCPropertiesReport = ConfigurationCCPropertiesReport_1 = __decorate([
2122
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.PropertiesReport)
2123
- ], ConfigurationCCPropertiesReport);
2124
- let ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = class ConfigurationCCPropertiesGet2 extends ConfigurationCC {
2125
- constructor(options) {
2126
- super(options);
2127
- this.parameter = options.parameter;
2128
- }
2129
- static from(raw, ctx) {
2130
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
2131
- const parameter = raw.payload.readUInt16BE(0);
2132
- return new ConfigurationCCPropertiesGet_1({
2133
- nodeId: ctx.sourceNodeId,
2134
- parameter
2135
- });
2136
- }
2137
- parameter;
2138
- serialize(ctx) {
2139
- this.payload = new import_safe2.Bytes(2);
2140
- this.payload.writeUInt16BE(this.parameter, 0);
2141
- return super.serialize(ctx);
2142
- }
2143
- toLogEntry(ctx) {
2144
- return {
2145
- ...super.toLogEntry(ctx),
2146
- message: { "parameter #": this.parameter }
2147
- };
2148
- }
2149
- };
2150
- ConfigurationCCPropertiesGet = ConfigurationCCPropertiesGet_1 = __decorate([
2151
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.PropertiesGet),
2152
- (0, import_CommandClassDecorators.expectedCCResponse)(ConfigurationCCPropertiesReport)
2153
- ], ConfigurationCCPropertiesGet);
2154
- let ConfigurationCCDefaultReset = class ConfigurationCCDefaultReset2 extends ConfigurationCC {
2155
- };
2156
- ConfigurationCCDefaultReset = __decorate([
2157
- (0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.DefaultReset)
2158
- ], ConfigurationCCDefaultReset);
2383
+ };
2384
+ return ConfigurationCCPropertiesGet2 = _classThis;
2385
+ })();
2386
+ let ConfigurationCCDefaultReset = (() => {
2387
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.ConfigurationCommand.DefaultReset)];
2388
+ let _classDescriptor;
2389
+ let _classExtraInitializers = [];
2390
+ let _classThis;
2391
+ let _classSuper = ConfigurationCC;
2392
+ var ConfigurationCCDefaultReset2 = class extends _classSuper {
2393
+ static {
2394
+ _classThis = this;
2395
+ }
2396
+ static {
2397
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
2398
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2399
+ ConfigurationCCDefaultReset2 = _classThis = _classDescriptor.value;
2400
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
2401
+ __runInitializers(_classThis, _classExtraInitializers);
2402
+ }
2403
+ };
2404
+ return ConfigurationCCDefaultReset2 = _classThis;
2405
+ })();
2159
2406
  function isSafeValue(value, size, format) {
2160
2407
  let minValue;
2161
2408
  let maxValue;