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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. package/build/cjs/cc/AlarmSensorCC.js +381 -266
  2. package/build/cjs/cc/AlarmSensorCC.js.map +3 -3
  3. package/build/cjs/cc/AssociationCC.js +669 -503
  4. package/build/cjs/cc/AssociationCC.js.map +3 -3
  5. package/build/cjs/cc/AssociationGroupInfoCC.js +633 -492
  6. package/build/cjs/cc/AssociationGroupInfoCC.js.map +3 -3
  7. package/build/cjs/cc/BarrierOperatorCC.js +595 -429
  8. package/build/cjs/cc/BarrierOperatorCC.js.map +3 -3
  9. package/build/cjs/cc/BasicCC.js +354 -260
  10. package/build/cjs/cc/BasicCC.js.map +3 -3
  11. package/build/cjs/cc/BatteryCC.js +427 -345
  12. package/build/cjs/cc/BatteryCC.js.map +3 -3
  13. package/build/cjs/cc/BinarySensorCC.js +391 -276
  14. package/build/cjs/cc/BinarySensorCC.js.map +3 -3
  15. package/build/cjs/cc/BinarySwitchCC.js +347 -253
  16. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  17. package/build/cjs/cc/CRC16CC.js +160 -85
  18. package/build/cjs/cc/CRC16CC.js.map +3 -3
  19. package/build/cjs/cc/CentralSceneCC.js +459 -324
  20. package/build/cjs/cc/CentralSceneCC.js.map +3 -3
  21. package/build/cjs/cc/ClimateControlScheduleCC.js +459 -293
  22. package/build/cjs/cc/ClimateControlScheduleCC.js.map +3 -3
  23. package/build/cjs/cc/ClockCC.js +254 -150
  24. package/build/cjs/cc/ClockCC.js.map +3 -3
  25. package/build/cjs/cc/ColorSwitchCC.js +758 -610
  26. package/build/cjs/cc/ColorSwitchCC.js.map +3 -3
  27. package/build/cjs/cc/ConfigurationCC.js +1700 -1453
  28. package/build/cjs/cc/ConfigurationCC.js.map +3 -3
  29. package/build/cjs/cc/DeviceResetLocallyCC.js +125 -49
  30. package/build/cjs/cc/DeviceResetLocallyCC.js.map +3 -3
  31. package/build/cjs/cc/DoorLockCC.js +904 -777
  32. package/build/cjs/cc/DoorLockCC.js.map +3 -3
  33. package/build/cjs/cc/DoorLockLoggingCC.js +321 -206
  34. package/build/cjs/cc/DoorLockLoggingCC.js.map +3 -3
  35. package/build/cjs/cc/EnergyProductionCC.js +249 -160
  36. package/build/cjs/cc/EnergyProductionCC.js.map +3 -3
  37. package/build/cjs/cc/EntryControlCC.js +619 -458
  38. package/build/cjs/cc/EntryControlCC.js.map +3 -3
  39. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +898 -698
  40. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +3 -3
  41. package/build/cjs/cc/HailCC.js +57 -11
  42. package/build/cjs/cc/HailCC.js.map +2 -2
  43. package/build/cjs/cc/HumidityControlModeCC.js +359 -233
  44. package/build/cjs/cc/HumidityControlModeCC.js.map +3 -3
  45. package/build/cjs/cc/HumidityControlOperatingStateCC.js +189 -103
  46. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +3 -3
  47. package/build/cjs/cc/HumidityControlSetpointCC.js +682 -495
  48. package/build/cjs/cc/HumidityControlSetpointCC.js.map +3 -3
  49. package/build/cjs/cc/InclusionControllerCC.js +205 -114
  50. package/build/cjs/cc/InclusionControllerCC.js.map +3 -3
  51. package/build/cjs/cc/IndicatorCC.js +897 -736
  52. package/build/cjs/cc/IndicatorCC.js.map +3 -3
  53. package/build/cjs/cc/IrrigationCC.js +1651 -1405
  54. package/build/cjs/cc/IrrigationCC.js.map +3 -3
  55. package/build/cjs/cc/LanguageCC.js +268 -171
  56. package/build/cjs/cc/LanguageCC.js.map +3 -3
  57. package/build/cjs/cc/LockCC.js +254 -154
  58. package/build/cjs/cc/LockCC.js.map +3 -3
  59. package/build/cjs/cc/ManufacturerProprietaryCC.js +189 -129
  60. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  61. package/build/cjs/cc/ManufacturerSpecificCC.js +319 -213
  62. package/build/cjs/cc/ManufacturerSpecificCC.js.map +3 -3
  63. package/build/cjs/cc/MeterCC.js +827 -707
  64. package/build/cjs/cc/MeterCC.js.map +3 -3
  65. package/build/cjs/cc/MultiChannelAssociationCC.js +612 -478
  66. package/build/cjs/cc/MultiChannelAssociationCC.js.map +3 -3
  67. package/build/cjs/cc/MultiChannelCC.js +1037 -819
  68. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  69. package/build/cjs/cc/MultiCommandCC.js +172 -97
  70. package/build/cjs/cc/MultiCommandCC.js.map +3 -3
  71. package/build/cjs/cc/MultilevelSensorCC.js +589 -449
  72. package/build/cjs/cc/MultilevelSensorCC.js.map +3 -3
  73. package/build/cjs/cc/MultilevelSwitchCC.js +587 -439
  74. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  75. package/build/cjs/cc/NoOperationCC.js +89 -27
  76. package/build/cjs/cc/NoOperationCC.js.map +2 -2
  77. package/build/cjs/cc/NodeNamingCC.js +417 -277
  78. package/build/cjs/cc/NodeNamingCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +972 -818
  80. package/build/cjs/cc/NotificationCC.js.map +3 -3
  81. package/build/cjs/cc/PowerlevelCC.js +450 -303
  82. package/build/cjs/cc/PowerlevelCC.js.map +3 -3
  83. package/build/cjs/cc/ProtectionCC.js +686 -494
  84. package/build/cjs/cc/ProtectionCC.js.map +3 -3
  85. package/build/cjs/cc/SceneActivationCC.js +165 -97
  86. package/build/cjs/cc/SceneActivationCC.js.map +3 -3
  87. package/build/cjs/cc/SceneActuatorConfigurationCC.js +346 -243
  88. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +3 -3
  89. package/build/cjs/cc/SceneControllerConfigurationCC.js +401 -298
  90. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +3 -3
  91. package/build/cjs/cc/ScheduleEntryLockCC.js +1552 -1272
  92. package/build/cjs/cc/ScheduleEntryLockCC.js.map +3 -3
  93. package/build/cjs/cc/Security2CC.js +1483 -1219
  94. package/build/cjs/cc/Security2CC.js.map +3 -3
  95. package/build/cjs/cc/SecurityCC.js +839 -619
  96. package/build/cjs/cc/SecurityCC.js.map +3 -3
  97. package/build/cjs/cc/SoundSwitchCC.js +707 -515
  98. package/build/cjs/cc/SoundSwitchCC.js.map +3 -3
  99. package/build/cjs/cc/SupervisionCC.js +327 -237
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.js +386 -263
  102. package/build/cjs/cc/ThermostatFanModeCC.js.map +3 -3
  103. package/build/cjs/cc/ThermostatFanStateCC.js +192 -106
  104. package/build/cjs/cc/ThermostatFanStateCC.js.map +3 -3
  105. package/build/cjs/cc/ThermostatModeCC.js +425 -302
  106. package/build/cjs/cc/ThermostatModeCC.js.map +3 -3
  107. package/build/cjs/cc/ThermostatOperatingStateCC.js +188 -102
  108. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +3 -3
  109. package/build/cjs/cc/ThermostatSetbackCC.js +277 -173
  110. package/build/cjs/cc/ThermostatSetbackCC.js.map +3 -3
  111. package/build/cjs/cc/ThermostatSetpointCC.js +645 -491
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.js +515 -353
  114. package/build/cjs/cc/TimeCC.js.map +3 -3
  115. package/build/cjs/cc/TimeParametersCC.js +302 -202
  116. package/build/cjs/cc/TimeParametersCC.js.map +3 -3
  117. package/build/cjs/cc/TransportServiceCC.js +433 -315
  118. package/build/cjs/cc/TransportServiceCC.js.map +3 -3
  119. package/build/cjs/cc/UserCodeCC.js +1385 -1102
  120. package/build/cjs/cc/UserCodeCC.js.map +3 -3
  121. package/build/cjs/cc/VersionCC.js +696 -562
  122. package/build/cjs/cc/VersionCC.js.map +3 -3
  123. package/build/cjs/cc/WakeUpCC.js +499 -346
  124. package/build/cjs/cc/WakeUpCC.js.map +3 -3
  125. package/build/cjs/cc/WindowCoveringCC.js +626 -478
  126. package/build/cjs/cc/WindowCoveringCC.js.map +3 -3
  127. package/build/cjs/cc/ZWaveLongRangeCC.js +57 -10
  128. package/build/cjs/cc/ZWaveLongRangeCC.js.map +2 -2
  129. package/build/cjs/cc/ZWavePlusCC.js +233 -159
  130. package/build/cjs/cc/ZWavePlusCC.js.map +3 -3
  131. package/build/cjs/cc/ZWaveProtocolCC.js +1515 -948
  132. package/build/cjs/cc/ZWaveProtocolCC.js.map +3 -3
  133. package/build/cjs/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  134. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +1 -1
  135. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +395 -274
  136. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +3 -3
  137. package/build/cjs/lib/CommandClassDecorators.d.ts +11 -15
  138. package/build/cjs/lib/CommandClassDecorators.js +19 -20
  139. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  140. package/build/cjs/lib/Security2/Extension.d.ts +1 -1
  141. package/build/cjs/lib/Security2/Extension.js +217 -126
  142. package/build/cjs/lib/Security2/Extension.js.map +3 -3
  143. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  144. package/build/esm/cc/AlarmSensorCC.js +389 -291
  145. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  146. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  147. package/build/esm/cc/AssociationCC.js +678 -537
  148. package/build/esm/cc/AssociationCC.js.map +1 -1
  149. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  150. package/build/esm/cc/AssociationGroupInfoCC.js +659 -539
  151. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  152. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  153. package/build/esm/cc/BarrierOperatorCC.js +634 -493
  154. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  155. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  156. package/build/esm/cc/BasicCC.js +380 -302
  157. package/build/esm/cc/BasicCC.js.map +1 -1
  158. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  159. package/build/esm/cc/BatteryCC.js +449 -384
  160. package/build/esm/cc/BatteryCC.js.map +1 -1
  161. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/BinarySensorCC.js +395 -297
  163. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  164. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  165. package/build/esm/cc/BinarySwitchCC.js +353 -274
  166. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  167. package/build/esm/cc/CRC16CC.js +162 -98
  168. package/build/esm/cc/CRC16CC.js.map +1 -1
  169. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  170. package/build/esm/cc/CentralSceneCC.js +465 -351
  171. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  172. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  173. package/build/esm/cc/ClimateControlScheduleCC.js +454 -313
  174. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  175. package/build/esm/cc/ClockCC.js +248 -159
  176. package/build/esm/cc/ClockCC.js.map +1 -1
  177. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  178. package/build/esm/cc/ColorSwitchCC.js +802 -677
  179. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  180. package/build/esm/cc/ConfigurationCC.js +1899 -1687
  181. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  182. package/build/esm/cc/DeviceResetLocallyCC.js +124 -59
  183. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  184. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  185. package/build/esm/cc/DoorLockCC.js +951 -849
  186. package/build/esm/cc/DoorLockCC.js.map +1 -1
  187. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  188. package/build/esm/cc/DoorLockLoggingCC.js +316 -218
  189. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  190. package/build/esm/cc/EnergyProductionCC.js +240 -164
  191. package/build/esm/cc/EnergyProductionCC.js.map +1 -1
  192. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  193. package/build/esm/cc/EntryControlCC.js +629 -493
  194. package/build/esm/cc/EntryControlCC.js.map +1 -1
  195. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  196. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +938 -769
  197. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  198. package/build/esm/cc/HailCC.js +51 -12
  199. package/build/esm/cc/HailCC.js.map +1 -1
  200. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  201. package/build/esm/cc/HumidityControlModeCC.js +357 -250
  202. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  203. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  204. package/build/esm/cc/HumidityControlOperatingStateCC.js +182 -109
  205. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  206. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  207. package/build/esm/cc/HumidityControlSetpointCC.js +706 -546
  208. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  209. package/build/esm/cc/InclusionControllerCC.js +197 -119
  210. package/build/esm/cc/InclusionControllerCC.js.map +1 -1
  211. package/build/esm/cc/IndicatorCC.js +973 -835
  212. package/build/esm/cc/IndicatorCC.js.map +1 -1
  213. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  214. package/build/esm/cc/IrrigationCC.js +1697 -1496
  215. package/build/esm/cc/IrrigationCC.js.map +1 -1
  216. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  217. package/build/esm/cc/LanguageCC.js +266 -184
  218. package/build/esm/cc/LanguageCC.js.map +1 -1
  219. package/build/esm/cc/LockCC.d.ts.map +1 -1
  220. package/build/esm/cc/LockCC.js +247 -162
  221. package/build/esm/cc/LockCC.js.map +1 -1
  222. package/build/esm/cc/ManufacturerProprietaryCC.js +192 -141
  223. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  224. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  225. package/build/esm/cc/ManufacturerSpecificCC.js +312 -223
  226. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  227. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  228. package/build/esm/cc/MeterCC.js +896 -795
  229. package/build/esm/cc/MeterCC.js.map +1 -1
  230. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  231. package/build/esm/cc/MultiChannelAssociationCC.js +631 -518
  232. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  233. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  234. package/build/esm/cc/MultiChannelCC.js +1106 -921
  235. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  236. package/build/esm/cc/MultiCommandCC.js +166 -102
  237. package/build/esm/cc/MultiCommandCC.js.map +1 -1
  238. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  239. package/build/esm/cc/MultilevelSensorCC.js +616 -497
  240. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  241. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  242. package/build/esm/cc/MultilevelSwitchCC.js +621 -496
  243. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  244. package/build/esm/cc/NoOperationCC.js +82 -29
  245. package/build/esm/cc/NoOperationCC.js.map +1 -1
  246. package/build/esm/cc/NodeNamingCC.d.ts.map +1 -1
  247. package/build/esm/cc/NodeNamingCC.js +413 -294
  248. package/build/esm/cc/NodeNamingCC.js.map +1 -1
  249. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  250. package/build/esm/cc/NotificationCC.js +1097 -966
  251. package/build/esm/cc/NotificationCC.js.map +1 -1
  252. package/build/esm/cc/PowerlevelCC.js +437 -311
  253. package/build/esm/cc/PowerlevelCC.js.map +1 -1
  254. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  255. package/build/esm/cc/ProtectionCC.js +704 -543
  256. package/build/esm/cc/ProtectionCC.js.map +1 -1
  257. package/build/esm/cc/SceneActivationCC.d.ts.map +1 -1
  258. package/build/esm/cc/SceneActivationCC.js +157 -100
  259. package/build/esm/cc/SceneActivationCC.js.map +1 -1
  260. package/build/esm/cc/SceneActuatorConfigurationCC.js +357 -269
  261. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  262. package/build/esm/cc/SceneControllerConfigurationCC.js +434 -346
  263. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  264. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  265. package/build/esm/cc/ScheduleEntryLockCC.js +1596 -1357
  266. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  267. package/build/esm/cc/Security2CC.js +1633 -1406
  268. package/build/esm/cc/Security2CC.js.map +1 -1
  269. package/build/esm/cc/SecurityCC.js +876 -687
  270. package/build/esm/cc/SecurityCC.js.map +1 -1
  271. package/build/esm/cc/SoundSwitchCC.d.ts.map +1 -1
  272. package/build/esm/cc/SoundSwitchCC.js +689 -526
  273. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  274. package/build/esm/cc/SupervisionCC.js +349 -272
  275. package/build/esm/cc/SupervisionCC.js.map +1 -1
  276. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  277. package/build/esm/cc/ThermostatFanModeCC.js +388 -284
  278. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  279. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  280. package/build/esm/cc/ThermostatFanStateCC.js +184 -111
  281. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  282. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  283. package/build/esm/cc/ThermostatModeCC.js +435 -331
  284. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  285. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  286. package/build/esm/cc/ThermostatOperatingStateCC.js +180 -107
  287. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  288. package/build/esm/cc/ThermostatSetbackCC.js +274 -185
  289. package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
  290. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  291. package/build/esm/cc/ThermostatSetpointCC.js +674 -543
  292. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  293. package/build/esm/cc/TimeCC.js +499 -360
  294. package/build/esm/cc/TimeCC.js.map +1 -1
  295. package/build/esm/cc/TimeParametersCC.d.ts.map +1 -1
  296. package/build/esm/cc/TimeParametersCC.js +296 -211
  297. package/build/esm/cc/TimeParametersCC.js.map +1 -1
  298. package/build/esm/cc/TransportServiceCC.js +464 -363
  299. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  300. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  301. package/build/esm/cc/UserCodeCC.js +1443 -1205
  302. package/build/esm/cc/UserCodeCC.js.map +1 -1
  303. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  304. package/build/esm/cc/VersionCC.js +744 -635
  305. package/build/esm/cc/VersionCC.js.map +1 -1
  306. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  307. package/build/esm/cc/WakeUpCC.js +494 -364
  308. package/build/esm/cc/WakeUpCC.js.map +1 -1
  309. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  310. package/build/esm/cc/WindowCoveringCC.js +655 -530
  311. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  312. package/build/esm/cc/ZWaveLongRangeCC.js +51 -11
  313. package/build/esm/cc/ZWaveLongRangeCC.js.map +1 -1
  314. package/build/esm/cc/ZWavePlusCC.d.ts.map +1 -1
  315. package/build/esm/cc/ZWavePlusCC.js +223 -162
  316. package/build/esm/cc/ZWavePlusCC.js.map +1 -1
  317. package/build/esm/cc/ZWaveProtocolCC.js +1443 -953
  318. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  319. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts +4 -4
  320. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  321. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +390 -286
  322. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  323. package/build/esm/lib/CommandClassDecorators.d.ts +11 -15
  324. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  325. package/build/esm/lib/CommandClassDecorators.js +24 -24
  326. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  327. package/build/esm/lib/Security2/Extension.d.ts +1 -1
  328. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  329. package/build/esm/lib/Security2/Extension.js +207 -123
  330. package/build/esm/lib/Security2/Extension.js.map +1 -1
  331. package/package.json +6 -6
@@ -56,13 +56,45 @@ var import_Values = require("../lib/Values.js");
56
56
  var import_Types = require("../lib/_Types.js");
57
57
  var ccUtils = __toESM(require("../lib/utils.js"), 1);
58
58
  var import_AssociationGroupInfoCC = require("./AssociationGroupInfoCC.js");
59
- var __decorate = function(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- 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;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
59
+ var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
60
+ function accept(f) {
61
+ if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
62
+ return f;
63
+ }
64
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
65
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
66
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
67
+ var _, done = false;
68
+ for (var i = decorators.length - 1; i >= 0; i--) {
69
+ var context = {};
70
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
71
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
72
+ context.addInitializer = function(f) {
73
+ if (done) throw new TypeError("Cannot add initializers after decoration has completed");
74
+ extraInitializers.push(accept(f || null));
75
+ };
76
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
77
+ if (kind === "accessor") {
78
+ if (result === void 0) continue;
79
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
80
+ if (_ = accept(result.get)) descriptor.get = _;
81
+ if (_ = accept(result.set)) descriptor.set = _;
82
+ if (_ = accept(result.init)) initializers.unshift(_);
83
+ } else if (_ = accept(result)) {
84
+ if (kind === "field") initializers.unshift(_);
85
+ else descriptor[key] = _;
86
+ }
87
+ }
88
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
89
+ done = true;
90
+ };
91
+ var __runInitializers = function(thisArg, initializers, value) {
92
+ var useValue = arguments.length > 2;
93
+ for (var i = 0; i < initializers.length; i++) {
94
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
95
+ }
96
+ return useValue ? value : void 0;
64
97
  };
65
- var NotificationCC_1, NotificationCCSet_1, NotificationCCReport_1, NotificationCCGet_1, NotificationCCSupportedReport_1, NotificationCCEventSupportedReport_1, NotificationCCEventSupportedGet_1;
66
98
  function __assertType(argName, typeName, boundHasError) {
67
99
  const { ZWaveError: ZWaveError2, ZWaveErrorCodes: ZWaveErrorCodes2 } = require("@zwave-js/core");
68
100
  if (boundHasError()) {
@@ -276,115 +308,130 @@ function shouldAutoCreateSimpleDoorSensorValue(ctx, endpoint) {
276
308
  23
277
309
  );
278
310
  }
279
- let NotificationCCAPI = class NotificationCCAPI2 extends import_API.PhysicalCCAPI {
280
- supportsCommand(cmd) {
281
- switch (cmd) {
282
- case import_Types.NotificationCommand.Report:
283
- case import_Types.NotificationCommand.Get:
284
- return true;
285
- // These exist starting with V1
286
- case import_Types.NotificationCommand.Set:
287
- case import_Types.NotificationCommand.SupportedGet:
288
- return this.version >= 2;
289
- case import_Types.NotificationCommand.EventSupportedGet:
290
- return this.version >= 3;
291
- }
292
- return super.supportsCommand(cmd);
293
- }
294
- get [import_API.POLL_VALUE]() {
295
- return async function({ property, propertyKey }) {
296
- const valueId = {
297
- commandClass: this.ccId,
298
- endpoint: this.endpoint.index,
299
- property,
300
- propertyKey
301
- };
302
- if (NotificationCCValues.notificationVariable.is(valueId)) {
303
- const notificationType = this.tryGetValueDB()?.getMetadata(valueId)?.ccSpecific?.notificationType;
304
- if (notificationType != void 0) {
305
- return this.getInternal({ notificationType });
311
+ let NotificationCCAPI = (() => {
312
+ let _classDecorators = [(0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Notification)];
313
+ let _classDescriptor;
314
+ let _classExtraInitializers = [];
315
+ let _classThis;
316
+ let _classSuper = import_API.PhysicalCCAPI;
317
+ var NotificationCCAPI2 = class extends _classSuper {
318
+ static {
319
+ _classThis = this;
320
+ }
321
+ static {
322
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
323
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
324
+ NotificationCCAPI2 = _classThis = _classDescriptor.value;
325
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
326
+ __runInitializers(_classThis, _classExtraInitializers);
327
+ }
328
+ supportsCommand(cmd) {
329
+ switch (cmd) {
330
+ case import_Types.NotificationCommand.Report:
331
+ case import_Types.NotificationCommand.Get:
332
+ return true;
333
+ // These exist starting with V1
334
+ case import_Types.NotificationCommand.Set:
335
+ case import_Types.NotificationCommand.SupportedGet:
336
+ return this.version >= 2;
337
+ case import_Types.NotificationCommand.EventSupportedGet:
338
+ return this.version >= 3;
339
+ }
340
+ return super.supportsCommand(cmd);
341
+ }
342
+ get [import_API.POLL_VALUE]() {
343
+ return async function({ property, propertyKey }) {
344
+ const valueId = {
345
+ commandClass: this.ccId,
346
+ endpoint: this.endpoint.index,
347
+ property,
348
+ propertyKey
349
+ };
350
+ if (NotificationCCValues.notificationVariable.is(valueId)) {
351
+ const notificationType = this.tryGetValueDB()?.getMetadata(valueId)?.ccSpecific?.notificationType;
352
+ if (notificationType != void 0) {
353
+ return this.getInternal({ notificationType });
354
+ }
306
355
  }
356
+ (0, import_API.throwUnsupportedProperty)(this.ccId, property);
357
+ };
358
+ }
359
+ /**
360
+ * @internal
361
+ */
362
+ async getInternal(options) {
363
+ this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Get);
364
+ const cc = new NotificationCCGet({
365
+ nodeId: this.endpoint.nodeId,
366
+ endpointIndex: this.endpoint.index,
367
+ ...options
368
+ });
369
+ return this.host.sendCommand(cc, this.commandOptions);
370
+ }
371
+ async sendReport(options) {
372
+ __assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
373
+ this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Report);
374
+ const cc = new NotificationCCReport({
375
+ nodeId: this.endpoint.nodeId,
376
+ endpointIndex: this.endpoint.index,
377
+ ...options
378
+ });
379
+ return this.host.sendCommand(cc, this.commandOptions);
380
+ }
381
+ async get(options) {
382
+ __assertType("options", "NotificationCCGetOptions", __assertType__NotificationCCGetOptions.bind(void 0, options));
383
+ const response = await this.getInternal(options);
384
+ if (response) {
385
+ return (0, import_safe3.pick)(response, [
386
+ "notificationStatus",
387
+ "notificationEvent",
388
+ "alarmLevel",
389
+ "eventParameters",
390
+ "sequenceNumber"
391
+ ]);
307
392
  }
308
- (0, import_API.throwUnsupportedProperty)(this.ccId, property);
309
- };
310
- }
311
- /**
312
- * @internal
313
- */
314
- async getInternal(options) {
315
- this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Get);
316
- const cc = new NotificationCCGet({
317
- nodeId: this.endpoint.nodeId,
318
- endpointIndex: this.endpoint.index,
319
- ...options
320
- });
321
- return this.host.sendCommand(cc, this.commandOptions);
322
- }
323
- async sendReport(options) {
324
- __assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
325
- this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Report);
326
- const cc = new NotificationCCReport({
327
- nodeId: this.endpoint.nodeId,
328
- endpointIndex: this.endpoint.index,
329
- ...options
330
- });
331
- return this.host.sendCommand(cc, this.commandOptions);
332
- }
333
- async get(options) {
334
- __assertType("options", "NotificationCCGetOptions", __assertType__NotificationCCGetOptions.bind(void 0, options));
335
- const response = await this.getInternal(options);
336
- if (response) {
337
- return (0, import_safe3.pick)(response, [
338
- "notificationStatus",
339
- "notificationEvent",
340
- "alarmLevel",
341
- "eventParameters",
342
- "sequenceNumber"
343
- ]);
344
393
  }
345
- }
346
- async set(notificationType, notificationStatus) {
347
- __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
348
- __assertType("notificationStatus", "boolean", __assertType__boolean.bind(void 0, notificationStatus));
349
- this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Set);
350
- const cc = new NotificationCCSet({
351
- nodeId: this.endpoint.nodeId,
352
- endpointIndex: this.endpoint.index,
353
- notificationType,
354
- notificationStatus
355
- });
356
- return this.host.sendCommand(cc, this.commandOptions);
357
- }
358
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
359
- async getSupported() {
360
- this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.SupportedGet);
361
- const cc = new NotificationCCSupportedGet({
362
- nodeId: this.endpoint.nodeId,
363
- endpointIndex: this.endpoint.index
364
- });
365
- const response = await this.host.sendCommand(cc, this.commandOptions);
366
- if (response) {
367
- return (0, import_safe3.pick)(response, [
368
- "supportsV1Alarm",
369
- "supportedNotificationTypes"
370
- ]);
394
+ async set(notificationType, notificationStatus) {
395
+ __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
396
+ __assertType("notificationStatus", "boolean", __assertType__boolean.bind(void 0, notificationStatus));
397
+ this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.Set);
398
+ const cc = new NotificationCCSet({
399
+ nodeId: this.endpoint.nodeId,
400
+ endpointIndex: this.endpoint.index,
401
+ notificationType,
402
+ notificationStatus
403
+ });
404
+ return this.host.sendCommand(cc, this.commandOptions);
371
405
  }
372
- }
373
- async getSupportedEvents(notificationType) {
374
- __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
375
- this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.EventSupportedGet);
376
- const cc = new NotificationCCEventSupportedGet({
377
- nodeId: this.endpoint.nodeId,
378
- endpointIndex: this.endpoint.index,
379
- notificationType
380
- });
381
- const response = await this.host.sendCommand(cc, this.commandOptions);
382
- return response?.supportedEvents;
383
- }
384
- };
385
- NotificationCCAPI = __decorate([
386
- (0, import_CommandClassDecorators.API)(import_safe.CommandClasses.Notification)
387
- ], NotificationCCAPI);
406
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
407
+ async getSupported() {
408
+ this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.SupportedGet);
409
+ const cc = new NotificationCCSupportedGet({
410
+ nodeId: this.endpoint.nodeId,
411
+ endpointIndex: this.endpoint.index
412
+ });
413
+ const response = await this.host.sendCommand(cc, this.commandOptions);
414
+ if (response) {
415
+ return (0, import_safe3.pick)(response, [
416
+ "supportsV1Alarm",
417
+ "supportedNotificationTypes"
418
+ ]);
419
+ }
420
+ }
421
+ async getSupportedEvents(notificationType) {
422
+ __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
423
+ this.assertSupportsCommand(import_Types.NotificationCommand, import_Types.NotificationCommand.EventSupportedGet);
424
+ const cc = new NotificationCCEventSupportedGet({
425
+ nodeId: this.endpoint.nodeId,
426
+ endpointIndex: this.endpoint.index,
427
+ notificationType
428
+ });
429
+ const response = await this.host.sendCommand(cc, this.commandOptions);
430
+ return response?.supportedEvents;
431
+ }
432
+ };
433
+ return NotificationCCAPI2 = _classThis;
434
+ })();
388
435
  function getNotificationEnumBehavior(notification, valueConfig) {
389
436
  const variable = notification.variables.find((v) => v.states.has(valueConfig.value));
390
437
  if (!variable)
@@ -425,807 +472,914 @@ function getNotificationValueMetadata(previous, notification, valueConfig) {
425
472
  }
426
473
  return metadata;
427
474
  }
428
- let NotificationCC = NotificationCC_1 = class NotificationCC2 extends import_CommandClass.CommandClass {
429
- // former AlarmCC (v1..v2)
430
- determineRequiredCCInterviews() {
431
- return [
432
- ...super.determineRequiredCCInterviews(),
433
- import_safe.CommandClasses.Association,
434
- import_safe.CommandClasses["Multi Channel Association"],
435
- import_safe.CommandClasses["Association Group Information"]
436
- ];
437
- }
438
- async determineNotificationMode(ctx, api, supportedNotificationEvents) {
439
- const node = this.getNode(ctx);
440
- if (!node.supportsCC(import_safe.CommandClasses.Association))
441
- return "pull";
442
- if (node.supportsCC(import_safe.CommandClasses["Association Group Information"])) {
443
- try {
444
- const groupsIssueingNotifications = import_AssociationGroupInfoCC.AssociationGroupInfoCC.findGroupsForIssuedCommand(ctx, node, this.ccId, import_Types.NotificationCommand.Report);
445
- return groupsIssueingNotifications.length > 0 ? "push" : "pull";
446
- } catch {
447
- }
475
+ let NotificationCC = (() => {
476
+ let _classDecorators = [(0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Notification), (0, import_CommandClassDecorators.implementedVersion)(8), (0, import_CommandClassDecorators.ccValues)(NotificationCCValues)];
477
+ let _classDescriptor;
478
+ let _classExtraInitializers = [];
479
+ let _classThis;
480
+ let _classSuper = import_CommandClass.CommandClass;
481
+ var NotificationCC2 = class extends _classSuper {
482
+ static {
483
+ _classThis = this;
448
484
  }
449
- ctx.logNode(node.id, {
450
- endpoint: this.endpointIndex,
451
- message: `determining whether this node is pull or push...`,
452
- direction: "outbound"
453
- });
454
- for (const [type, events] of supportedNotificationEvents) {
455
- if (events.length === 0)
456
- continue;
457
- await api.set(type, true);
458
- try {
459
- const resp = await api.get({
460
- notificationType: type,
461
- notificationEvent: events[0]
462
- });
463
- switch (resp?.notificationStatus) {
464
- case 255:
465
- return "push";
466
- case 254:
467
- case 0:
468
- return "pull";
485
+ static {
486
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
487
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
488
+ NotificationCC2 = _classThis = _classDescriptor.value;
489
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
490
+ __runInitializers(_classThis, _classExtraInitializers);
491
+ }
492
+ // former AlarmCC (v1..v2)
493
+ determineRequiredCCInterviews() {
494
+ return [
495
+ ...super.determineRequiredCCInterviews(),
496
+ import_safe.CommandClasses.Association,
497
+ import_safe.CommandClasses["Multi Channel Association"],
498
+ import_safe.CommandClasses["Association Group Information"]
499
+ ];
500
+ }
501
+ async determineNotificationMode(ctx, api, supportedNotificationEvents) {
502
+ const node = this.getNode(ctx);
503
+ if (!node.supportsCC(import_safe.CommandClasses.Association))
504
+ return "pull";
505
+ if (node.supportsCC(import_safe.CommandClasses["Association Group Information"])) {
506
+ try {
507
+ const groupsIssueingNotifications = import_AssociationGroupInfoCC.AssociationGroupInfoCC.findGroupsForIssuedCommand(ctx, node, this.ccId, import_Types.NotificationCommand.Report);
508
+ return groupsIssueingNotifications.length > 0 ? "push" : "pull";
509
+ } catch {
469
510
  }
470
- } catch {
471
511
  }
472
- }
473
- return "push";
474
- }
475
- /** Whether the node implements push or pull notifications */
476
- static getNotificationMode(ctx, node) {
477
- return ctx.getValueDB(node.id).getValue(NotificationCCValues.notificationMode.id);
478
- }
479
- async interview(ctx) {
480
- const node = this.getNode(ctx);
481
- const endpoint = this.getEndpoint(ctx);
482
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Notification, ctx, endpoint).withOptions({
483
- priority: import_safe.MessagePriority.NodeQuery
484
- });
485
- ctx.logNode(node.id, {
486
- endpoint: this.endpointIndex,
487
- message: `Interviewing ${this.ccName}...`,
488
- direction: "none"
489
- });
490
- try {
491
- await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, import_Types.NotificationCommand.Report);
492
- } catch {
493
512
  ctx.logNode(node.id, {
494
- endpoint: endpoint.index,
495
- message: `Configuring associations to receive ${(0, import_safe.getCCName)(this.ccId)} reports failed!`,
496
- level: "warn"
513
+ endpoint: this.endpointIndex,
514
+ message: `determining whether this node is pull or push...`,
515
+ direction: "outbound"
497
516
  });
517
+ for (const [type, events] of supportedNotificationEvents) {
518
+ if (events.length === 0)
519
+ continue;
520
+ await api.set(type, true);
521
+ try {
522
+ const resp = await api.get({
523
+ notificationType: type,
524
+ notificationEvent: events[0]
525
+ });
526
+ switch (resp?.notificationStatus) {
527
+ case 255:
528
+ return "push";
529
+ case 254:
530
+ case 0:
531
+ return "pull";
532
+ }
533
+ } catch {
534
+ }
535
+ }
536
+ return "push";
498
537
  }
499
- let supportsV1Alarm = false;
500
- if (api.version >= 2) {
538
+ /** Whether the node implements push or pull notifications */
539
+ static getNotificationMode(ctx, node) {
540
+ return ctx.getValueDB(node.id).getValue(NotificationCCValues.notificationMode.id);
541
+ }
542
+ async interview(ctx) {
543
+ const node = this.getNode(ctx);
544
+ const endpoint = this.getEndpoint(ctx);
545
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Notification, ctx, endpoint).withOptions({
546
+ priority: import_safe.MessagePriority.NodeQuery
547
+ });
501
548
  ctx.logNode(node.id, {
502
549
  endpoint: this.endpointIndex,
503
- message: "querying supported notification types...",
504
- direction: "outbound"
550
+ message: `Interviewing ${this.ccName}...`,
551
+ direction: "none"
505
552
  });
506
- const suppResponse = await api.getSupported();
507
- if (!suppResponse) {
553
+ try {
554
+ await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, import_Types.NotificationCommand.Report);
555
+ } catch {
508
556
  ctx.logNode(node.id, {
509
- endpoint: this.endpointIndex,
510
- message: "Querying supported notification types timed out, skipping interview...",
557
+ endpoint: endpoint.index,
558
+ message: `Configuring associations to receive ${(0, import_safe.getCCName)(this.ccId)} reports failed!`,
511
559
  level: "warn"
512
560
  });
513
- return;
514
561
  }
515
- supportsV1Alarm = suppResponse.supportsV1Alarm;
516
- const supportedNotificationTypes = suppResponse.supportedNotificationTypes;
517
- const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
518
- const supportedNotificationEvents = /* @__PURE__ */ new Map();
519
- const logMessage = `received supported notification types:${supportedNotificationNames.map((name) => `
520
- \xB7 ${name}`).join("")}`;
521
- ctx.logNode(node.id, {
522
- endpoint: this.endpointIndex,
523
- message: logMessage,
524
- direction: "inbound"
525
- });
526
- if (api.version >= 3) {
527
- for (let i = 0; i < supportedNotificationTypes.length; i++) {
528
- const type = supportedNotificationTypes[i];
529
- const name = supportedNotificationNames[i];
562
+ let supportsV1Alarm = false;
563
+ if (api.version >= 2) {
564
+ ctx.logNode(node.id, {
565
+ endpoint: this.endpointIndex,
566
+ message: "querying supported notification types...",
567
+ direction: "outbound"
568
+ });
569
+ const suppResponse = await api.getSupported();
570
+ if (!suppResponse) {
530
571
  ctx.logNode(node.id, {
531
572
  endpoint: this.endpointIndex,
532
- message: `querying supported notification events for ${name}...`,
533
- direction: "outbound"
573
+ message: "Querying supported notification types timed out, skipping interview...",
574
+ level: "warn"
534
575
  });
535
- const supportedEvents = await api.getSupportedEvents(type);
536
- if (supportedEvents) {
537
- supportedNotificationEvents.set(type, supportedEvents);
576
+ return;
577
+ }
578
+ supportsV1Alarm = suppResponse.supportsV1Alarm;
579
+ const supportedNotificationTypes = suppResponse.supportedNotificationTypes;
580
+ const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
581
+ const supportedNotificationEvents = /* @__PURE__ */ new Map();
582
+ const logMessage = `received supported notification types:${supportedNotificationNames.map((name) => `
583
+ \xB7 ${name}`).join("")}`;
584
+ ctx.logNode(node.id, {
585
+ endpoint: this.endpointIndex,
586
+ message: logMessage,
587
+ direction: "inbound"
588
+ });
589
+ if (api.version >= 3) {
590
+ for (let i = 0; i < supportedNotificationTypes.length; i++) {
591
+ const type = supportedNotificationTypes[i];
592
+ const name = supportedNotificationNames[i];
538
593
  ctx.logNode(node.id, {
539
594
  endpoint: this.endpointIndex,
540
- message: `received supported notification events for ${name}: ${supportedEvents.map(String).join(", ")}`,
541
- direction: "inbound"
595
+ message: `querying supported notification events for ${name}...`,
596
+ direction: "outbound"
542
597
  });
598
+ const supportedEvents = await api.getSupportedEvents(type);
599
+ if (supportedEvents) {
600
+ supportedNotificationEvents.set(type, supportedEvents);
601
+ ctx.logNode(node.id, {
602
+ endpoint: this.endpointIndex,
603
+ message: `received supported notification events for ${name}: ${supportedEvents.map(String).join(", ")}`,
604
+ direction: "inbound"
605
+ });
606
+ }
607
+ }
608
+ }
609
+ let notificationMode = this.getValue(ctx, NotificationCCValues.notificationMode);
610
+ if (notificationMode !== "push" && notificationMode !== "pull") {
611
+ notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);
612
+ this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);
613
+ }
614
+ if (notificationMode === "pull") {
615
+ await this.refreshValues(ctx);
616
+ } else {
617
+ for (let i = 0; i < supportedNotificationTypes.length; i++) {
618
+ const type = supportedNotificationTypes[i];
619
+ const name = supportedNotificationNames[i];
620
+ const notification = (0, import_core.getNotification)(type);
621
+ ctx.logNode(node.id, {
622
+ endpoint: this.endpointIndex,
623
+ message: `enabling notifications for ${name}...`,
624
+ direction: "outbound"
625
+ });
626
+ await api.set(type, true);
627
+ if (notification) {
628
+ const events = supportedNotificationEvents.get(type);
629
+ if (events) {
630
+ for (const variable of notification.variables.filter((v) => !!v.idle)) {
631
+ if ([...variable.states.keys()].some((key) => events.includes(key))) {
632
+ const value = NotificationCCValues.notificationVariable(notification.name, variable.name);
633
+ if (this.getValue(ctx, value) == void 0) {
634
+ this.setValue(ctx, value, 0);
635
+ }
636
+ }
637
+ }
638
+ }
639
+ }
543
640
  }
544
641
  }
545
642
  }
546
- let notificationMode = this.getValue(ctx, NotificationCCValues.notificationMode);
547
- if (notificationMode !== "push" && notificationMode !== "pull") {
548
- notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);
549
- this.setValue(ctx, NotificationCCValues.notificationMode, notificationMode);
643
+ if (api.version === 1 || supportsV1Alarm) {
644
+ this.ensureMetadata(ctx, NotificationCCValues.alarmType);
645
+ this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);
550
646
  }
551
- if (notificationMode === "pull") {
552
- await this.refreshValues(ctx);
553
- } else {
647
+ const mappings = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
648
+ if (mappings) {
649
+ const supportedNotifications = /* @__PURE__ */ new Map();
650
+ for (const { to } of mappings) {
651
+ const notification = (0, import_core.getNotification)(to.notificationType);
652
+ if (!notification)
653
+ continue;
654
+ const valueConfig = (0, import_core.getNotificationValue)(notification, to.notificationEvent);
655
+ if (!supportedNotifications.has(to.notificationType)) {
656
+ supportedNotifications.set(to.notificationType, /* @__PURE__ */ new Set());
657
+ }
658
+ const supportedNotificationTypesSet = supportedNotifications.get(to.notificationType);
659
+ supportedNotificationTypesSet.add(to.notificationEvent);
660
+ if (valueConfig?.type !== "state")
661
+ continue;
662
+ const notificationValue = NotificationCCValues.notificationVariable(notification.name, valueConfig.variableName);
663
+ const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);
664
+ this.setMetadata(ctx, notificationValue, metadata);
665
+ if (valueConfig.idle) {
666
+ if (this.getValue(ctx, notificationValue) == void 0) {
667
+ this.setValue(ctx, notificationValue, 0);
668
+ }
669
+ }
670
+ }
671
+ this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);
672
+ for (const [type, events] of supportedNotifications) {
673
+ this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);
674
+ }
675
+ }
676
+ this.setInterviewComplete(ctx, true);
677
+ }
678
+ async refreshValues(ctx) {
679
+ const node = this.getNode(ctx);
680
+ if (NotificationCC2.getNotificationMode(ctx, node) === "pull") {
681
+ const endpoint = this.getEndpoint(ctx);
682
+ const api = import_API.CCAPI.create(import_safe.CommandClasses.Notification, ctx, endpoint).withOptions({
683
+ priority: import_safe.MessagePriority.NodeQuery
684
+ });
685
+ const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];
686
+ const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
554
687
  for (let i = 0; i < supportedNotificationTypes.length; i++) {
555
688
  const type = supportedNotificationTypes[i];
556
689
  const name = supportedNotificationNames[i];
557
- const notification = (0, import_core.getNotification)(type);
558
690
  ctx.logNode(node.id, {
559
691
  endpoint: this.endpointIndex,
560
- message: `enabling notifications for ${name}...`,
692
+ message: `querying notification status for ${name}...`,
561
693
  direction: "outbound"
562
694
  });
563
- await api.set(type, true);
564
- if (notification) {
565
- const events = supportedNotificationEvents.get(type);
566
- if (events) {
567
- for (const variable of notification.variables.filter((v) => !!v.idle)) {
568
- if ([...variable.states.keys()].some((key) => events.includes(key))) {
569
- const value = NotificationCCValues.notificationVariable(notification.name, variable.name);
570
- if (this.getValue(ctx, value) == void 0) {
571
- this.setValue(ctx, value, 0);
572
- }
573
- }
574
- }
575
- }
576
- }
695
+ const response = await api.getInternal({
696
+ notificationType: type
697
+ });
698
+ if (response)
699
+ await node.handleCommand(response);
577
700
  }
701
+ this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());
578
702
  }
579
703
  }
580
- if (api.version === 1 || supportsV1Alarm) {
581
- this.ensureMetadata(ctx, NotificationCCValues.alarmType);
582
- this.ensureMetadata(ctx, NotificationCCValues.alarmLevel);
704
+ shouldRefreshValues(ctx) {
705
+ const isPullMode = NotificationCC2.getNotificationMode(ctx, this.getNode(ctx)) === "pull";
706
+ if (!isPullMode)
707
+ return false;
708
+ const lastUpdated = this.getValue(ctx, NotificationCCValues.lastRefresh);
709
+ return lastUpdated == void 0 || Date.now() - lastUpdated > import_core.timespan.hours(6);
583
710
  }
584
- const mappings = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
585
- if (mappings) {
586
- const supportedNotifications = /* @__PURE__ */ new Map();
587
- for (const { to } of mappings) {
588
- const notification = (0, import_core.getNotification)(to.notificationType);
589
- if (!notification)
590
- continue;
591
- const valueConfig = (0, import_core.getNotificationValue)(notification, to.notificationEvent);
592
- if (!supportedNotifications.has(to.notificationType)) {
593
- supportedNotifications.set(to.notificationType, /* @__PURE__ */ new Set());
594
- }
595
- const supportedNotificationTypesSet = supportedNotifications.get(to.notificationType);
596
- supportedNotificationTypesSet.add(to.notificationEvent);
597
- if (valueConfig?.type !== "state")
598
- continue;
599
- const notificationValue = NotificationCCValues.notificationVariable(notification.name, valueConfig.variableName);
600
- const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);
601
- this.setMetadata(ctx, notificationValue, metadata);
602
- if (valueConfig.idle) {
603
- if (this.getValue(ctx, notificationValue) == void 0) {
604
- this.setValue(ctx, notificationValue, 0);
605
- }
711
+ };
712
+ return NotificationCC2 = _classThis;
713
+ })();
714
+ let NotificationCCSet = (() => {
715
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Set), (0, import_CommandClassDecorators.useSupervision)()];
716
+ let _classDescriptor;
717
+ let _classExtraInitializers = [];
718
+ let _classThis;
719
+ let _classSuper = NotificationCC;
720
+ var NotificationCCSet2 = class extends _classSuper {
721
+ static {
722
+ _classThis = this;
723
+ }
724
+ static {
725
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
726
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
727
+ NotificationCCSet2 = _classThis = _classDescriptor.value;
728
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
729
+ __runInitializers(_classThis, _classExtraInitializers);
730
+ }
731
+ constructor(options) {
732
+ super(options);
733
+ this.notificationType = options.notificationType;
734
+ this.notificationStatus = options.notificationStatus;
735
+ }
736
+ static from(raw, ctx) {
737
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
738
+ const notificationType = raw.payload[0];
739
+ const notificationStatus = raw.payload[1] === 255;
740
+ return new this({
741
+ nodeId: ctx.sourceNodeId,
742
+ notificationType,
743
+ notificationStatus
744
+ });
745
+ }
746
+ notificationType;
747
+ notificationStatus;
748
+ serialize(ctx) {
749
+ this.payload = import_safe2.Bytes.from([
750
+ this.notificationType,
751
+ this.notificationStatus ? 255 : 0
752
+ ]);
753
+ return super.serialize(ctx);
754
+ }
755
+ toLogEntry(ctx) {
756
+ return {
757
+ ...super.toLogEntry(ctx),
758
+ message: {
759
+ "notification type": (0, import_core.getNotificationName)(this.notificationType),
760
+ status: this.notificationStatus
606
761
  }
762
+ };
763
+ }
764
+ };
765
+ return NotificationCCSet2 = _classThis;
766
+ })();
767
+ let NotificationCCReport = (() => {
768
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Report), (0, import_CommandClassDecorators.useSupervision)()];
769
+ let _classDescriptor;
770
+ let _classExtraInitializers = [];
771
+ let _classThis;
772
+ let _classSuper = NotificationCC;
773
+ var NotificationCCReport2 = class extends _classSuper {
774
+ static {
775
+ _classThis = this;
776
+ }
777
+ static {
778
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
779
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
780
+ NotificationCCReport2 = _classThis = _classDescriptor.value;
781
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
782
+ __runInitializers(_classThis, _classExtraInitializers);
783
+ }
784
+ constructor(options) {
785
+ super(options);
786
+ if (options.alarmType != void 0) {
787
+ this.alarmType = options.alarmType;
788
+ this.alarmLevel = options.alarmLevel;
607
789
  }
608
- this.setValue(ctx, NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);
609
- for (const [type, events] of supportedNotifications) {
610
- this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(type), [...events]);
790
+ if (options.notificationType != void 0) {
791
+ this.notificationType = options.notificationType;
792
+ this.notificationStatus = options.notificationStatus ?? true;
793
+ this.notificationEvent = options.notificationEvent;
794
+ this.eventParameters = options.eventParameters;
795
+ this.sequenceNumber = options.sequenceNumber;
611
796
  }
612
797
  }
613
- this.setInterviewComplete(ctx, true);
614
- }
615
- async refreshValues(ctx) {
616
- const node = this.getNode(ctx);
617
- if (NotificationCC_1.getNotificationMode(ctx, node) === "pull") {
618
- const endpoint = this.getEndpoint(ctx);
619
- const api = import_API.CCAPI.create(import_safe.CommandClasses.Notification, ctx, endpoint).withOptions({
620
- priority: import_safe.MessagePriority.NodeQuery
621
- });
622
- const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes) ?? [];
623
- const supportedNotificationNames = supportedNotificationTypes.map(import_core.getNotificationName);
624
- for (let i = 0; i < supportedNotificationTypes.length; i++) {
625
- const type = supportedNotificationTypes[i];
626
- const name = supportedNotificationNames[i];
627
- ctx.logNode(node.id, {
628
- endpoint: this.endpointIndex,
629
- message: `querying notification status for ${name}...`,
630
- direction: "outbound"
631
- });
632
- const response = await api.getInternal({
633
- notificationType: type
798
+ static from(raw, ctx) {
799
+ (0, import_safe.validatePayload)(raw.payload.length >= 2);
800
+ const alarmType = raw.payload[0];
801
+ const alarmLevel = raw.payload[1];
802
+ if (raw.payload.length < 7) {
803
+ return new this({
804
+ nodeId: ctx.sourceNodeId,
805
+ alarmType,
806
+ alarmLevel
634
807
  });
635
- if (response)
636
- await node.handleCommand(response);
637
808
  }
638
- this.setValue(ctx, NotificationCCValues.lastRefresh, Date.now());
639
- }
640
- }
641
- shouldRefreshValues(ctx) {
642
- const isPullMode = NotificationCC_1.getNotificationMode(ctx, this.getNode(ctx)) === "pull";
643
- if (!isPullMode)
644
- return false;
645
- const lastUpdated = this.getValue(ctx, NotificationCCValues.lastRefresh);
646
- return lastUpdated == void 0 || Date.now() - lastUpdated > import_core.timespan.hours(6);
647
- }
648
- };
649
- NotificationCC = NotificationCC_1 = __decorate([
650
- (0, import_CommandClassDecorators.commandClass)(import_safe.CommandClasses.Notification),
651
- (0, import_CommandClassDecorators.implementedVersion)(8),
652
- (0, import_CommandClassDecorators.ccValues)(NotificationCCValues)
653
- ], NotificationCC);
654
- let NotificationCCSet = NotificationCCSet_1 = class NotificationCCSet2 extends NotificationCC {
655
- constructor(options) {
656
- super(options);
657
- this.notificationType = options.notificationType;
658
- this.notificationStatus = options.notificationStatus;
659
- }
660
- static from(raw, ctx) {
661
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
662
- const notificationType = raw.payload[0];
663
- const notificationStatus = raw.payload[1] === 255;
664
- return new NotificationCCSet_1({
665
- nodeId: ctx.sourceNodeId,
666
- notificationType,
667
- notificationStatus
668
- });
669
- }
670
- notificationType;
671
- notificationStatus;
672
- serialize(ctx) {
673
- this.payload = import_safe2.Bytes.from([
674
- this.notificationType,
675
- this.notificationStatus ? 255 : 0
676
- ]);
677
- return super.serialize(ctx);
678
- }
679
- toLogEntry(ctx) {
680
- return {
681
- ...super.toLogEntry(ctx),
682
- message: {
683
- "notification type": (0, import_core.getNotificationName)(this.notificationType),
684
- status: this.notificationStatus
809
+ const notificationStatus = raw.payload[3];
810
+ const notificationType = raw.payload[4];
811
+ const notificationEvent = raw.payload[5];
812
+ const containsSeqNum = !!(raw.payload[6] & 128);
813
+ const numEventParams = raw.payload[6] & 31;
814
+ let eventParameters;
815
+ if (numEventParams > 0) {
816
+ (0, import_safe.validatePayload)(raw.payload.length >= 7 + numEventParams);
817
+ eventParameters = raw.payload.subarray(7, 7 + numEventParams);
685
818
  }
686
- };
687
- }
688
- };
689
- NotificationCCSet = NotificationCCSet_1 = __decorate([
690
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Set),
691
- (0, import_CommandClassDecorators.useSupervision)()
692
- ], NotificationCCSet);
693
- let NotificationCCReport = NotificationCCReport_1 = class NotificationCCReport2 extends NotificationCC {
694
- constructor(options) {
695
- super(options);
696
- if (options.alarmType != void 0) {
697
- this.alarmType = options.alarmType;
698
- this.alarmLevel = options.alarmLevel;
699
- }
700
- if (options.notificationType != void 0) {
701
- this.notificationType = options.notificationType;
702
- this.notificationStatus = options.notificationStatus ?? true;
703
- this.notificationEvent = options.notificationEvent;
704
- this.eventParameters = options.eventParameters;
705
- this.sequenceNumber = options.sequenceNumber;
706
- }
707
- }
708
- static from(raw, ctx) {
709
- (0, import_safe.validatePayload)(raw.payload.length >= 2);
710
- const alarmType = raw.payload[0];
711
- const alarmLevel = raw.payload[1];
712
- if (raw.payload.length < 7) {
713
- return new NotificationCCReport_1({
819
+ let sequenceNumber;
820
+ if (containsSeqNum) {
821
+ (0, import_safe.validatePayload)(raw.payload.length >= 7 + numEventParams + 1);
822
+ sequenceNumber = raw.payload[7 + numEventParams];
823
+ }
824
+ return new this({
714
825
  nodeId: ctx.sourceNodeId,
715
826
  alarmType,
716
- alarmLevel
827
+ alarmLevel,
828
+ notificationStatus,
829
+ notificationType,
830
+ notificationEvent,
831
+ eventParameters,
832
+ sequenceNumber
717
833
  });
718
834
  }
719
- const notificationStatus = raw.payload[3];
720
- const notificationType = raw.payload[4];
721
- const notificationEvent = raw.payload[5];
722
- const containsSeqNum = !!(raw.payload[6] & 128);
723
- const numEventParams = raw.payload[6] & 31;
724
- let eventParameters;
725
- if (numEventParams > 0) {
726
- (0, import_safe.validatePayload)(raw.payload.length >= 7 + numEventParams);
727
- eventParameters = raw.payload.subarray(7, 7 + numEventParams);
728
- }
729
- let sequenceNumber;
730
- if (containsSeqNum) {
731
- (0, import_safe.validatePayload)(raw.payload.length >= 7 + numEventParams + 1);
732
- sequenceNumber = raw.payload[7 + numEventParams];
733
- }
734
- return new NotificationCCReport_1({
735
- nodeId: ctx.sourceNodeId,
736
- alarmType,
737
- alarmLevel,
738
- notificationStatus,
739
- notificationType,
740
- notificationEvent,
741
- eventParameters,
742
- sequenceNumber
743
- });
744
- }
745
- persistValues(ctx) {
746
- if (!super.persistValues(ctx))
747
- return false;
748
- const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
749
- if (this.alarmType != void 0 && this.alarmLevel != void 0 && this.alarmType !== 0) {
750
- if (ccVersion >= 2) {
751
- const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes);
752
- if ((0, import_typeguards.isArray)(supportedNotificationTypes) && supportedNotificationTypes.includes(this.alarmType)) {
753
- const supportedNotificationEvents = this.getValue(ctx, NotificationCCValues.supportedNotificationEvents(this.alarmType));
754
- if ((0, import_typeguards.isArray)(supportedNotificationEvents) && supportedNotificationEvents.includes(this.alarmLevel)) {
755
- ctx.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
756
- this.notificationType = this.alarmType;
757
- this.notificationEvent = this.alarmLevel;
758
- this.alarmType = void 0;
759
- this.alarmLevel = void 0;
835
+ persistValues(ctx) {
836
+ if (!super.persistValues(ctx))
837
+ return false;
838
+ const ccVersion = (0, import_CommandClass.getEffectiveCCVersion)(ctx, this);
839
+ if (this.alarmType != void 0 && this.alarmLevel != void 0 && this.alarmType !== 0) {
840
+ if (ccVersion >= 2) {
841
+ const supportedNotificationTypes = this.getValue(ctx, NotificationCCValues.supportedNotificationTypes);
842
+ if ((0, import_typeguards.isArray)(supportedNotificationTypes) && supportedNotificationTypes.includes(this.alarmType)) {
843
+ const supportedNotificationEvents = this.getValue(ctx, NotificationCCValues.supportedNotificationEvents(this.alarmType));
844
+ if ((0, import_typeguards.isArray)(supportedNotificationEvents) && supportedNotificationEvents.includes(this.alarmLevel)) {
845
+ ctx.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
846
+ this.notificationType = this.alarmType;
847
+ this.notificationEvent = this.alarmLevel;
848
+ this.alarmType = void 0;
849
+ this.alarmLevel = void 0;
850
+ }
760
851
  }
761
- }
762
- } else {
763
- const mapping = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
764
- const match = mapping?.find((m) => m.from.alarmType === this.alarmType && (m.from.alarmLevel == void 0 || m.from.alarmLevel === this.alarmLevel));
765
- if (match) {
766
- ctx.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
767
- this.notificationType = match.to.notificationType;
768
- this.notificationEvent = match.to.notificationEvent;
769
- if (match.to.eventParameters) {
770
- this.eventParameters = {};
771
- for (const [key, val] of Object.entries(match.to.eventParameters)) {
772
- if (typeof val === "number") {
773
- this.eventParameters[key] = val;
774
- } else if (val === "alarmLevel") {
775
- this.eventParameters[key] = this.alarmLevel;
852
+ } else {
853
+ const mapping = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
854
+ const match = mapping?.find((m) => m.from.alarmType === this.alarmType && (m.from.alarmLevel == void 0 || m.from.alarmLevel === this.alarmLevel));
855
+ if (match) {
856
+ ctx.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
857
+ this.notificationType = match.to.notificationType;
858
+ this.notificationEvent = match.to.notificationEvent;
859
+ if (match.to.eventParameters) {
860
+ this.eventParameters = {};
861
+ for (const [key, val] of Object.entries(match.to.eventParameters)) {
862
+ if (typeof val === "number") {
863
+ this.eventParameters[key] = val;
864
+ } else if (val === "alarmLevel") {
865
+ this.eventParameters[key] = this.alarmLevel;
866
+ }
776
867
  }
777
868
  }
778
869
  }
779
870
  }
780
871
  }
781
- }
782
- this.parseEventParameters(ctx);
783
- if (this.alarmType != void 0) {
784
- const alarmTypeValue = NotificationCCValues.alarmType;
785
- this.ensureMetadata(ctx, alarmTypeValue);
786
- this.setValue(ctx, alarmTypeValue, this.alarmType);
787
- }
788
- if (this.alarmLevel != void 0) {
789
- const alarmLevelValue = NotificationCCValues.alarmLevel;
790
- this.ensureMetadata(ctx, alarmLevelValue);
791
- this.setValue(ctx, alarmLevelValue, this.alarmLevel);
792
- }
793
- return true;
794
- }
795
- alarmType;
796
- alarmLevel;
797
- notificationType;
798
- notificationStatus;
799
- notificationEvent;
800
- eventParameters;
801
- sequenceNumber;
802
- toLogEntry(ctx) {
803
- let message = {};
804
- if (this.alarmType) {
805
- message = {
806
- "V1 alarm type": this.alarmType,
807
- "V1 alarm level": this.alarmLevel
808
- };
809
- }
810
- let valueConfig;
811
- if (this.notificationType) {
812
- const notification = (0, import_core.getNotification)(this.notificationType);
813
- if (notification) {
814
- valueConfig = (0, import_core.getNotificationValue)(notification, this.notificationEvent);
872
+ this.parseEventParameters(ctx);
873
+ if (this.alarmType != void 0) {
874
+ const alarmTypeValue = NotificationCCValues.alarmType;
875
+ this.ensureMetadata(ctx, alarmTypeValue);
876
+ this.setValue(ctx, alarmTypeValue, this.alarmType);
815
877
  }
816
- if (valueConfig) {
817
- message = {
818
- ...message,
819
- "notification type": (0, import_core.getNotificationName)(this.notificationType),
820
- "notification status": this.notificationStatus,
821
- [`notification ${valueConfig.type}`]: valueConfig.label ?? `Unknown (${(0, import_safe3.num2hex)(this.notificationEvent)})`
822
- };
823
- } else if (this.notificationEvent === 0) {
824
- message = {
825
- ...message,
826
- "notification type": this.notificationType,
827
- "notification status": this.notificationStatus,
828
- "notification state": "idle"
829
- };
830
- } else {
878
+ if (this.alarmLevel != void 0) {
879
+ const alarmLevelValue = NotificationCCValues.alarmLevel;
880
+ this.ensureMetadata(ctx, alarmLevelValue);
881
+ this.setValue(ctx, alarmLevelValue, this.alarmLevel);
882
+ }
883
+ return true;
884
+ }
885
+ alarmType;
886
+ alarmLevel;
887
+ notificationType;
888
+ notificationStatus;
889
+ notificationEvent;
890
+ eventParameters;
891
+ sequenceNumber;
892
+ toLogEntry(ctx) {
893
+ let message = {};
894
+ if (this.alarmType) {
831
895
  message = {
832
- ...message,
833
- "notification type": this.notificationType,
834
- "notification status": this.notificationStatus,
835
- "notification event": (0, import_safe3.num2hex)(this.notificationEvent)
896
+ "V1 alarm type": this.alarmType,
897
+ "V1 alarm level": this.alarmLevel
836
898
  };
837
899
  }
838
- }
839
- if (this.sequenceNumber != void 0) {
840
- message["sequence number"] = this.sequenceNumber;
841
- }
842
- if (this.eventParameters != void 0) {
843
- if (typeof this.eventParameters === "number") {
844
- let found = false;
845
- if (valueConfig?.parameter?.type === "enum") {
846
- const label = valueConfig.parameter.values[this.eventParameters];
847
- if (label) {
848
- message["state parameters"] = label;
849
- found = true;
850
- }
900
+ let valueConfig;
901
+ if (this.notificationType) {
902
+ const notification = (0, import_core.getNotification)(this.notificationType);
903
+ if (notification) {
904
+ valueConfig = (0, import_core.getNotificationValue)(notification, this.notificationEvent);
851
905
  }
852
- if (!found) {
853
- message["state parameters"] = (0, import_safe3.num2hex)(this.eventParameters);
906
+ if (valueConfig) {
907
+ message = {
908
+ ...message,
909
+ "notification type": (0, import_core.getNotificationName)(this.notificationType),
910
+ "notification status": this.notificationStatus,
911
+ [`notification ${valueConfig.type}`]: valueConfig.label ?? `Unknown (${(0, import_safe3.num2hex)(this.notificationEvent)})`
912
+ };
913
+ } else if (this.notificationEvent === 0) {
914
+ message = {
915
+ ...message,
916
+ "notification type": this.notificationType,
917
+ "notification status": this.notificationStatus,
918
+ "notification state": "idle"
919
+ };
920
+ } else {
921
+ message = {
922
+ ...message,
923
+ "notification type": this.notificationType,
924
+ "notification status": this.notificationStatus,
925
+ "notification event": (0, import_safe3.num2hex)(this.notificationEvent)
926
+ };
854
927
  }
855
- } else if ((0, import_safe2.isUint8Array)(this.eventParameters)) {
856
- message["event parameters"] = (0, import_safe3.buffer2hex)(this.eventParameters);
857
- } else if (this.eventParameters instanceof import_safe.Duration) {
858
- message["event parameters"] = this.eventParameters.toString();
859
- } else {
860
- message["event parameters"] = Object.entries(this.eventParameters).map(([param, val]) => `
861
- ${param}: ${(0, import_safe3.num2hex)(val)}`).join("");
862
928
  }
863
- } else if (valueConfig?.parameter?.type === "enum" && valueConfig.parameter.default != void 0) {
864
- const label = valueConfig.parameter.values[valueConfig.parameter.default];
865
- if (label) {
866
- message["state parameters"] = `${label} (omitted)`;
929
+ if (this.sequenceNumber != void 0) {
930
+ message["sequence number"] = this.sequenceNumber;
931
+ }
932
+ if (this.eventParameters != void 0) {
933
+ if (typeof this.eventParameters === "number") {
934
+ let found = false;
935
+ if (valueConfig?.parameter?.type === "enum") {
936
+ const label = valueConfig.parameter.values[this.eventParameters];
937
+ if (label) {
938
+ message["state parameters"] = label;
939
+ found = true;
940
+ }
941
+ }
942
+ if (!found) {
943
+ message["state parameters"] = (0, import_safe3.num2hex)(this.eventParameters);
944
+ }
945
+ } else if ((0, import_safe2.isUint8Array)(this.eventParameters)) {
946
+ message["event parameters"] = (0, import_safe3.buffer2hex)(this.eventParameters);
947
+ } else if (this.eventParameters instanceof import_safe.Duration) {
948
+ message["event parameters"] = this.eventParameters.toString();
949
+ } else {
950
+ message["event parameters"] = Object.entries(this.eventParameters).map(([param, val]) => `
951
+ ${param}: ${(0, import_safe3.num2hex)(val)}`).join("");
952
+ }
953
+ } else if (valueConfig?.parameter?.type === "enum" && valueConfig.parameter.default != void 0) {
954
+ const label = valueConfig.parameter.values[valueConfig.parameter.default];
955
+ if (label) {
956
+ message["state parameters"] = `${label} (omitted)`;
957
+ }
867
958
  }
959
+ return {
960
+ ...super.toLogEntry(ctx),
961
+ message
962
+ };
868
963
  }
869
- return {
870
- ...super.toLogEntry(ctx),
871
- message
872
- };
873
- }
874
- parseEventParameters(ctx) {
875
- if (this.notificationType == void 0 || this.notificationEvent == void 0) {
876
- return;
877
- }
878
- const notification = (0, import_core.getNotification)(this.notificationType);
879
- if (!notification)
880
- return;
881
- const valueConfig = (0, import_core.getNotificationValue)(notification, this.notificationEvent);
882
- if (!valueConfig)
883
- return;
884
- if (valueConfig.parameter?.type === "duration") {
885
- if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
964
+ parseEventParameters(ctx) {
965
+ if (this.notificationType == void 0 || this.notificationEvent == void 0) {
886
966
  return;
887
967
  }
888
- this.eventParameters = import_safe.Duration.parseReport(this.eventParameters[0]);
889
- } else if (valueConfig.parameter?.type === "commandclass") {
890
- if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
968
+ const notification = (0, import_core.getNotification)(this.notificationType);
969
+ if (!notification)
891
970
  return;
892
- }
893
- if (this.eventParameters.length === 1 && notification.type === 6 && (this.notificationEvent === 5 || this.notificationEvent === 6)) {
894
- this.eventParameters = {
895
- userId: this.eventParameters[0]
896
- };
897
- } else {
898
- try {
899
- const cc = import_CommandClass.CommandClass.parse(this.eventParameters, {
900
- ...ctx,
901
- frameType: "singlecast",
902
- sourceNodeId: this.nodeId,
903
- // Security encapsulation is handled outside of this CC,
904
- // so it is not needed here:
905
- hasSecurityClass: () => false,
906
- getHighestSecurityClass: () => import_safe.SecurityClass.None,
907
- setSecurityClass: () => {
908
- },
909
- securityManager: void 0,
910
- securityManager2: void 0,
911
- securityManagerLR: void 0
912
- });
913
- (0, import_safe.validatePayload)(!(cc instanceof import_CommandClass.InvalidCC));
914
- cc.encapsulatingCC = this;
915
- if ((0, import_NotificationEventPayload.isNotificationEventPayload)(cc)) {
916
- this.eventParameters = cc.toNotificationEventParameters();
917
- } else {
918
- let json = cc.toJSON();
919
- if ("nodeId" in json && "ccId" in json && "payload" in json) {
920
- json = (0, import_safe3.pick)(json, ["payload"]);
971
+ const valueConfig = (0, import_core.getNotificationValue)(notification, this.notificationEvent);
972
+ if (!valueConfig)
973
+ return;
974
+ if (valueConfig.parameter?.type === "duration") {
975
+ if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
976
+ return;
977
+ }
978
+ this.eventParameters = import_safe.Duration.parseReport(this.eventParameters[0]);
979
+ } else if (valueConfig.parameter?.type === "commandclass") {
980
+ if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
981
+ return;
982
+ }
983
+ if (this.eventParameters.length === 1 && notification.type === 6 && (this.notificationEvent === 5 || this.notificationEvent === 6)) {
984
+ this.eventParameters = {
985
+ userId: this.eventParameters[0]
986
+ };
987
+ } else {
988
+ try {
989
+ const cc = import_CommandClass.CommandClass.parse(this.eventParameters, {
990
+ ...ctx,
991
+ frameType: "singlecast",
992
+ sourceNodeId: this.nodeId,
993
+ // Security encapsulation is handled outside of this CC,
994
+ // so it is not needed here:
995
+ hasSecurityClass: () => false,
996
+ getHighestSecurityClass: () => import_safe.SecurityClass.None,
997
+ setSecurityClass: () => {
998
+ },
999
+ securityManager: void 0,
1000
+ securityManager2: void 0,
1001
+ securityManagerLR: void 0
1002
+ });
1003
+ (0, import_safe.validatePayload)(!(cc instanceof import_CommandClass.InvalidCC));
1004
+ cc.encapsulatingCC = this;
1005
+ if ((0, import_NotificationEventPayload.isNotificationEventPayload)(cc)) {
1006
+ this.eventParameters = cc.toNotificationEventParameters();
1007
+ } else {
1008
+ let json = cc.toJSON();
1009
+ if ("nodeId" in json && "ccId" in json && "payload" in json) {
1010
+ json = (0, import_safe3.pick)(json, ["payload"]);
1011
+ }
1012
+ this.eventParameters = json;
921
1013
  }
922
- this.eventParameters = json;
923
- }
924
- } catch (e) {
925
- if ((0, import_safe.isZWaveError)(e) && e.code === import_safe.ZWaveErrorCodes.PacketFormat_InvalidPayload && (0, import_safe2.isUint8Array)(this.eventParameters)) {
926
- const { ccId, ccCommand } = import_CommandClass.CCRaw.parse(this.eventParameters);
927
- if (ccId === import_safe.CommandClasses["User Code"] && ccCommand === import_Types.UserCodeCommand.Report && this.eventParameters.length >= 3) {
928
- this.eventParameters = {
929
- userId: this.eventParameters[2]
930
- };
1014
+ } catch (e) {
1015
+ if ((0, import_safe.isZWaveError)(e) && e.code === import_safe.ZWaveErrorCodes.PacketFormat_InvalidPayload && (0, import_safe2.isUint8Array)(this.eventParameters)) {
1016
+ const { ccId, ccCommand } = import_CommandClass.CCRaw.parse(this.eventParameters);
1017
+ if (ccId === import_safe.CommandClasses["User Code"] && ccCommand === import_Types.UserCodeCommand.Report && this.eventParameters.length >= 3) {
1018
+ this.eventParameters = {
1019
+ userId: this.eventParameters[2]
1020
+ };
1021
+ } else {
1022
+ ctx.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
1023
+ }
931
1024
  } else {
932
- ctx.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
1025
+ throw e;
933
1026
  }
934
- } else {
935
- throw e;
936
1027
  }
937
1028
  }
1029
+ } else if (valueConfig.parameter?.type === "value") {
1030
+ if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
1031
+ return;
1032
+ }
1033
+ this.eventParameters = {
1034
+ [valueConfig.parameter.propertyName]: import_safe2.Bytes.view(this.eventParameters).readUIntBE(0, this.eventParameters.length)
1035
+ };
1036
+ } else if (valueConfig.parameter?.type === "enum") {
1037
+ this.eventParameters = (0, import_safe2.isUint8Array)(this.eventParameters) && this.eventParameters.length === 1 ? this.eventParameters[0] : void 0;
1038
+ if (this.eventParameters == void 0 && valueConfig.parameter.default != void 0) {
1039
+ this.eventParameters = valueConfig.parameter.default;
1040
+ }
938
1041
  }
939
- } else if (valueConfig.parameter?.type === "value") {
940
- if (!(0, import_safe2.isUint8Array)(this.eventParameters)) {
941
- return;
1042
+ }
1043
+ serialize(ctx) {
1044
+ if (this.notificationType != void 0) {
1045
+ if (this.notificationEvent == void 0) {
1046
+ throw new import_safe.ZWaveError(`Notification CC reports requires the notification event to be set!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
1047
+ } else if (this.eventParameters != void 0 && !(0, import_safe2.isUint8Array)(this.eventParameters)) {
1048
+ throw new import_safe.ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
1049
+ }
1050
+ const controlByte = (this.sequenceNumber != void 0 ? 128 : 0) | (this.eventParameters?.length ?? 0) & 31;
1051
+ this.payload = import_safe2.Bytes.from([
1052
+ 0,
1053
+ 0,
1054
+ 0,
1055
+ 255,
1056
+ this.notificationType,
1057
+ this.notificationEvent,
1058
+ controlByte
1059
+ ]);
1060
+ if (this.eventParameters) {
1061
+ this.payload = import_safe2.Bytes.concat([
1062
+ this.payload,
1063
+ this.eventParameters
1064
+ ]);
1065
+ }
1066
+ if (this.sequenceNumber != void 0) {
1067
+ this.payload = import_safe2.Bytes.concat([
1068
+ this.payload,
1069
+ import_safe2.Bytes.from([this.sequenceNumber])
1070
+ ]);
1071
+ }
1072
+ } else {
1073
+ this.payload = import_safe2.Bytes.from([
1074
+ this.alarmType ?? 0,
1075
+ this.alarmLevel ?? 0
1076
+ ]);
942
1077
  }
943
- this.eventParameters = {
944
- [valueConfig.parameter.propertyName]: import_safe2.Bytes.view(this.eventParameters).readUIntBE(0, this.eventParameters.length)
945
- };
946
- } else if (valueConfig.parameter?.type === "enum") {
947
- this.eventParameters = (0, import_safe2.isUint8Array)(this.eventParameters) && this.eventParameters.length === 1 ? this.eventParameters[0] : void 0;
948
- if (this.eventParameters == void 0 && valueConfig.parameter.default != void 0) {
949
- this.eventParameters = valueConfig.parameter.default;
1078
+ return super.serialize(ctx);
1079
+ }
1080
+ };
1081
+ return NotificationCCReport2 = _classThis;
1082
+ })();
1083
+ let NotificationCCGet = (() => {
1084
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Get), (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCReport)];
1085
+ let _classDescriptor;
1086
+ let _classExtraInitializers = [];
1087
+ let _classThis;
1088
+ let _classSuper = NotificationCC;
1089
+ var NotificationCCGet2 = class extends _classSuper {
1090
+ static {
1091
+ _classThis = this;
1092
+ }
1093
+ static {
1094
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1095
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1096
+ NotificationCCGet2 = _classThis = _classDescriptor.value;
1097
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1098
+ __runInitializers(_classThis, _classExtraInitializers);
1099
+ }
1100
+ constructor(options) {
1101
+ super(options);
1102
+ if ("alarmType" in options) {
1103
+ this.alarmType = options.alarmType;
1104
+ } else {
1105
+ this.notificationType = options.notificationType;
1106
+ this.notificationEvent = options.notificationEvent;
950
1107
  }
951
1108
  }
952
- }
953
- serialize(ctx) {
954
- if (this.notificationType != void 0) {
955
- if (this.notificationEvent == void 0) {
956
- throw new import_safe.ZWaveError(`Notification CC reports requires the notification event to be set!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
957
- } else if (this.eventParameters != void 0 && !(0, import_safe2.isUint8Array)(this.eventParameters)) {
958
- throw new import_safe.ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, import_safe.ZWaveErrorCodes.Argument_Invalid);
1109
+ static from(raw, ctx) {
1110
+ (0, import_safe.validatePayload)(raw.payload.length >= 1);
1111
+ if (raw.payload.length >= 2) {
1112
+ const notificationType = raw.payload[1];
1113
+ let notificationEvent;
1114
+ if (raw.payload.length >= 3 && notificationType != 255) {
1115
+ notificationEvent = raw.payload[2];
1116
+ }
1117
+ return new this({
1118
+ nodeId: ctx.sourceNodeId,
1119
+ notificationType,
1120
+ notificationEvent
1121
+ });
1122
+ } else {
1123
+ const alarmType = raw.payload[0];
1124
+ return new this({
1125
+ nodeId: ctx.sourceNodeId,
1126
+ alarmType
1127
+ });
959
1128
  }
960
- const controlByte = (this.sequenceNumber != void 0 ? 128 : 0) | (this.eventParameters?.length ?? 0) & 31;
1129
+ }
1130
+ /** Proprietary V1/V2 alarm type */
1131
+ alarmType;
1132
+ /** Regulated V3+ notification type */
1133
+ notificationType;
1134
+ notificationEvent;
1135
+ serialize(ctx) {
1136
+ const notificationEvent = this.notificationEvent === 255 ? 0 : this.notificationEvent;
961
1137
  this.payload = import_safe2.Bytes.from([
962
- 0,
963
- 0,
964
- 0,
965
- 255,
966
- this.notificationType,
967
- this.notificationEvent,
968
- controlByte
1138
+ this.alarmType ?? 0,
1139
+ this.notificationType ?? 255,
1140
+ notificationEvent ?? 0
969
1141
  ]);
970
- if (this.eventParameters) {
971
- this.payload = import_safe2.Bytes.concat([
972
- this.payload,
973
- this.eventParameters
974
- ]);
1142
+ return super.serialize(ctx);
1143
+ }
1144
+ toLogEntry(ctx) {
1145
+ const message = {};
1146
+ if (this.alarmType != void 0) {
1147
+ message["V1 alarm type"] = this.alarmType;
975
1148
  }
976
- if (this.sequenceNumber != void 0) {
977
- this.payload = import_safe2.Bytes.concat([
978
- this.payload,
979
- import_safe2.Bytes.from([this.sequenceNumber])
980
- ]);
1149
+ if (this.notificationType != void 0) {
1150
+ message["notification type"] = (0, import_core.getNotificationName)(this.notificationType);
1151
+ if (this.notificationEvent != void 0) {
1152
+ message["notification event"] = (0, import_core.getNotificationEventName)(this.notificationType, this.notificationEvent);
1153
+ }
981
1154
  }
982
- } else {
983
- this.payload = import_safe2.Bytes.from([
984
- this.alarmType ?? 0,
985
- this.alarmLevel ?? 0
1155
+ return {
1156
+ ...super.toLogEntry(ctx),
1157
+ message
1158
+ };
1159
+ }
1160
+ };
1161
+ return NotificationCCGet2 = _classThis;
1162
+ })();
1163
+ let NotificationCCSupportedReport = (() => {
1164
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.SupportedReport), (0, import_CommandClassDecorators.ccValueProperty)("supportsV1Alarm", NotificationCCValues.supportsV1Alarm), (0, import_CommandClassDecorators.ccValueProperty)("supportedNotificationTypes", NotificationCCValues.supportedNotificationTypes)];
1165
+ let _classDescriptor;
1166
+ let _classExtraInitializers = [];
1167
+ let _classThis;
1168
+ let _classSuper = NotificationCC;
1169
+ var NotificationCCSupportedReport2 = class extends _classSuper {
1170
+ static {
1171
+ _classThis = this;
1172
+ }
1173
+ static {
1174
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1175
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1176
+ NotificationCCSupportedReport2 = _classThis = _classDescriptor.value;
1177
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1178
+ __runInitializers(_classThis, _classExtraInitializers);
1179
+ }
1180
+ constructor(options) {
1181
+ super(options);
1182
+ this.supportsV1Alarm = options.supportsV1Alarm;
1183
+ this.supportedNotificationTypes = options.supportedNotificationTypes;
1184
+ }
1185
+ static from(raw, ctx) {
1186
+ (0, import_safe.validatePayload)(raw.payload.length >= 1);
1187
+ const supportsV1Alarm = !!(raw.payload[0] & 128);
1188
+ const numBitMaskBytes = raw.payload[0] & 31;
1189
+ (0, import_safe.validatePayload)(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);
1190
+ const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);
1191
+ const supportedNotificationTypes = (0, import_safe.parseBitMask)(
1192
+ notificationBitMask,
1193
+ // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1194
+ 0
1195
+ );
1196
+ return new this({
1197
+ nodeId: ctx.sourceNodeId,
1198
+ supportsV1Alarm,
1199
+ supportedNotificationTypes
1200
+ });
1201
+ }
1202
+ supportsV1Alarm;
1203
+ supportedNotificationTypes;
1204
+ serialize(ctx) {
1205
+ const bitMask = (0, import_safe.encodeBitMask)(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);
1206
+ this.payload = import_safe2.Bytes.concat([
1207
+ import_safe2.Bytes.from([
1208
+ (this.supportsV1Alarm ? 128 : 0) | bitMask.length
1209
+ ]),
1210
+ bitMask
986
1211
  ]);
1212
+ return super.serialize(ctx);
987
1213
  }
988
- return super.serialize(ctx);
989
- }
990
- };
991
- NotificationCCReport = NotificationCCReport_1 = __decorate([
992
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Report),
993
- (0, import_CommandClassDecorators.useSupervision)()
994
- ], NotificationCCReport);
995
- let NotificationCCGet = NotificationCCGet_1 = class NotificationCCGet2 extends NotificationCC {
996
- constructor(options) {
997
- super(options);
998
- if ("alarmType" in options) {
999
- this.alarmType = options.alarmType;
1000
- } else {
1214
+ toLogEntry(ctx) {
1215
+ return {
1216
+ ...super.toLogEntry(ctx),
1217
+ message: {
1218
+ "supports V1 alarm": this.supportsV1Alarm,
1219
+ "supported notification types": this.supportedNotificationTypes.map((t) => `
1220
+ \xB7 ${(0, import_core.getNotificationName)(t)}`).join("")
1221
+ }
1222
+ };
1223
+ }
1224
+ };
1225
+ return NotificationCCSupportedReport2 = _classThis;
1226
+ })();
1227
+ let NotificationCCSupportedGet = (() => {
1228
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.SupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCSupportedReport)];
1229
+ let _classDescriptor;
1230
+ let _classExtraInitializers = [];
1231
+ let _classThis;
1232
+ let _classSuper = NotificationCC;
1233
+ var NotificationCCSupportedGet2 = class extends _classSuper {
1234
+ static {
1235
+ _classThis = this;
1236
+ }
1237
+ static {
1238
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1239
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1240
+ NotificationCCSupportedGet2 = _classThis = _classDescriptor.value;
1241
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1242
+ __runInitializers(_classThis, _classExtraInitializers);
1243
+ }
1244
+ };
1245
+ return NotificationCCSupportedGet2 = _classThis;
1246
+ })();
1247
+ let NotificationCCEventSupportedReport = (() => {
1248
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.EventSupportedReport)];
1249
+ let _classDescriptor;
1250
+ let _classExtraInitializers = [];
1251
+ let _classThis;
1252
+ let _classSuper = NotificationCC;
1253
+ var NotificationCCEventSupportedReport2 = class extends _classSuper {
1254
+ static {
1255
+ _classThis = this;
1256
+ }
1257
+ static {
1258
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1259
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1260
+ NotificationCCEventSupportedReport2 = _classThis = _classDescriptor.value;
1261
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1262
+ __runInitializers(_classThis, _classExtraInitializers);
1263
+ }
1264
+ constructor(options) {
1265
+ super(options);
1001
1266
  this.notificationType = options.notificationType;
1002
- this.notificationEvent = options.notificationEvent;
1267
+ this.supportedEvents = options.supportedEvents;
1003
1268
  }
1004
- }
1005
- static from(raw, ctx) {
1006
- (0, import_safe.validatePayload)(raw.payload.length >= 1);
1007
- if (raw.payload.length >= 2) {
1008
- const notificationType = raw.payload[1];
1009
- let notificationEvent;
1010
- if (raw.payload.length >= 3 && notificationType != 255) {
1011
- notificationEvent = raw.payload[2];
1269
+ static from(raw, ctx) {
1270
+ (0, import_safe.validatePayload)(raw.payload.length >= 1);
1271
+ const notificationType = raw.payload[0];
1272
+ const numBitMaskBytes = raw.payload[1] & 31;
1273
+ if (numBitMaskBytes === 0) {
1274
+ return new this({
1275
+ nodeId: ctx.sourceNodeId,
1276
+ notificationType,
1277
+ supportedEvents: []
1278
+ });
1012
1279
  }
1013
- return new NotificationCCGet_1({
1280
+ (0, import_safe.validatePayload)(raw.payload.length >= 2 + numBitMaskBytes);
1281
+ const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);
1282
+ const supportedEvents = (0, import_safe.parseBitMask)(
1283
+ eventBitMask,
1284
+ // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1285
+ 0
1286
+ );
1287
+ return new this({
1014
1288
  nodeId: ctx.sourceNodeId,
1015
1289
  notificationType,
1016
- notificationEvent
1017
- });
1018
- } else {
1019
- const alarmType = raw.payload[0];
1020
- return new NotificationCCGet_1({
1021
- nodeId: ctx.sourceNodeId,
1022
- alarmType
1290
+ supportedEvents
1023
1291
  });
1024
1292
  }
1025
- }
1026
- /** Proprietary V1/V2 alarm type */
1027
- alarmType;
1028
- /** Regulated V3+ notification type */
1029
- notificationType;
1030
- notificationEvent;
1031
- serialize(ctx) {
1032
- const notificationEvent = this.notificationEvent === 255 ? 0 : this.notificationEvent;
1033
- this.payload = import_safe2.Bytes.from([
1034
- this.alarmType ?? 0,
1035
- this.notificationType ?? 255,
1036
- notificationEvent ?? 0
1037
- ]);
1038
- return super.serialize(ctx);
1039
- }
1040
- toLogEntry(ctx) {
1041
- const message = {};
1042
- if (this.alarmType != void 0) {
1043
- message["V1 alarm type"] = this.alarmType;
1044
- }
1045
- if (this.notificationType != void 0) {
1046
- message["notification type"] = (0, import_core.getNotificationName)(this.notificationType);
1047
- if (this.notificationEvent != void 0) {
1048
- message["notification event"] = (0, import_core.getNotificationEventName)(this.notificationType, this.notificationEvent);
1293
+ persistValues(ctx) {
1294
+ if (!super.persistValues(ctx))
1295
+ return false;
1296
+ this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);
1297
+ const notification = (0, import_core.getNotification)(this.notificationType);
1298
+ if (!notification) {
1299
+ this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));
1300
+ } else {
1301
+ let isFirst = true;
1302
+ for (const value of this.supportedEvents) {
1303
+ const valueConfig = (0, import_core.getNotificationValue)(notification, value);
1304
+ if (valueConfig?.type === "state") {
1305
+ const notificationValue = NotificationCCValues.notificationVariable(notification.name, valueConfig.variableName);
1306
+ const metadata = getNotificationValueMetadata(isFirst ? void 0 : this.getMetadata(ctx, notificationValue), notification, valueConfig);
1307
+ this.setMetadata(ctx, notificationValue, metadata);
1308
+ isFirst = false;
1309
+ }
1310
+ }
1049
1311
  }
1312
+ return true;
1050
1313
  }
1051
- return {
1052
- ...super.toLogEntry(ctx),
1053
- message
1054
- };
1055
- }
1056
- };
1057
- NotificationCCGet = NotificationCCGet_1 = __decorate([
1058
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.Get),
1059
- (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCReport)
1060
- ], NotificationCCGet);
1061
- let NotificationCCSupportedReport = NotificationCCSupportedReport_1 = class NotificationCCSupportedReport2 extends NotificationCC {
1062
- constructor(options) {
1063
- super(options);
1064
- this.supportsV1Alarm = options.supportsV1Alarm;
1065
- this.supportedNotificationTypes = options.supportedNotificationTypes;
1066
- }
1067
- static from(raw, ctx) {
1068
- (0, import_safe.validatePayload)(raw.payload.length >= 1);
1069
- const supportsV1Alarm = !!(raw.payload[0] & 128);
1070
- const numBitMaskBytes = raw.payload[0] & 31;
1071
- (0, import_safe.validatePayload)(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);
1072
- const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);
1073
- const supportedNotificationTypes = (0, import_safe.parseBitMask)(
1074
- notificationBitMask,
1075
- // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1076
- 0
1077
- );
1078
- return new NotificationCCSupportedReport_1({
1079
- nodeId: ctx.sourceNodeId,
1080
- supportsV1Alarm,
1081
- supportedNotificationTypes
1082
- });
1083
- }
1084
- supportsV1Alarm;
1085
- supportedNotificationTypes;
1086
- serialize(ctx) {
1087
- const bitMask = (0, import_safe.encodeBitMask)(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);
1088
- this.payload = import_safe2.Bytes.concat([
1089
- import_safe2.Bytes.from([
1090
- (this.supportsV1Alarm ? 128 : 0) | bitMask.length
1091
- ]),
1092
- bitMask
1093
- ]);
1094
- return super.serialize(ctx);
1095
- }
1096
- toLogEntry(ctx) {
1097
- return {
1098
- ...super.toLogEntry(ctx),
1099
- message: {
1100
- "supports V1 alarm": this.supportsV1Alarm,
1101
- "supported notification types": this.supportedNotificationTypes.map((t) => `
1102
- \xB7 ${(0, import_core.getNotificationName)(t)}`).join("")
1314
+ notificationType;
1315
+ supportedEvents;
1316
+ serialize(ctx) {
1317
+ this.payload = import_safe2.Bytes.from([this.notificationType, 0]);
1318
+ if (this.supportedEvents.length > 0) {
1319
+ const bitMask = (0, import_safe.encodeBitMask)(this.supportedEvents, Math.max(...this.supportedEvents), 0);
1320
+ this.payload[1] = bitMask.length;
1321
+ this.payload = import_safe2.Bytes.concat([this.payload, bitMask]);
1103
1322
  }
1104
- };
1105
- }
1106
- };
1107
- __decorate([
1108
- (0, import_CommandClassDecorators.ccValue)(NotificationCCValues.supportsV1Alarm)
1109
- ], NotificationCCSupportedReport.prototype, "supportsV1Alarm", void 0);
1110
- __decorate([
1111
- (0, import_CommandClassDecorators.ccValue)(NotificationCCValues.supportedNotificationTypes)
1112
- ], NotificationCCSupportedReport.prototype, "supportedNotificationTypes", void 0);
1113
- NotificationCCSupportedReport = NotificationCCSupportedReport_1 = __decorate([
1114
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.SupportedReport)
1115
- ], NotificationCCSupportedReport);
1116
- let NotificationCCSupportedGet = class NotificationCCSupportedGet2 extends NotificationCC {
1117
- };
1118
- NotificationCCSupportedGet = __decorate([
1119
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.SupportedGet),
1120
- (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCSupportedReport)
1121
- ], NotificationCCSupportedGet);
1122
- let NotificationCCEventSupportedReport = NotificationCCEventSupportedReport_1 = class NotificationCCEventSupportedReport2 extends NotificationCC {
1123
- constructor(options) {
1124
- super(options);
1125
- this.notificationType = options.notificationType;
1126
- this.supportedEvents = options.supportedEvents;
1127
- }
1128
- static from(raw, ctx) {
1129
- (0, import_safe.validatePayload)(raw.payload.length >= 1);
1130
- const notificationType = raw.payload[0];
1131
- const numBitMaskBytes = raw.payload[1] & 31;
1132
- if (numBitMaskBytes === 0) {
1133
- return new NotificationCCEventSupportedReport_1({
1323
+ return super.serialize(ctx);
1324
+ }
1325
+ toLogEntry(ctx) {
1326
+ return {
1327
+ ...super.toLogEntry(ctx),
1328
+ message: {
1329
+ "notification type": (0, import_core.getNotificationName)(this.notificationType),
1330
+ "supported events": this.supportedEvents.map((e) => `
1331
+ \xB7 ${(0, import_core.getNotificationValueName)(this.notificationType, e)}`).join("")
1332
+ }
1333
+ };
1334
+ }
1335
+ };
1336
+ return NotificationCCEventSupportedReport2 = _classThis;
1337
+ })();
1338
+ let NotificationCCEventSupportedGet = (() => {
1339
+ let _classDecorators = [(0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.EventSupportedGet), (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCEventSupportedReport)];
1340
+ let _classDescriptor;
1341
+ let _classExtraInitializers = [];
1342
+ let _classThis;
1343
+ let _classSuper = NotificationCC;
1344
+ var NotificationCCEventSupportedGet2 = class extends _classSuper {
1345
+ static {
1346
+ _classThis = this;
1347
+ }
1348
+ static {
1349
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
1350
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
1351
+ NotificationCCEventSupportedGet2 = _classThis = _classDescriptor.value;
1352
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
1353
+ __runInitializers(_classThis, _classExtraInitializers);
1354
+ }
1355
+ constructor(options) {
1356
+ super(options);
1357
+ this.notificationType = options.notificationType;
1358
+ }
1359
+ static from(raw, ctx) {
1360
+ (0, import_safe.validatePayload)(raw.payload.length >= 1);
1361
+ const notificationType = raw.payload[0];
1362
+ return new this({
1134
1363
  nodeId: ctx.sourceNodeId,
1135
- notificationType,
1136
- supportedEvents: []
1364
+ notificationType
1137
1365
  });
1138
1366
  }
1139
- (0, import_safe.validatePayload)(raw.payload.length >= 2 + numBitMaskBytes);
1140
- const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);
1141
- const supportedEvents = (0, import_safe.parseBitMask)(
1142
- eventBitMask,
1143
- // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1144
- 0
1145
- );
1146
- return new NotificationCCEventSupportedReport_1({
1147
- nodeId: ctx.sourceNodeId,
1148
- notificationType,
1149
- supportedEvents
1150
- });
1151
- }
1152
- persistValues(ctx) {
1153
- if (!super.persistValues(ctx))
1154
- return false;
1155
- this.setValue(ctx, NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);
1156
- const notification = (0, import_core.getNotification)(this.notificationType);
1157
- if (!notification) {
1158
- this.setMetadata(ctx, NotificationCCValues.unknownNotificationType(this.notificationType));
1159
- } else {
1160
- let isFirst = true;
1161
- for (const value of this.supportedEvents) {
1162
- const valueConfig = (0, import_core.getNotificationValue)(notification, value);
1163
- if (valueConfig?.type === "state") {
1164
- const notificationValue = NotificationCCValues.notificationVariable(notification.name, valueConfig.variableName);
1165
- const metadata = getNotificationValueMetadata(isFirst ? void 0 : this.getMetadata(ctx, notificationValue), notification, valueConfig);
1166
- this.setMetadata(ctx, notificationValue, metadata);
1167
- isFirst = false;
1367
+ notificationType;
1368
+ serialize(ctx) {
1369
+ this.payload = import_safe2.Bytes.from([this.notificationType]);
1370
+ return super.serialize(ctx);
1371
+ }
1372
+ toLogEntry(ctx) {
1373
+ return {
1374
+ ...super.toLogEntry(ctx),
1375
+ message: {
1376
+ "notification type": (0, import_core.getNotificationName)(this.notificationType)
1168
1377
  }
1169
- }
1378
+ };
1170
1379
  }
1171
- return true;
1172
- }
1173
- notificationType;
1174
- supportedEvents;
1175
- serialize(ctx) {
1176
- this.payload = import_safe2.Bytes.from([this.notificationType, 0]);
1177
- if (this.supportedEvents.length > 0) {
1178
- const bitMask = (0, import_safe.encodeBitMask)(this.supportedEvents, Math.max(...this.supportedEvents), 0);
1179
- this.payload[1] = bitMask.length;
1180
- this.payload = import_safe2.Bytes.concat([this.payload, bitMask]);
1181
- }
1182
- return super.serialize(ctx);
1183
- }
1184
- toLogEntry(ctx) {
1185
- return {
1186
- ...super.toLogEntry(ctx),
1187
- message: {
1188
- "notification type": (0, import_core.getNotificationName)(this.notificationType),
1189
- "supported events": this.supportedEvents.map((e) => `
1190
- \xB7 ${(0, import_core.getNotificationValueName)(this.notificationType, e)}`).join("")
1191
- }
1192
- };
1193
- }
1194
- };
1195
- NotificationCCEventSupportedReport = NotificationCCEventSupportedReport_1 = __decorate([
1196
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.EventSupportedReport)
1197
- ], NotificationCCEventSupportedReport);
1198
- let NotificationCCEventSupportedGet = NotificationCCEventSupportedGet_1 = class NotificationCCEventSupportedGet2 extends NotificationCC {
1199
- constructor(options) {
1200
- super(options);
1201
- this.notificationType = options.notificationType;
1202
- }
1203
- static from(raw, ctx) {
1204
- (0, import_safe.validatePayload)(raw.payload.length >= 1);
1205
- const notificationType = raw.payload[0];
1206
- return new NotificationCCEventSupportedGet_1({
1207
- nodeId: ctx.sourceNodeId,
1208
- notificationType
1209
- });
1210
- }
1211
- notificationType;
1212
- serialize(ctx) {
1213
- this.payload = import_safe2.Bytes.from([this.notificationType]);
1214
- return super.serialize(ctx);
1215
- }
1216
- toLogEntry(ctx) {
1217
- return {
1218
- ...super.toLogEntry(ctx),
1219
- message: {
1220
- "notification type": (0, import_core.getNotificationName)(this.notificationType)
1221
- }
1222
- };
1223
- }
1224
- };
1225
- NotificationCCEventSupportedGet = NotificationCCEventSupportedGet_1 = __decorate([
1226
- (0, import_CommandClassDecorators.CCCommand)(import_Types.NotificationCommand.EventSupportedGet),
1227
- (0, import_CommandClassDecorators.expectedCCResponse)(NotificationCCEventSupportedReport)
1228
- ], NotificationCCEventSupportedGet);
1380
+ };
1381
+ return NotificationCCEventSupportedGet2 = _classThis;
1382
+ })();
1229
1383
  // Annotate the CommonJS export names for ESM import in node:
1230
1384
  0 && (module.exports = {
1231
1385
  NotificationCC,