@zwave-js/cc 13.10.1 → 14.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/build/cc/AlarmSensorCC.d.ts +31 -20
  2. package/build/cc/AlarmSensorCC.d.ts.map +1 -1
  3. package/build/cc/AlarmSensorCC.js +106 -87
  4. package/build/cc/AlarmSensorCC.js.map +1 -1
  5. package/build/cc/AssociationCC.d.ts +38 -32
  6. package/build/cc/AssociationCC.d.ts.map +1 -1
  7. package/build/cc/AssociationCC.js +193 -176
  8. package/build/cc/AssociationCC.js.map +1 -1
  9. package/build/cc/AssociationGroupInfoCC.d.ts +42 -36
  10. package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  11. package/build/cc/AssociationGroupInfoCC.js +218 -200
  12. package/build/cc/AssociationGroupInfoCC.js.map +1 -1
  13. package/build/cc/BarrierOperatorCC.d.ts +41 -24
  14. package/build/cc/BarrierOperatorCC.d.ts.map +1 -1
  15. package/build/cc/BarrierOperatorCC.js +143 -109
  16. package/build/cc/BarrierOperatorCC.js.map +1 -1
  17. package/build/cc/BasicCC.d.ts +22 -23
  18. package/build/cc/BasicCC.d.ts.map +1 -1
  19. package/build/cc/BasicCC.js +83 -77
  20. package/build/cc/BasicCC.js.map +1 -1
  21. package/build/cc/BatteryCC.d.ts +22 -14
  22. package/build/cc/BatteryCC.d.ts.map +1 -1
  23. package/build/cc/BatteryCC.js +116 -87
  24. package/build/cc/BatteryCC.js.map +1 -1
  25. package/build/cc/BinarySensorCC.d.ts +22 -19
  26. package/build/cc/BinarySensorCC.d.ts.map +1 -1
  27. package/build/cc/BinarySensorCC.js +103 -93
  28. package/build/cc/BinarySensorCC.js.map +1 -1
  29. package/build/cc/BinarySwitchCC.d.ts +20 -20
  30. package/build/cc/BinarySwitchCC.d.ts.map +1 -1
  31. package/build/cc/BinarySwitchCC.js +71 -59
  32. package/build/cc/BinarySwitchCC.js.map +1 -1
  33. package/build/cc/CRC16CC.d.ts +9 -9
  34. package/build/cc/CRC16CC.d.ts.map +1 -1
  35. package/build/cc/CRC16CC.js +36 -36
  36. package/build/cc/CRC16CC.js.map +1 -1
  37. package/build/cc/CentralSceneCC.d.ts +34 -16
  38. package/build/cc/CentralSceneCC.d.ts.map +1 -1
  39. package/build/cc/CentralSceneCC.js +116 -79
  40. package/build/cc/CentralSceneCC.js.map +1 -1
  41. package/build/cc/ClimateControlScheduleCC.d.ts +38 -21
  42. package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  43. package/build/cc/ClimateControlScheduleCC.js +113 -81
  44. package/build/cc/ClimateControlScheduleCC.js.map +1 -1
  45. package/build/cc/ClockCC.d.ts +18 -11
  46. package/build/cc/ClockCC.d.ts.map +1 -1
  47. package/build/cc/ClockCC.js +57 -43
  48. package/build/cc/ClockCC.js.map +1 -1
  49. package/build/cc/ColorSwitchCC.d.ts +37 -33
  50. package/build/cc/ColorSwitchCC.d.ts.map +1 -1
  51. package/build/cc/ColorSwitchCC.js +216 -189
  52. package/build/cc/ColorSwitchCC.js.map +1 -1
  53. package/build/cc/ConfigurationCC.d.ts +89 -74
  54. package/build/cc/ConfigurationCC.d.ts.map +1 -1
  55. package/build/cc/ConfigurationCC.js +541 -485
  56. package/build/cc/ConfigurationCC.js.map +1 -1
  57. package/build/cc/DeviceResetLocallyCC.d.ts +3 -3
  58. package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  59. package/build/cc/DeviceResetLocallyCC.js +14 -14
  60. package/build/cc/DeviceResetLocallyCC.js.map +1 -1
  61. package/build/cc/DoorLockCC.d.ts +66 -27
  62. package/build/cc/DoorLockCC.d.ts.map +1 -1
  63. package/build/cc/DoorLockCC.js +288 -197
  64. package/build/cc/DoorLockCC.js.map +1 -1
  65. package/build/cc/DoorLockLoggingCC.d.ts +23 -13
  66. package/build/cc/DoorLockLoggingCC.d.ts.map +1 -1
  67. package/build/cc/DoorLockLoggingCC.js +81 -63
  68. package/build/cc/DoorLockLoggingCC.js.map +1 -1
  69. package/build/cc/EnergyProductionCC.d.ts +16 -14
  70. package/build/cc/EnergyProductionCC.d.ts.map +1 -1
  71. package/build/cc/EnergyProductionCC.js +58 -52
  72. package/build/cc/EnergyProductionCC.js.map +1 -1
  73. package/build/cc/EntryControlCC.d.ts +44 -18
  74. package/build/cc/EntryControlCC.d.ts.map +1 -1
  75. package/build/cc/EntryControlCC.js +163 -112
  76. package/build/cc/EntryControlCC.js.map +1 -1
  77. package/build/cc/FirmwareUpdateMetaDataCC.d.ts +69 -34
  78. package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  79. package/build/cc/FirmwareUpdateMetaDataCC.js +311 -245
  80. package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  81. package/build/cc/HumidityControlModeCC.d.ts +24 -16
  82. package/build/cc/HumidityControlModeCC.d.ts.map +1 -1
  83. package/build/cc/HumidityControlModeCC.js +80 -65
  84. package/build/cc/HumidityControlModeCC.js.map +1 -1
  85. package/build/cc/HumidityControlOperatingStateCC.d.ts +11 -7
  86. package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  87. package/build/cc/HumidityControlOperatingStateCC.js +31 -22
  88. package/build/cc/HumidityControlOperatingStateCC.js.map +1 -1
  89. package/build/cc/HumidityControlSetpointCC.d.ts +68 -49
  90. package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  91. package/build/cc/HumidityControlSetpointCC.js +203 -181
  92. package/build/cc/HumidityControlSetpointCC.js.map +1 -1
  93. package/build/cc/InclusionControllerCC.d.ts +13 -11
  94. package/build/cc/InclusionControllerCC.d.ts.map +1 -1
  95. package/build/cc/InclusionControllerCC.js +49 -42
  96. package/build/cc/InclusionControllerCC.js.map +1 -1
  97. package/build/cc/IndicatorCC.d.ts +46 -39
  98. package/build/cc/IndicatorCC.d.ts.map +1 -1
  99. package/build/cc/IndicatorCC.js +298 -277
  100. package/build/cc/IndicatorCC.js.map +1 -1
  101. package/build/cc/IrrigationCC.d.ts +127 -57
  102. package/build/cc/IrrigationCC.d.ts.map +1 -1
  103. package/build/cc/IrrigationCC.js +496 -352
  104. package/build/cc/IrrigationCC.js.map +1 -1
  105. package/build/cc/LanguageCC.d.ts +17 -11
  106. package/build/cc/LanguageCC.d.ts.map +1 -1
  107. package/build/cc/LanguageCC.js +54 -44
  108. package/build/cc/LanguageCC.js.map +1 -1
  109. package/build/cc/LockCC.d.ts +16 -11
  110. package/build/cc/LockCC.d.ts.map +1 -1
  111. package/build/cc/LockCC.js +48 -38
  112. package/build/cc/LockCC.js.map +1 -1
  113. package/build/cc/ManufacturerProprietaryCC.d.ts +12 -11
  114. package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  115. package/build/cc/ManufacturerProprietaryCC.js +45 -50
  116. package/build/cc/ManufacturerProprietaryCC.js.map +1 -1
  117. package/build/cc/ManufacturerSpecificCC.d.ts +20 -13
  118. package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  119. package/build/cc/ManufacturerSpecificCC.js +79 -63
  120. package/build/cc/ManufacturerSpecificCC.js.map +1 -1
  121. package/build/cc/MeterCC.d.ts +30 -26
  122. package/build/cc/MeterCC.d.ts.map +1 -1
  123. package/build/cc/MeterCC.js +236 -204
  124. package/build/cc/MeterCC.js.map +1 -1
  125. package/build/cc/MultiChannelAssociationCC.d.ts +31 -26
  126. package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  127. package/build/cc/MultiChannelAssociationCC.js +177 -168
  128. package/build/cc/MultiChannelAssociationCC.js.map +1 -1
  129. package/build/cc/MultiChannelCC.d.ts +70 -49
  130. package/build/cc/MultiChannelCC.d.ts.map +1 -1
  131. package/build/cc/MultiChannelCC.js +377 -318
  132. package/build/cc/MultiChannelCC.js.map +1 -1
  133. package/build/cc/MultiCommandCC.d.ts +9 -9
  134. package/build/cc/MultiCommandCC.d.ts.map +1 -1
  135. package/build/cc/MultiCommandCC.js +35 -36
  136. package/build/cc/MultiCommandCC.js.map +1 -1
  137. package/build/cc/MultilevelSensorCC.d.ts +38 -33
  138. package/build/cc/MultilevelSensorCC.d.ts.map +1 -1
  139. package/build/cc/MultilevelSensorCC.js +172 -152
  140. package/build/cc/MultilevelSensorCC.js.map +1 -1
  141. package/build/cc/MultilevelSwitchCC.d.ts +29 -25
  142. package/build/cc/MultilevelSwitchCC.d.ts.map +1 -1
  143. package/build/cc/MultilevelSwitchCC.js +147 -127
  144. package/build/cc/MultilevelSwitchCC.js.map +1 -1
  145. package/build/cc/NoOperationCC.d.ts +0 -8
  146. package/build/cc/NoOperationCC.d.ts.map +1 -1
  147. package/build/cc/NoOperationCC.js +2 -11
  148. package/build/cc/NoOperationCC.js.map +1 -1
  149. package/build/cc/NodeNamingCC.d.ts +27 -17
  150. package/build/cc/NodeNamingCC.d.ts.map +1 -1
  151. package/build/cc/NodeNamingCC.js +86 -69
  152. package/build/cc/NodeNamingCC.js.map +1 -1
  153. package/build/cc/NotificationCC.d.ts +46 -43
  154. package/build/cc/NotificationCC.d.ts.map +1 -1
  155. package/build/cc/NotificationCC.js +317 -303
  156. package/build/cc/NotificationCC.js.map +1 -1
  157. package/build/cc/PowerlevelCC.d.ts +22 -18
  158. package/build/cc/PowerlevelCC.d.ts.map +1 -1
  159. package/build/cc/PowerlevelCC.js +125 -95
  160. package/build/cc/PowerlevelCC.js.map +1 -1
  161. package/build/cc/ProtectionCC.d.ts +49 -26
  162. package/build/cc/ProtectionCC.d.ts.map +1 -1
  163. package/build/cc/ProtectionCC.js +172 -126
  164. package/build/cc/ProtectionCC.js.map +1 -1
  165. package/build/cc/SceneActivationCC.d.ts +8 -7
  166. package/build/cc/SceneActivationCC.d.ts.map +1 -1
  167. package/build/cc/SceneActivationCC.js +28 -23
  168. package/build/cc/SceneActivationCC.js.map +1 -1
  169. package/build/cc/SceneActuatorConfigurationCC.d.ts +23 -15
  170. package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  171. package/build/cc/SceneActuatorConfigurationCC.js +79 -62
  172. package/build/cc/SceneActuatorConfigurationCC.js.map +1 -1
  173. package/build/cc/SceneControllerConfigurationCC.d.ts +25 -17
  174. package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  175. package/build/cc/SceneControllerConfigurationCC.js +92 -78
  176. package/build/cc/SceneControllerConfigurationCC.js.map +1 -1
  177. package/build/cc/ScheduleEntryLockCC.d.ts +86 -72
  178. package/build/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  179. package/build/cc/ScheduleEntryLockCC.js +607 -455
  180. package/build/cc/ScheduleEntryLockCC.js.map +1 -1
  181. package/build/cc/Security2CC.d.ts +78 -87
  182. package/build/cc/Security2CC.d.ts.map +1 -1
  183. package/build/cc/Security2CC.js +798 -765
  184. package/build/cc/Security2CC.js.map +1 -1
  185. package/build/cc/SecurityCC.d.ts +47 -42
  186. package/build/cc/SecurityCC.d.ts.map +1 -1
  187. package/build/cc/SecurityCC.js +240 -218
  188. package/build/cc/SecurityCC.js.map +1 -1
  189. package/build/cc/SoundSwitchCC.d.ts +36 -29
  190. package/build/cc/SoundSwitchCC.d.ts.map +1 -1
  191. package/build/cc/SoundSwitchCC.js +180 -157
  192. package/build/cc/SoundSwitchCC.js.map +1 -1
  193. package/build/cc/SupervisionCC.d.ts +17 -14
  194. package/build/cc/SupervisionCC.d.ts.map +1 -1
  195. package/build/cc/SupervisionCC.js +86 -66
  196. package/build/cc/SupervisionCC.js.map +1 -1
  197. package/build/cc/ThermostatFanModeCC.d.ts +25 -15
  198. package/build/cc/ThermostatFanModeCC.d.ts.map +1 -1
  199. package/build/cc/ThermostatFanModeCC.js +79 -60
  200. package/build/cc/ThermostatFanModeCC.js.map +1 -1
  201. package/build/cc/ThermostatFanStateCC.d.ts +11 -7
  202. package/build/cc/ThermostatFanStateCC.d.ts.map +1 -1
  203. package/build/cc/ThermostatFanStateCC.js +31 -22
  204. package/build/cc/ThermostatFanStateCC.js.map +1 -1
  205. package/build/cc/ThermostatModeCC.d.ts +24 -21
  206. package/build/cc/ThermostatModeCC.d.ts.map +1 -1
  207. package/build/cc/ThermostatModeCC.js +106 -90
  208. package/build/cc/ThermostatModeCC.js.map +1 -1
  209. package/build/cc/ThermostatOperatingStateCC.d.ts +11 -7
  210. package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  211. package/build/cc/ThermostatOperatingStateCC.js +31 -22
  212. package/build/cc/ThermostatOperatingStateCC.js.map +1 -1
  213. package/build/cc/ThermostatSetbackCC.d.ts +14 -13
  214. package/build/cc/ThermostatSetbackCC.d.ts.map +1 -1
  215. package/build/cc/ThermostatSetbackCC.js +64 -57
  216. package/build/cc/ThermostatSetbackCC.js.map +1 -1
  217. package/build/cc/ThermostatSetpointCC.d.ts +38 -57
  218. package/build/cc/ThermostatSetpointCC.d.ts.map +1 -1
  219. package/build/cc/ThermostatSetpointCC.js +200 -264
  220. package/build/cc/ThermostatSetpointCC.js.map +1 -1
  221. package/build/cc/TimeCC.d.ts +24 -20
  222. package/build/cc/TimeCC.d.ts.map +1 -1
  223. package/build/cc/TimeCC.js +119 -108
  224. package/build/cc/TimeCC.js.map +1 -1
  225. package/build/cc/TimeParametersCC.d.ts +18 -14
  226. package/build/cc/TimeParametersCC.d.ts.map +1 -1
  227. package/build/cc/TimeParametersCC.js +77 -69
  228. package/build/cc/TimeParametersCC.js.map +1 -1
  229. package/build/cc/TransportServiceCC.d.ts +29 -32
  230. package/build/cc/TransportServiceCC.d.ts.map +1 -1
  231. package/build/cc/TransportServiceCC.js +159 -161
  232. package/build/cc/TransportServiceCC.js.map +1 -1
  233. package/build/cc/UserCodeCC.d.ts +83 -66
  234. package/build/cc/UserCodeCC.d.ts.map +1 -1
  235. package/build/cc/UserCodeCC.js +449 -402
  236. package/build/cc/UserCodeCC.js.map +1 -1
  237. package/build/cc/VersionCC.d.ts +36 -20
  238. package/build/cc/VersionCC.d.ts.map +1 -1
  239. package/build/cc/VersionCC.js +190 -149
  240. package/build/cc/VersionCC.js.map +1 -1
  241. package/build/cc/WakeUpCC.d.ts +27 -13
  242. package/build/cc/WakeUpCC.d.ts.map +1 -1
  243. package/build/cc/WakeUpCC.js +105 -77
  244. package/build/cc/WakeUpCC.js.map +1 -1
  245. package/build/cc/WindowCoveringCC.d.ts +39 -27
  246. package/build/cc/WindowCoveringCC.d.ts.map +1 -1
  247. package/build/cc/WindowCoveringCC.js +169 -137
  248. package/build/cc/WindowCoveringCC.js.map +1 -1
  249. package/build/cc/ZWavePlusCC.d.ts +8 -7
  250. package/build/cc/ZWavePlusCC.d.ts.map +1 -1
  251. package/build/cc/ZWavePlusCC.js +44 -37
  252. package/build/cc/ZWavePlusCC.js.map +1 -1
  253. package/build/cc/ZWaveProtocolCC.d.ts +111 -84
  254. package/build/cc/ZWaveProtocolCC.d.ts.map +1 -1
  255. package/build/cc/ZWaveProtocolCC.js +583 -508
  256. package/build/cc/ZWaveProtocolCC.js.map +1 -1
  257. package/build/cc/index.d.ts +37 -34
  258. package/build/cc/index.d.ts.map +1 -1
  259. package/build/cc/index.js +6 -7
  260. package/build/cc/index.js.map +1 -1
  261. package/build/cc/manufacturerProprietary/FibaroCC.d.ts +29 -24
  262. package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  263. package/build/cc/manufacturerProprietary/FibaroCC.js +109 -112
  264. package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  265. package/build/index.d.ts +0 -1
  266. package/build/index.d.ts.map +1 -1
  267. package/build/index.js +0 -1
  268. package/build/index.js.map +1 -1
  269. package/build/lib/API.d.ts +21 -18
  270. package/build/lib/API.d.ts.map +1 -1
  271. package/build/lib/API.js +25 -49
  272. package/build/lib/API.js.map +1 -1
  273. package/build/lib/CommandClass.d.ts +51 -89
  274. package/build/lib/CommandClass.d.ts.map +1 -1
  275. package/build/lib/CommandClass.js +177 -249
  276. package/build/lib/CommandClass.js.map +1 -1
  277. package/build/lib/EncapsulatingCommandClass.d.ts +1 -15
  278. package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -1
  279. package/build/lib/EncapsulatingCommandClass.js.map +1 -1
  280. package/build/lib/ICommandClassContainer.d.ts +1 -8
  281. package/build/lib/ICommandClassContainer.d.ts.map +1 -1
  282. package/build/lib/ICommandClassContainer.js +0 -8
  283. package/build/lib/ICommandClassContainer.js.map +1 -1
  284. package/build/lib/Values.d.ts +3 -3
  285. package/build/lib/Values.d.ts.map +1 -1
  286. package/build/lib/_Types.d.ts.map +1 -1
  287. package/build/lib/_Types.js +1 -0
  288. package/build/lib/_Types.js.map +1 -1
  289. package/build/lib/utils.d.ts +14 -13
  290. package/build/lib/utils.d.ts.map +1 -1
  291. package/build/lib/utils.js +94 -92
  292. package/build/lib/utils.js.map +1 -1
  293. package/package.json +4 -5
@@ -28,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  __setModuleDefault(result, mod);
29
29
  return result;
30
30
  };
31
- var NotificationCC_1;
31
+ var NotificationCC_1, NotificationCCSet_1, NotificationCCReport_1, NotificationCCGet_1, NotificationCCSupportedReport_1, NotificationCCEventSupportedReport_1, NotificationCCEventSupportedGet_1;
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.NotificationCCEventSupportedGet = exports.NotificationCCEventSupportedReport = exports.NotificationCCSupportedGet = exports.NotificationCCSupportedReport = exports.NotificationCCGet = exports.NotificationCCReport = exports.NotificationCCSet = exports.NotificationCC = exports.NotificationCCAPI = exports.NotificationCCValues = void 0;
34
34
  exports.getNotificationEnumBehavior = getNotificationEnumBehavior;
@@ -44,7 +44,10 @@ const __assertType__NotificationCCReportOptions = $o => {
44
44
  function _number($o) {
45
45
  return typeof $o !== "number" ? {} : null;
46
46
  }
47
- function _1($o) {
47
+ function _buffer($o) {
48
+ return !Buffer.isBuffer($o) ? {} : null;
49
+ }
50
+ function _0($o) {
48
51
  if (typeof $o !== "object" || $o === null || Array.isArray($o))
49
52
  return {};
50
53
  if ("alarmType" in $o && $o["alarmType"] !== undefined) {
@@ -52,37 +55,26 @@ const __assertType__NotificationCCReportOptions = $o => {
52
55
  if (error)
53
56
  return error;
54
57
  }
55
- else
56
- return {};
57
58
  if ("alarmLevel" in $o && $o["alarmLevel"] !== undefined) {
58
59
  const error = _number($o["alarmLevel"]);
59
60
  if (error)
60
61
  return error;
61
62
  }
62
- else
63
- return {};
64
- return null;
65
- }
66
- function _buffer($o) {
67
- return !Buffer.isBuffer($o) ? {} : null;
68
- }
69
- function _2($o) {
70
- if (typeof $o !== "object" || $o === null || Array.isArray($o))
71
- return {};
72
63
  if ("notificationType" in $o && $o["notificationType"] !== undefined) {
73
64
  const error = _number($o["notificationType"]);
74
65
  if (error)
75
66
  return error;
76
67
  }
77
- else
78
- return {};
79
68
  if ("notificationEvent" in $o && $o["notificationEvent"] !== undefined) {
80
69
  const error = _number($o["notificationEvent"]);
81
70
  if (error)
82
71
  return error;
83
72
  }
84
- else
85
- return {};
73
+ if ("notificationStatus" in $o && $o["notificationStatus"] !== undefined) {
74
+ const error = _number($o["notificationStatus"]);
75
+ if (error)
76
+ return error;
77
+ }
86
78
  if ("eventParameters" in $o && $o["eventParameters"] !== undefined) {
87
79
  const error = _buffer($o["eventParameters"]);
88
80
  if (error)
@@ -95,18 +87,9 @@ const __assertType__NotificationCCReportOptions = $o => {
95
87
  }
96
88
  return null;
97
89
  }
98
- function su__1__2_eu($o) {
99
- const conditions = [_1, _2];
100
- for (const condition of conditions) {
101
- const error = condition($o);
102
- if (!error)
103
- return null;
104
- }
105
- return {};
106
- }
107
- return su__1__2_eu($o);
90
+ return _0($o);
108
91
  };
109
- const __assertType__NotificationCCGetSpecificOptions = $o => {
92
+ const __assertType__NotificationCCGetOptions = $o => {
110
93
  function _number($o) {
111
94
  return typeof $o !== "number" ? {} : null;
112
95
  }
@@ -258,8 +241,8 @@ exports.NotificationCCValues = Object.freeze({
258
241
  undefined),
259
242
  }),
260
243
  });
261
- function shouldAutoCreateSimpleDoorSensorValue(applHost, endpoint) {
262
- const valueDB = applHost.tryGetValueDB(endpoint.nodeId);
244
+ function shouldAutoCreateSimpleDoorSensorValue(ctx, endpoint) {
245
+ const valueDB = ctx.tryGetValueDB(endpoint.nodeId);
263
246
  if (!valueDB)
264
247
  return false;
265
248
  const supportedACEvents = valueDB.getValue(exports.NotificationCCValues.supportedNotificationEvents(
@@ -312,32 +295,31 @@ let NotificationCCAPI = class NotificationCCAPI extends API_1.PhysicalCCAPI {
312
295
  */
313
296
  async getInternal(options) {
314
297
  this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Get);
315
- const cc = new NotificationCCGet(this.applHost, {
298
+ const cc = new NotificationCCGet({
316
299
  nodeId: this.endpoint.nodeId,
317
- endpoint: this.endpoint.index,
300
+ endpointIndex: this.endpoint.index,
318
301
  ...options,
319
302
  });
320
- return this.applHost.sendCommand(cc, this.commandOptions);
303
+ return this.host.sendCommand(cc, this.commandOptions);
321
304
  }
322
305
  async sendReport(options) {
323
306
  __assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
324
307
  this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Report);
325
- const cc = new NotificationCCReport(this.applHost, {
308
+ const cc = new NotificationCCReport({
326
309
  nodeId: this.endpoint.nodeId,
327
- endpoint: this.endpoint.index,
310
+ endpointIndex: this.endpoint.index,
328
311
  ...options,
329
312
  });
330
- return this.applHost.sendCommand(cc, this.commandOptions);
313
+ return this.host.sendCommand(cc, this.commandOptions);
331
314
  }
332
315
  async get(options) {
333
- __assertType("options", "NotificationCCGetSpecificOptions", __assertType__NotificationCCGetSpecificOptions.bind(void 0, options));
316
+ __assertType("options", "NotificationCCGetOptions", __assertType__NotificationCCGetOptions.bind(void 0, options));
334
317
  const response = await this.getInternal(options);
335
318
  if (response) {
336
319
  return (0, safe_2.pick)(response, [
337
320
  "notificationStatus",
338
321
  "notificationEvent",
339
322
  "alarmLevel",
340
- "zensorNetSourceNodeId",
341
323
  "eventParameters",
342
324
  "sequenceNumber",
343
325
  ]);
@@ -347,22 +329,22 @@ let NotificationCCAPI = class NotificationCCAPI extends API_1.PhysicalCCAPI {
347
329
  __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
348
330
  __assertType("notificationStatus", "boolean", __assertType__boolean.bind(void 0, notificationStatus));
349
331
  this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Set);
350
- const cc = new NotificationCCSet(this.applHost, {
332
+ const cc = new NotificationCCSet({
351
333
  nodeId: this.endpoint.nodeId,
352
- endpoint: this.endpoint.index,
334
+ endpointIndex: this.endpoint.index,
353
335
  notificationType,
354
336
  notificationStatus,
355
337
  });
356
- return this.applHost.sendCommand(cc, this.commandOptions);
338
+ return this.host.sendCommand(cc, this.commandOptions);
357
339
  }
358
340
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
359
341
  async getSupported() {
360
342
  this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.SupportedGet);
361
- const cc = new NotificationCCSupportedGet(this.applHost, {
343
+ const cc = new NotificationCCSupportedGet({
362
344
  nodeId: this.endpoint.nodeId,
363
- endpoint: this.endpoint.index,
345
+ endpointIndex: this.endpoint.index,
364
346
  });
365
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
347
+ const response = await this.host.sendCommand(cc, this.commandOptions);
366
348
  if (response) {
367
349
  return (0, safe_2.pick)(response, [
368
350
  "supportsV1Alarm",
@@ -373,12 +355,12 @@ let NotificationCCAPI = class NotificationCCAPI extends API_1.PhysicalCCAPI {
373
355
  async getSupportedEvents(notificationType) {
374
356
  __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
375
357
  this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.EventSupportedGet);
376
- const cc = new NotificationCCEventSupportedGet(this.applHost, {
358
+ const cc = new NotificationCCEventSupportedGet({
377
359
  nodeId: this.endpoint.nodeId,
378
- endpoint: this.endpoint.index,
360
+ endpointIndex: this.endpoint.index,
379
361
  notificationType,
380
362
  });
381
- const response = await this.applHost.sendCommand(cc, this.commandOptions);
363
+ const response = await this.host.sendCommand(cc, this.commandOptions);
382
364
  return response?.supportedEvents;
383
365
  }
384
366
  };
@@ -445,8 +427,8 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
445
427
  safe_1.CommandClasses["Association Group Information"],
446
428
  ];
447
429
  }
448
- async determineNotificationMode(applHost, api, supportedNotificationEvents) {
449
- const node = this.getNode(applHost);
430
+ async determineNotificationMode(ctx, api, supportedNotificationEvents) {
431
+ const node = this.getNode(ctx);
450
432
  // SDS14223: If the supporting node does not support the Association Command Class,
451
433
  // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.
452
434
  if (!node.supportsCC(safe_1.CommandClasses.Association))
@@ -454,14 +436,14 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
454
436
  if (node.supportsCC(safe_1.CommandClasses["Association Group Information"])) {
455
437
  try {
456
438
  const groupsIssueingNotifications = AssociationGroupInfoCC_1.AssociationGroupInfoCC
457
- .findGroupsForIssuedCommand(applHost, node, this.ccId, _Types_1.NotificationCommand.Report);
439
+ .findGroupsForIssuedCommand(ctx, node, this.ccId, _Types_1.NotificationCommand.Report);
458
440
  return groupsIssueingNotifications.length > 0 ? "push" : "pull";
459
441
  }
460
442
  catch {
461
443
  // We might be dealing with an older cache file, fall back to testing
462
444
  }
463
445
  }
464
- applHost.controllerLog.logNode(node.id, {
446
+ ctx.logNode(node.id, {
465
447
  endpoint: this.endpointIndex,
466
448
  message: `determining whether this node is pull or push...`,
467
449
  direction: "outbound",
@@ -496,18 +478,18 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
496
478
  return "push";
497
479
  }
498
480
  /** Whether the node implements push or pull notifications */
499
- static getNotificationMode(applHost, node) {
500
- return applHost
481
+ static getNotificationMode(ctx, node) {
482
+ return ctx
501
483
  .getValueDB(node.id)
502
484
  .getValue(exports.NotificationCCValues.notificationMode.id);
503
485
  }
504
- async interview(applHost) {
505
- const node = this.getNode(applHost);
506
- const endpoint = this.getEndpoint(applHost);
507
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, applHost, endpoint).withOptions({
486
+ async interview(ctx) {
487
+ const node = this.getNode(ctx);
488
+ const endpoint = this.getEndpoint(ctx);
489
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, ctx, endpoint).withOptions({
508
490
  priority: safe_1.MessagePriority.NodeQuery,
509
491
  });
510
- applHost.controllerLog.logNode(node.id, {
492
+ ctx.logNode(node.id, {
511
493
  endpoint: this.endpointIndex,
512
494
  message: `Interviewing ${this.ccName}...`,
513
495
  direction: "none",
@@ -515,25 +497,25 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
515
497
  // If one Association group issues Notification Reports,
516
498
  // we must associate ourselves with that channel
517
499
  try {
518
- await ccUtils.assignLifelineIssueingCommand(applHost, endpoint, this.ccId, _Types_1.NotificationCommand.Report);
500
+ await ccUtils.assignLifelineIssueingCommand(ctx, endpoint, this.ccId, _Types_1.NotificationCommand.Report);
519
501
  }
520
502
  catch {
521
- applHost.controllerLog.logNode(node.id, {
503
+ ctx.logNode(node.id, {
522
504
  endpoint: endpoint.index,
523
505
  message: `Configuring associations to receive ${(0, safe_1.getCCName)(this.ccId)} reports failed!`,
524
506
  level: "warn",
525
507
  });
526
508
  }
527
509
  let supportsV1Alarm = false;
528
- if (this.version >= 2) {
529
- applHost.controllerLog.logNode(node.id, {
510
+ if (api.version >= 2) {
511
+ ctx.logNode(node.id, {
530
512
  endpoint: this.endpointIndex,
531
513
  message: "querying supported notification types...",
532
514
  direction: "outbound",
533
515
  });
534
516
  const suppResponse = await api.getSupported();
535
517
  if (!suppResponse) {
536
- applHost.controllerLog.logNode(node.id, {
518
+ ctx.logNode(node.id, {
537
519
  endpoint: this.endpointIndex,
538
520
  message: "Querying supported notification types timed out, skipping interview...",
539
521
  level: "warn",
@@ -547,17 +529,17 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
547
529
  const logMessage = `received supported notification types:${supportedNotificationNames
548
530
  .map((name) => `\n· ${name}`)
549
531
  .join("")}`;
550
- applHost.controllerLog.logNode(node.id, {
532
+ ctx.logNode(node.id, {
551
533
  endpoint: this.endpointIndex,
552
534
  message: logMessage,
553
535
  direction: "inbound",
554
536
  });
555
- if (this.version >= 3) {
537
+ if (api.version >= 3) {
556
538
  // Query each notification for its supported events
557
539
  for (let i = 0; i < supportedNotificationTypes.length; i++) {
558
540
  const type = supportedNotificationTypes[i];
559
541
  const name = supportedNotificationNames[i];
560
- applHost.controllerLog.logNode(node.id, {
542
+ ctx.logNode(node.id, {
561
543
  endpoint: this.endpointIndex,
562
544
  message: `querying supported notification events for ${name}...`,
563
545
  direction: "outbound",
@@ -565,7 +547,7 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
565
547
  const supportedEvents = await api.getSupportedEvents(type);
566
548
  if (supportedEvents) {
567
549
  supportedNotificationEvents.set(type, supportedEvents);
568
- applHost.controllerLog.logNode(node.id, {
550
+ ctx.logNode(node.id, {
569
551
  endpoint: this.endpointIndex,
570
552
  message: `received supported notification events for ${name}: ${supportedEvents
571
553
  .map(String)
@@ -576,13 +558,13 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
576
558
  }
577
559
  }
578
560
  // Determine whether the node is a push or pull node
579
- let notificationMode = this.getValue(applHost, exports.NotificationCCValues.notificationMode);
561
+ let notificationMode = this.getValue(ctx, exports.NotificationCCValues.notificationMode);
580
562
  if (notificationMode !== "push" && notificationMode !== "pull") {
581
- notificationMode = await this.determineNotificationMode(applHost, api, supportedNotificationEvents);
582
- this.setValue(applHost, exports.NotificationCCValues.notificationMode, notificationMode);
563
+ notificationMode = await this.determineNotificationMode(ctx, api, supportedNotificationEvents);
564
+ this.setValue(ctx, exports.NotificationCCValues.notificationMode, notificationMode);
583
565
  }
584
566
  if (notificationMode === "pull") {
585
- await this.refreshValues(applHost);
567
+ await this.refreshValues(ctx);
586
568
  } /* if (notificationMode === "push") */
587
569
  else {
588
570
  for (let i = 0; i < supportedNotificationTypes.length; i++) {
@@ -590,7 +572,7 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
590
572
  const name = supportedNotificationNames[i];
591
573
  const notification = (0, core_1.getNotification)(type);
592
574
  // Enable reports for each notification type
593
- applHost.controllerLog.logNode(node.id, {
575
+ ctx.logNode(node.id, {
594
576
  endpoint: this.endpointIndex,
595
577
  message: `enabling notifications for ${name}...`,
596
578
  direction: "outbound",
@@ -610,9 +592,9 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
610
592
  // TODO: GH#1028
611
593
  // * do this only if the last update was more than 5 minutes ago
612
594
  // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start
613
- if (this.getValue(applHost, value)
595
+ if (this.getValue(ctx, value)
614
596
  == undefined) {
615
- this.setValue(applHost, value, 0);
597
+ this.setValue(ctx, value, 0);
616
598
  }
617
599
  }
618
600
  }
@@ -622,12 +604,12 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
622
604
  }
623
605
  }
624
606
  // Only create metadata for V1 values if necessary
625
- if (this.version === 1 || supportsV1Alarm) {
626
- this.ensureMetadata(applHost, exports.NotificationCCValues.alarmType);
627
- this.ensureMetadata(applHost, exports.NotificationCCValues.alarmLevel);
607
+ if (api.version === 1 || supportsV1Alarm) {
608
+ this.ensureMetadata(ctx, exports.NotificationCCValues.alarmType);
609
+ this.ensureMetadata(ctx, exports.NotificationCCValues.alarmLevel);
628
610
  }
629
611
  // Also create metadata for values mapped through compat config
630
- const mappings = applHost.getDeviceConfig?.(this.nodeId)
612
+ const mappings = ctx.getDeviceConfig?.(this.nodeId)
631
613
  ?.compat?.alarmMapping;
632
614
  if (mappings) {
633
615
  // Find all mappings to a valid notification variable
@@ -649,43 +631,43 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
649
631
  const notificationValue = exports.NotificationCCValues
650
632
  .notificationVariable(notification.name, valueConfig.variableName);
651
633
  // Create or update the metadata
652
- const metadata = getNotificationValueMetadata(this.getMetadata(applHost, notificationValue), notification, valueConfig);
653
- this.setMetadata(applHost, notificationValue, metadata);
634
+ const metadata = getNotificationValueMetadata(this.getMetadata(ctx, notificationValue), notification, valueConfig);
635
+ this.setMetadata(ctx, notificationValue, metadata);
654
636
  // Set the value to idle if it has no value yet
655
637
  if (valueConfig.idle) {
656
638
  // TODO: GH#1028
657
639
  // * do this only if the last update was more than 5 minutes ago
658
640
  // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start
659
- if (this.getValue(applHost, notificationValue) == undefined) {
660
- this.setValue(applHost, notificationValue, 0);
641
+ if (this.getValue(ctx, notificationValue) == undefined) {
642
+ this.setValue(ctx, notificationValue, 0);
661
643
  }
662
644
  }
663
645
  }
664
646
  // Remember supported notification types and events in the cache
665
- this.setValue(applHost, exports.NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);
647
+ this.setValue(ctx, exports.NotificationCCValues.supportedNotificationTypes, [...supportedNotifications.keys()]);
666
648
  for (const [type, events] of supportedNotifications) {
667
- this.setValue(applHost, exports.NotificationCCValues.supportedNotificationEvents(type), [...events]);
649
+ this.setValue(ctx, exports.NotificationCCValues.supportedNotificationEvents(type), [...events]);
668
650
  }
669
651
  }
670
652
  // Remember that the interview is complete
671
- this.setInterviewComplete(applHost, true);
653
+ this.setInterviewComplete(ctx, true);
672
654
  }
673
- async refreshValues(applHost) {
674
- const node = this.getNode(applHost);
655
+ async refreshValues(ctx) {
656
+ const node = this.getNode(ctx);
675
657
  // Refreshing values only works on pull nodes
676
- if (NotificationCC_1.getNotificationMode(applHost, node) === "pull") {
677
- const endpoint = this.getEndpoint(applHost);
678
- const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, applHost, endpoint).withOptions({
658
+ if (NotificationCC_1.getNotificationMode(ctx, node) === "pull") {
659
+ const endpoint = this.getEndpoint(ctx);
660
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, ctx, endpoint).withOptions({
679
661
  priority: safe_1.MessagePriority.NodeQuery,
680
662
  });
681
663
  // Load supported notification types and events from cache
682
- const supportedNotificationTypes = this.getValue(applHost, exports.NotificationCCValues.supportedNotificationTypes) ?? [];
664
+ const supportedNotificationTypes = this.getValue(ctx, exports.NotificationCCValues.supportedNotificationTypes) ?? [];
683
665
  const supportedNotificationNames = supportedNotificationTypes.map(core_1.getNotificationName);
684
666
  for (let i = 0; i < supportedNotificationTypes.length; i++) {
685
667
  const type = supportedNotificationTypes[i];
686
668
  const name = supportedNotificationNames[i];
687
669
  // Always query each notification for its current status
688
- applHost.controllerLog.logNode(node.id, {
670
+ ctx.logNode(node.id, {
689
671
  endpoint: this.endpointIndex,
690
672
  message: `querying notification status for ${name}...`,
691
673
  direction: "outbound",
@@ -701,15 +683,15 @@ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClas
701
683
  await node.handleCommand(response);
702
684
  }
703
685
  // Remember when we did this
704
- this.setValue(applHost, exports.NotificationCCValues.lastRefresh, Date.now());
686
+ this.setValue(ctx, exports.NotificationCCValues.lastRefresh, Date.now());
705
687
  }
706
688
  }
707
- shouldRefreshValues(applHost) {
689
+ shouldRefreshValues(ctx) {
708
690
  // Pull-mode nodes must be polled regularly
709
- const isPullMode = NotificationCC_1.getNotificationMode(applHost, this.getNode(applHost)) === "pull";
691
+ const isPullMode = NotificationCC_1.getNotificationMode(ctx, this.getNode(ctx)) === "pull";
710
692
  if (!isPullMode)
711
693
  return false;
712
- const lastUpdated = this.getValue(applHost, exports.NotificationCCValues.lastRefresh);
694
+ const lastUpdated = this.getValue(ctx, exports.NotificationCCValues.lastRefresh);
713
695
  return (lastUpdated == undefined
714
696
  || Date.now() - lastUpdated > core_1.timespan.hours(6));
715
697
  }
@@ -720,31 +702,34 @@ exports.NotificationCC = NotificationCC = NotificationCC_1 = __decorate([
720
702
  (0, CommandClassDecorators_1.implementedVersion)(8),
721
703
  (0, CommandClassDecorators_1.ccValues)(exports.NotificationCCValues)
722
704
  ], NotificationCC);
723
- let NotificationCCSet = class NotificationCCSet extends NotificationCC {
724
- constructor(host, options) {
725
- super(host, options);
726
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
727
- (0, safe_1.validatePayload)(this.payload.length >= 2);
728
- this.notificationType = this.payload[0];
729
- this.notificationStatus = this.payload[1] === 0xff;
730
- }
731
- else {
732
- this.notificationType = options.notificationType;
733
- this.notificationStatus = options.notificationStatus;
734
- }
705
+ let NotificationCCSet = NotificationCCSet_1 = class NotificationCCSet extends NotificationCC {
706
+ constructor(options) {
707
+ super(options);
708
+ this.notificationType = options.notificationType;
709
+ this.notificationStatus = options.notificationStatus;
710
+ }
711
+ static from(raw, ctx) {
712
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
713
+ const notificationType = raw.payload[0];
714
+ const notificationStatus = raw.payload[1] === 0xff;
715
+ return new NotificationCCSet_1({
716
+ nodeId: ctx.sourceNodeId,
717
+ notificationType,
718
+ notificationStatus,
719
+ });
735
720
  }
736
721
  notificationType;
737
722
  notificationStatus;
738
- serialize() {
723
+ serialize(ctx) {
739
724
  this.payload = Buffer.from([
740
725
  this.notificationType,
741
726
  this.notificationStatus ? 0xff : 0x00,
742
727
  ]);
743
- return super.serialize();
728
+ return super.serialize(ctx);
744
729
  }
745
- toLogEntry(host) {
730
+ toLogEntry(ctx) {
746
731
  return {
747
- ...super.toLogEntry(host),
732
+ ...super.toLogEntry(ctx),
748
733
  message: {
749
734
  "notification type": (0, core_1.getNotificationName)(this.notificationType),
750
735
  status: this.notificationStatus,
@@ -753,77 +738,85 @@ let NotificationCCSet = class NotificationCCSet extends NotificationCC {
753
738
  }
754
739
  };
755
740
  exports.NotificationCCSet = NotificationCCSet;
756
- exports.NotificationCCSet = NotificationCCSet = __decorate([
741
+ exports.NotificationCCSet = NotificationCCSet = NotificationCCSet_1 = __decorate([
757
742
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.Set),
758
743
  (0, CommandClassDecorators_1.useSupervision)()
759
744
  ], NotificationCCSet);
760
- let NotificationCCReport = class NotificationCCReport extends NotificationCC {
761
- constructor(host, options) {
762
- super(host, options);
763
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
764
- (0, safe_1.validatePayload)(this.payload.length >= 2);
765
- this.alarmType = this.payload[0];
766
- this.alarmLevel = this.payload[1];
767
- // V2..V3, reserved in V4+
768
- if ((this.version === 2 || this.version === 3)
769
- && this.payload.length >= 3) {
770
- this.zensorNetSourceNodeId = this.payload[2];
771
- }
772
- // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.
773
- // Don't use the version to decide because we might discard notifications
774
- // before the interview is complete
775
- if (this.payload.length >= 7) {
776
- this.notificationStatus = this.payload[3];
777
- this.notificationType = this.payload[4];
778
- this.notificationEvent = this.payload[5];
779
- const containsSeqNum = !!(this.payload[6] & 0b1000_0000);
780
- const numEventParams = this.payload[6] & 0b11111;
781
- if (numEventParams > 0) {
782
- (0, safe_1.validatePayload)(this.payload.length >= 7 + numEventParams);
783
- this.eventParameters = Buffer.from(this.payload.subarray(7, 7 + numEventParams));
784
- }
785
- if (containsSeqNum) {
786
- (0, safe_1.validatePayload)(this.payload.length >= 7 + numEventParams + 1);
787
- this.sequenceNumber = this.payload[7 + numEventParams];
788
- }
789
- }
790
- // Store the V1 alarm values if they exist
745
+ let NotificationCCReport = NotificationCCReport_1 = class NotificationCCReport extends NotificationCC {
746
+ constructor(options) {
747
+ super(options);
748
+ if (options.alarmType != undefined) {
749
+ this.alarmType = options.alarmType;
750
+ this.alarmLevel = options.alarmLevel;
791
751
  }
792
- else {
793
- // Create a notification to send
794
- if ("alarmType" in options) {
795
- this.alarmType = options.alarmType;
796
- this.alarmLevel = options.alarmLevel;
797
- // Send a V1 command
798
- this.version = 1;
799
- }
800
- else {
801
- this.notificationType = options.notificationType;
802
- this.notificationStatus = true;
803
- this.notificationEvent = options.notificationEvent;
804
- this.eventParameters = options.eventParameters;
805
- this.sequenceNumber = options.sequenceNumber;
806
- }
752
+ if (options.notificationType != undefined) {
753
+ this.notificationType = options.notificationType;
754
+ this.notificationStatus = options.notificationStatus ?? true;
755
+ this.notificationEvent = options.notificationEvent;
756
+ this.eventParameters = options.eventParameters;
757
+ this.sequenceNumber = options.sequenceNumber;
807
758
  }
808
759
  }
809
- persistValues(applHost) {
810
- if (!super.persistValues(applHost))
760
+ static from(raw, ctx) {
761
+ (0, safe_1.validatePayload)(raw.payload.length >= 2);
762
+ const alarmType = raw.payload[0];
763
+ const alarmLevel = raw.payload[1];
764
+ // Byte 2 used to be zensorNetSourceNodeId in V2 and V3, but we don't care about that
765
+ if (raw.payload.length < 7) {
766
+ return new NotificationCCReport_1({
767
+ nodeId: ctx.sourceNodeId,
768
+ alarmType,
769
+ alarmLevel,
770
+ });
771
+ }
772
+ // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.
773
+ // Don't use the version to decide because we might discard notifications
774
+ // before the interview is complete
775
+ const notificationStatus = raw.payload[3];
776
+ const notificationType = raw.payload[4];
777
+ const notificationEvent = raw.payload[5];
778
+ const containsSeqNum = !!(raw.payload[6] & 0b1000_0000);
779
+ const numEventParams = raw.payload[6] & 0b11111;
780
+ let eventParameters;
781
+ if (numEventParams > 0) {
782
+ (0, safe_1.validatePayload)(raw.payload.length >= 7 + numEventParams);
783
+ eventParameters = Buffer.from(raw.payload.subarray(7, 7 + numEventParams));
784
+ }
785
+ let sequenceNumber;
786
+ if (containsSeqNum) {
787
+ (0, safe_1.validatePayload)(raw.payload.length >= 7 + numEventParams + 1);
788
+ sequenceNumber = raw.payload[7 + numEventParams];
789
+ }
790
+ return new NotificationCCReport_1({
791
+ nodeId: ctx.sourceNodeId,
792
+ alarmType,
793
+ alarmLevel,
794
+ notificationStatus,
795
+ notificationType,
796
+ notificationEvent,
797
+ eventParameters,
798
+ sequenceNumber,
799
+ });
800
+ }
801
+ persistValues(ctx) {
802
+ if (!super.persistValues(ctx))
811
803
  return false;
804
+ const ccVersion = (0, CommandClass_1.getEffectiveCCVersion)(ctx, this);
812
805
  // Check if we need to re-interpret the alarm values somehow
813
806
  if (this.alarmType != undefined
814
807
  && this.alarmLevel != undefined
815
808
  && this.alarmType !== 0) {
816
- if (this.version >= 2) {
809
+ if (ccVersion >= 2) {
817
810
  // Check if the device actually supports Notification CC, but chooses
818
811
  // to send Alarm frames instead (GH#1034)
819
- const supportedNotificationTypes = this.getValue(applHost, exports.NotificationCCValues.supportedNotificationTypes);
812
+ const supportedNotificationTypes = this.getValue(ctx, exports.NotificationCCValues.supportedNotificationTypes);
820
813
  if ((0, typeguards_1.isArray)(supportedNotificationTypes)
821
814
  && supportedNotificationTypes.includes(this.alarmType)) {
822
- const supportedNotificationEvents = this.getValue(applHost, exports.NotificationCCValues.supportedNotificationEvents(this.alarmType));
815
+ const supportedNotificationEvents = this.getValue(ctx, exports.NotificationCCValues.supportedNotificationEvents(this.alarmType));
823
816
  if ((0, typeguards_1.isArray)(supportedNotificationEvents)
824
817
  && supportedNotificationEvents.includes(this.alarmLevel)) {
825
818
  // This alarm frame corresponds to a valid notification event
826
- applHost.controllerLog.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
819
+ ctx.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
827
820
  this.notificationType = this.alarmType;
828
821
  this.notificationEvent = this.alarmLevel;
829
822
  this.alarmType = undefined;
@@ -833,12 +826,12 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
833
826
  }
834
827
  else {
835
828
  // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report
836
- const mapping = this.host.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
829
+ const mapping = ctx.getDeviceConfig?.(this.nodeId)?.compat?.alarmMapping;
837
830
  const match = mapping?.find((m) => m.from.alarmType === this.alarmType
838
831
  && (m.from.alarmLevel == undefined
839
832
  || m.from.alarmLevel === this.alarmLevel));
840
833
  if (match) {
841
- applHost.controllerLog.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
834
+ ctx.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
842
835
  this.notificationType = match.to.notificationType;
843
836
  this.notificationEvent = match.to.notificationEvent;
844
837
  if (match.to.eventParameters) {
@@ -858,16 +851,16 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
858
851
  }
859
852
  }
860
853
  // Now we can interpret the event parameters and turn them into something useful
861
- this.parseEventParameters(applHost);
854
+ this.parseEventParameters(ctx);
862
855
  if (this.alarmType != undefined) {
863
856
  const alarmTypeValue = exports.NotificationCCValues.alarmType;
864
- this.ensureMetadata(applHost, alarmTypeValue);
865
- this.setValue(applHost, alarmTypeValue, this.alarmType);
857
+ this.ensureMetadata(ctx, alarmTypeValue);
858
+ this.setValue(ctx, alarmTypeValue, this.alarmType);
866
859
  }
867
860
  if (this.alarmLevel != undefined) {
868
861
  const alarmLevelValue = exports.NotificationCCValues.alarmLevel;
869
- this.ensureMetadata(applHost, alarmLevelValue);
870
- this.setValue(applHost, alarmLevelValue, this.alarmLevel);
862
+ this.ensureMetadata(ctx, alarmLevelValue);
863
+ this.setValue(ctx, alarmLevelValue, this.alarmLevel);
871
864
  }
872
865
  return true;
873
866
  }
@@ -876,10 +869,9 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
876
869
  notificationType;
877
870
  notificationStatus;
878
871
  notificationEvent;
879
- zensorNetSourceNodeId;
880
872
  eventParameters;
881
873
  sequenceNumber;
882
- toLogEntry(host) {
874
+ toLogEntry(ctx) {
883
875
  let message = {};
884
876
  if (this.alarmType) {
885
877
  message = {
@@ -919,9 +911,6 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
919
911
  };
920
912
  }
921
913
  }
922
- if (this.zensorNetSourceNodeId) {
923
- message["zensor net source node id"] = this.zensorNetSourceNodeId;
924
- }
925
914
  if (this.sequenceNumber != undefined) {
926
915
  message["sequence number"] = this.sequenceNumber;
927
916
  }
@@ -960,11 +949,11 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
960
949
  }
961
950
  }
962
951
  return {
963
- ...super.toLogEntry(host),
952
+ ...super.toLogEntry(ctx),
964
953
  message,
965
954
  };
966
955
  }
967
- parseEventParameters(applHost) {
956
+ parseEventParameters(ctx) {
968
957
  // This only makes sense for V2+ notifications
969
958
  if (this.notificationType == undefined
970
959
  || this.notificationEvent == undefined) {
@@ -1006,12 +995,21 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
1006
995
  // Try to parse the event parameters - if this fails, we should still handle the notification report
1007
996
  try {
1008
997
  // Convert CommandClass instances to a standardized object representation
1009
- const cc = CommandClass_1.CommandClass.from(this.host, {
1010
- data: this.eventParameters,
1011
- fromEncapsulation: true,
1012
- encapCC: this,
998
+ const cc = CommandClass_1.CommandClass.parse(this.eventParameters, {
999
+ ...ctx,
1000
+ frameType: "singlecast",
1001
+ sourceNodeId: this.nodeId,
1002
+ // Security encapsulation is handled outside of this CC,
1003
+ // so it is not needed here:
1004
+ hasSecurityClass: () => false,
1005
+ getHighestSecurityClass: () => safe_1.SecurityClass.None,
1006
+ setSecurityClass: () => { },
1007
+ securityManager: undefined,
1008
+ securityManager2: undefined,
1009
+ securityManagerLR: undefined,
1013
1010
  });
1014
1011
  (0, safe_1.validatePayload)(!(cc instanceof CommandClass_1.InvalidCC));
1012
+ cc.encapsulatingCC = this;
1015
1013
  if ((0, NotificationEventPayload_1.isNotificationEventPayload)(cc)) {
1016
1014
  this.eventParameters = cc
1017
1015
  .toNotificationEventParameters();
@@ -1032,8 +1030,7 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
1032
1030
  && e.code
1033
1031
  === safe_1.ZWaveErrorCodes.PacketFormat_InvalidPayload
1034
1032
  && Buffer.isBuffer(this.eventParameters)) {
1035
- const ccId = CommandClass_1.CommandClass.getCommandClass(this.eventParameters);
1036
- const ccCommand = CommandClass_1.CommandClass.getCCCommand(this.eventParameters);
1033
+ const { ccId, ccCommand } = CommandClass_1.CCRaw.parse(this.eventParameters);
1037
1034
  if (ccId === safe_1.CommandClasses["User Code"]
1038
1035
  && ccCommand === _Types_1.UserCodeCommand.Report
1039
1036
  && this.eventParameters.length >= 3) {
@@ -1044,7 +1041,7 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
1044
1041
  };
1045
1042
  }
1046
1043
  else {
1047
- applHost.controllerLog.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
1044
+ ctx.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
1048
1045
  }
1049
1046
  }
1050
1047
  else {
@@ -1079,17 +1076,10 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
1079
1076
  }
1080
1077
  }
1081
1078
  }
1082
- serialize() {
1083
- if (this.version === 1) {
1084
- if (this.alarmLevel == undefined || this.alarmType == undefined) {
1085
- throw new safe_1.ZWaveError(`Notification CC V1 (Alarm CC) reports requires the alarm type and level to be set!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
1086
- }
1087
- this.payload = Buffer.from([this.alarmType, this.alarmLevel]);
1088
- }
1089
- else {
1090
- if (this.notificationType == undefined
1091
- || this.notificationEvent == undefined) {
1092
- throw new safe_1.ZWaveError(`Notification CC reports requires the notification type and event to be set!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
1079
+ serialize(ctx) {
1080
+ if (this.notificationType != undefined) {
1081
+ if (this.notificationEvent == undefined) {
1082
+ throw new safe_1.ZWaveError(`Notification CC reports requires the notification event to be set!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
1093
1083
  }
1094
1084
  else if (this.eventParameters != undefined
1095
1085
  && !Buffer.isBuffer(this.eventParameters)) {
@@ -1119,35 +1109,51 @@ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
1119
1109
  ]);
1120
1110
  }
1121
1111
  }
1122
- return super.serialize();
1112
+ else {
1113
+ this.payload = Buffer.from([
1114
+ this.alarmType ?? 0x00,
1115
+ this.alarmLevel ?? 0x00,
1116
+ ]);
1117
+ }
1118
+ return super.serialize(ctx);
1123
1119
  }
1124
1120
  };
1125
1121
  exports.NotificationCCReport = NotificationCCReport;
1126
- exports.NotificationCCReport = NotificationCCReport = __decorate([
1122
+ exports.NotificationCCReport = NotificationCCReport = NotificationCCReport_1 = __decorate([
1127
1123
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.Report),
1128
1124
  (0, CommandClassDecorators_1.useSupervision)()
1129
1125
  ], NotificationCCReport);
1130
- let NotificationCCGet = class NotificationCCGet extends NotificationCC {
1131
- constructor(host, options) {
1132
- super(host, options);
1133
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1134
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1135
- this.alarmType = this.payload[0] || undefined;
1136
- if (this.payload.length >= 2) {
1137
- this.notificationType = this.payload[1] || undefined;
1138
- if (this.payload.length >= 3 && this.notificationType != 0xff) {
1139
- this.notificationEvent = this.payload[2];
1140
- }
1141
- }
1126
+ let NotificationCCGet = NotificationCCGet_1 = class NotificationCCGet extends NotificationCC {
1127
+ constructor(options) {
1128
+ super(options);
1129
+ if ("alarmType" in options) {
1130
+ this.alarmType = options.alarmType;
1142
1131
  }
1143
1132
  else {
1144
- if ("alarmType" in options) {
1145
- this.alarmType = options.alarmType;
1146
- }
1147
- else {
1148
- this.notificationType = options.notificationType;
1149
- this.notificationEvent = options.notificationEvent;
1133
+ this.notificationType = options.notificationType;
1134
+ this.notificationEvent = options.notificationEvent;
1135
+ }
1136
+ }
1137
+ static from(raw, ctx) {
1138
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1139
+ if (raw.payload.length >= 2) {
1140
+ const notificationType = raw.payload[1];
1141
+ let notificationEvent;
1142
+ if (raw.payload.length >= 3 && notificationType != 0xff) {
1143
+ notificationEvent = raw.payload[2];
1150
1144
  }
1145
+ return new NotificationCCGet_1({
1146
+ nodeId: ctx.sourceNodeId,
1147
+ notificationType,
1148
+ notificationEvent,
1149
+ });
1150
+ }
1151
+ else {
1152
+ const alarmType = raw.payload[0];
1153
+ return new NotificationCCGet_1({
1154
+ nodeId: ctx.sourceNodeId,
1155
+ alarmType,
1156
+ });
1151
1157
  }
1152
1158
  }
1153
1159
  /** Proprietary V1/V2 alarm type */
@@ -1155,20 +1161,18 @@ let NotificationCCGet = class NotificationCCGet extends NotificationCC {
1155
1161
  /** Regulated V3+ notification type */
1156
1162
  notificationType;
1157
1163
  notificationEvent;
1158
- serialize() {
1159
- const payload = [this.alarmType || 0];
1160
- if (this.version >= 2 && this.notificationType != undefined) {
1161
- payload.push(this.notificationType);
1162
- if (this.version >= 3) {
1163
- payload.push(this.notificationType === 0xff
1164
- ? 0x00
1165
- : this.notificationEvent || 0);
1166
- }
1167
- }
1168
- this.payload = Buffer.from(payload);
1169
- return super.serialize();
1164
+ serialize(ctx) {
1165
+ const notificationEvent = this.notificationEvent === 0xff
1166
+ ? 0x00
1167
+ : this.notificationEvent;
1168
+ this.payload = Buffer.from([
1169
+ this.alarmType ?? 0x00,
1170
+ this.notificationType ?? 0xff,
1171
+ notificationEvent ?? 0x00,
1172
+ ]);
1173
+ return super.serialize(ctx);
1170
1174
  }
1171
- toLogEntry(host) {
1175
+ toLogEntry(ctx) {
1172
1176
  const message = {};
1173
1177
  if (this.alarmType != undefined) {
1174
1178
  message["V1 alarm type"] = this.alarmType;
@@ -1180,38 +1184,40 @@ let NotificationCCGet = class NotificationCCGet extends NotificationCC {
1180
1184
  }
1181
1185
  }
1182
1186
  return {
1183
- ...super.toLogEntry(host),
1187
+ ...super.toLogEntry(ctx),
1184
1188
  message,
1185
1189
  };
1186
1190
  }
1187
1191
  };
1188
1192
  exports.NotificationCCGet = NotificationCCGet;
1189
- exports.NotificationCCGet = NotificationCCGet = __decorate([
1193
+ exports.NotificationCCGet = NotificationCCGet = NotificationCCGet_1 = __decorate([
1190
1194
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.Get),
1191
1195
  (0, CommandClassDecorators_1.expectedCCResponse)(NotificationCCReport)
1192
1196
  ], NotificationCCGet);
1193
- let NotificationCCSupportedReport = class NotificationCCSupportedReport extends NotificationCC {
1194
- constructor(host, options) {
1195
- super(host, options);
1196
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1197
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1198
- this.supportsV1Alarm = !!(this.payload[0] & 0b1000_0000);
1199
- const numBitMaskBytes = this.payload[0] & 0b0001_1111;
1200
- (0, safe_1.validatePayload)(numBitMaskBytes > 0, this.payload.length >= 1 + numBitMaskBytes);
1201
- const notificationBitMask = this.payload.subarray(1, 1 + numBitMaskBytes);
1202
- this.supportedNotificationTypes = (0, safe_1.parseBitMask)(notificationBitMask,
1203
- // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1204
- 0);
1205
- }
1206
- else {
1207
- this.supportsV1Alarm = options.supportsV1Alarm;
1208
- this.supportedNotificationTypes =
1209
- options.supportedNotificationTypes;
1210
- }
1197
+ let NotificationCCSupportedReport = NotificationCCSupportedReport_1 = class NotificationCCSupportedReport extends NotificationCC {
1198
+ constructor(options) {
1199
+ super(options);
1200
+ this.supportsV1Alarm = options.supportsV1Alarm;
1201
+ this.supportedNotificationTypes = options.supportedNotificationTypes;
1202
+ }
1203
+ static from(raw, ctx) {
1204
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1205
+ const supportsV1Alarm = !!(raw.payload[0] & 0b1000_0000);
1206
+ const numBitMaskBytes = raw.payload[0] & 0b0001_1111;
1207
+ (0, safe_1.validatePayload)(numBitMaskBytes > 0, raw.payload.length >= 1 + numBitMaskBytes);
1208
+ const notificationBitMask = raw.payload.subarray(1, 1 + numBitMaskBytes);
1209
+ const supportedNotificationTypes = (0, safe_1.parseBitMask)(notificationBitMask,
1210
+ // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1211
+ 0);
1212
+ return new NotificationCCSupportedReport_1({
1213
+ nodeId: ctx.sourceNodeId,
1214
+ supportsV1Alarm,
1215
+ supportedNotificationTypes,
1216
+ });
1211
1217
  }
1212
1218
  supportsV1Alarm;
1213
1219
  supportedNotificationTypes;
1214
- serialize() {
1220
+ serialize(ctx) {
1215
1221
  const bitMask = (0, safe_1.encodeBitMask)(this.supportedNotificationTypes, Math.max(...this.supportedNotificationTypes), 0);
1216
1222
  this.payload = Buffer.concat([
1217
1223
  Buffer.from([
@@ -1219,11 +1225,11 @@ let NotificationCCSupportedReport = class NotificationCCSupportedReport extends
1219
1225
  ]),
1220
1226
  bitMask,
1221
1227
  ]);
1222
- return super.serialize();
1228
+ return super.serialize(ctx);
1223
1229
  }
1224
- toLogEntry(host) {
1230
+ toLogEntry(ctx) {
1225
1231
  return {
1226
- ...super.toLogEntry(host),
1232
+ ...super.toLogEntry(ctx),
1227
1233
  message: {
1228
1234
  "supports V1 alarm": this.supportsV1Alarm,
1229
1235
  "supported notification types": this.supportedNotificationTypes
@@ -1240,7 +1246,7 @@ __decorate([
1240
1246
  __decorate([
1241
1247
  (0, CommandClassDecorators_1.ccValue)(exports.NotificationCCValues.supportedNotificationTypes)
1242
1248
  ], NotificationCCSupportedReport.prototype, "supportedNotificationTypes", void 0);
1243
- exports.NotificationCCSupportedReport = NotificationCCSupportedReport = __decorate([
1249
+ exports.NotificationCCSupportedReport = NotificationCCSupportedReport = NotificationCCSupportedReport_1 = __decorate([
1244
1250
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.SupportedReport)
1245
1251
  ], NotificationCCSupportedReport);
1246
1252
  let NotificationCCSupportedGet = class NotificationCCSupportedGet extends NotificationCC {
@@ -1250,39 +1256,45 @@ exports.NotificationCCSupportedGet = NotificationCCSupportedGet = __decorate([
1250
1256
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.SupportedGet),
1251
1257
  (0, CommandClassDecorators_1.expectedCCResponse)(NotificationCCSupportedReport)
1252
1258
  ], NotificationCCSupportedGet);
1253
- let NotificationCCEventSupportedReport = class NotificationCCEventSupportedReport extends NotificationCC {
1254
- constructor(host, options) {
1255
- super(host, options);
1256
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1257
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1258
- this.notificationType = this.payload[0];
1259
- const numBitMaskBytes = this.payload[1] & 0b000_11111;
1260
- if (numBitMaskBytes === 0) {
1261
- // Notification type is not supported
1262
- this.supportedEvents = [];
1263
- return;
1264
- }
1265
- (0, safe_1.validatePayload)(this.payload.length >= 2 + numBitMaskBytes);
1266
- const eventBitMask = this.payload.subarray(2, 2 + numBitMaskBytes);
1267
- this.supportedEvents = (0, safe_1.parseBitMask)(eventBitMask,
1268
- // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1269
- 0);
1270
- }
1271
- else {
1272
- this.notificationType = options.notificationType;
1273
- this.supportedEvents = options.supportedEvents;
1259
+ let NotificationCCEventSupportedReport = NotificationCCEventSupportedReport_1 = class NotificationCCEventSupportedReport extends NotificationCC {
1260
+ constructor(options) {
1261
+ super(options);
1262
+ this.notificationType = options.notificationType;
1263
+ this.supportedEvents = options.supportedEvents;
1264
+ }
1265
+ static from(raw, ctx) {
1266
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1267
+ const notificationType = raw.payload[0];
1268
+ const numBitMaskBytes = raw.payload[1] & 0b000_11111;
1269
+ if (numBitMaskBytes === 0) {
1270
+ // Notification type is not supported
1271
+ return new NotificationCCEventSupportedReport_1({
1272
+ nodeId: ctx.sourceNodeId,
1273
+ notificationType,
1274
+ supportedEvents: [],
1275
+ });
1274
1276
  }
1277
+ (0, safe_1.validatePayload)(raw.payload.length >= 2 + numBitMaskBytes);
1278
+ const eventBitMask = raw.payload.subarray(2, 2 + numBitMaskBytes);
1279
+ const supportedEvents = (0, safe_1.parseBitMask)(eventBitMask,
1280
+ // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1281
+ 0);
1282
+ return new NotificationCCEventSupportedReport_1({
1283
+ nodeId: ctx.sourceNodeId,
1284
+ notificationType,
1285
+ supportedEvents,
1286
+ });
1275
1287
  }
1276
- persistValues(applHost) {
1277
- if (!super.persistValues(applHost))
1288
+ persistValues(ctx) {
1289
+ if (!super.persistValues(ctx))
1278
1290
  return false;
1279
1291
  // Store which events this notification supports
1280
- this.setValue(applHost, exports.NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);
1292
+ this.setValue(ctx, exports.NotificationCCValues.supportedNotificationEvents(this.notificationType), this.supportedEvents);
1281
1293
  // For each event, predefine the value metadata
1282
1294
  const notification = (0, core_1.getNotification)(this.notificationType);
1283
1295
  if (!notification) {
1284
1296
  // This is an unknown notification
1285
- this.setMetadata(applHost, exports.NotificationCCValues.unknownNotificationType(this.notificationType));
1297
+ this.setMetadata(ctx, exports.NotificationCCValues.unknownNotificationType(this.notificationType));
1286
1298
  }
1287
1299
  else {
1288
1300
  // This is a standardized notification
@@ -1296,8 +1308,8 @@ let NotificationCCEventSupportedReport = class NotificationCCEventSupportedRepor
1296
1308
  // After we've created the metadata initially, extend it
1297
1309
  const metadata = getNotificationValueMetadata(isFirst
1298
1310
  ? undefined
1299
- : this.getMetadata(applHost, notificationValue), notification, valueConfig);
1300
- this.setMetadata(applHost, notificationValue, metadata);
1311
+ : this.getMetadata(ctx, notificationValue), notification, valueConfig);
1312
+ this.setMetadata(ctx, notificationValue, metadata);
1301
1313
  isFirst = false;
1302
1314
  }
1303
1315
  }
@@ -1306,18 +1318,18 @@ let NotificationCCEventSupportedReport = class NotificationCCEventSupportedRepor
1306
1318
  }
1307
1319
  notificationType;
1308
1320
  supportedEvents;
1309
- serialize() {
1321
+ serialize(ctx) {
1310
1322
  this.payload = Buffer.from([this.notificationType, 0]);
1311
1323
  if (this.supportedEvents.length > 0) {
1312
1324
  const bitMask = (0, safe_1.encodeBitMask)(this.supportedEvents, Math.max(...this.supportedEvents), 0);
1313
1325
  this.payload[1] = bitMask.length;
1314
1326
  this.payload = Buffer.concat([this.payload, bitMask]);
1315
1327
  }
1316
- return super.serialize();
1328
+ return super.serialize(ctx);
1317
1329
  }
1318
- toLogEntry(host) {
1330
+ toLogEntry(ctx) {
1319
1331
  return {
1320
- ...super.toLogEntry(host),
1332
+ ...super.toLogEntry(ctx),
1321
1333
  message: {
1322
1334
  "notification type": (0, core_1.getNotificationName)(this.notificationType),
1323
1335
  "supported events": this.supportedEvents
@@ -1328,28 +1340,30 @@ let NotificationCCEventSupportedReport = class NotificationCCEventSupportedRepor
1328
1340
  }
1329
1341
  };
1330
1342
  exports.NotificationCCEventSupportedReport = NotificationCCEventSupportedReport;
1331
- exports.NotificationCCEventSupportedReport = NotificationCCEventSupportedReport = __decorate([
1343
+ exports.NotificationCCEventSupportedReport = NotificationCCEventSupportedReport = NotificationCCEventSupportedReport_1 = __decorate([
1332
1344
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.EventSupportedReport)
1333
1345
  ], NotificationCCEventSupportedReport);
1334
- let NotificationCCEventSupportedGet = class NotificationCCEventSupportedGet extends NotificationCC {
1335
- constructor(host, options) {
1336
- super(host, options);
1337
- if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1338
- (0, safe_1.validatePayload)(this.payload.length >= 1);
1339
- this.notificationType = this.payload[0];
1340
- }
1341
- else {
1342
- this.notificationType = options.notificationType;
1343
- }
1346
+ let NotificationCCEventSupportedGet = NotificationCCEventSupportedGet_1 = class NotificationCCEventSupportedGet extends NotificationCC {
1347
+ constructor(options) {
1348
+ super(options);
1349
+ this.notificationType = options.notificationType;
1350
+ }
1351
+ static from(raw, ctx) {
1352
+ (0, safe_1.validatePayload)(raw.payload.length >= 1);
1353
+ const notificationType = raw.payload[0];
1354
+ return new NotificationCCEventSupportedGet_1({
1355
+ nodeId: ctx.sourceNodeId,
1356
+ notificationType,
1357
+ });
1344
1358
  }
1345
1359
  notificationType;
1346
- serialize() {
1360
+ serialize(ctx) {
1347
1361
  this.payload = Buffer.from([this.notificationType]);
1348
- return super.serialize();
1362
+ return super.serialize(ctx);
1349
1363
  }
1350
- toLogEntry(host) {
1364
+ toLogEntry(ctx) {
1351
1365
  return {
1352
- ...super.toLogEntry(host),
1366
+ ...super.toLogEntry(ctx),
1353
1367
  message: {
1354
1368
  "notification type": (0, core_1.getNotificationName)(this.notificationType),
1355
1369
  },
@@ -1357,7 +1371,7 @@ let NotificationCCEventSupportedGet = class NotificationCCEventSupportedGet exte
1357
1371
  }
1358
1372
  };
1359
1373
  exports.NotificationCCEventSupportedGet = NotificationCCEventSupportedGet;
1360
- exports.NotificationCCEventSupportedGet = NotificationCCEventSupportedGet = __decorate([
1374
+ exports.NotificationCCEventSupportedGet = NotificationCCEventSupportedGet = NotificationCCEventSupportedGet_1 = __decorate([
1361
1375
  (0, CommandClassDecorators_1.CCCommand)(_Types_1.NotificationCommand.EventSupportedGet),
1362
1376
  (0, CommandClassDecorators_1.expectedCCResponse)(NotificationCCEventSupportedReport)
1363
1377
  ], NotificationCCEventSupportedGet);