@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,883 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.MultiChannelAssociationCCSupportedGroupingsGet = exports.MultiChannelAssociationCCSupportedGroupingsReport = exports.MultiChannelAssociationCCGet = exports.MultiChannelAssociationCCReport = exports.MultiChannelAssociationCCRemove = exports.MultiChannelAssociationCCSet = exports.MultiChannelAssociationCC = exports.MultiChannelAssociationCCAPI = exports.getGroupCountValueId = exports.getEndpointsValueId = exports.getNodeIdsValueId = exports.getMaxNodesValueId = void 0;
33
+ function __assertType(argName, typeName, boundHasError) {
34
+ const { ZWaveError, ZWaveErrorCodes } = require("@zwave-js/core");
35
+ if (boundHasError()) {
36
+ throw new ZWaveError(typeName ? `${argName} is not a ${typeName}` : `${argName} has the wrong type`, ZWaveErrorCodes.Argument_Invalid);
37
+ }
38
+ }
39
+ const __assertType__number = $o => {
40
+ function _number($o) {
41
+ return typeof $o !== "number" ? {} : null;
42
+ }
43
+ return _number($o);
44
+ };
45
+ const __assertType__MultiChannelAssociationCCSetOptions = $o => {
46
+ function _number($o) {
47
+ return typeof $o !== "number" ? {} : null;
48
+ }
49
+ function _2($o) {
50
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
51
+ return {};
52
+ if ("groupId" in $o && $o["groupId"] !== undefined) {
53
+ const error = _number($o["groupId"]);
54
+ if (error)
55
+ return error;
56
+ }
57
+ else
58
+ return {};
59
+ return null;
60
+ }
61
+ function sa__number_ea_10($o) {
62
+ if (!Array.isArray($o))
63
+ return {};
64
+ for (let i = 0; i < $o.length; i++) {
65
+ const error = _number($o[i]);
66
+ if (error)
67
+ return error;
68
+ }
69
+ return null;
70
+ }
71
+ function _3($o) {
72
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
73
+ return {};
74
+ if ("nodeIds" in $o && $o["nodeIds"] !== undefined) {
75
+ const error = sa__number_ea_10($o["nodeIds"]);
76
+ if (error)
77
+ return error;
78
+ }
79
+ else
80
+ return {};
81
+ return null;
82
+ }
83
+ function si__2__3_ei($o) {
84
+ const conditions = [_2, _3];
85
+ for (const condition of conditions) {
86
+ const error = condition($o);
87
+ if (error)
88
+ return error;
89
+ }
90
+ return null;
91
+ }
92
+ function su__number_sa__number_ea_10_10_10_eu($o) {
93
+ const conditions = [_number, sa__number_ea_10];
94
+ for (const condition of conditions) {
95
+ const error = condition($o);
96
+ if (!error)
97
+ return null;
98
+ }
99
+ return {};
100
+ }
101
+ function _11($o) {
102
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
103
+ return {};
104
+ if ("nodeId" in $o && $o["nodeId"] !== undefined) {
105
+ const error = _number($o["nodeId"]);
106
+ if (error)
107
+ return error;
108
+ }
109
+ else
110
+ return {};
111
+ if ("endpoint" in $o && $o["endpoint"] !== undefined) {
112
+ const error = su__number_sa__number_ea_10_10_10_eu($o["endpoint"]);
113
+ if (error)
114
+ return error;
115
+ }
116
+ else
117
+ return {};
118
+ return null;
119
+ }
120
+ function sa__11_ea_11($o) {
121
+ if (!Array.isArray($o))
122
+ return {};
123
+ for (let i = 0; i < $o.length; i++) {
124
+ const error = _11($o[i]);
125
+ if (error)
126
+ return error;
127
+ }
128
+ return null;
129
+ }
130
+ function _5($o) {
131
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
132
+ return {};
133
+ if ("endpoints" in $o && $o["endpoints"] !== undefined) {
134
+ const error = sa__11_ea_11($o["endpoints"]);
135
+ if (error)
136
+ return error;
137
+ }
138
+ else
139
+ return {};
140
+ return null;
141
+ }
142
+ function si__2__5_ei($o) {
143
+ const conditions = [_2, _5];
144
+ for (const condition of conditions) {
145
+ const error = condition($o);
146
+ if (error)
147
+ return error;
148
+ }
149
+ return null;
150
+ }
151
+ function _7($o) {
152
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
153
+ return {};
154
+ if ("nodeIds" in $o && $o["nodeIds"] !== undefined) {
155
+ const error = sa__number_ea_10($o["nodeIds"]);
156
+ if (error)
157
+ return error;
158
+ }
159
+ else
160
+ return {};
161
+ if ("endpoints" in $o && $o["endpoints"] !== undefined) {
162
+ const error = sa__11_ea_11($o["endpoints"]);
163
+ if (error)
164
+ return error;
165
+ }
166
+ else
167
+ return {};
168
+ return null;
169
+ }
170
+ function si__2__7_ei($o) {
171
+ const conditions = [_2, _7];
172
+ for (const condition of conditions) {
173
+ const error = condition($o);
174
+ if (error)
175
+ return error;
176
+ }
177
+ return null;
178
+ }
179
+ function su_si__2__3_ei_si__2__5_ei_si__2__7_ei_eu($o) {
180
+ const conditions = [si__2__3_ei, si__2__5_ei, si__2__7_ei];
181
+ for (const condition of conditions) {
182
+ const error = condition($o);
183
+ if (!error)
184
+ return null;
185
+ }
186
+ return {};
187
+ }
188
+ return su_si__2__3_ei_si__2__5_ei_si__2__7_ei_eu($o);
189
+ };
190
+ const __assertType__MultiChannelAssociationCCRemoveOptions = $o => {
191
+ function _number($o) {
192
+ return typeof $o !== "number" ? {} : null;
193
+ }
194
+ function sa__number_ea_3($o) {
195
+ if (!Array.isArray($o))
196
+ return {};
197
+ for (let i = 0; i < $o.length; i++) {
198
+ const error = _number($o[i]);
199
+ if (error)
200
+ return error;
201
+ }
202
+ return null;
203
+ }
204
+ function su__number_sa__number_ea_3_3_3_eu($o) {
205
+ const conditions = [_number, sa__number_ea_3];
206
+ for (const condition of conditions) {
207
+ const error = condition($o);
208
+ if (!error)
209
+ return null;
210
+ }
211
+ return {};
212
+ }
213
+ function _4($o) {
214
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
215
+ return {};
216
+ if ("nodeId" in $o && $o["nodeId"] !== undefined) {
217
+ const error = _number($o["nodeId"]);
218
+ if (error)
219
+ return error;
220
+ }
221
+ else
222
+ return {};
223
+ if ("endpoint" in $o && $o["endpoint"] !== undefined) {
224
+ const error = su__number_sa__number_ea_3_3_3_eu($o["endpoint"]);
225
+ if (error)
226
+ return error;
227
+ }
228
+ else
229
+ return {};
230
+ return null;
231
+ }
232
+ function sa__4_ea_4($o) {
233
+ if (!Array.isArray($o))
234
+ return {};
235
+ for (let i = 0; i < $o.length; i++) {
236
+ const error = _4($o[i]);
237
+ if (error)
238
+ return error;
239
+ }
240
+ return null;
241
+ }
242
+ function _0($o) {
243
+ if (typeof $o !== "object" || $o === null || Array.isArray($o))
244
+ return {};
245
+ if ("groupId" in $o && $o["groupId"] !== undefined) {
246
+ const error = _number($o["groupId"]);
247
+ if (error)
248
+ return error;
249
+ }
250
+ if ("nodeIds" in $o && $o["nodeIds"] !== undefined) {
251
+ const error = sa__number_ea_3($o["nodeIds"]);
252
+ if (error)
253
+ return error;
254
+ }
255
+ if ("endpoints" in $o && $o["endpoints"] !== undefined) {
256
+ const error = sa__4_ea_4($o["endpoints"]);
257
+ if (error)
258
+ return error;
259
+ }
260
+ return null;
261
+ }
262
+ return _0($o);
263
+ };
264
+ const safe_1 = require("@zwave-js/core/safe");
265
+ const safe_2 = require("@zwave-js/shared/safe");
266
+ const API_1 = require("../lib/API");
267
+ const CommandClass_1 = require("../lib/CommandClass");
268
+ const ccUtils = __importStar(require("../lib/utils"));
269
+ const _Types_1 = require("../lib/_Types");
270
+ const AssociationCC_1 = require("./AssociationCC");
271
+ /** Returns the ValueID used to store the maximum number of nodes of an association group */
272
+ function getMaxNodesValueId(endpointIndex, groupId) {
273
+ return {
274
+ commandClass: safe_1.CommandClasses["Multi Channel Association"],
275
+ endpoint: endpointIndex,
276
+ property: "maxNodes",
277
+ propertyKey: groupId,
278
+ };
279
+ }
280
+ exports.getMaxNodesValueId = getMaxNodesValueId;
281
+ /** Returns the ValueID used to store the node IDs of a multi channel association group */
282
+ function getNodeIdsValueId(endpointIndex, groupId) {
283
+ return {
284
+ commandClass: safe_1.CommandClasses["Multi Channel Association"],
285
+ endpoint: endpointIndex,
286
+ property: "nodeIds",
287
+ propertyKey: groupId,
288
+ };
289
+ }
290
+ exports.getNodeIdsValueId = getNodeIdsValueId;
291
+ /** Returns the ValueID used to store the endpoint addresses of a multi channel association group */
292
+ function getEndpointsValueId(endpointIndex, groupId) {
293
+ return {
294
+ commandClass: safe_1.CommandClasses["Multi Channel Association"],
295
+ endpoint: endpointIndex,
296
+ property: "endpoints",
297
+ propertyKey: groupId,
298
+ };
299
+ }
300
+ exports.getEndpointsValueId = getEndpointsValueId;
301
+ /** Returns the ValueID used to store the number of multi channel association group */
302
+ function getGroupCountValueId(endpointIndex) {
303
+ return {
304
+ commandClass: safe_1.CommandClasses["Multi Channel Association"],
305
+ endpoint: endpointIndex,
306
+ property: "groupCount",
307
+ };
308
+ }
309
+ exports.getGroupCountValueId = getGroupCountValueId;
310
+ function endpointAddressesToString(endpoints) {
311
+ return endpoints
312
+ .map(({ nodeId, endpoint }) => {
313
+ if (typeof endpoint === "number") {
314
+ return `${nodeId}:${endpoint}`;
315
+ }
316
+ else {
317
+ return `${nodeId}:[${endpoint.map(String).join(", ")}]`;
318
+ }
319
+ })
320
+ .join(", ");
321
+ }
322
+ const MULTI_CHANNEL_ASSOCIATION_MARKER = 0x00;
323
+ function serializeMultiChannelAssociationDestination(nodeIds, endpoints) {
324
+ const nodeAddressBytes = nodeIds.length;
325
+ const endpointAddressBytes = endpoints.length * 2;
326
+ const payload = Buffer.allocUnsafe(
327
+ // node addresses
328
+ nodeAddressBytes +
329
+ // endpoint marker
330
+ (endpointAddressBytes > 0 ? 1 : 0) +
331
+ // endpoints
332
+ endpointAddressBytes);
333
+ // write node addresses
334
+ for (let i = 0; i < nodeIds.length; i++) {
335
+ payload[i] = nodeIds[i];
336
+ }
337
+ // write endpoint addresses
338
+ if (endpointAddressBytes > 0) {
339
+ let offset = nodeIds.length;
340
+ payload[offset] = MULTI_CHANNEL_ASSOCIATION_MARKER;
341
+ offset += 1;
342
+ for (let i = 0; i < endpoints.length; i++) {
343
+ const endpoint = endpoints[i];
344
+ const destination = typeof endpoint.endpoint === "number"
345
+ ? // The destination is a single number
346
+ endpoint.endpoint & 127
347
+ : // The destination is a bit mask
348
+ (0, safe_1.encodeBitMask)(endpoint.endpoint, 7)[0] | 128;
349
+ payload[offset + 2 * i] = endpoint.nodeId;
350
+ payload[offset + 2 * i + 1] = destination;
351
+ }
352
+ }
353
+ return payload;
354
+ }
355
+ function deserializeMultiChannelAssociationDestination(data) {
356
+ const nodeIds = [];
357
+ let endpointOffset = data.length;
358
+ // Scan node ids until we find the marker
359
+ for (let i = 0; i < data.length; i++) {
360
+ if (data[i] === MULTI_CHANNEL_ASSOCIATION_MARKER) {
361
+ endpointOffset = i + 1;
362
+ break;
363
+ }
364
+ nodeIds.push(data[i]);
365
+ }
366
+ const endpoints = [];
367
+ for (let i = endpointOffset; i < data.length; i += 2) {
368
+ const nodeId = data[i];
369
+ const isBitMask = !!(data[i + 1] & 128);
370
+ const destination = data[i + 1] & 127;
371
+ const endpoint = isBitMask
372
+ ? (0, safe_1.parseBitMask)(Buffer.from([destination]))
373
+ : destination;
374
+ endpoints.push({ nodeId, endpoint });
375
+ }
376
+ return { nodeIds, endpoints };
377
+ }
378
+ // @noSetValueAPI
379
+ let MultiChannelAssociationCCAPI = class MultiChannelAssociationCCAPI extends API_1.PhysicalCCAPI {
380
+ supportsCommand(cmd) {
381
+ switch (cmd) {
382
+ case _Types_1.MultiChannelAssociationCommand.Get:
383
+ case _Types_1.MultiChannelAssociationCommand.Set:
384
+ case _Types_1.MultiChannelAssociationCommand.Remove:
385
+ case _Types_1.MultiChannelAssociationCommand.SupportedGroupingsGet:
386
+ return true; // This is mandatory
387
+ }
388
+ return super.supportsCommand(cmd);
389
+ }
390
+ /**
391
+ * Returns the number of association groups a node supports.
392
+ * Association groups are consecutive, starting at 1.
393
+ */
394
+ async getGroupCount() {
395
+ this.assertSupportsCommand(_Types_1.MultiChannelAssociationCommand, _Types_1.MultiChannelAssociationCommand.SupportedGroupingsGet);
396
+ const cc = new MultiChannelAssociationCCSupportedGroupingsGet(this.applHost, {
397
+ nodeId: this.endpoint.nodeId,
398
+ endpoint: this.endpoint.index,
399
+ });
400
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
401
+ return response === null || response === void 0 ? void 0 : response.groupCount;
402
+ }
403
+ /**
404
+ * Returns information about an association group.
405
+ */
406
+ async getGroup(groupId) {
407
+ __assertType("groupId", "number", __assertType__number.bind(void 0, groupId));
408
+ this.assertSupportsCommand(_Types_1.MultiChannelAssociationCommand, _Types_1.MultiChannelAssociationCommand.Get);
409
+ const cc = new MultiChannelAssociationCCGet(this.applHost, {
410
+ nodeId: this.endpoint.nodeId,
411
+ endpoint: this.endpoint.index,
412
+ groupId,
413
+ });
414
+ const response = await this.applHost.sendCommand(cc, this.commandOptions);
415
+ if (response) {
416
+ return (0, safe_2.pick)(response, ["maxNodes", "nodeIds", "endpoints"]);
417
+ }
418
+ }
419
+ /**
420
+ * Adds new nodes or endpoints to an association group
421
+ */
422
+ async addDestinations(options) {
423
+ __assertType("options", "MultiChannelAssociationCCSetOptions", __assertType__MultiChannelAssociationCCSetOptions.bind(void 0, options));
424
+ this.assertSupportsCommand(_Types_1.MultiChannelAssociationCommand, _Types_1.MultiChannelAssociationCommand.Set);
425
+ const cc = new MultiChannelAssociationCCSet(this.applHost, {
426
+ nodeId: this.endpoint.nodeId,
427
+ endpoint: this.endpoint.index,
428
+ ...options,
429
+ });
430
+ await this.applHost.sendCommand(cc, this.commandOptions);
431
+ }
432
+ /**
433
+ * Removes nodes or endpoints from an association group
434
+ */
435
+ async removeDestinations(options) {
436
+ __assertType("options", "MultiChannelAssociationCCRemoveOptions", __assertType__MultiChannelAssociationCCRemoveOptions.bind(void 0, options));
437
+ this.assertSupportsCommand(_Types_1.MultiChannelAssociationCommand, _Types_1.MultiChannelAssociationCommand.Remove);
438
+ if (!options.groupId && this.version === 1) {
439
+ // V1 does not support omitting the group, manually remove the destination from all groups
440
+ // We don't want to do too much work, so find out which groups the destination is in
441
+ const currentDestinations = MultiChannelAssociationCC.getAllDestinationsCached(this.applHost, this.endpoint);
442
+ for (const [group, destinations] of currentDestinations) {
443
+ const cc = new MultiChannelAssociationCCRemove(this.applHost, {
444
+ nodeId: this.endpoint.nodeId,
445
+ endpoint: this.endpoint.index,
446
+ groupId: group,
447
+ nodeIds: destinations
448
+ .filter((d) => !d.endpoint)
449
+ .map((d) => d.nodeId),
450
+ endpoints: destinations.filter((d) => !!d.endpoint),
451
+ });
452
+ await this.applHost.sendCommand(cc, this.commandOptions);
453
+ }
454
+ }
455
+ else {
456
+ const cc = new MultiChannelAssociationCCRemove(this.applHost, {
457
+ nodeId: this.endpoint.nodeId,
458
+ endpoint: this.endpoint.index,
459
+ ...options,
460
+ });
461
+ await this.applHost.sendCommand(cc, this.commandOptions);
462
+ }
463
+ }
464
+ };
465
+ MultiChannelAssociationCCAPI = __decorate([
466
+ (0, CommandClass_1.API)(safe_1.CommandClasses["Multi Channel Association"])
467
+ ], MultiChannelAssociationCCAPI);
468
+ exports.MultiChannelAssociationCCAPI = MultiChannelAssociationCCAPI;
469
+ let MultiChannelAssociationCC = class MultiChannelAssociationCC extends CommandClass_1.CommandClass {
470
+ constructor(host, options) {
471
+ super(host, options);
472
+ // Make valueIDs internal
473
+ this.registerValue(getMaxNodesValueId(0, 0).property, {
474
+ internal: true,
475
+ });
476
+ this.registerValue(getNodeIdsValueId(0, 0).property, {
477
+ internal: true,
478
+ });
479
+ this.registerValue(getEndpointsValueId(0, 0).property, {
480
+ internal: true,
481
+ });
482
+ }
483
+ determineRequiredCCInterviews() {
484
+ // MultiChannelAssociationCC must be interviewed after Z-Wave+ if that is supported
485
+ return [
486
+ ...super.determineRequiredCCInterviews(),
487
+ safe_1.CommandClasses["Z-Wave Plus Info"],
488
+ // We need information about endpoints to correctly configure the lifeline associations
489
+ safe_1.CommandClasses["Multi Channel"],
490
+ // AssociationCC will short-circuit if this CC is supported
491
+ safe_1.CommandClasses.Association,
492
+ ];
493
+ }
494
+ /**
495
+ * Returns the number of association groups reported by the node/endpoint.
496
+ * This only works AFTER the interview process
497
+ */
498
+ static getGroupCountCached(applHost, endpoint) {
499
+ return (applHost
500
+ .getValueDB(endpoint.nodeId)
501
+ .getValue(getGroupCountValueId(endpoint.index)) || 0);
502
+ }
503
+ /**
504
+ * Returns the number of nodes an association group supports.
505
+ * This only works AFTER the interview process
506
+ */
507
+ static getMaxNodesCached(applHost, endpoint, groupId) {
508
+ var _a;
509
+ return ((_a = applHost
510
+ .getValueDB(endpoint.nodeId)
511
+ .getValue(getMaxNodesValueId(endpoint.index, groupId))) !== null && _a !== void 0 ? _a : 0);
512
+ }
513
+ /**
514
+ * Returns all the destinations of all association groups reported by the node/endpoint.
515
+ * This only works AFTER the interview process
516
+ */
517
+ static getAllDestinationsCached(applHost, endpoint) {
518
+ var _a, _b;
519
+ const ret = new Map();
520
+ const groupCount = this.getGroupCountCached(applHost, endpoint);
521
+ const valueDB = applHost.getValueDB(endpoint.nodeId);
522
+ for (let i = 1; i <= groupCount; i++) {
523
+ const groupDestinations = [];
524
+ // Add all node destinations
525
+ const nodes = (_a = valueDB.getValue(getNodeIdsValueId(endpoint.index, i))) !== null && _a !== void 0 ? _a : [];
526
+ groupDestinations.push(...nodes.map((nodeId) => ({ nodeId })));
527
+ // And all endpoint destinations
528
+ const endpoints = (_b = valueDB.getValue(getEndpointsValueId(endpoint.index, i))) !== null && _b !== void 0 ? _b : [];
529
+ for (const ep of endpoints) {
530
+ if (typeof ep.endpoint === "number") {
531
+ groupDestinations.push({
532
+ nodeId: ep.nodeId,
533
+ endpoint: ep.endpoint,
534
+ });
535
+ }
536
+ else {
537
+ groupDestinations.push(...ep.endpoint.map((e) => ({
538
+ nodeId: ep.nodeId,
539
+ endpoint: e,
540
+ })));
541
+ }
542
+ }
543
+ ret.set(i,
544
+ // Filter out duplicates
545
+ groupDestinations.filter((addr, index) => index ===
546
+ groupDestinations.findIndex(({ nodeId, endpoint }) => nodeId === addr.nodeId &&
547
+ endpoint === addr.endpoint)));
548
+ }
549
+ return ret;
550
+ }
551
+ async interview(applHost) {
552
+ const node = this.getNode(applHost);
553
+ const endpoint = this.getEndpoint(applHost);
554
+ const mcAPI = API_1.CCAPI.create(safe_1.CommandClasses["Multi Channel Association"], applHost, endpoint);
555
+ applHost.controllerLog.logNode(node.id, {
556
+ endpoint: this.endpointIndex,
557
+ message: `Interviewing ${this.ccName}...`,
558
+ direction: "none",
559
+ });
560
+ // First find out how many groups are supported as multi channel
561
+ applHost.controllerLog.logNode(node.id, {
562
+ endpoint: this.endpointIndex,
563
+ message: "querying number of multi channel association groups...",
564
+ direction: "outbound",
565
+ });
566
+ const mcGroupCount = await mcAPI.getGroupCount();
567
+ if (mcGroupCount != undefined) {
568
+ applHost.controllerLog.logNode(node.id, {
569
+ endpoint: this.endpointIndex,
570
+ message: `supports ${mcGroupCount} multi channel association groups`,
571
+ direction: "inbound",
572
+ });
573
+ }
574
+ else {
575
+ applHost.controllerLog.logNode(node.id, {
576
+ endpoint: this.endpointIndex,
577
+ message: "Querying multi channel association groups timed out, skipping interview...",
578
+ level: "warn",
579
+ });
580
+ return;
581
+ }
582
+ // Query each association group for its members
583
+ await this.refreshValues(applHost);
584
+ // And set up lifeline associations
585
+ await ccUtils.configureLifelineAssociations(applHost, endpoint);
586
+ // Remember that the interview is complete
587
+ this.setInterviewComplete(applHost, true);
588
+ }
589
+ async refreshValues(applHost) {
590
+ var _a;
591
+ const node = this.getNode(applHost);
592
+ const endpoint = this.getEndpoint(applHost);
593
+ const mcAPI = API_1.CCAPI.create(safe_1.CommandClasses["Multi Channel Association"], applHost, endpoint).withOptions({
594
+ priority: safe_1.MessagePriority.NodeQuery,
595
+ });
596
+ const assocAPI = API_1.CCAPI.create(safe_1.CommandClasses.Association, applHost, endpoint).withOptions({
597
+ priority: safe_1.MessagePriority.NodeQuery,
598
+ });
599
+ const valueDB = this.getValueDB(applHost);
600
+ const mcGroupCount = (_a = valueDB.getValue(getGroupCountValueId(this.endpointIndex))) !== null && _a !== void 0 ? _a : 0;
601
+ // Some devices report more association groups than multi channel association groups, so we need this info here
602
+ const assocGroupCount = valueDB.getValue((0, AssociationCC_1.getGroupCountValueId)(this.endpointIndex)) || mcGroupCount;
603
+ // Then query each multi channel association group
604
+ for (let groupId = 1; groupId <= mcGroupCount; groupId++) {
605
+ applHost.controllerLog.logNode(node.id, {
606
+ endpoint: this.endpointIndex,
607
+ message: `querying multi channel association group #${groupId}...`,
608
+ direction: "outbound",
609
+ });
610
+ const group = await mcAPI.getGroup(groupId);
611
+ if (!group)
612
+ continue;
613
+ const logMessage = `received information for multi channel association group #${groupId}:
614
+ maximum # of nodes: ${group.maxNodes}
615
+ currently assigned nodes: ${group.nodeIds.map(String).join(", ")}
616
+ currently assigned endpoints: ${group.endpoints
617
+ .map(({ nodeId, endpoint }) => {
618
+ if (typeof endpoint === "number") {
619
+ return `${nodeId}:${endpoint}`;
620
+ }
621
+ else {
622
+ return `${nodeId}:[${endpoint.map(String).join(", ")}]`;
623
+ }
624
+ })
625
+ .join("")}`;
626
+ applHost.controllerLog.logNode(node.id, {
627
+ endpoint: this.endpointIndex,
628
+ message: logMessage,
629
+ direction: "inbound",
630
+ });
631
+ }
632
+ // Check if there are more non-multi-channel association groups we haven't queried yet
633
+ if (assocAPI.isSupported() && assocGroupCount > mcGroupCount) {
634
+ applHost.controllerLog.logNode(node.id, {
635
+ endpoint: this.endpointIndex,
636
+ message: `querying additional non-multi-channel association groups...`,
637
+ direction: "outbound",
638
+ });
639
+ for (let groupId = mcGroupCount + 1; groupId <= assocGroupCount; groupId++) {
640
+ applHost.controllerLog.logNode(node.id, {
641
+ endpoint: this.endpointIndex,
642
+ message: `querying association group #${groupId}...`,
643
+ direction: "outbound",
644
+ });
645
+ const group = await assocAPI.getGroup(groupId);
646
+ if (!group)
647
+ continue;
648
+ const logMessage = `received information for association group #${groupId}:
649
+ maximum # of nodes: ${group.maxNodes}
650
+ currently assigned nodes: ${group.nodeIds.map(String).join(", ")}`;
651
+ applHost.controllerLog.logNode(node.id, {
652
+ endpoint: this.endpointIndex,
653
+ message: logMessage,
654
+ direction: "inbound",
655
+ });
656
+ }
657
+ }
658
+ }
659
+ };
660
+ MultiChannelAssociationCC = __decorate([
661
+ (0, CommandClass_1.commandClass)(safe_1.CommandClasses["Multi Channel Association"]),
662
+ (0, CommandClass_1.implementedVersion)(4)
663
+ ], MultiChannelAssociationCC);
664
+ exports.MultiChannelAssociationCC = MultiChannelAssociationCC;
665
+ let MultiChannelAssociationCCSet = class MultiChannelAssociationCCSet extends MultiChannelAssociationCC {
666
+ constructor(host, options) {
667
+ super(host, options);
668
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
669
+ // TODO: Deserialize payload
670
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
671
+ }
672
+ else {
673
+ if (options.groupId < 1) {
674
+ throw new safe_1.ZWaveError("The group id must be positive!", safe_1.ZWaveErrorCodes.Argument_Invalid);
675
+ }
676
+ this.groupId = options.groupId;
677
+ this.nodeIds = ("nodeIds" in options && options.nodeIds) || [];
678
+ if (this.nodeIds.some((n) => n < 1 || n > safe_1.MAX_NODES)) {
679
+ throw new safe_1.ZWaveError(`All node IDs must be between 1 and ${safe_1.MAX_NODES}!`, safe_1.ZWaveErrorCodes.Argument_Invalid);
680
+ }
681
+ this.endpoints =
682
+ ("endpoints" in options && options.endpoints) || [];
683
+ }
684
+ }
685
+ serialize() {
686
+ this.payload = Buffer.concat([
687
+ Buffer.from([this.groupId]),
688
+ serializeMultiChannelAssociationDestination(this.nodeIds, this.endpoints),
689
+ ]);
690
+ return super.serialize();
691
+ }
692
+ toLogEntry(applHost) {
693
+ return {
694
+ ...super.toLogEntry(applHost),
695
+ message: {
696
+ "group id": this.groupId,
697
+ "node ids": this.nodeIds.join(", "),
698
+ endpoints: endpointAddressesToString(this.endpoints),
699
+ },
700
+ };
701
+ }
702
+ };
703
+ MultiChannelAssociationCCSet = __decorate([
704
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.Set)
705
+ ], MultiChannelAssociationCCSet);
706
+ exports.MultiChannelAssociationCCSet = MultiChannelAssociationCCSet;
707
+ let MultiChannelAssociationCCRemove = class MultiChannelAssociationCCRemove extends MultiChannelAssociationCC {
708
+ constructor(host, options) {
709
+ super(host, options);
710
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
711
+ // TODO: Deserialize payload
712
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
713
+ }
714
+ else {
715
+ // Validate options
716
+ if (!options.groupId) {
717
+ if (this.version === 1) {
718
+ throw new safe_1.ZWaveError(`Node ${this.nodeId} only supports MultiChannelAssociationCC V1 which requires the group Id to be set`, safe_1.ZWaveErrorCodes.Argument_Invalid);
719
+ }
720
+ }
721
+ else if (options.groupId < 0) {
722
+ throw new safe_1.ZWaveError("The group id must be positive!", safe_1.ZWaveErrorCodes.Argument_Invalid);
723
+ }
724
+ // When removing associations, we allow invalid node IDs.
725
+ // See GH#3606 - it is possible that those exist.
726
+ this.groupId = options.groupId;
727
+ this.nodeIds = options.nodeIds;
728
+ this.endpoints = options.endpoints;
729
+ }
730
+ }
731
+ serialize() {
732
+ this.payload = Buffer.concat([
733
+ Buffer.from([this.groupId || 0]),
734
+ serializeMultiChannelAssociationDestination(this.nodeIds || [], this.endpoints || []),
735
+ ]);
736
+ return super.serialize();
737
+ }
738
+ toLogEntry(applHost) {
739
+ const message = { "group id": this.groupId };
740
+ if (this.nodeIds) {
741
+ message["node ids"] = this.nodeIds.join(", ");
742
+ }
743
+ if (this.endpoints) {
744
+ message.endpoints = endpointAddressesToString(this.endpoints);
745
+ }
746
+ return {
747
+ ...super.toLogEntry(applHost),
748
+ message,
749
+ };
750
+ }
751
+ };
752
+ MultiChannelAssociationCCRemove = __decorate([
753
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.Remove)
754
+ ], MultiChannelAssociationCCRemove);
755
+ exports.MultiChannelAssociationCCRemove = MultiChannelAssociationCCRemove;
756
+ let MultiChannelAssociationCCReport = class MultiChannelAssociationCCReport extends MultiChannelAssociationCC {
757
+ constructor(host, options) {
758
+ super(host, options);
759
+ (0, safe_1.validatePayload)(this.payload.length >= 3);
760
+ this._groupId = this.payload[0];
761
+ this._maxNodes = this.payload[1];
762
+ this._reportsToFollow = this.payload[2];
763
+ ({ nodeIds: this._nodeIds, endpoints: this._endpoints } =
764
+ deserializeMultiChannelAssociationDestination(this.payload.slice(3)));
765
+ }
766
+ get groupId() {
767
+ return this._groupId;
768
+ }
769
+ get maxNodes() {
770
+ return this._maxNodes;
771
+ }
772
+ get nodeIds() {
773
+ return this._nodeIds;
774
+ }
775
+ get endpoints() {
776
+ return this._endpoints;
777
+ }
778
+ get reportsToFollow() {
779
+ return this._reportsToFollow;
780
+ }
781
+ getPartialCCSessionId() {
782
+ // Distinguish sessions by the association group ID
783
+ return { groupId: this._groupId };
784
+ }
785
+ expectMoreMessages() {
786
+ return this._reportsToFollow > 0;
787
+ }
788
+ mergePartialCCs(applHost, partials) {
789
+ // Concat the list of nodes
790
+ this._nodeIds = [...partials, this]
791
+ .map((report) => report._nodeIds)
792
+ .reduce((prev, cur) => prev.concat(...cur), []);
793
+ // Concat the list of endpoints
794
+ this._endpoints = [...partials, this]
795
+ .map((report) => report._endpoints)
796
+ .reduce((prev, cur) => prev.concat(...cur), []);
797
+ }
798
+ toLogEntry(applHost) {
799
+ return {
800
+ ...super.toLogEntry(applHost),
801
+ message: {
802
+ "group id": this.groupId,
803
+ "maximum # of nodes": this.maxNodes,
804
+ "node ids": this.nodeIds.join(", "),
805
+ endpoints: endpointAddressesToString(this.endpoints),
806
+ },
807
+ };
808
+ }
809
+ };
810
+ __decorate([
811
+ (0, CommandClass_1.ccValue)({ internal: true })
812
+ ], MultiChannelAssociationCCReport.prototype, "maxNodes", null);
813
+ __decorate([
814
+ (0, CommandClass_1.ccValue)({ internal: true })
815
+ ], MultiChannelAssociationCCReport.prototype, "nodeIds", null);
816
+ __decorate([
817
+ (0, CommandClass_1.ccValue)({ internal: true })
818
+ ], MultiChannelAssociationCCReport.prototype, "endpoints", null);
819
+ MultiChannelAssociationCCReport = __decorate([
820
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.Report)
821
+ ], MultiChannelAssociationCCReport);
822
+ exports.MultiChannelAssociationCCReport = MultiChannelAssociationCCReport;
823
+ let MultiChannelAssociationCCGet = class MultiChannelAssociationCCGet extends MultiChannelAssociationCC {
824
+ constructor(host, options) {
825
+ super(host, options);
826
+ if ((0, CommandClass_1.gotDeserializationOptions)(options)) {
827
+ // TODO: Deserialize payload
828
+ throw new safe_1.ZWaveError(`${this.constructor.name}: deserialization not implemented`, safe_1.ZWaveErrorCodes.Deserialization_NotImplemented);
829
+ }
830
+ else {
831
+ if (options.groupId < 1) {
832
+ throw new safe_1.ZWaveError("The group id must be positive!", safe_1.ZWaveErrorCodes.Argument_Invalid);
833
+ }
834
+ this.groupId = options.groupId;
835
+ }
836
+ }
837
+ serialize() {
838
+ this.payload = Buffer.from([this.groupId]);
839
+ return super.serialize();
840
+ }
841
+ toLogEntry(applHost) {
842
+ return {
843
+ ...super.toLogEntry(applHost),
844
+ message: { "group id": this.groupId },
845
+ };
846
+ }
847
+ };
848
+ MultiChannelAssociationCCGet = __decorate([
849
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.Get),
850
+ (0, CommandClass_1.expectedCCResponse)(MultiChannelAssociationCCReport)
851
+ ], MultiChannelAssociationCCGet);
852
+ exports.MultiChannelAssociationCCGet = MultiChannelAssociationCCGet;
853
+ let MultiChannelAssociationCCSupportedGroupingsReport = class MultiChannelAssociationCCSupportedGroupingsReport extends MultiChannelAssociationCC {
854
+ constructor(host, options) {
855
+ super(host, options);
856
+ (0, safe_1.validatePayload)(this.payload.length >= 1);
857
+ this._groupCount = this.payload[0];
858
+ }
859
+ get groupCount() {
860
+ return this._groupCount;
861
+ }
862
+ toLogEntry(applHost) {
863
+ return {
864
+ ...super.toLogEntry(applHost),
865
+ message: { "group count": this.groupCount },
866
+ };
867
+ }
868
+ };
869
+ __decorate([
870
+ (0, CommandClass_1.ccValue)({ internal: true })
871
+ ], MultiChannelAssociationCCSupportedGroupingsReport.prototype, "groupCount", null);
872
+ MultiChannelAssociationCCSupportedGroupingsReport = __decorate([
873
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.SupportedGroupingsReport)
874
+ ], MultiChannelAssociationCCSupportedGroupingsReport);
875
+ exports.MultiChannelAssociationCCSupportedGroupingsReport = MultiChannelAssociationCCSupportedGroupingsReport;
876
+ let MultiChannelAssociationCCSupportedGroupingsGet = class MultiChannelAssociationCCSupportedGroupingsGet extends MultiChannelAssociationCC {
877
+ };
878
+ MultiChannelAssociationCCSupportedGroupingsGet = __decorate([
879
+ (0, CommandClass_1.CCCommand)(_Types_1.MultiChannelAssociationCommand.SupportedGroupingsGet),
880
+ (0, CommandClass_1.expectedCCResponse)(MultiChannelAssociationCCSupportedGroupingsReport)
881
+ ], MultiChannelAssociationCCSupportedGroupingsGet);
882
+ exports.MultiChannelAssociationCCSupportedGroupingsGet = MultiChannelAssociationCCSupportedGroupingsGet;
883
+ //# sourceMappingURL=MultiChannelAssociationCC.js.map