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

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