@zwave-js/cc 9.3.1-0-pr-4662-79458fb

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 (297) hide show
  1. package/build/cc/AlarmSensorCC.d.ts +54 -0
  2. package/build/cc/AlarmSensorCC.d.ts.map +1 -0
  3. package/build/cc/AlarmSensorCC.js +378 -0
  4. package/build/cc/AlarmSensorCC.js.map +1 -0
  5. package/build/cc/AssociationCC.d.ts +123 -0
  6. package/build/cc/AssociationCC.d.ts.map +1 -0
  7. package/build/cc/AssociationCC.js +615 -0
  8. package/build/cc/AssociationCC.js.map +1 -0
  9. package/build/cc/AssociationGroupInfoCC.d.ts +97 -0
  10. package/build/cc/AssociationGroupInfoCC.d.ts.map +1 -0
  11. package/build/cc/AssociationGroupInfoCC.js +530 -0
  12. package/build/cc/AssociationGroupInfoCC.js.map +1 -0
  13. package/build/cc/BarrierOperatorCC.d.ts +75 -0
  14. package/build/cc/BarrierOperatorCC.d.ts.map +1 -0
  15. package/build/cc/BarrierOperatorCC.js +492 -0
  16. package/build/cc/BarrierOperatorCC.js.map +1 -0
  17. package/build/cc/BasicCC.d.ts +51 -0
  18. package/build/cc/BasicCC.d.ts.map +1 -0
  19. package/build/cc/BasicCC.js +344 -0
  20. package/build/cc/BasicCC.js.map +1 -0
  21. package/build/cc/BatteryCC.d.ts +56 -0
  22. package/build/cc/BatteryCC.d.ts.map +1 -0
  23. package/build/cc/BatteryCC.js +417 -0
  24. package/build/cc/BatteryCC.js.map +1 -0
  25. package/build/cc/BinarySensorCC.d.ts +52 -0
  26. package/build/cc/BinarySensorCC.d.ts.map +1 -0
  27. package/build/cc/BinarySensorCC.js +321 -0
  28. package/build/cc/BinarySensorCC.js.map +1 -0
  29. package/build/cc/BinarySwitchCC.d.ts +55 -0
  30. package/build/cc/BinarySwitchCC.d.ts.map +1 -0
  31. package/build/cc/BinarySwitchCC.js +327 -0
  32. package/build/cc/BinarySwitchCC.js.map +1 -0
  33. package/build/cc/CRC16CC.d.ts +28 -0
  34. package/build/cc/CRC16CC.d.ts.map +1 -0
  35. package/build/cc/CRC16CC.js +109 -0
  36. package/build/cc/CRC16CC.js.map +1 -0
  37. package/build/cc/CentralSceneCC.d.ts +69 -0
  38. package/build/cc/CentralSceneCC.d.ts.map +1 -0
  39. package/build/cc/CentralSceneCC.js +443 -0
  40. package/build/cc/CentralSceneCC.js.map +1 -0
  41. package/build/cc/ClimateControlScheduleCC.d.ts +78 -0
  42. package/build/cc/ClimateControlScheduleCC.d.ts.map +1 -0
  43. package/build/cc/ClimateControlScheduleCC.js +417 -0
  44. package/build/cc/ClimateControlScheduleCC.js.map +1 -0
  45. package/build/cc/ClockCC.d.ts +40 -0
  46. package/build/cc/ClockCC.d.ts.map +1 -0
  47. package/build/cc/ClockCC.js +185 -0
  48. package/build/cc/ClockCC.js.map +1 -0
  49. package/build/cc/ColorSwitchCC.d.ts +98 -0
  50. package/build/cc/ColorSwitchCC.d.ts.map +1 -0
  51. package/build/cc/ColorSwitchCC.js +1045 -0
  52. package/build/cc/ColorSwitchCC.js.map +1 -0
  53. package/build/cc/ConfigurationCC.d.ts +315 -0
  54. package/build/cc/ConfigurationCC.d.ts.map +1 -0
  55. package/build/cc/ConfigurationCC.js +2257 -0
  56. package/build/cc/ConfigurationCC.js.map +1 -0
  57. package/build/cc/DeviceResetLocallyCC.d.ts +9 -0
  58. package/build/cc/DeviceResetLocallyCC.d.ts.map +1 -0
  59. package/build/cc/DeviceResetLocallyCC.js +28 -0
  60. package/build/cc/DeviceResetLocallyCC.js.map +1 -0
  61. package/build/cc/DoorLockCC.d.ts +116 -0
  62. package/build/cc/DoorLockCC.d.ts.map +1 -0
  63. package/build/cc/DoorLockCC.js +1112 -0
  64. package/build/cc/DoorLockCC.js.map +1 -0
  65. package/build/cc/DoorLockLoggingCC.d.ts +41 -0
  66. package/build/cc/DoorLockLoggingCC.d.ts.map +1 -0
  67. package/build/cc/DoorLockLoggingCC.js +288 -0
  68. package/build/cc/DoorLockLoggingCC.js.map +1 -0
  69. package/build/cc/EntryControlCC.d.ts +71 -0
  70. package/build/cc/EntryControlCC.d.ts.map +1 -0
  71. package/build/cc/EntryControlCC.js +492 -0
  72. package/build/cc/EntryControlCC.js.map +1 -0
  73. package/build/cc/FirmwareUpdateMetaDataCC.d.ts +148 -0
  74. package/build/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -0
  75. package/build/cc/FirmwareUpdateMetaDataCC.js +727 -0
  76. package/build/cc/FirmwareUpdateMetaDataCC.js.map +1 -0
  77. package/build/cc/HailCC.d.ts +6 -0
  78. package/build/cc/HailCC.d.ts.map +1 -0
  79. package/build/cc/HailCC.js +23 -0
  80. package/build/cc/HailCC.js.map +1 -0
  81. package/build/cc/HumidityControlModeCC.d.ts +47 -0
  82. package/build/cc/HumidityControlModeCC.d.ts.map +1 -0
  83. package/build/cc/HumidityControlModeCC.js +288 -0
  84. package/build/cc/HumidityControlModeCC.js.map +1 -0
  85. package/build/cc/HumidityControlOperatingStateCC.d.ts +24 -0
  86. package/build/cc/HumidityControlOperatingStateCC.d.ts.map +1 -0
  87. package/build/cc/HumidityControlOperatingStateCC.js +129 -0
  88. package/build/cc/HumidityControlOperatingStateCC.js.map +1 -0
  89. package/build/cc/HumidityControlSetpointCC.d.ts +103 -0
  90. package/build/cc/HumidityControlSetpointCC.d.ts.map +1 -0
  91. package/build/cc/HumidityControlSetpointCC.js +626 -0
  92. package/build/cc/HumidityControlSetpointCC.js.map +1 -0
  93. package/build/cc/IndicatorCC.d.ts +88 -0
  94. package/build/cc/IndicatorCC.d.ts.map +1 -0
  95. package/build/cc/IndicatorCC.js +758 -0
  96. package/build/cc/IndicatorCC.js.map +1 -0
  97. package/build/cc/IrrigationCC.d.ts +278 -0
  98. package/build/cc/IrrigationCC.d.ts.map +1 -0
  99. package/build/cc/IrrigationCC.js +2062 -0
  100. package/build/cc/IrrigationCC.js.map +1 -0
  101. package/build/cc/LanguageCC.d.ts +41 -0
  102. package/build/cc/LanguageCC.d.ts.map +1 -0
  103. package/build/cc/LanguageCC.js +220 -0
  104. package/build/cc/LanguageCC.js.map +1 -0
  105. package/build/cc/LockCC.d.ts +41 -0
  106. package/build/cc/LockCC.d.ts.map +1 -0
  107. package/build/cc/LockCC.js +185 -0
  108. package/build/cc/LockCC.js.map +1 -0
  109. package/build/cc/ManufacturerProprietaryCC.d.ts +31 -0
  110. package/build/cc/ManufacturerProprietaryCC.d.ts.map +1 -0
  111. package/build/cc/ManufacturerProprietaryCC.js +275 -0
  112. package/build/cc/ManufacturerProprietaryCC.js.map +1 -0
  113. package/build/cc/ManufacturerSpecificCC.d.ts +59 -0
  114. package/build/cc/ManufacturerSpecificCC.d.ts.map +1 -0
  115. package/build/cc/ManufacturerSpecificCC.js +285 -0
  116. package/build/cc/ManufacturerSpecificCC.js.map +1 -0
  117. package/build/cc/MeterCC.d.ts +100 -0
  118. package/build/cc/MeterCC.d.ts.map +1 -0
  119. package/build/cc/MeterCC.js +820 -0
  120. package/build/cc/MeterCC.js.map +1 -0
  121. package/build/cc/MultiChannelAssociationCC.d.ts +127 -0
  122. package/build/cc/MultiChannelAssociationCC.d.ts.map +1 -0
  123. package/build/cc/MultiChannelAssociationCC.js +883 -0
  124. package/build/cc/MultiChannelAssociationCC.js.map +1 -0
  125. package/build/cc/MultiChannelCC.d.ts +164 -0
  126. package/build/cc/MultiChannelCC.d.ts.map +1 -0
  127. package/build/cc/MultiChannelCC.js +1004 -0
  128. package/build/cc/MultiChannelCC.js.map +1 -0
  129. package/build/cc/MultiCommandCC.d.ts +28 -0
  130. package/build/cc/MultiCommandCC.d.ts.map +1 -0
  131. package/build/cc/MultiCommandCC.js +137 -0
  132. package/build/cc/MultiCommandCC.js.map +1 -0
  133. package/build/cc/MultilevelSensorCC.d.ts +83 -0
  134. package/build/cc/MultilevelSensorCC.d.ts.map +1 -0
  135. package/build/cc/MultilevelSensorCC.js +633 -0
  136. package/build/cc/MultilevelSensorCC.js.map +1 -0
  137. package/build/cc/MultilevelSwitchCC.d.ts +86 -0
  138. package/build/cc/MultilevelSwitchCC.d.ts.map +1 -0
  139. package/build/cc/MultilevelSwitchCC.js +774 -0
  140. package/build/cc/MultilevelSwitchCC.js.map +1 -0
  141. package/build/cc/NoOperationCC.d.ts +17 -0
  142. package/build/cc/NoOperationCC.d.ts.map +1 -0
  143. package/build/cc/NoOperationCC.js +50 -0
  144. package/build/cc/NoOperationCC.js.map +1 -0
  145. package/build/cc/NodeNamingCC.d.ts +57 -0
  146. package/build/cc/NodeNamingCC.d.ts.map +1 -0
  147. package/build/cc/NodeNamingCC.js +313 -0
  148. package/build/cc/NodeNamingCC.js.map +1 -0
  149. package/build/cc/NotificationCC.d.ts +127 -0
  150. package/build/cc/NotificationCC.d.ts.map +1 -0
  151. package/build/cc/NotificationCC.js +1193 -0
  152. package/build/cc/NotificationCC.js.map +1 -0
  153. package/build/cc/PowerlevelCC.d.ts +63 -0
  154. package/build/cc/PowerlevelCC.d.ts.map +1 -0
  155. package/build/cc/PowerlevelCC.js +262 -0
  156. package/build/cc/PowerlevelCC.js.map +1 -0
  157. package/build/cc/ProtectionCC.d.ts +94 -0
  158. package/build/cc/ProtectionCC.d.ts.map +1 -0
  159. package/build/cc/ProtectionCC.js +630 -0
  160. package/build/cc/ProtectionCC.js.map +1 -0
  161. package/build/cc/SceneActivationCC.d.ts +34 -0
  162. package/build/cc/SceneActivationCC.d.ts.map +1 -0
  163. package/build/cc/SceneActivationCC.js +170 -0
  164. package/build/cc/SceneActivationCC.js.map +1 -0
  165. package/build/cc/SceneActuatorConfigurationCC.d.ts +52 -0
  166. package/build/cc/SceneActuatorConfigurationCC.d.ts.map +1 -0
  167. package/build/cc/SceneActuatorConfigurationCC.js +368 -0
  168. package/build/cc/SceneActuatorConfigurationCC.js.map +1 -0
  169. package/build/cc/SceneControllerConfigurationCC.d.ts +61 -0
  170. package/build/cc/SceneControllerConfigurationCC.d.ts.map +1 -0
  171. package/build/cc/SceneControllerConfigurationCC.js +444 -0
  172. package/build/cc/SceneControllerConfigurationCC.js.map +1 -0
  173. package/build/cc/Security2CC.d.ts +213 -0
  174. package/build/cc/Security2CC.d.ts.map +1 -0
  175. package/build/cc/Security2CC.js +1124 -0
  176. package/build/cc/Security2CC.js.map +1 -0
  177. package/build/cc/SecurityCC.d.ts +109 -0
  178. package/build/cc/SecurityCC.d.ts.map +1 -0
  179. package/build/cc/SecurityCC.js +609 -0
  180. package/build/cc/SecurityCC.js.map +1 -0
  181. package/build/cc/SoundSwitchCC.d.ts +87 -0
  182. package/build/cc/SoundSwitchCC.d.ts.map +1 -0
  183. package/build/cc/SoundSwitchCC.js +548 -0
  184. package/build/cc/SoundSwitchCC.js.map +1 -0
  185. package/build/cc/SupervisionCC.d.ts +63 -0
  186. package/build/cc/SupervisionCC.d.ts.map +1 -0
  187. package/build/cc/SupervisionCC.js +239 -0
  188. package/build/cc/SupervisionCC.js.map +1 -0
  189. package/build/cc/ThermostatFanModeCC.d.ts +53 -0
  190. package/build/cc/ThermostatFanModeCC.d.ts.map +1 -0
  191. package/build/cc/ThermostatFanModeCC.js +359 -0
  192. package/build/cc/ThermostatFanModeCC.js.map +1 -0
  193. package/build/cc/ThermostatFanStateCC.d.ts +24 -0
  194. package/build/cc/ThermostatFanStateCC.d.ts.map +1 -0
  195. package/build/cc/ThermostatFanStateCC.js +131 -0
  196. package/build/cc/ThermostatFanStateCC.js.map +1 -0
  197. package/build/cc/ThermostatModeCC.d.ts +58 -0
  198. package/build/cc/ThermostatModeCC.d.ts.map +1 -0
  199. package/build/cc/ThermostatModeCC.js +370 -0
  200. package/build/cc/ThermostatModeCC.js.map +1 -0
  201. package/build/cc/ThermostatOperatingStateCC.d.ts +24 -0
  202. package/build/cc/ThermostatOperatingStateCC.d.ts.map +1 -0
  203. package/build/cc/ThermostatOperatingStateCC.js +127 -0
  204. package/build/cc/ThermostatOperatingStateCC.js.map +1 -0
  205. package/build/cc/ThermostatSetbackCC.d.ts +42 -0
  206. package/build/cc/ThermostatSetbackCC.d.ts.map +1 -0
  207. package/build/cc/ThermostatSetbackCC.js +237 -0
  208. package/build/cc/ThermostatSetbackCC.js.map +1 -0
  209. package/build/cc/ThermostatSetpointCC.d.ts +98 -0
  210. package/build/cc/ThermostatSetpointCC.d.ts.map +1 -0
  211. package/build/cc/ThermostatSetpointCC.js +707 -0
  212. package/build/cc/ThermostatSetpointCC.js.map +1 -0
  213. package/build/cc/TimeCC.d.ts +78 -0
  214. package/build/cc/TimeCC.d.ts.map +1 -0
  215. package/build/cc/TimeCC.js +373 -0
  216. package/build/cc/TimeCC.js.map +1 -0
  217. package/build/cc/TimeParametersCC.d.ts +40 -0
  218. package/build/cc/TimeParametersCC.d.ts.map +1 -0
  219. package/build/cc/TimeParametersCC.js +275 -0
  220. package/build/cc/TimeParametersCC.js.map +1 -0
  221. package/build/cc/TransportServiceCC.d.ts +101 -0
  222. package/build/cc/TransportServiceCC.d.ts.map +1 -0
  223. package/build/cc/TransportServiceCC.js +404 -0
  224. package/build/cc/TransportServiceCC.js.map +1 -0
  225. package/build/cc/UserCodeCC.d.ts +219 -0
  226. package/build/cc/UserCodeCC.d.ts.map +1 -0
  227. package/build/cc/UserCodeCC.js +1526 -0
  228. package/build/cc/UserCodeCC.js.map +1 -0
  229. package/build/cc/VersionCC.d.ts +91 -0
  230. package/build/cc/VersionCC.d.ts.map +1 -0
  231. package/build/cc/VersionCC.js +654 -0
  232. package/build/cc/VersionCC.js.map +1 -0
  233. package/build/cc/WakeUpCC.d.ts +67 -0
  234. package/build/cc/WakeUpCC.d.ts.map +1 -0
  235. package/build/cc/WakeUpCC.js +425 -0
  236. package/build/cc/WakeUpCC.js.map +1 -0
  237. package/build/cc/ZWavePlusCC.d.ts +40 -0
  238. package/build/cc/ZWavePlusCC.d.ts.map +1 -0
  239. package/build/cc/ZWavePlusCC.js +269 -0
  240. package/build/cc/ZWavePlusCC.js.map +1 -0
  241. package/build/cc/index.d.ts +64 -0
  242. package/build/cc/index.d.ts.map +1 -0
  243. package/build/cc/index.js +496 -0
  244. package/build/cc/index.js.map +1 -0
  245. package/build/cc/manufacturerProprietary/FibaroCC.d.ts +62 -0
  246. package/build/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -0
  247. package/build/cc/manufacturerProprietary/FibaroCC.js +247 -0
  248. package/build/cc/manufacturerProprietary/FibaroCC.js.map +1 -0
  249. package/build/index.d.ts +11 -0
  250. package/build/index.d.ts.map +1 -0
  251. package/build/index.js +48 -0
  252. package/build/index.js.map +1 -0
  253. package/build/index_safe.d.ts +4 -0
  254. package/build/index_safe.d.ts.map +1 -0
  255. package/build/index_safe.js +30 -0
  256. package/build/index_safe.js.map +1 -0
  257. package/build/lib/API.d.ts +176 -0
  258. package/build/lib/API.d.ts.map +1 -0
  259. package/build/lib/API.js +325 -0
  260. package/build/lib/API.js.map +1 -0
  261. package/build/lib/CommandClass.d.ts +341 -0
  262. package/build/lib/CommandClass.d.ts.map +1 -0
  263. package/build/lib/CommandClass.js +1088 -0
  264. package/build/lib/CommandClass.js.map +1 -0
  265. package/build/lib/EncapsulatingCommandClass.d.ts +35 -0
  266. package/build/lib/EncapsulatingCommandClass.d.ts.map +1 -0
  267. package/build/lib/EncapsulatingCommandClass.js +53 -0
  268. package/build/lib/EncapsulatingCommandClass.js.map +1 -0
  269. package/build/lib/ICommandClassContainer.d.ts +9 -0
  270. package/build/lib/ICommandClassContainer.d.ts.map +1 -0
  271. package/build/lib/ICommandClassContainer.js +12 -0
  272. package/build/lib/ICommandClassContainer.js.map +1 -0
  273. package/build/lib/NotificationEventPayload.d.ts +11 -0
  274. package/build/lib/NotificationEventPayload.d.ts.map +1 -0
  275. package/build/lib/NotificationEventPayload.js +11 -0
  276. package/build/lib/NotificationEventPayload.js.map +1 -0
  277. package/build/lib/Security2/Extension.d.ts +87 -0
  278. package/build/lib/Security2/Extension.d.ts.map +1 -0
  279. package/build/lib/Security2/Extension.js +235 -0
  280. package/build/lib/Security2/Extension.js.map +1 -0
  281. package/build/lib/Security2/shared.d.ts +31 -0
  282. package/build/lib/Security2/shared.d.ts.map +1 -0
  283. package/build/lib/Security2/shared.js +37 -0
  284. package/build/lib/Security2/shared.js.map +1 -0
  285. package/build/lib/_Types.d.ts +1446 -0
  286. package/build/lib/_Types.d.ts.map +1 -0
  287. package/build/lib/_Types.js +1334 -0
  288. package/build/lib/_Types.js.map +1 -0
  289. package/build/lib/serializers.d.ts +24 -0
  290. package/build/lib/serializers.d.ts.map +1 -0
  291. package/build/lib/serializers.js +66 -0
  292. package/build/lib/serializers.js.map +1 -0
  293. package/build/lib/utils.d.ts +13 -0
  294. package/build/lib/utils.d.ts.map +1 -0
  295. package/build/lib/utils.js +675 -0
  296. package/build/lib/utils.js.map +1 -0
  297. package/package.json +77 -0
@@ -0,0 +1,1193 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var NotificationCC_1;
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.NotificationCCEventSupportedGet = exports.NotificationCCEventSupportedReport = exports.NotificationCCSupportedGet = exports.NotificationCCSupportedReport = exports.NotificationCCGet = exports.NotificationCCReport = exports.NotificationCCSet = exports.NotificationCC = exports.getNotificationValueMetadata = exports.getNotificationValueMetadataUnknownType = exports.NotificationCCAPI = exports.getAlarmLevelValueId = exports.getAlarmTypeValueId = exports.getNotificationModeValueId = exports.getSupportedNotificationEventsValueId = exports.getSupportedNotificationTypesValueId = exports.getSupportsV1AlarmValueId = void 0;
34
+ function __assertType(argName, typeName, boundHasError) {
35
+ const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
36
+ if (boundHasError()) {
37
+ throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
38
+ }
39
+ }
40
+ const __assertType__NotificationCCReportOptions = $o => {
41
+ function _number($o) {
42
+ return typeof $o !== "number" ? {} : null;
43
+ }
44
+ function _1($o) {
45
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
46
+ return {};
47
+ if ("alarmType" in $o && $o["alarmType"] !== undefined) {
48
+ const error = _number($o["alarmType"]);
49
+ if (error)
50
+ return error;
51
+ }
52
+ else
53
+ return {};
54
+ if ("alarmLevel" in $o && $o["alarmLevel"] !== undefined) {
55
+ const error = _number($o["alarmLevel"]);
56
+ if (error)
57
+ return error;
58
+ }
59
+ else
60
+ return {};
61
+ return null;
62
+ }
63
+ function _buffer($o) {
64
+ return !Buffer.isBuffer($o) ? {} : null;
65
+ }
66
+ function _2($o) {
67
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
68
+ return {};
69
+ if ("notificationType" in $o && $o["notificationType"] !== undefined) {
70
+ const error = _number($o["notificationType"]);
71
+ if (error)
72
+ return error;
73
+ }
74
+ else
75
+ return {};
76
+ if ("notificationEvent" in $o && $o["notificationEvent"] !== undefined) {
77
+ const error = _number($o["notificationEvent"]);
78
+ if (error)
79
+ return error;
80
+ }
81
+ else
82
+ return {};
83
+ if ("eventParameters" in $o && $o["eventParameters"] !== undefined) {
84
+ const error = _buffer($o["eventParameters"]);
85
+ if (error)
86
+ return error;
87
+ }
88
+ if ("sequenceNumber" in $o && $o["sequenceNumber"] !== undefined) {
89
+ const error = _number($o["sequenceNumber"]);
90
+ if (error)
91
+ return error;
92
+ }
93
+ return null;
94
+ }
95
+ function su__1__2_eu($o) {
96
+ const conditions = [_1, _2];
97
+ for (const condition of conditions) {
98
+ const error = condition($o);
99
+ if (!error)
100
+ return null;
101
+ }
102
+ return {};
103
+ }
104
+ return su__1__2_eu($o);
105
+ };
106
+ const __assertType__NotificationCCGetSpecificOptions = $o => {
107
+ function _number($o) {
108
+ return typeof $o !== "number" ? {} : null;
109
+ }
110
+ function _1($o) {
111
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
112
+ return {};
113
+ if ("alarmType" in $o && $o["alarmType"] !== undefined) {
114
+ const error = _number($o["alarmType"]);
115
+ if (error)
116
+ return error;
117
+ }
118
+ else
119
+ return {};
120
+ return null;
121
+ }
122
+ function _2($o) {
123
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
124
+ return {};
125
+ if ("notificationType" in $o && $o["notificationType"] !== undefined) {
126
+ const error = _number($o["notificationType"]);
127
+ if (error)
128
+ return error;
129
+ }
130
+ else
131
+ return {};
132
+ if ("notificationEvent" in $o && $o["notificationEvent"] !== undefined) {
133
+ const error = _number($o["notificationEvent"]);
134
+ if (error)
135
+ return error;
136
+ }
137
+ return null;
138
+ }
139
+ function su__1__2_eu($o) {
140
+ const conditions = [_1, _2];
141
+ for (const condition of conditions) {
142
+ const error = condition($o);
143
+ if (!error)
144
+ return null;
145
+ }
146
+ return {};
147
+ }
148
+ return su__1__2_eu($o);
149
+ };
150
+ const __assertType__number = $o => {
151
+ function _number($o) {
152
+ return typeof $o !== "number" ? {} : null;
153
+ }
154
+ return _number($o);
155
+ };
156
+ const __assertType__boolean = $o => {
157
+ function _boolean($o) {
158
+ return typeof $o !== "boolean" ? {} : null;
159
+ }
160
+ return _boolean($o);
161
+ };
162
+ const config_1 = require("@zwave-js/config");
163
+ const safe_1 = require("@zwave-js/core/safe");
164
+ const safe_2 = require("@zwave-js/shared/safe");
165
+ const typeguards_1 = require("alcalzone-shared/typeguards");
166
+ const API_1 = require("../lib/API");
167
+ const CommandClass_1 = require("../lib/CommandClass");
168
+ const NotificationEventPayload_1 = require("../lib/NotificationEventPayload");
169
+ const ccUtils = __importStar(require("../lib/utils"));
170
+ const _Types_1 = require("../lib/_Types");
171
+ /** Returns the ValueID used to store whether a node supports V1 Alarms */
172
+ function getSupportsV1AlarmValueId() {
173
+ return {
174
+ commandClass: safe_1.CommandClasses.Notification,
175
+ property: "supportsV1Alarm",
176
+ };
177
+ }
178
+ exports.getSupportsV1AlarmValueId = getSupportsV1AlarmValueId;
179
+ /** Returns the ValueID used to store the supported notification types of a node */
180
+ function getSupportedNotificationTypesValueId() {
181
+ return {
182
+ commandClass: safe_1.CommandClasses.Notification,
183
+ property: "supportedNotificationTypes",
184
+ };
185
+ }
186
+ exports.getSupportedNotificationTypesValueId = getSupportedNotificationTypesValueId;
187
+ /** Returns the ValueID used to store the supported notification events of a node */
188
+ function getSupportedNotificationEventsValueId(type) {
189
+ return {
190
+ commandClass: safe_1.CommandClasses.Notification,
191
+ property: "supportedNotificationEvents",
192
+ propertyKey: type,
193
+ };
194
+ }
195
+ exports.getSupportedNotificationEventsValueId = getSupportedNotificationEventsValueId;
196
+ /** Returns the ValueID used to store whether a node supports push or pull */
197
+ function getNotificationModeValueId() {
198
+ return {
199
+ commandClass: safe_1.CommandClasses.Notification,
200
+ property: "notificationMode",
201
+ };
202
+ }
203
+ exports.getNotificationModeValueId = getNotificationModeValueId;
204
+ function getAlarmTypeValueId(endpoint) {
205
+ return {
206
+ commandClass: safe_1.CommandClasses.Notification,
207
+ endpoint,
208
+ property: "alarmType",
209
+ };
210
+ }
211
+ exports.getAlarmTypeValueId = getAlarmTypeValueId;
212
+ function getAlarmLevelValueId(endpoint) {
213
+ return {
214
+ commandClass: safe_1.CommandClasses.Notification,
215
+ endpoint,
216
+ property: "alarmLevel",
217
+ };
218
+ }
219
+ exports.getAlarmLevelValueId = getAlarmLevelValueId;
220
+ function lookupNotificationNames(applHost, notificationTypes) {
221
+ return notificationTypes
222
+ .map((n) => {
223
+ const ret = applHost.configManager.lookupNotification(n);
224
+ return [n, ret];
225
+ })
226
+ .map(([type, ntfcn]) => ntfcn ? ntfcn.name : `UNKNOWN (${(0, safe_2.num2hex)(type)})`);
227
+ }
228
+ let NotificationCCAPI = class NotificationCCAPI extends API_1.PhysicalCCAPI {
229
+ supportsCommand(cmd) {
230
+ switch (cmd) {
231
+ case _Types_1.NotificationCommand.Report:
232
+ case _Types_1.NotificationCommand.Get:
233
+ return true; // These exist starting with V1
234
+ case _Types_1.NotificationCommand.Set:
235
+ case _Types_1.NotificationCommand.SupportedGet:
236
+ return this.version >= 2;
237
+ case _Types_1.NotificationCommand.EventSupportedGet:
238
+ return this.version >= 3;
239
+ }
240
+ return super.supportsCommand(cmd);
241
+ }
242
+ /**
243
+ * @internal
244
+ */
245
+ async getInternal(options) {
246
+ this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Get);
247
+ const cc = new NotificationCCGet(this.applHost, {
248
+ nodeId: this.endpoint.nodeId,
249
+ endpoint: this.endpoint.index,
250
+ ...options,
251
+ });
252
+ return this.applHost.sendCommand(cc, this.commandOptions);
253
+ }
254
+ async sendReport(options) {
255
+ __assertType("options", "NotificationCCReportOptions", __assertType__NotificationCCReportOptions.bind(void 0, options));
256
+ this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Report);
257
+ const cc = new NotificationCCReport(this.applHost, {
258
+ nodeId: this.endpoint.nodeId,
259
+ endpoint: this.endpoint.index,
260
+ ...options,
261
+ });
262
+ await this.applHost.sendCommand(cc, this.commandOptions);
263
+ }
264
+ async get(options) {
265
+ __assertType("options", "NotificationCCGetSpecificOptions", __assertType__NotificationCCGetSpecificOptions.bind(void 0, options));
266
+ const response = await this.getInternal(options);
267
+ if (response) {
268
+ return (0, safe_2.pick)(response, [
269
+ "notificationStatus",
270
+ "notificationEvent",
271
+ "alarmLevel",
272
+ "zensorNetSourceNodeId",
273
+ "eventParameters",
274
+ "sequenceNumber",
275
+ ]);
276
+ }
277
+ }
278
+ async set(notificationType, notificationStatus) {
279
+ __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
280
+ __assertType("notificationStatus", "boolean", __assertType__boolean.bind(void 0, notificationStatus));
281
+ this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.Set);
282
+ const cc = new NotificationCCSet(this.applHost, {
283
+ nodeId: this.endpoint.nodeId,
284
+ endpoint: this.endpoint.index,
285
+ notificationType,
286
+ notificationStatus,
287
+ });
288
+ await this.applHost.sendCommand(cc, this.commandOptions);
289
+ }
290
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
291
+ async getSupported() {
292
+ this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.SupportedGet);
293
+ const cc = new NotificationCCSupportedGet(this.applHost, {
294
+ nodeId: this.endpoint.nodeId,
295
+ endpoint: this.endpoint.index,
296
+ });
297
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
298
+ if (response) {
299
+ return (0, safe_2.pick)(response, [
300
+ "supportsV1Alarm",
301
+ "supportedNotificationTypes",
302
+ ]);
303
+ }
304
+ }
305
+ async getSupportedEvents(notificationType) {
306
+ __assertType("notificationType", "number", __assertType__number.bind(void 0, notificationType));
307
+ this.assertSupportsCommand(_Types_1.NotificationCommand, _Types_1.NotificationCommand.EventSupportedGet);
308
+ const cc = new NotificationCCEventSupportedGet(this.applHost, {
309
+ nodeId: this.endpoint.nodeId,
310
+ endpoint: this.endpoint.index,
311
+ notificationType,
312
+ });
313
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
314
+ return response === null || response === void 0 ? void 0 : response.supportedEvents;
315
+ }
316
+ };
317
+ NotificationCCAPI = __decorate([
318
+ (0, CommandClass_1.API)(safe_1.CommandClasses.Notification)
319
+ ], NotificationCCAPI);
320
+ exports.NotificationCCAPI = NotificationCCAPI;
321
+ /** Returns the metadata to use for a notification value with an unknown notification type */
322
+ function getNotificationValueMetadataUnknownType(type) {
323
+ return {
324
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
325
+ label: `Unknown notification (${(0, safe_2.num2hex)(type)})`,
326
+ ccSpecific: {
327
+ notificationType: type,
328
+ },
329
+ };
330
+ }
331
+ exports.getNotificationValueMetadataUnknownType = getNotificationValueMetadataUnknownType;
332
+ /**
333
+ * Returns the metadata to use for a known notification value.
334
+ * Can be used to extend a previously defined metadata,
335
+ * e.g. for V2 notifications that don't allow discovering supported events.
336
+ */
337
+ function getNotificationValueMetadata(previous, notificationConfig, valueConfig) {
338
+ const metadata = previous !== null && previous !== void 0 ? previous : {
339
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
340
+ label: valueConfig.variableName,
341
+ states: {},
342
+ ccSpecific: {
343
+ notificationType: notificationConfig.id,
344
+ },
345
+ };
346
+ if (valueConfig.idle) {
347
+ metadata.states[0] = "idle";
348
+ }
349
+ metadata.states[valueConfig.value] = valueConfig.label;
350
+ return metadata;
351
+ }
352
+ exports.getNotificationValueMetadata = getNotificationValueMetadata;
353
+ function defineMetadataForNotificationEvents(configManager, endpoint, type, events) {
354
+ const ret = new Map();
355
+ const notificationConfig = configManager.lookupNotification(type);
356
+ if (!notificationConfig) {
357
+ // This is an unknown notification
358
+ const property = `UNKNOWN_${(0, safe_2.num2hex)(type)}`;
359
+ const valueId = {
360
+ commandClass: safe_1.CommandClasses.Notification,
361
+ endpoint,
362
+ property,
363
+ };
364
+ ret.set(JSON.stringify(valueId), getNotificationValueMetadataUnknownType(type));
365
+ return ret;
366
+ }
367
+ const property = notificationConfig.name;
368
+ for (const value of events) {
369
+ // Find out which property we need to update
370
+ const valueConfig = notificationConfig.lookupValue(value);
371
+ if ((valueConfig === null || valueConfig === void 0 ? void 0 : valueConfig.type) === "state") {
372
+ const valueId = {
373
+ commandClass: safe_1.CommandClasses.Notification,
374
+ endpoint,
375
+ property,
376
+ propertyKey: valueConfig.variableName,
377
+ };
378
+ const dictKey = JSON.stringify(valueId);
379
+ const metadata = getNotificationValueMetadata(ret.get(dictKey), notificationConfig, valueConfig);
380
+ ret.set(dictKey, metadata);
381
+ }
382
+ }
383
+ return ret;
384
+ }
385
+ let NotificationCC = NotificationCC_1 = class NotificationCC extends CommandClass_1.CommandClass {
386
+ // former AlarmCC (v1..v2)
387
+ constructor(host, options) {
388
+ super(host, options);
389
+ // mark some value IDs as internal
390
+ this.registerValue(getNotificationModeValueId().property, {
391
+ internal: true,
392
+ });
393
+ this.registerValue(getSupportedNotificationTypesValueId().property, {
394
+ internal: true,
395
+ });
396
+ this.registerValue(getSupportedNotificationEventsValueId(0).property, {
397
+ internal: true,
398
+ });
399
+ }
400
+ determineRequiredCCInterviews() {
401
+ return [
402
+ ...super.determineRequiredCCInterviews(),
403
+ safe_1.CommandClasses.Association,
404
+ safe_1.CommandClasses["Multi Channel Association"],
405
+ safe_1.CommandClasses["Association Group Information"],
406
+ ];
407
+ }
408
+ async determineNotificationMode(applHost, api, supportedNotificationEvents) {
409
+ var _a, _b;
410
+ const node = this.getNode(applHost);
411
+ // SDS14223: If the supporting node does not support the Association Command Class,
412
+ // it may be concluded that the supporting node implements Pull Mode and discovery may be aborted.
413
+ if (!node.supportsCC(safe_1.CommandClasses.Association))
414
+ return "pull";
415
+ try {
416
+ if (node.supportsCC(safe_1.CommandClasses["Association Group Information"])) {
417
+ const assocGroups = ccUtils.getAssociationGroups(applHost, node);
418
+ for (const group of assocGroups.values()) {
419
+ // Check if this group sends Notification Reports
420
+ if ((_b = (_a = group.issuedCommands) === null || _a === void 0 ? void 0 : _a.get(safe_1.CommandClasses.Notification)) === null || _b === void 0 ? void 0 : _b.includes(_Types_1.NotificationCommand.Report)) {
421
+ return "push";
422
+ }
423
+ }
424
+ return "pull";
425
+ }
426
+ }
427
+ catch {
428
+ // We might be dealing with an older cache file, fall back to testing
429
+ }
430
+ applHost.controllerLog.logNode(node.id, {
431
+ endpoint: this.endpointIndex,
432
+ message: `determining whether this node is pull or push...`,
433
+ direction: "outbound",
434
+ });
435
+ // Find a notification type with at least one supported event
436
+ for (const [type, events] of supportedNotificationEvents) {
437
+ if (events.length === 0)
438
+ continue;
439
+ // Enable the event and request the status
440
+ await api.set(type, true);
441
+ try {
442
+ const resp = await api.get({
443
+ notificationType: type,
444
+ notificationEvent: events[0],
445
+ });
446
+ switch (resp === null || resp === void 0 ? void 0 : resp.notificationStatus) {
447
+ case 0xff:
448
+ return "push";
449
+ case 0xfe:
450
+ case 0x00:
451
+ return "pull";
452
+ }
453
+ }
454
+ catch {
455
+ /* ignore */
456
+ }
457
+ }
458
+ // If everything failed, fall back to "pull"
459
+ return "pull";
460
+ }
461
+ /** Whether the node implements push or pull notifications */
462
+ static getNotificationMode(applHost, node) {
463
+ return applHost
464
+ .getValueDB(node.id)
465
+ .getValue(getNotificationModeValueId());
466
+ }
467
+ async interview(applHost) {
468
+ const node = this.getNode(applHost);
469
+ const endpoint = this.getEndpoint(applHost);
470
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, applHost, endpoint).withOptions({
471
+ priority: safe_1.MessagePriority.NodeQuery,
472
+ });
473
+ const valueDB = this.getValueDB(applHost);
474
+ applHost.controllerLog.logNode(node.id, {
475
+ endpoint: this.endpointIndex,
476
+ message: `Interviewing ${this.ccName}...`,
477
+ direction: "none",
478
+ });
479
+ let supportsV1Alarm = false;
480
+ if (this.version >= 2) {
481
+ applHost.controllerLog.logNode(node.id, {
482
+ endpoint: this.endpointIndex,
483
+ message: "querying supported notification types...",
484
+ direction: "outbound",
485
+ });
486
+ const suppResponse = await api.getSupported();
487
+ if (!suppResponse) {
488
+ applHost.controllerLog.logNode(node.id, {
489
+ endpoint: this.endpointIndex,
490
+ message: "Querying supported notification types timed out, skipping interview...",
491
+ level: "warn",
492
+ });
493
+ return;
494
+ }
495
+ supportsV1Alarm = suppResponse.supportsV1Alarm;
496
+ const supportedNotificationTypes = suppResponse.supportedNotificationTypes;
497
+ const supportedNotificationNames = lookupNotificationNames(applHost, supportedNotificationTypes);
498
+ const supportedNotificationEvents = new Map();
499
+ const logMessage = `received supported notification types:${supportedNotificationNames
500
+ .map((name) => `\n· ${name}`)
501
+ .join("")}`;
502
+ applHost.controllerLog.logNode(node.id, {
503
+ endpoint: this.endpointIndex,
504
+ message: logMessage,
505
+ direction: "inbound",
506
+ });
507
+ if (this.version >= 3) {
508
+ // Query each notification for its supported events
509
+ for (let i = 0; i < supportedNotificationTypes.length; i++) {
510
+ const type = supportedNotificationTypes[i];
511
+ const name = supportedNotificationNames[i];
512
+ applHost.controllerLog.logNode(node.id, {
513
+ endpoint: this.endpointIndex,
514
+ message: `querying supported notification events for ${name}...`,
515
+ direction: "outbound",
516
+ });
517
+ const supportedEvents = await api.getSupportedEvents(type);
518
+ if (supportedEvents) {
519
+ supportedNotificationEvents.set(type, supportedEvents);
520
+ applHost.controllerLog.logNode(node.id, {
521
+ endpoint: this.endpointIndex,
522
+ message: `received supported notification events for ${name}: ${supportedEvents
523
+ .map(String)
524
+ .join(", ")}`,
525
+ direction: "inbound",
526
+ });
527
+ }
528
+ }
529
+ }
530
+ // Determine whether the node is a push or pull node
531
+ let notificationMode = valueDB.getValue(getNotificationModeValueId());
532
+ if (notificationMode !== "push" && notificationMode !== "pull") {
533
+ notificationMode = await this.determineNotificationMode(applHost, api, supportedNotificationEvents);
534
+ valueDB.setValue(getNotificationModeValueId(), notificationMode);
535
+ }
536
+ if (notificationMode === "pull") {
537
+ await this.refreshValues(applHost);
538
+ } /* if (notificationMode === "push") */
539
+ else {
540
+ for (let i = 0; i < supportedNotificationTypes.length; i++) {
541
+ const type = supportedNotificationTypes[i];
542
+ const name = supportedNotificationNames[i];
543
+ const notificationConfig = applHost.configManager.lookupNotification(type);
544
+ // Enable reports for each notification type
545
+ applHost.controllerLog.logNode(node.id, {
546
+ endpoint: this.endpointIndex,
547
+ message: `enabling notifications for ${name}...`,
548
+ direction: "outbound",
549
+ });
550
+ await api.set(type, true);
551
+ // Set the value to idle if possible and there is no value yet
552
+ if (notificationConfig) {
553
+ const property = notificationConfig.name;
554
+ const events = supportedNotificationEvents.get(type);
555
+ if (events) {
556
+ // Find all variables that are supported by this node and have an idle state
557
+ for (const variable of notificationConfig.variables.filter((v) => !!v.idle)) {
558
+ if ([...variable.states.keys()].some((key) => events.includes(key))) {
559
+ const propertyKey = variable.name;
560
+ const valueId = {
561
+ commandClass: safe_1.CommandClasses.Notification,
562
+ endpoint: endpoint.index,
563
+ property,
564
+ propertyKey,
565
+ };
566
+ // Set the value to idle if it has no value yet
567
+ // TODO: GH#1028
568
+ // * do this only if the last update was more than 5 minutes ago
569
+ // * schedule an auto-idle if the last update was less than 5 minutes ago but before the current applHost start
570
+ if (valueDB.getValue(valueId) == undefined) {
571
+ valueDB.setValue(valueId, 0 /* idle */);
572
+ }
573
+ }
574
+ }
575
+ }
576
+ }
577
+ }
578
+ }
579
+ }
580
+ // Only create metadata for V1 values if necessary
581
+ if (this.version === 1 || supportsV1Alarm) {
582
+ valueDB.setMetadata(getAlarmTypeValueId(this.endpointIndex), {
583
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
584
+ label: "Alarm Type",
585
+ });
586
+ valueDB.setMetadata(getAlarmLevelValueId(this.endpointIndex), {
587
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
588
+ label: "Alarm Level",
589
+ });
590
+ }
591
+ // Remember that the interview is complete
592
+ this.setInterviewComplete(applHost, true);
593
+ }
594
+ async refreshValues(applHost) {
595
+ var _a;
596
+ const node = this.getNode(applHost);
597
+ // Refreshing values only works on pull nodes
598
+ if (NotificationCC_1.getNotificationMode(applHost, node) === "pull") {
599
+ const endpoint = this.getEndpoint(applHost);
600
+ const api = API_1.CCAPI.create(safe_1.CommandClasses.Notification, applHost, endpoint).withOptions({
601
+ priority: safe_1.MessagePriority.NodeQuery,
602
+ });
603
+ const valueDB = this.getValueDB(applHost);
604
+ // Load supported notification types and events from cache
605
+ const supportedNotificationTypes = (_a = valueDB.getValue(getSupportedNotificationTypesValueId())) !== null && _a !== void 0 ? _a : [];
606
+ const supportedNotificationNames = lookupNotificationNames(applHost, supportedNotificationTypes);
607
+ for (let i = 0; i < supportedNotificationTypes.length; i++) {
608
+ const type = supportedNotificationTypes[i];
609
+ const name = supportedNotificationNames[i];
610
+ // Always query each notification for its current status
611
+ applHost.controllerLog.logNode(node.id, {
612
+ endpoint: this.endpointIndex,
613
+ message: `querying notification status for ${name}...`,
614
+ direction: "outbound",
615
+ });
616
+ const response = await api.getInternal({
617
+ notificationType: type,
618
+ });
619
+ // NotificationReports don't store their values themselves,
620
+ // because the behaviour is too complex and spans the lifetime
621
+ // of several reports. Thus we handle it in the Node instance
622
+ // @ts-expect-error
623
+ if (response)
624
+ await node.handleCommand(response);
625
+ }
626
+ }
627
+ }
628
+ };
629
+ NotificationCC = NotificationCC_1 = __decorate([
630
+ (0, CommandClass_1.commandClass)(safe_1.CommandClasses.Notification),
631
+ (0, CommandClass_1.implementedVersion)(8)
632
+ ], NotificationCC);
633
+ exports.NotificationCC = NotificationCC;
634
+ let NotificationCCSet = class NotificationCCSet extends NotificationCC {
635
+ constructor(host, options) {
636
+ super(host, options);
637
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
638
+ // TODO: Deserialize payload
639
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
640
+ }
641
+ else {
642
+ this.notificationType = options.notificationType;
643
+ this.notificationStatus = options.notificationStatus;
644
+ }
645
+ }
646
+ serialize() {
647
+ this.payload = Buffer.from([
648
+ this.notificationType,
649
+ this.notificationStatus ? 0xff : 0x00,
650
+ ]);
651
+ return super.serialize();
652
+ }
653
+ toLogEntry(applHost) {
654
+ return {
655
+ ...super.toLogEntry(applHost),
656
+ message: {
657
+ "notification type": applHost.configManager.getNotificationName(this.notificationType),
658
+ status: this.notificationStatus,
659
+ },
660
+ };
661
+ }
662
+ };
663
+ NotificationCCSet = __decorate([
664
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.Set)
665
+ ], NotificationCCSet);
666
+ exports.NotificationCCSet = NotificationCCSet;
667
+ let NotificationCCReport = class NotificationCCReport extends NotificationCC {
668
+ constructor(host, options) {
669
+ super(host, options);
670
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
671
+ (0, safe_1.validatePayload)(this.payload.length >= 2);
672
+ this.alarmType = this.payload[0];
673
+ this.alarmLevel = this.payload[1];
674
+ // V2..V3, reserved in V4+
675
+ if ((this.version === 2 || this.version === 3) &&
676
+ this.payload.length >= 3) {
677
+ this.zensorNetSourceNodeId = this.payload[2];
678
+ }
679
+ // V2+ requires the alarm bytes to be zero. Manufacturers don't care though, so we don't enforce that.
680
+ // Don't use the version to decide because we might discard notifications
681
+ // before the interview is complete
682
+ if (this.payload.length >= 7) {
683
+ this.notificationStatus = this.payload[3];
684
+ this.notificationType = this.payload[4];
685
+ this.notificationEvent = this.payload[5];
686
+ // Ignore the legacy alarm bytes unless we're dealing with an unknown notification
687
+ // and the alarmType has a valid value. This allows us to handle "unknown" notifications
688
+ // which incorrectly convey their info via alarm values.
689
+ const needsV1Values = this.notificationEvent === 0xfe && this.alarmType !== 0;
690
+ if (!needsV1Values) {
691
+ this.alarmType = undefined;
692
+ this.alarmLevel = undefined;
693
+ }
694
+ const containsSeqNum = !!(this.payload[6] & 128);
695
+ const numEventParams = this.payload[6] & 0b11111;
696
+ if (numEventParams > 0) {
697
+ (0, safe_1.validatePayload)(this.payload.length >= 7 + numEventParams);
698
+ this.eventParameters = Buffer.from(this.payload.slice(7, 7 + numEventParams));
699
+ }
700
+ if (containsSeqNum) {
701
+ (0, safe_1.validatePayload)(this.payload.length >= 7 + numEventParams + 1);
702
+ this.sequenceNumber = this.payload[7 + numEventParams];
703
+ }
704
+ }
705
+ // Store the V1 alarm values if they exist
706
+ }
707
+ else {
708
+ // Create a notification to send
709
+ if ("alarmType" in options) {
710
+ this.alarmType = options.alarmType;
711
+ this.alarmLevel = options.alarmLevel;
712
+ // Send a V1 command
713
+ this.version = 1;
714
+ }
715
+ else {
716
+ this.notificationType = options.notificationType;
717
+ this.notificationStatus = true;
718
+ this.notificationEvent = options.notificationEvent;
719
+ this.eventParameters = options.eventParameters;
720
+ this.sequenceNumber = options.sequenceNumber;
721
+ }
722
+ }
723
+ }
724
+ persistValues(applHost) {
725
+ var _a, _b, _c, _d;
726
+ if (!super.persistValues(applHost))
727
+ return false;
728
+ const valueDB = this.getValueDB(applHost);
729
+ // Check if we need to re-interpret the alarm values somehow
730
+ if (this.alarmType != undefined &&
731
+ this.alarmLevel != undefined &&
732
+ this.alarmType !== 0) {
733
+ if (this.version >= 2) {
734
+ // Check if the device actually supports Notification CC, but chooses
735
+ // to send Alarm frames instead (GH#1034)
736
+ const supportedNotificationTypes = valueDB.getValue(getSupportedNotificationTypesValueId());
737
+ if ((0, typeguards_1.isArray)(supportedNotificationTypes) &&
738
+ supportedNotificationTypes.includes(this.alarmType)) {
739
+ const supportedNotificationEvents = valueDB.getValue(getSupportedNotificationEventsValueId(this.alarmType));
740
+ if ((0, typeguards_1.isArray)(supportedNotificationEvents) &&
741
+ supportedNotificationEvents.includes(this.alarmLevel)) {
742
+ // This alarm frame corresponds to a valid notification event
743
+ applHost.controllerLog.logNode(this.nodeId, `treating V1 Alarm frame as Notification Report`);
744
+ this.notificationType = this.alarmType;
745
+ this.notificationEvent = this.alarmLevel;
746
+ this.alarmType = undefined;
747
+ this.alarmLevel = undefined;
748
+ }
749
+ }
750
+ }
751
+ else {
752
+ // V1 Alarm, check if there is a compat option to map this V1 report to a V2+ report
753
+ const mapping = (_d = (_c = (_b = (_a = this.host).getDeviceConfig) === null || _b === void 0 ? void 0 : _b.call(_a, this.nodeId)) === null || _c === void 0 ? void 0 : _c.compat) === null || _d === void 0 ? void 0 : _d.alarmMapping;
754
+ const match = mapping === null || mapping === void 0 ? void 0 : mapping.find((m) => m.from.alarmType === this.alarmType &&
755
+ (m.from.alarmLevel == undefined ||
756
+ m.from.alarmLevel === this.alarmLevel));
757
+ if (match) {
758
+ applHost.controllerLog.logNode(this.nodeId, `compat mapping found, treating V1 Alarm frame as Notification Report`);
759
+ this.notificationType = match.to.notificationType;
760
+ this.notificationEvent = match.to.notificationEvent;
761
+ if (match.to.eventParameters) {
762
+ this.eventParameters = {};
763
+ for (const [key, val] of Object.entries(match.to.eventParameters)) {
764
+ if (typeof val === "number") {
765
+ this.eventParameters[key] = val;
766
+ }
767
+ else if (val === "alarmLevel") {
768
+ this.eventParameters[key] = this.alarmLevel;
769
+ }
770
+ }
771
+ }
772
+ // After mapping we do not set the legacy V1 values to undefined
773
+ // Otherwise, adding a new mapping will be a breaking change
774
+ }
775
+ }
776
+ }
777
+ // Now we can interpret the event parameters and turn them into something useful
778
+ this.parseEventParameters(applHost);
779
+ if (this.alarmType != undefined) {
780
+ const valueId = getAlarmTypeValueId(this.endpointIndex);
781
+ if (!valueDB.hasMetadata(valueId)) {
782
+ valueDB.setMetadata(valueId, {
783
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
784
+ label: "Alarm Type",
785
+ });
786
+ }
787
+ valueDB.setValue(valueId, this.alarmType);
788
+ }
789
+ if (this.alarmLevel != undefined) {
790
+ const valueId = getAlarmLevelValueId(this.endpointIndex);
791
+ if (!valueDB.hasMetadata(valueId)) {
792
+ valueDB.setMetadata(valueId, {
793
+ ...safe_1.ValueMetadata.ReadOnlyUInt8,
794
+ label: "Alarm Level",
795
+ });
796
+ }
797
+ valueDB.setValue(valueId, this.alarmLevel);
798
+ }
799
+ return true;
800
+ }
801
+ toLogEntry(applHost) {
802
+ var _a, _b;
803
+ let message;
804
+ if (this.alarmType) {
805
+ message = {
806
+ "V1 alarm type": this.alarmType,
807
+ "V1 alarm level": this.alarmLevel,
808
+ };
809
+ }
810
+ else {
811
+ let valueConfig;
812
+ try {
813
+ valueConfig = (_a = applHost.configManager
814
+ .lookupNotification(this.notificationType)) === null || _a === void 0 ? void 0 : _a.lookupValue(this.notificationEvent);
815
+ }
816
+ catch {
817
+ /* ignore */
818
+ }
819
+ if (valueConfig) {
820
+ message = {
821
+ "notification type": applHost.configManager.getNotificationName(this.notificationType),
822
+ "notification status": this.notificationStatus,
823
+ [`notification ${valueConfig.type}`]: (_b = valueConfig.label) !== null && _b !== void 0 ? _b : `Unknown (${(0, safe_2.num2hex)(this.notificationEvent)})`,
824
+ };
825
+ }
826
+ else if (this.notificationEvent === 0x00) {
827
+ message = {
828
+ "notification type": this.notificationType,
829
+ "notification status": this.notificationStatus,
830
+ "notification state": "idle",
831
+ };
832
+ }
833
+ else {
834
+ message = {
835
+ "notification type": this.notificationType,
836
+ "notification status": this.notificationStatus,
837
+ "notification event": (0, safe_2.num2hex)(this.notificationEvent),
838
+ };
839
+ }
840
+ }
841
+ if (this.zensorNetSourceNodeId) {
842
+ message["zensor net source node id"] = this.zensorNetSourceNodeId;
843
+ }
844
+ if (this.sequenceNumber != undefined) {
845
+ message["sequence number"] = this.sequenceNumber;
846
+ }
847
+ if (this.eventParameters != undefined) {
848
+ if (Buffer.isBuffer(this.eventParameters)) {
849
+ message["event parameters"] = (0, safe_2.buffer2hex)(this.eventParameters);
850
+ }
851
+ else if (this.eventParameters instanceof safe_1.Duration) {
852
+ message["event parameters"] = this.eventParameters.toString();
853
+ }
854
+ else {
855
+ message["event parameters"] = Object.entries(this.eventParameters)
856
+ .map(([param, val]) => `\n ${param}: ${(0, safe_2.num2hex)(val)}`)
857
+ .join("");
858
+ }
859
+ }
860
+ return {
861
+ ...super.toLogEntry(applHost),
862
+ message,
863
+ };
864
+ }
865
+ parseEventParameters(applHost) {
866
+ // This only makes sense for V2+ notifications with a non-empty event parameters buffer
867
+ if (this.notificationType == undefined ||
868
+ this.notificationEvent == undefined ||
869
+ !Buffer.isBuffer(this.eventParameters)) {
870
+ return;
871
+ }
872
+ // Look up the received notification and value in the config
873
+ const notificationConfig = applHost.configManager.lookupNotification(this.notificationType);
874
+ if (!notificationConfig)
875
+ return;
876
+ const valueConfig = notificationConfig.lookupValue(this.notificationEvent);
877
+ if (!valueConfig)
878
+ return;
879
+ // Parse the event parameters if possible
880
+ if (valueConfig.parameter instanceof config_1.NotificationParameterWithDuration) {
881
+ // The parameters contain a Duration
882
+ this.eventParameters = safe_1.Duration.parseReport(this.eventParameters[0]);
883
+ }
884
+ else if (valueConfig.parameter instanceof
885
+ config_1.NotificationParameterWithCommandClass) {
886
+ // The parameters **should** contain a CC, however there might be some exceptions
887
+ if (this.eventParameters.length === 1 &&
888
+ notificationConfig.id === 0x06 &&
889
+ (this.notificationEvent === 0x05 ||
890
+ this.notificationEvent === 0x06)) {
891
+ // Access control -> Keypad Lock/Unlock operation
892
+ // Some devices only send the User ID, not a complete CC payload
893
+ this.eventParameters = {
894
+ userId: this.eventParameters[0],
895
+ };
896
+ }
897
+ else {
898
+ // Try to parse the event parameters - if this fails, we should still handle the notification report
899
+ try {
900
+ // Convert CommandClass instances to a standardized object representation
901
+ const cc = CommandClass_1.CommandClass.from(this.host, {
902
+ data: this.eventParameters,
903
+ fromEncapsulation: true,
904
+ encapCC: this,
905
+ });
906
+ (0, safe_1.validatePayload)(!(cc instanceof CommandClass_1.InvalidCC));
907
+ if ((0, NotificationEventPayload_1.isNotificationEventPayload)(cc)) {
908
+ this.eventParameters =
909
+ cc.toNotificationEventParameters();
910
+ }
911
+ else {
912
+ // If a CC has no good toJSON() representation, we're only interested in the payload
913
+ let json = cc.toJSON();
914
+ if ("nodeId" in json &&
915
+ "ccId" in json &&
916
+ "payload" in json) {
917
+ json = (0, safe_2.pick)(json, ["payload"]);
918
+ }
919
+ this.eventParameters = json;
920
+ }
921
+ }
922
+ catch (e) {
923
+ if ((0, safe_1.isZWaveError)(e) &&
924
+ e.code ===
925
+ safe_1.ZWaveErrorCodes.PacketFormat_InvalidPayload &&
926
+ Buffer.isBuffer(this.eventParameters)) {
927
+ const ccId = CommandClass_1.CommandClass.getCommandClass(this.eventParameters);
928
+ const ccCommand = CommandClass_1.CommandClass.getCCCommand(this.eventParameters);
929
+ if (ccId === safe_1.CommandClasses["User Code"] &&
930
+ ccCommand === _Types_1.UserCodeCommand.Report &&
931
+ this.eventParameters.length >= 3) {
932
+ // Access control -> Keypad Lock/Unlock operation
933
+ // Some devices report the user code with truncated UserCode reports
934
+ this.eventParameters = {
935
+ userId: this.eventParameters[2],
936
+ };
937
+ }
938
+ else {
939
+ applHost.controllerLog.logNode(this.nodeId, `Failed to parse Notification CC event parameters, ignoring them...`, "error");
940
+ }
941
+ }
942
+ else {
943
+ // unexpected error
944
+ throw e;
945
+ }
946
+ }
947
+ }
948
+ }
949
+ else if (valueConfig.parameter instanceof config_1.NotificationParameterWithValue) {
950
+ // The parameters contain a named value
951
+ this.eventParameters = {
952
+ [valueConfig.parameter.propertyName]: this.eventParameters.readUIntBE(0, this.eventParameters.length),
953
+ };
954
+ }
955
+ }
956
+ serialize() {
957
+ var _a, _b;
958
+ if (this.version === 1) {
959
+ if (this.alarmLevel == undefined || this.alarmType == undefined) {
960
+ 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);
961
+ }
962
+ this.payload = Buffer.from([this.alarmType, this.alarmLevel]);
963
+ }
964
+ else {
965
+ if (this.notificationType == undefined ||
966
+ this.notificationEvent == undefined) {
967
+ throw new safe_1.ZWaveError(`Notification CC reports requires the notification type and event to be set!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
968
+ }
969
+ else if (this.eventParameters != undefined &&
970
+ !Buffer.isBuffer(this.eventParameters)) {
971
+ throw new safe_1.ZWaveError(`When sending Notification CC reports, the event parameters can only be buffers!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
972
+ }
973
+ const controlByte = (this.sequenceNumber != undefined ? 128 : 0) |
974
+ (((_b = (_a = this.eventParameters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) & 0b11111);
975
+ this.payload = Buffer.from([
976
+ 0,
977
+ 0,
978
+ 0,
979
+ 0xff,
980
+ this.notificationType,
981
+ this.notificationEvent,
982
+ controlByte,
983
+ ]);
984
+ if (this.eventParameters) {
985
+ this.payload = Buffer.concat([
986
+ this.payload,
987
+ this.eventParameters,
988
+ ]);
989
+ }
990
+ if (this.sequenceNumber != undefined) {
991
+ this.payload = Buffer.concat([
992
+ this.payload,
993
+ Buffer.from([this.sequenceNumber]),
994
+ ]);
995
+ }
996
+ }
997
+ return super.serialize();
998
+ }
999
+ };
1000
+ NotificationCCReport = __decorate([
1001
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.Report)
1002
+ ], NotificationCCReport);
1003
+ exports.NotificationCCReport = NotificationCCReport;
1004
+ let NotificationCCGet = class NotificationCCGet extends NotificationCC {
1005
+ constructor(host, options) {
1006
+ super(host, options);
1007
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1008
+ // TODO: Deserialize payload
1009
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1010
+ }
1011
+ else {
1012
+ if ("alarmType" in options) {
1013
+ this.alarmType = options.alarmType;
1014
+ }
1015
+ else {
1016
+ this.notificationType = options.notificationType;
1017
+ this.notificationEvent = options.notificationEvent;
1018
+ }
1019
+ }
1020
+ }
1021
+ serialize() {
1022
+ const payload = [this.alarmType || 0];
1023
+ if (this.version >= 2 && this.notificationType != undefined) {
1024
+ payload.push(this.notificationType);
1025
+ if (this.version >= 3) {
1026
+ payload.push(this.notificationType === 0xff
1027
+ ? 0x00
1028
+ : this.notificationEvent || 0);
1029
+ }
1030
+ }
1031
+ this.payload = Buffer.from(payload);
1032
+ return super.serialize();
1033
+ }
1034
+ toLogEntry(applHost) {
1035
+ var _a, _b, _c;
1036
+ const message = {};
1037
+ if (this.alarmType != undefined) {
1038
+ message["V1 alarm type"] = this.alarmType;
1039
+ }
1040
+ if (this.notificationType != undefined) {
1041
+ message["notification type"] =
1042
+ applHost.configManager.getNotificationName(this.notificationType);
1043
+ if (this.notificationEvent != undefined) {
1044
+ message["notification event"] =
1045
+ (_c = (_b = (_a = applHost.configManager
1046
+ .lookupNotification(this.notificationType)) === null || _a === void 0 ? void 0 : _a.events.get(this.notificationEvent)) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : `Unknown (${(0, safe_2.num2hex)(this.notificationEvent)})`;
1047
+ }
1048
+ }
1049
+ return {
1050
+ ...super.toLogEntry(applHost),
1051
+ message,
1052
+ };
1053
+ }
1054
+ };
1055
+ NotificationCCGet = __decorate([
1056
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.Get),
1057
+ (0, CommandClass_1.expectedCCResponse)(NotificationCCReport)
1058
+ ], NotificationCCGet);
1059
+ exports.NotificationCCGet = NotificationCCGet;
1060
+ let NotificationCCSupportedReport = class NotificationCCSupportedReport extends NotificationCC {
1061
+ constructor(host, options) {
1062
+ super(host, options);
1063
+ (0, safe_1.validatePayload)(this.payload.length >= 1);
1064
+ this._supportsV1Alarm = !!(this.payload[0] & 128);
1065
+ const numBitMaskBytes = this.payload[0] & 31;
1066
+ (0, safe_1.validatePayload)(numBitMaskBytes > 0, this.payload.length >= 1 + numBitMaskBytes);
1067
+ const notificationBitMask = this.payload.slice(1, 1 + numBitMaskBytes);
1068
+ this._supportedNotificationTypes = (0, safe_1.parseBitMask)(notificationBitMask,
1069
+ // bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1070
+ 0);
1071
+ }
1072
+ get supportsV1Alarm() {
1073
+ return this._supportsV1Alarm;
1074
+ }
1075
+ get supportedNotificationTypes() {
1076
+ return this._supportedNotificationTypes;
1077
+ }
1078
+ toLogEntry(applHost) {
1079
+ return {
1080
+ ...super.toLogEntry(applHost),
1081
+ message: {
1082
+ "supports V1 alarm": this.supportsV1Alarm,
1083
+ "supported notification types": this.supportedNotificationTypes
1084
+ .map((t) => `\n· ${applHost.configManager.getNotificationName(t)}`)
1085
+ .join(""),
1086
+ },
1087
+ };
1088
+ }
1089
+ };
1090
+ __decorate([
1091
+ (0, CommandClass_1.ccValue)({ internal: true })
1092
+ ], NotificationCCSupportedReport.prototype, "supportsV1Alarm", null);
1093
+ __decorate([
1094
+ (0, CommandClass_1.ccValue)({ internal: true })
1095
+ ], NotificationCCSupportedReport.prototype, "supportedNotificationTypes", null);
1096
+ NotificationCCSupportedReport = __decorate([
1097
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.SupportedReport)
1098
+ ], NotificationCCSupportedReport);
1099
+ exports.NotificationCCSupportedReport = NotificationCCSupportedReport;
1100
+ let NotificationCCSupportedGet = class NotificationCCSupportedGet extends NotificationCC {
1101
+ };
1102
+ NotificationCCSupportedGet = __decorate([
1103
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.SupportedGet),
1104
+ (0, CommandClass_1.expectedCCResponse)(NotificationCCSupportedReport)
1105
+ ], NotificationCCSupportedGet);
1106
+ exports.NotificationCCSupportedGet = NotificationCCSupportedGet;
1107
+ let NotificationCCEventSupportedReport = class NotificationCCEventSupportedReport extends NotificationCC {
1108
+ constructor(host, options) {
1109
+ super(host, options);
1110
+ (0, safe_1.validatePayload)(this.payload.length >= 1);
1111
+ this._notificationType = this.payload[0];
1112
+ const numBitMaskBytes = this.payload[1] & 31;
1113
+ if (numBitMaskBytes === 0) {
1114
+ // Notification type is not supported
1115
+ this._supportedEvents = [];
1116
+ return;
1117
+ }
1118
+ (0, safe_1.validatePayload)(this.payload.length >= 2 + numBitMaskBytes);
1119
+ const eventBitMask = this.payload.slice(2, 2 + numBitMaskBytes);
1120
+ this._supportedEvents = (0, safe_1.parseBitMask)(eventBitMask,
1121
+ // In this mask, bit 0 is ignored, but counting still starts at 1, so the first bit must have the value 0
1122
+ 0);
1123
+ }
1124
+ persistValues(applHost) {
1125
+ if (!super.persistValues(applHost))
1126
+ return false;
1127
+ const valueDB = this.getValueDB(applHost);
1128
+ // Store which events this notification supports
1129
+ valueDB.setValue(getSupportedNotificationEventsValueId(this._notificationType), this._supportedEvents);
1130
+ // For each event, predefine the value metadata
1131
+ const metadataMap = defineMetadataForNotificationEvents(applHost.configManager, this.endpointIndex, this._notificationType, this._supportedEvents);
1132
+ for (const [key, metadata] of metadataMap.entries()) {
1133
+ const valueId = JSON.parse(key);
1134
+ valueDB.setMetadata(valueId, metadata);
1135
+ }
1136
+ return true;
1137
+ }
1138
+ get notificationType() {
1139
+ return this._notificationType;
1140
+ }
1141
+ get supportedEvents() {
1142
+ return this._supportedEvents;
1143
+ }
1144
+ toLogEntry(applHost) {
1145
+ const notification = applHost.configManager.lookupNotification(this.notificationType);
1146
+ return {
1147
+ ...super.toLogEntry(applHost),
1148
+ message: {
1149
+ "notification type": applHost.configManager.getNotificationName(this.notificationType),
1150
+ "supported events": this.supportedEvents
1151
+ .map((e) => {
1152
+ var _a, _b;
1153
+ return `\n· ${(_b = (_a = notification === null || notification === void 0 ? void 0 : notification.lookupValue(e)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : `Unknown (${(0, safe_2.num2hex)(e)})`}`;
1154
+ })
1155
+ .join(""),
1156
+ },
1157
+ };
1158
+ }
1159
+ };
1160
+ NotificationCCEventSupportedReport = __decorate([
1161
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.EventSupportedReport)
1162
+ ], NotificationCCEventSupportedReport);
1163
+ exports.NotificationCCEventSupportedReport = NotificationCCEventSupportedReport;
1164
+ let NotificationCCEventSupportedGet = class NotificationCCEventSupportedGet extends NotificationCC {
1165
+ constructor(host, options) {
1166
+ super(host, options);
1167
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
1168
+ // TODO: Deserialize payload
1169
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
1170
+ }
1171
+ else {
1172
+ this.notificationType = options.notificationType;
1173
+ }
1174
+ }
1175
+ serialize() {
1176
+ this.payload = Buffer.from([this.notificationType]);
1177
+ return super.serialize();
1178
+ }
1179
+ toLogEntry(applHost) {
1180
+ return {
1181
+ ...super.toLogEntry(applHost),
1182
+ message: {
1183
+ "notification type": applHost.configManager.getNotificationName(this.notificationType),
1184
+ },
1185
+ };
1186
+ }
1187
+ };
1188
+ NotificationCCEventSupportedGet = __decorate([
1189
+ (0, CommandClass_1.CCCommand)(_Types_1.NotificationCommand.EventSupportedGet),
1190
+ (0, CommandClass_1.expectedCCResponse)(NotificationCCEventSupportedReport)
1191
+ ], NotificationCCEventSupportedGet);
1192
+ exports.NotificationCCEventSupportedGet = NotificationCCEventSupportedGet;
1193
+ //# sourceMappingURL=NotificationCC.js.map