@zwave-js/cc 15.28.0 → 15.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/build/cjs/cc/AlarmSensorCC.d.ts +3 -1
  2. package/build/cjs/cc/AlarmSensorCC.js +22 -2
  3. package/build/cjs/cc/AlarmSensorCC.js.map +2 -2
  4. package/build/cjs/cc/AssociationCC.js +6 -5
  5. package/build/cjs/cc/AssociationCC.js.map +2 -2
  6. package/build/cjs/cc/AssociationGroupInfoCC.js +4 -5
  7. package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
  8. package/build/cjs/cc/BarrierOperatorCC.d.ts +6 -3
  9. package/build/cjs/cc/BarrierOperatorCC.js +40 -6
  10. package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
  11. package/build/cjs/cc/BasicCC.d.ts +4 -1
  12. package/build/cjs/cc/BasicCC.js +18 -0
  13. package/build/cjs/cc/BasicCC.js.map +3 -3
  14. package/build/cjs/cc/BasicWindowCoveringCC.js.map +2 -2
  15. package/build/cjs/cc/BatteryCC.js +16 -3
  16. package/build/cjs/cc/BatteryCC.js.map +2 -2
  17. package/build/cjs/cc/BinarySensorCC.js.map +2 -2
  18. package/build/cjs/cc/BinarySwitchCC.d.ts +4 -1
  19. package/build/cjs/cc/BinarySwitchCC.js +18 -0
  20. package/build/cjs/cc/BinarySwitchCC.js.map +3 -3
  21. package/build/cjs/cc/CRC16CC.d.ts +3 -2
  22. package/build/cjs/cc/CRC16CC.js +7 -1
  23. package/build/cjs/cc/CRC16CC.js.map +3 -3
  24. package/build/cjs/cc/CentralSceneCC.d.ts +4 -1
  25. package/build/cjs/cc/CentralSceneCC.js +34 -2
  26. package/build/cjs/cc/CentralSceneCC.js.map +2 -2
  27. package/build/cjs/cc/ClimateControlScheduleCC.d.ts +6 -3
  28. package/build/cjs/cc/ClimateControlScheduleCC.js +54 -6
  29. package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
  30. package/build/cjs/cc/ClockCC.d.ts +2 -1
  31. package/build/cjs/cc/ClockCC.js +19 -2
  32. package/build/cjs/cc/ClockCC.js.map +2 -2
  33. package/build/cjs/cc/ColorSwitchCC.js +1 -4
  34. package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
  35. package/build/cjs/cc/ConfigurationCC.d.ts +3 -2
  36. package/build/cjs/cc/ConfigurationCC.js +62 -8
  37. package/build/cjs/cc/ConfigurationCC.js.map +2 -2
  38. package/build/cjs/cc/DeviceResetLocallyCC.js.map +2 -2
  39. package/build/cjs/cc/DoorLockCC.js.map +2 -2
  40. package/build/cjs/cc/DoorLockLoggingCC.d.ts +3 -1
  41. package/build/cjs/cc/DoorLockLoggingCC.js +35 -2
  42. package/build/cjs/cc/DoorLockLoggingCC.js.map +2 -2
  43. package/build/cjs/cc/EntryControlCC.d.ts +5 -1
  44. package/build/cjs/cc/EntryControlCC.js +57 -2
  45. package/build/cjs/cc/EntryControlCC.js.map +2 -2
  46. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js +4 -16
  47. package/build/cjs/cc/FirmwareUpdateMetaDataCC.js.map +2 -2
  48. package/build/cjs/cc/HumidityControlModeCC.d.ts +3 -1
  49. package/build/cjs/cc/HumidityControlModeCC.js +14 -2
  50. package/build/cjs/cc/HumidityControlModeCC.js.map +2 -2
  51. package/build/cjs/cc/HumidityControlOperatingStateCC.d.ts +3 -1
  52. package/build/cjs/cc/HumidityControlOperatingStateCC.js +4 -0
  53. package/build/cjs/cc/HumidityControlOperatingStateCC.js.map +2 -2
  54. package/build/cjs/cc/HumidityControlSetpointCC.d.ts +8 -4
  55. package/build/cjs/cc/HumidityControlSetpointCC.js +61 -12
  56. package/build/cjs/cc/HumidityControlSetpointCC.js.map +2 -2
  57. package/build/cjs/cc/IndicatorCC.js +1 -5
  58. package/build/cjs/cc/IndicatorCC.js.map +2 -2
  59. package/build/cjs/cc/IrrigationCC.d.ts +15 -9
  60. package/build/cjs/cc/IrrigationCC.js +260 -24
  61. package/build/cjs/cc/IrrigationCC.js.map +2 -2
  62. package/build/cjs/cc/LanguageCC.d.ts +2 -1
  63. package/build/cjs/cc/LanguageCC.js +18 -2
  64. package/build/cjs/cc/LanguageCC.js.map +2 -2
  65. package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
  66. package/build/cjs/cc/ManufacturerSpecificCC.js +4 -5
  67. package/build/cjs/cc/ManufacturerSpecificCC.js.map +2 -2
  68. package/build/cjs/cc/MeterCC.js +8 -21
  69. package/build/cjs/cc/MeterCC.js.map +2 -2
  70. package/build/cjs/cc/MultiChannelAssociationCC.js +11 -7
  71. package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
  72. package/build/cjs/cc/MultiChannelCC.d.ts +5 -2
  73. package/build/cjs/cc/MultiChannelCC.js +35 -12
  74. package/build/cjs/cc/MultiChannelCC.js.map +3 -3
  75. package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
  76. package/build/cjs/cc/MultilevelSwitchCC.d.ts +5 -1
  77. package/build/cjs/cc/MultilevelSwitchCC.js +30 -0
  78. package/build/cjs/cc/MultilevelSwitchCC.js.map +3 -3
  79. package/build/cjs/cc/NotificationCC.js +29 -11
  80. package/build/cjs/cc/NotificationCC.js.map +2 -2
  81. package/build/cjs/cc/PowerlevelCC.js.map +1 -1
  82. package/build/cjs/cc/ProtectionCC.js.map +2 -2
  83. package/build/cjs/cc/SceneActuatorConfigurationCC.d.ts +3 -2
  84. package/build/cjs/cc/SceneActuatorConfigurationCC.js +38 -5
  85. package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
  86. package/build/cjs/cc/SceneControllerConfigurationCC.d.ts +3 -2
  87. package/build/cjs/cc/SceneControllerConfigurationCC.js +25 -4
  88. package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
  89. package/build/cjs/cc/ScheduleEntryLockCC.js.map +2 -2
  90. package/build/cjs/cc/Security2CC.d.ts +2 -1
  91. package/build/cjs/cc/Security2CC.js +31 -3
  92. package/build/cjs/cc/Security2CC.js.map +2 -2
  93. package/build/cjs/cc/SecurityCC.d.ts +2 -1
  94. package/build/cjs/cc/SecurityCC.js +7 -6
  95. package/build/cjs/cc/SecurityCC.js.map +2 -2
  96. package/build/cjs/cc/SoundSwitchCC.js +6 -6
  97. package/build/cjs/cc/SoundSwitchCC.js.map +2 -2
  98. package/build/cjs/cc/SupervisionCC.d.ts +2 -1
  99. package/build/cjs/cc/SupervisionCC.js +6 -0
  100. package/build/cjs/cc/SupervisionCC.js.map +3 -3
  101. package/build/cjs/cc/ThermostatFanModeCC.d.ts +3 -1
  102. package/build/cjs/cc/ThermostatFanModeCC.js +17 -2
  103. package/build/cjs/cc/ThermostatFanModeCC.js.map +2 -2
  104. package/build/cjs/cc/ThermostatFanStateCC.d.ts +3 -1
  105. package/build/cjs/cc/ThermostatFanStateCC.js +4 -0
  106. package/build/cjs/cc/ThermostatFanStateCC.js.map +2 -2
  107. package/build/cjs/cc/ThermostatModeCC.js +2 -4
  108. package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
  109. package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
  110. package/build/cjs/cc/ThermostatSetpointCC.d.ts +4 -1
  111. package/build/cjs/cc/ThermostatSetpointCC.js +18 -0
  112. package/build/cjs/cc/ThermostatSetpointCC.js.map +3 -3
  113. package/build/cjs/cc/TimeCC.d.ts +1 -1
  114. package/build/cjs/cc/TimeCC.js +11 -2
  115. package/build/cjs/cc/TimeCC.js.map +2 -2
  116. package/build/cjs/cc/TransportServiceCC.js.map +2 -2
  117. package/build/cjs/cc/UserCodeCC.d.ts +2 -1
  118. package/build/cjs/cc/UserCodeCC.js +32 -8
  119. package/build/cjs/cc/UserCodeCC.js.map +2 -2
  120. package/build/cjs/cc/UserCredentialCC.js +4 -6
  121. package/build/cjs/cc/UserCredentialCC.js.map +2 -2
  122. package/build/cjs/cc/VersionCC.d.ts +1 -0
  123. package/build/cjs/cc/VersionCC.js +32 -0
  124. package/build/cjs/cc/VersionCC.js.map +2 -2
  125. package/build/cjs/cc/WakeUpCC.d.ts +2 -0
  126. package/build/cjs/cc/WakeUpCC.js +14 -0
  127. package/build/cjs/cc/WakeUpCC.js.map +2 -2
  128. package/build/cjs/cc/WindowCoveringCC.js +5 -1
  129. package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
  130. package/build/cjs/cc/ZWaveProtocolCC.js +3 -11
  131. package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
  132. package/build/cjs/cc/_CCValues.generated.d.ts +2 -2
  133. package/build/cjs/cc/_CCValues.generated.js.map +2 -2
  134. package/build/cjs/cc/index.d.ts +179 -179
  135. package/build/cjs/cc/index.js.map +1 -1
  136. package/build/cjs/cc/manufacturerProprietary/Decorators.js.map +2 -2
  137. package/build/cjs/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
  138. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +30 -2
  139. package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +2 -2
  140. package/build/cjs/lib/API.d.ts +3 -2
  141. package/build/cjs/lib/API.js.map +2 -2
  142. package/build/cjs/lib/CommandClass.d.ts +20 -0
  143. package/build/cjs/lib/CommandClass.js +52 -11
  144. package/build/cjs/lib/CommandClass.js.map +3 -3
  145. package/build/cjs/lib/CommandClassDecorators.js.map +2 -2
  146. package/build/cjs/lib/EncapsulatingCommandClass.js.map +2 -2
  147. package/build/cjs/lib/NotificationEventPayload.js.map +2 -2
  148. package/build/cjs/lib/Security2/Extension.js +1 -4
  149. package/build/cjs/lib/Security2/Extension.js.map +2 -2
  150. package/build/cjs/lib/Security2/shared.js.map +2 -2
  151. package/build/cjs/lib/SetValueResult.js.map +1 -1
  152. package/build/cjs/lib/Values.d.ts +1 -1
  153. package/build/cjs/lib/Values.js.map +2 -2
  154. package/build/cjs/lib/_CCAPI.generated.js.map +1 -1
  155. package/build/cjs/lib/_Types.d.ts +30 -30
  156. package/build/cjs/lib/_Types.js.map +2 -2
  157. package/build/cjs/lib/serializers.js +1 -4
  158. package/build/cjs/lib/serializers.js.map +2 -2
  159. package/build/cjs/lib/utils.js.map +2 -2
  160. package/build/esm/cc/AlarmSensorCC.d.ts +3 -1
  161. package/build/esm/cc/AlarmSensorCC.d.ts.map +1 -1
  162. package/build/esm/cc/AlarmSensorCC.js +26 -9
  163. package/build/esm/cc/AlarmSensorCC.js.map +1 -1
  164. package/build/esm/cc/AssociationCC.d.ts.map +1 -1
  165. package/build/esm/cc/AssociationCC.js +8 -7
  166. package/build/esm/cc/AssociationCC.js.map +1 -1
  167. package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
  168. package/build/esm/cc/AssociationGroupInfoCC.js +10 -12
  169. package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
  170. package/build/esm/cc/BarrierOperatorCC.d.ts +6 -3
  171. package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
  172. package/build/esm/cc/BarrierOperatorCC.js +55 -27
  173. package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
  174. package/build/esm/cc/BasicCC.d.ts +4 -1
  175. package/build/esm/cc/BasicCC.d.ts.map +1 -1
  176. package/build/esm/cc/BasicCC.js +30 -7
  177. package/build/esm/cc/BasicCC.js.map +1 -1
  178. package/build/esm/cc/BasicWindowCoveringCC.d.ts.map +1 -1
  179. package/build/esm/cc/BasicWindowCoveringCC.js +2 -5
  180. package/build/esm/cc/BasicWindowCoveringCC.js.map +1 -1
  181. package/build/esm/cc/BatteryCC.d.ts.map +1 -1
  182. package/build/esm/cc/BatteryCC.js +12 -12
  183. package/build/esm/cc/BatteryCC.js.map +1 -1
  184. package/build/esm/cc/BinarySensorCC.d.ts.map +1 -1
  185. package/build/esm/cc/BinarySensorCC.js +4 -5
  186. package/build/esm/cc/BinarySensorCC.js.map +1 -1
  187. package/build/esm/cc/BinarySwitchCC.d.ts +4 -1
  188. package/build/esm/cc/BinarySwitchCC.d.ts.map +1 -1
  189. package/build/esm/cc/BinarySwitchCC.js +31 -6
  190. package/build/esm/cc/BinarySwitchCC.js.map +1 -1
  191. package/build/esm/cc/CRC16CC.d.ts +3 -2
  192. package/build/esm/cc/CRC16CC.d.ts.map +1 -1
  193. package/build/esm/cc/CRC16CC.js +10 -4
  194. package/build/esm/cc/CRC16CC.js.map +1 -1
  195. package/build/esm/cc/CentralSceneCC.d.ts +4 -1
  196. package/build/esm/cc/CentralSceneCC.d.ts.map +1 -1
  197. package/build/esm/cc/CentralSceneCC.js +37 -7
  198. package/build/esm/cc/CentralSceneCC.js.map +1 -1
  199. package/build/esm/cc/ClimateControlScheduleCC.d.ts +6 -3
  200. package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
  201. package/build/esm/cc/ClimateControlScheduleCC.js +63 -18
  202. package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
  203. package/build/esm/cc/ClockCC.d.ts +2 -1
  204. package/build/esm/cc/ClockCC.d.ts.map +1 -1
  205. package/build/esm/cc/ClockCC.js +26 -9
  206. package/build/esm/cc/ClockCC.js.map +1 -1
  207. package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
  208. package/build/esm/cc/ColorSwitchCC.js +17 -20
  209. package/build/esm/cc/ColorSwitchCC.js.map +1 -1
  210. package/build/esm/cc/ConfigurationCC.d.ts +3 -2
  211. package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
  212. package/build/esm/cc/ConfigurationCC.js +83 -41
  213. package/build/esm/cc/ConfigurationCC.js.map +1 -1
  214. package/build/esm/cc/DeviceResetLocallyCC.d.ts.map +1 -1
  215. package/build/esm/cc/DeviceResetLocallyCC.js +1 -2
  216. package/build/esm/cc/DeviceResetLocallyCC.js.map +1 -1
  217. package/build/esm/cc/DoorLockCC.d.ts.map +1 -1
  218. package/build/esm/cc/DoorLockCC.js +25 -29
  219. package/build/esm/cc/DoorLockCC.js.map +1 -1
  220. package/build/esm/cc/DoorLockLoggingCC.d.ts +3 -1
  221. package/build/esm/cc/DoorLockLoggingCC.d.ts.map +1 -1
  222. package/build/esm/cc/DoorLockLoggingCC.js +39 -5
  223. package/build/esm/cc/DoorLockLoggingCC.js.map +1 -1
  224. package/build/esm/cc/EntryControlCC.d.ts +5 -1
  225. package/build/esm/cc/EntryControlCC.d.ts.map +1 -1
  226. package/build/esm/cc/EntryControlCC.js +74 -14
  227. package/build/esm/cc/EntryControlCC.js.map +1 -1
  228. package/build/esm/cc/FirmwareUpdateMetaDataCC.d.ts.map +1 -1
  229. package/build/esm/cc/FirmwareUpdateMetaDataCC.js +15 -27
  230. package/build/esm/cc/FirmwareUpdateMetaDataCC.js.map +1 -1
  231. package/build/esm/cc/HumidityControlModeCC.d.ts +3 -1
  232. package/build/esm/cc/HumidityControlModeCC.d.ts.map +1 -1
  233. package/build/esm/cc/HumidityControlModeCC.js +15 -7
  234. package/build/esm/cc/HumidityControlModeCC.js.map +1 -1
  235. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts +3 -1
  236. package/build/esm/cc/HumidityControlOperatingStateCC.d.ts.map +1 -1
  237. package/build/esm/cc/HumidityControlOperatingStateCC.js +5 -1
  238. package/build/esm/cc/HumidityControlOperatingStateCC.js.map +1 -1
  239. package/build/esm/cc/HumidityControlSetpointCC.d.ts +8 -4
  240. package/build/esm/cc/HumidityControlSetpointCC.d.ts.map +1 -1
  241. package/build/esm/cc/HumidityControlSetpointCC.js +60 -34
  242. package/build/esm/cc/HumidityControlSetpointCC.js.map +1 -1
  243. package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
  244. package/build/esm/cc/IndicatorCC.js +19 -38
  245. package/build/esm/cc/IndicatorCC.js.map +1 -1
  246. package/build/esm/cc/IrrigationCC.d.ts +15 -9
  247. package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
  248. package/build/esm/cc/IrrigationCC.js +276 -67
  249. package/build/esm/cc/IrrigationCC.js.map +1 -1
  250. package/build/esm/cc/LanguageCC.d.ts +2 -1
  251. package/build/esm/cc/LanguageCC.d.ts.map +1 -1
  252. package/build/esm/cc/LanguageCC.js +18 -6
  253. package/build/esm/cc/LanguageCC.js.map +1 -1
  254. package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
  255. package/build/esm/cc/ManufacturerProprietaryCC.js +1 -2
  256. package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
  257. package/build/esm/cc/ManufacturerSpecificCC.d.ts.map +1 -1
  258. package/build/esm/cc/ManufacturerSpecificCC.js +5 -8
  259. package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
  260. package/build/esm/cc/MeterCC.d.ts.map +1 -1
  261. package/build/esm/cc/MeterCC.js +15 -29
  262. package/build/esm/cc/MeterCC.js.map +1 -1
  263. package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
  264. package/build/esm/cc/MultiChannelAssociationCC.js +15 -20
  265. package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
  266. package/build/esm/cc/MultiChannelCC.d.ts +5 -2
  267. package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
  268. package/build/esm/cc/MultiChannelCC.js +43 -29
  269. package/build/esm/cc/MultiChannelCC.js.map +1 -1
  270. package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
  271. package/build/esm/cc/MultilevelSensorCC.js +11 -11
  272. package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
  273. package/build/esm/cc/MultilevelSwitchCC.d.ts +5 -1
  274. package/build/esm/cc/MultilevelSwitchCC.d.ts.map +1 -1
  275. package/build/esm/cc/MultilevelSwitchCC.js +56 -16
  276. package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
  277. package/build/esm/cc/NotificationCC.d.ts.map +1 -1
  278. package/build/esm/cc/NotificationCC.js +66 -55
  279. package/build/esm/cc/NotificationCC.js.map +1 -1
  280. package/build/esm/cc/PowerlevelCC.d.ts.map +1 -1
  281. package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
  282. package/build/esm/cc/ProtectionCC.js +10 -9
  283. package/build/esm/cc/ProtectionCC.js.map +1 -1
  284. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts +3 -2
  285. package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
  286. package/build/esm/cc/SceneActuatorConfigurationCC.js +44 -21
  287. package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
  288. package/build/esm/cc/SceneControllerConfigurationCC.d.ts +3 -2
  289. package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
  290. package/build/esm/cc/SceneControllerConfigurationCC.js +35 -28
  291. package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
  292. package/build/esm/cc/ScheduleEntryLockCC.d.ts.map +1 -1
  293. package/build/esm/cc/ScheduleEntryLockCC.js +13 -20
  294. package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
  295. package/build/esm/cc/Security2CC.d.ts +2 -1
  296. package/build/esm/cc/Security2CC.d.ts.map +1 -1
  297. package/build/esm/cc/Security2CC.js +68 -32
  298. package/build/esm/cc/Security2CC.js.map +1 -1
  299. package/build/esm/cc/SecurityCC.d.ts +2 -1
  300. package/build/esm/cc/SecurityCC.d.ts.map +1 -1
  301. package/build/esm/cc/SecurityCC.js +16 -11
  302. package/build/esm/cc/SecurityCC.js.map +1 -1
  303. package/build/esm/cc/SoundSwitchCC.js +2 -2
  304. package/build/esm/cc/SoundSwitchCC.js.map +1 -1
  305. package/build/esm/cc/SupervisionCC.d.ts +2 -1
  306. package/build/esm/cc/SupervisionCC.d.ts.map +1 -1
  307. package/build/esm/cc/SupervisionCC.js +13 -6
  308. package/build/esm/cc/SupervisionCC.js.map +1 -1
  309. package/build/esm/cc/ThermostatFanModeCC.d.ts +3 -1
  310. package/build/esm/cc/ThermostatFanModeCC.d.ts.map +1 -1
  311. package/build/esm/cc/ThermostatFanModeCC.js +19 -9
  312. package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
  313. package/build/esm/cc/ThermostatFanStateCC.d.ts +3 -1
  314. package/build/esm/cc/ThermostatFanStateCC.d.ts.map +1 -1
  315. package/build/esm/cc/ThermostatFanStateCC.js +5 -1
  316. package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
  317. package/build/esm/cc/ThermostatModeCC.d.ts.map +1 -1
  318. package/build/esm/cc/ThermostatModeCC.js +2 -4
  319. package/build/esm/cc/ThermostatModeCC.js.map +1 -1
  320. package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
  321. package/build/esm/cc/ThermostatOperatingStateCC.js +1 -2
  322. package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
  323. package/build/esm/cc/ThermostatSetpointCC.d.ts +4 -1
  324. package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
  325. package/build/esm/cc/ThermostatSetpointCC.js +31 -19
  326. package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
  327. package/build/esm/cc/TimeCC.d.ts +1 -1
  328. package/build/esm/cc/TimeCC.d.ts.map +1 -1
  329. package/build/esm/cc/TimeCC.js +18 -9
  330. package/build/esm/cc/TimeCC.js.map +1 -1
  331. package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
  332. package/build/esm/cc/TransportServiceCC.js +8 -8
  333. package/build/esm/cc/TransportServiceCC.js.map +1 -1
  334. package/build/esm/cc/UserCodeCC.d.ts +2 -1
  335. package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
  336. package/build/esm/cc/UserCodeCC.js +51 -36
  337. package/build/esm/cc/UserCodeCC.js.map +1 -1
  338. package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
  339. package/build/esm/cc/UserCredentialCC.js +42 -59
  340. package/build/esm/cc/UserCredentialCC.js.map +1 -1
  341. package/build/esm/cc/VersionCC.d.ts +1 -0
  342. package/build/esm/cc/VersionCC.d.ts.map +1 -1
  343. package/build/esm/cc/VersionCC.js +37 -3
  344. package/build/esm/cc/VersionCC.js.map +1 -1
  345. package/build/esm/cc/WakeUpCC.d.ts +2 -0
  346. package/build/esm/cc/WakeUpCC.d.ts.map +1 -1
  347. package/build/esm/cc/WakeUpCC.js +14 -0
  348. package/build/esm/cc/WakeUpCC.js.map +1 -1
  349. package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
  350. package/build/esm/cc/WindowCoveringCC.js +10 -9
  351. package/build/esm/cc/WindowCoveringCC.js.map +1 -1
  352. package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
  353. package/build/esm/cc/ZWaveProtocolCC.js +5 -26
  354. package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
  355. package/build/esm/cc/_CCValues.generated.d.ts +2 -2
  356. package/build/esm/cc/_CCValues.generated.d.ts.map +1 -1
  357. package/build/esm/cc/_CCValues.generated.js +637 -678
  358. package/build/esm/cc/_CCValues.generated.js.map +1 -1
  359. package/build/esm/cc/index.d.ts +179 -179
  360. package/build/esm/cc/index.d.ts.map +1 -1
  361. package/build/esm/cc/index.js +124 -124
  362. package/build/esm/cc/index.js.map +1 -1
  363. package/build/esm/cc/manufacturerProprietary/Decorators.d.ts.map +1 -1
  364. package/build/esm/cc/manufacturerProprietary/Decorators.js.map +1 -1
  365. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts +2 -1
  366. package/build/esm/cc/manufacturerProprietary/FibaroCC.d.ts.map +1 -1
  367. package/build/esm/cc/manufacturerProprietary/FibaroCC.js +34 -4
  368. package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
  369. package/build/esm/lib/API.d.ts +3 -2
  370. package/build/esm/lib/API.d.ts.map +1 -1
  371. package/build/esm/lib/API.js +1 -1
  372. package/build/esm/lib/API.js.map +1 -1
  373. package/build/esm/lib/CommandClass.d.ts +20 -0
  374. package/build/esm/lib/CommandClass.d.ts.map +1 -1
  375. package/build/esm/lib/CommandClass.js +50 -16
  376. package/build/esm/lib/CommandClass.js.map +1 -1
  377. package/build/esm/lib/CommandClassDecorators.d.ts.map +1 -1
  378. package/build/esm/lib/CommandClassDecorators.js +1 -2
  379. package/build/esm/lib/CommandClassDecorators.js.map +1 -1
  380. package/build/esm/lib/EncapsulatingCommandClass.d.ts.map +1 -1
  381. package/build/esm/lib/EncapsulatingCommandClass.js.map +1 -1
  382. package/build/esm/lib/NotificationEventPayload.d.ts.map +1 -1
  383. package/build/esm/lib/NotificationEventPayload.js.map +1 -1
  384. package/build/esm/lib/Security2/Extension.d.ts.map +1 -1
  385. package/build/esm/lib/Security2/Extension.js +2 -6
  386. package/build/esm/lib/Security2/Extension.js.map +1 -1
  387. package/build/esm/lib/Security2/shared.d.ts.map +1 -1
  388. package/build/esm/lib/Security2/shared.js.map +1 -1
  389. package/build/esm/lib/SetValueResult.d.ts.map +1 -1
  390. package/build/esm/lib/Values.d.ts +1 -1
  391. package/build/esm/lib/Values.d.ts.map +1 -1
  392. package/build/esm/lib/Values.js.map +1 -1
  393. package/build/esm/lib/_CCAPI.generated.d.ts.map +1 -1
  394. package/build/esm/lib/_Types.d.ts +30 -30
  395. package/build/esm/lib/_Types.d.ts.map +1 -1
  396. package/build/esm/lib/_Types.js.map +1 -1
  397. package/build/esm/lib/serializers.d.ts.map +1 -1
  398. package/build/esm/lib/serializers.js +1 -4
  399. package/build/esm/lib/serializers.js.map +1 -1
  400. package/build/esm/lib/traits.d.ts.map +1 -1
  401. package/build/esm/lib/utils.d.ts.map +1 -1
  402. package/build/esm/lib/utils.js +25 -31
  403. package/build/esm/lib/utils.js.map +1 -1
  404. package/package.json +7 -7
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src_gen/lib/utils.ts"],
4
- "sourcesContent": ["import type { AssociationConfig, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetAllEndpoints,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype MaybeNotKnown,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype QuerySecurityClasses,\n\tSecurityClass,\n\ttype SupportsCC,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tactuatorCCs,\n\tgetCCName,\n\tisActuatorCC,\n\tisLongRangeNodeId,\n\tisSensorCC,\n\tlogDict,\n\tlogText,\n} from \"@zwave-js/core\";\nimport {\n\tObjectKeyMap,\n\ttype ReadonlyObjectKeyMap,\n\tgetEnumMemberName,\n} from \"@zwave-js/shared\";\nimport { distinct } from \"alcalzone-shared/arrays\";\nimport { AssociationCC, AssociationCCValues } from \"../cc/AssociationCC.js\";\nimport { AssociationGroupInfoCC } from \"../cc/AssociationGroupInfoCC.js\";\nimport { MultiChannelAssociationCC } from \"../cc/MultiChannelAssociationCC.js\";\nimport { CCAPI, type CCAPIHost, type CCAPINode } from \"./API.js\";\nimport {\n\ttype AssociationAddress,\n\tAssociationCheckResult,\n\ttype AssociationGroup,\n\tAssociationGroupInfoProfile,\n\ttype EndpointAddress,\n} from \"./_Types.js\";\n\nexport function getAssociations(\n\tctx: GetValueDB,\n\tendpoint: EndpointId & SupportsCC,\n): ReadonlyMap<number, readonly AssociationAddress[]> {\n\tconst ret = new Map<number, readonly AssociationAddress[]>();\n\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tconst destinations = AssociationCC.getAllDestinationsCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tfor (const [groupId, assocs] of destinations) {\n\t\t\tret.set(groupId, assocs);\n\t\t}\n\t} else {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Merge the \"normal\" destinations with multi channel destinations\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tconst destinations = MultiChannelAssociationCC.getAllDestinationsCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tfor (const [groupId, assocs] of destinations) {\n\t\t\tif (ret.has(groupId)) {\n\t\t\t\tconst normalAssociations = ret.get(groupId)!;\n\t\t\t\tret.set(groupId, [\n\t\t\t\t\t...normalAssociations,\n\t\t\t\t\t// Eliminate potential duplicates\n\t\t\t\t\t...assocs.filter(\n\t\t\t\t\t\t(a1) =>\n\t\t\t\t\t\t\t!normalAssociations.some(\n\t\t\t\t\t\t\t\t(a2) =>\n\t\t\t\t\t\t\t\t\ta1.nodeId === a2.nodeId\n\t\t\t\t\t\t\t\t\t&& a1.endpoint === a2.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\tret.set(groupId, assocs);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ret;\n}\n\nexport function getAllAssociations(\n\tctx: GetValueDB,\n\tnode: NodeId & GetAllEndpoints<EndpointId & SupportsCC>,\n): ReadonlyObjectKeyMap<\n\tAssociationAddress,\n\tReadonlyMap<number, readonly AssociationAddress[]>\n> {\n\tconst ret = new ObjectKeyMap<\n\t\tAssociationAddress,\n\t\tReadonlyMap<number, readonly AssociationAddress[]>\n\t>();\n\tfor (const endpoint of node.getAllEndpoints()) {\n\t\tconst address: AssociationAddress = {\n\t\t\tnodeId: node.id,\n\t\t\tendpoint: endpoint.index,\n\t\t};\n\t\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\t\tret.set(address, getAssociations(ctx, endpoint));\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport function checkAssociation(\n\tctx:\n\t\t& HostIDs\n\t\t& GetValueDB\n\t\t& GetNode<\n\t\t\t& NodeId\n\t\t\t& SupportsCC\n\t\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t\t& QuerySecurityClasses\n\t\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestination: AssociationAddress,\n): AssociationCheckResult {\n\t// Check that the target endpoint exists except when adding an association to the controller\n\tconst targetNode = ctx.getNodeOrThrow(destination.nodeId);\n\tconst targetEndpoint = destination.nodeId === ctx.ownNodeId\n\t\t? targetNode\n\t\t: targetNode.getEndpointOrThrow(destination.endpoint ?? 0);\n\n\tif (\n\t\t!endpoint.supportsCC(CommandClasses.Association)\n\t\t&& !endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])\n\t) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Associations to and from ZWLR devices are not allowed\n\tif (isLongRangeNodeId(destination.nodeId)) {\n\t\treturn AssociationCheckResult.Forbidden_DestinationIsLongRange;\n\t} else if (isLongRangeNodeId(endpoint.nodeId)) {\n\t\t// Except the lifeline back to the host\n\t\tif (group !== 1 || destination.nodeId !== ctx.ownNodeId) {\n\t\t\treturn AssociationCheckResult.Forbidden_SourceIsLongRange;\n\t\t}\n\t}\n\n\t// The following checks don't apply to Lifeline associations\n\tif (destination.nodeId === ctx.ownNodeId) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\t// Disallow self-associations\n\tif (destination.nodeId === endpoint.nodeId) {\n\t\treturn AssociationCheckResult.Forbidden_SelfAssociation;\n\t}\n\n\t// For Association version 1 and version 2 / MCA version 1-3:\n\t// A controlling node MUST NOT associate Node A to a Node B destination\n\t// if Node A and Node B\u2019s highest Security Class are not identical.\n\t// For Association version 3 / MCA version 4:\n\t// A controlling node MUST NOT associate Node A to a Node B destination\n\t// if Node A was not granted Node B\u2019s highest Security Class.\n\n\tconst sourceNode = ctx.getNode(endpoint.nodeId)!;\n\tlet securityClassMustMatch: boolean;\n\tif (destination.endpoint == undefined) {\n\t\t// \"normal\" association\n\t\tconst sourceNodeCCVersion = endpoint.getCCVersion(\n\t\t\tCommandClasses.Association,\n\t\t);\n\t\tsecurityClassMustMatch = sourceNodeCCVersion < 3;\n\t} else {\n\t\t// multi channel association\n\t\tconst sourceNodeCCVersion = endpoint.getCCVersion(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t);\n\t\tsecurityClassMustMatch = sourceNodeCCVersion < 4;\n\t}\n\n\tconst sourceSecurityClass = sourceNode.getHighestSecurityClass();\n\tconst targetSecurityClass = targetNode.getHighestSecurityClass();\n\n\t// If the security classes are unknown, all bets are off\n\tif (sourceSecurityClass != undefined && targetSecurityClass != undefined) {\n\t\tif (\n\t\t\tsecurityClassMustMatch\n\t\t\t&& sourceSecurityClass !== targetSecurityClass\n\t\t) {\n\t\t\treturn AssociationCheckResult.Forbidden_SecurityClassMismatch;\n\t\t} else if (\n\t\t\t// Commands to insecure nodes are allowed\n\t\t\ttargetSecurityClass !== SecurityClass.None\n\t\t\t// Otherwise, the sender must know the target's highest key\n\t\t\t&& !securityClassMustMatch\n\t\t\t&& !sourceNode.hasSecurityClass(targetSecurityClass)\n\t\t) {\n\t\t\treturn AssociationCheckResult\n\t\t\t\t.Forbidden_DestinationSecurityClassNotGranted;\n\t\t}\n\t}\n\n\t// SDS14223:\n\t// A controlling node MUST NOT associate Node A to a Node B destination that does not support\n\t// the Command Class that the Node A will be controlling\n\t//\n\t// To determine this, the node must support the AGI CC or we have no way of knowing which\n\t// CCs the node will control\n\tif (!endpoint.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\tconst groupCommandList = AssociationGroupInfoCC.getIssuedCommandsCached(\n\t\tctx,\n\t\tendpoint,\n\t\tgroup,\n\t);\n\tif (!groupCommandList || !groupCommandList.size) {\n\t\t// We don't know which CCs this group controls, just allow it\n\t\treturn AssociationCheckResult.OK;\n\t}\n\tconst groupCCs = [...groupCommandList.keys()];\n\n\t// A controlling node MAY create an association to a destination supporting an\n\t// actuator Command Class if the actual association group sends Basic Control Command Class.\n\tif (\n\t\tgroupCCs.includes(CommandClasses.Basic)\n\t\t&& actuatorCCs.some((cc) => targetEndpoint?.supportsCC(cc))\n\t) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\t// Enforce that at least one issued CC is supported\n\tif (groupCCs.some((cc) => targetEndpoint?.supportsCC(cc))) {\n\t\treturn AssociationCheckResult.OK;\n\t} else {\n\t\treturn AssociationCheckResult.Forbidden_NoSupportedCCs;\n\t}\n}\n\nexport function getAssociationGroups(\n\tctx: GetValueDB & GetDeviceConfig,\n\tendpoint: EndpointId & SupportsCC,\n): ReadonlyMap<number, AssociationGroup> {\n\t// Check whether we have multi channel support or not\n\tlet assocInstance: typeof AssociationCC;\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t} else {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t}\n\n\tconst assocGroupCount = assocInstance.getGroupCountCached(ctx, endpoint)\n\t\t?? 0;\n\tconst mcGroupCount = mcInstance?.getGroupCountCached(ctx, endpoint)\n\t\t?? 0;\n\tconst groupCount = Math.max(assocGroupCount, mcGroupCount);\n\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\n\tconst ret = new Map<number, AssociationGroup>();\n\n\tif (endpoint.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\t// We can read all information we need from the AGI CC\n\t\tconst agiInstance = AssociationGroupInfoCC;\n\t\tfor (let group = 1; group <= groupCount; group++) {\n\t\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\t\tendpoint.index,\n\t\t\t\tgroup,\n\t\t\t);\n\t\t\tconst multiChannel = !!mcInstance && group <= mcGroupCount;\n\t\t\tret.set(group, {\n\t\t\t\tmaxNodes: (multiChannel\n\t\t\t\t\t? mcInstance!\n\t\t\t\t\t: assocInstance).getMaxNodesCached(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t) || 1,\n\t\t\t\t// AGI implies Z-Wave+ where group 1 is the lifeline\n\t\t\t\tisLifeline: group === 1,\n\t\t\t\tlabel:\n\t\t\t\t\t// prefer the configured label if we have one\n\t\t\t\t\tassocConfig?.label\n\t\t\t\t\t\t// the ones reported by AGI are sometimes pretty bad\n\t\t\t\t\t\t?? agiInstance.getGroupNameCached(\n\t\t\t\t\t\t\tctx,\n\t\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\t\tgroup,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t// but still better than \"unnamed\"\n\t\t\t\t\t\t?? `Unnamed group ${group}`,\n\t\t\t\tmultiChannel,\n\t\t\t\tprofile: agiInstance.getGroupProfileCached(\n\t\t\t\t\tctx,\n\t\t\t\t\tendpoint,\n\t\t\t\t\tgroup,\n\t\t\t\t),\n\t\t\t\tissuedCommands: agiInstance.getIssuedCommandsCached(\n\t\t\t\t\tctx,\n\t\t\t\t\tendpoint,\n\t\t\t\t\tgroup,\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\t} else {\n\t\t// we need to consult the device config\n\t\tfor (let group = 1; group <= groupCount; group++) {\n\t\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\t\tendpoint.index,\n\t\t\t\tgroup,\n\t\t\t);\n\t\t\tconst multiChannel = !!mcInstance && group <= mcGroupCount;\n\t\t\tret.set(group, {\n\t\t\t\tmaxNodes: (multiChannel\n\t\t\t\t\t? mcInstance!\n\t\t\t\t\t: assocInstance).getMaxNodesCached(\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tendpoint,\n\t\t\t\t\t\tgroup,\n\t\t\t\t\t)\n\t\t\t\t\t|| assocConfig?.maxNodes\n\t\t\t\t\t|| 1,\n\t\t\t\tisLifeline: assocConfig?.isLifeline ?? group === 1,\n\t\t\t\tlabel: assocConfig?.label ?? `Unnamed group ${group}`,\n\t\t\t\tmultiChannel,\n\t\t\t});\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport function getAllAssociationGroups(\n\tctx: GetValueDB & GetDeviceConfig,\n\tnode: NodeId & GetAllEndpoints<EndpointId & SupportsCC>,\n): ReadonlyMap<number, ReadonlyMap<number, AssociationGroup>> {\n\tconst ret = new Map<number, ReadonlyMap<number, AssociationGroup>>();\n\tfor (const endpoint of node.getAllEndpoints()) {\n\t\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\t\tret.set(endpoint.index, getAssociationGroups(ctx, endpoint));\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport async function addAssociations(\n\tctx: CCAPIHost<\n\t\t& CCAPINode\n\t\t& SupportsCC\n\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t& QuerySecurityClasses\n\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestinations: AssociationAddress[],\n\toptions?: {\n\t\t/**\n\t\t * Whether to force creating associations even if they are not allowed.\n\t\t * **Note:** Invalid associations will most likely not work\n\t\t */\n\t\tforce?: boolean;\n\t},\n): Promise<void> {\n\tconst nodeAndEndpointString = `${endpoint.nodeId}${\n\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t}`;\n\n\t// Check whether we should add any associations the device does not have support for\n\tlet assocInstance: typeof AssociationCC | undefined;\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\t// Split associations into conventional and endpoint associations\n\tconst nodeAssociations = distinct(\n\t\tdestinations\n\t\t\t.filter((a) => a.endpoint == undefined)\n\t\t\t.map((a) => a.nodeId),\n\t);\n\tconst endpointAssociations = destinations.filter(\n\t\t(a) => a.endpoint != undefined,\n\t) as EndpointAddress[];\n\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t} else if (nodeAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t} else if (endpointAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Disallow associating a node with itself. This is technically checked as part of\n\t// checkAssociations, but here we provide a better error message.\n\tconst selfAssociations = destinations.filter((d) =>\n\t\td.nodeId === endpoint.nodeId\n\t);\n\tif (selfAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Associating a node with itself is not allowed!`,\n\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\tselfAssociations.map((a) => ({\n\t\t\t\t...a,\n\t\t\t\tcheckResult: AssociationCheckResult.Forbidden_SelfAssociation,\n\t\t\t})),\n\t\t);\n\t}\n\n\tconst assocGroupCount = assocInstance?.getGroupCountCached(ctx, endpoint)\n\t\t?? 0;\n\tconst mcGroupCount = mcInstance?.getGroupCountCached(ctx, endpoint)\n\t\t?? 0;\n\tconst groupCount = Math.max(assocGroupCount, mcGroupCount);\n\tif (group > groupCount) {\n\t\tthrow new ZWaveError(\n\t\t\t`Group ${group} does not exist on node ${nodeAndEndpointString}`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\n\tconst groupIsMultiChannel = !!mcInstance\n\t\t&& group <= mcGroupCount\n\t\t&& deviceConfig?.associations?.get(group)?.multiChannel !== false;\n\n\tif (groupIsMultiChannel) {\n\t\t// Check that all associations are allowed\n\t\tif (!options?.force) {\n\t\t\tconst disallowedAssociations = destinations.map(\n\t\t\t\t(a) => ({\n\t\t\t\t\t...a,\n\t\t\t\t\tcheckResult: checkAssociation(ctx, endpoint, group, a),\n\t\t\t\t}),\n\t\t\t).filter(({ checkResult }) =>\n\t\t\t\tcheckResult !== AssociationCheckResult.OK\n\t\t\t);\n\t\t\tif (disallowedAssociations.length) {\n\t\t\t\tlet message = `The following associations are not allowed:`;\n\t\t\t\tmessage += disallowedAssociations\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(a) =>\n\t\t\t\t\t\t\t`\\n\u00B7 Node ${a.nodeId}${\n\t\t\t\t\t\t\t\ta.endpoint ? `, endpoint ${a.endpoint}` : \"\"\n\t\t\t\t\t\t\t}: ${\n\t\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\t\tAssociationCheckResult,\n\t\t\t\t\t\t\t\t\ta.checkResult,\n\t\t\t\t\t\t\t\t).replace(\"Forbidden_\", \"\")\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\");\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\tmessage,\n\t\t\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\t\t\tdisallowedAssociations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// And add them\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.addDestinations({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t\tendpoints: endpointAssociations,\n\t\t});\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t} else {\n\t\t// Although the node supports multi channel associations, this group only supports \"normal\" associations\n\t\tif (destinations.some((a) => a.endpoint != undefined)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Node ${nodeAndEndpointString}, group ${group} does not support multi channel associations!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Check that all associations are allowed\n\t\tif (!options?.force) {\n\t\t\tconst disallowedAssociations = destinations.map(\n\t\t\t\t(a) => ({\n\t\t\t\t\t...a,\n\t\t\t\t\tcheckResult: checkAssociation(ctx, endpoint, group, a),\n\t\t\t\t}),\n\t\t\t).filter(({ checkResult }) =>\n\t\t\t\tcheckResult !== AssociationCheckResult.OK\n\t\t\t);\n\t\t\tif (disallowedAssociations.length) {\n\t\t\t\tlet message =\n\t\t\t\t\t`The associations to the following nodes are not allowed`;\n\t\t\t\tmessage += disallowedAssociations\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(a) =>\n\t\t\t\t\t\t\t`\\n\u00B7 Node ${a.nodeId}: ${\n\t\t\t\t\t\t\t\tgetEnumMemberName(\n\t\t\t\t\t\t\t\t\tAssociationCheckResult,\n\t\t\t\t\t\t\t\t\ta.checkResult,\n\t\t\t\t\t\t\t\t).replace(\"Forbidden_\", \"\")\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\");\n\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\tmessage,\n\t\t\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\t\t\tdisallowedAssociations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.addNodeIds(group, ...destinations.map((a) => a.nodeId));\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t}\n}\n\nexport async function removeAssociations(\n\tctx: CCAPIHost,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestinations: AssociationAddress[],\n): Promise<void> {\n\tconst nodeAndEndpointString = `${endpoint.nodeId}${\n\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t}`;\n\n\t// Split associations into conventional and endpoint associations\n\tconst nodeAssociations = distinct(\n\t\tdestinations\n\t\t\t.filter((a) => a.endpoint == undefined)\n\t\t\t.map((a) => a.nodeId),\n\t);\n\tconst endpointAssociations = destinations.filter(\n\t\t(a) => a.endpoint != undefined,\n\t) as EndpointAddress[];\n\n\t// Removing associations is not either/or - we could have a device with duplicated associations between\n\t// Association CC and Multi Channel Association CC\n\t// Figure out what we need to use to remove the associations\n\n\tlet groupExistsAsMultiChannel = false;\n\tlet groupExistsAsNodeAssociation = false;\n\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tlet assocInstance: typeof AssociationCC | undefined;\n\n\t// To remove a multi channel association, we need to make sure that the group exists\n\t// and the node supports multi channel associations\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t\tif (group <= mcInstance.getGroupCountCached(ctx, endpoint)) {\n\t\t\tgroupExistsAsMultiChannel = true;\n\t\t}\n\t} else if (endpointAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// To remove a normal association, we need to make sure that the group exists either as a normal association\n\t// or as a multi channel association\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t\tif (group <= assocInstance.getGroupCountCached(ctx, endpoint)) {\n\t\t\tgroupExistsAsNodeAssociation = true;\n\t\t}\n\t}\n\n\tif (!mcInstance && !assocInstance) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Ensure the group exists and can be used\n\tif (!groupExistsAsMultiChannel && !groupExistsAsNodeAssociation) {\n\t\tthrow new ZWaveError(\n\t\t\t` Association group ${group} does not exist for node ${nodeAndEndpointString}`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\tif (endpointAssociations.length > 0 && !groupExistsAsMultiChannel) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString}, association group ${group} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\n\t// Even if we only remove node associations, we use both CCs since it has been found that some\n\t// devices do not correctly share the node list between the two commands\n\tif (\n\t\tassocInstance\n\t\t&& nodeAssociations.length > 0\n\t\t&& groupExistsAsNodeAssociation\n\t) {\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.removeNodeIds({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t});\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t}\n\n\tif (mcInstance && groupExistsAsMultiChannel) {\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.removeDestinations({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t\tendpoints: endpointAssociations,\n\t\t});\n\t\t// Refresh the multi channel association list\n\t\tawait api.getGroup(group);\n\t}\n}\n\nexport function getLifelineGroupIds(\n\tctx: GetValueDB & GetDeviceConfig,\n\tendpoint: EndpointId & SupportsCC,\n): number[] {\n\t// For now only support this for the root endpoint - i.e. node\n\tif (endpoint.index > 0) return [];\n\n\t// Some nodes define multiple lifeline groups, so we need to assign us to\n\t// all of them\n\tconst lifelineGroups: number[] = [];\n\n\t// If the target node supports Z-Wave+ info that means the lifeline MUST be group #1\n\tif (endpoint.supportsCC(CommandClasses[\"Z-Wave Plus Info\"])) {\n\t\tlifelineGroups.push(1);\n\t}\n\n\t// We have a device config file that tells us which (additional) association to assign\n\tlet associations: ReadonlyMap<number, AssociationConfig> | undefined;\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\tif (endpoint.index === 0) {\n\t\t// The root endpoint's associations may be configured separately or as part of \"endpoints\"\n\t\tassociations = deviceConfig?.associations\n\t\t\t?? deviceConfig?.endpoints?.get(0)?.associations;\n\t} else {\n\t\t// The other endpoints can only have a configuration as part of \"endpoints\"\n\t\tassociations = deviceConfig?.endpoints?.get(\n\t\t\tendpoint.index,\n\t\t)?.associations;\n\t}\n\n\tif (associations?.size) {\n\t\tlifelineGroups.push(\n\t\t\t...[...associations.values()]\n\t\t\t\t.filter((a) => a.isLifeline)\n\t\t\t\t.map((a) => a.groupId),\n\t\t);\n\t}\n\n\treturn distinct(lifelineGroups).toSorted((a, b) => a - b);\n}\n\nexport async function configureLifelineAssociations(\n\tctx: CCAPIHost<\n\t\t& CCAPINode\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n): Promise<void> {\n\t// Assign the controller to all lifeline groups\n\tconst ownNodeId = ctx.ownNodeId;\n\tconst node = ctx.getNodeOrThrow(endpoint.nodeId);\n\tconst valueDB = ctx.getValueDB(node.id);\n\tconst deviceConfig = ctx.getDeviceConfig?.(node.id);\n\n\t// We check if a node supports Multi Channel CC before creating Multi Channel Lifeline Associations (#1109)\n\tconst nodeSupportsMultiChannel = node.supportsCC(\n\t\tCommandClasses[\"Multi Channel\"],\n\t);\n\n\tlet assocInstance: typeof AssociationCC | undefined;\n\tconst assocAPI = CCAPI.create(\n\t\tCommandClasses.Association,\n\t\tctx,\n\t\tendpoint,\n\t);\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t}\n\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tlet mcGroupCount = 0;\n\tconst mcAPI = CCAPI.create(\n\t\tCommandClasses[\"Multi Channel Association\"],\n\t\tctx,\n\t\tendpoint,\n\t);\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t\tmcGroupCount = mcInstance.getGroupCountCached(ctx, endpoint) ?? 0;\n\t}\n\n\tconst lifelineGroups = getLifelineGroupIds(ctx, node);\n\tif (lifelineGroups.length === 0) {\n\t\t// We can look for the General Lifeline AGI profile as a last resort\n\t\tif (\n\t\t\tendpoint.supportsCC(CommandClasses[\"Association Group Information\"])\n\t\t) {\n\t\t\tconst agiAPI = CCAPI.create(\n\t\t\t\tCommandClasses[\"Association Group Information\"],\n\t\t\t\tctx,\n\t\t\t\tendpoint,\n\t\t\t);\n\n\t\t\t// The lifeline MUST be group 1\n\t\t\tconst lifeline = await agiAPI\n\t\t\t\t.getGroupInfo(1, true)\n\t\t\t\t.catch(() => undefined);\n\t\t\tif (\n\t\t\t\tlifeline?.profile\n\t\t\t\t\t=== AssociationGroupInfoProfile[\"General: Lifeline\"]\n\t\t\t) {\n\t\t\t\tlifelineGroups.push(1);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lifelineGroups.length === 0) {\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: endpoint.index,\n\t\t\tmessage:\n\t\t\t\t\"No information about Lifeline associations, cannot assign ourselves!\",\n\t\t\tlevel: \"warn\",\n\t\t});\n\t\t// Remember that we have NO lifeline association\n\t\tvalueDB.setValue(\n\t\t\tAssociationCCValues.hasLifeline.endpoint(endpoint.index),\n\t\t\tfalse,\n\t\t);\n\t\treturn;\n\t}\n\n\tctx.logNode(node.id, {\n\t\tendpoint: endpoint.index,\n\t\tmessage: logText(\n\t\t\t`Checking/assigning lifeline groups: ${\n\t\t\t\tlifelineGroups.join(\n\t\t\t\t\t\", \",\n\t\t\t\t)\n\t\t\t}`,\n\t\t\t{\n\t\t\t\tnested: logDict({\n\t\t\t\t\t\"supports classic associations\": !!assocInstance,\n\t\t\t\t\t\"supports multi channel associations\": !!mcInstance,\n\t\t\t\t}),\n\t\t\t},\n\t\t),\n\t});\n\n\tfor (const group of lifelineGroups) {\n\t\tconst groupSupportsMultiChannelAssociation = group <= mcGroupCount;\n\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\tendpoint.index,\n\t\t\tgroup,\n\t\t);\n\n\t\tconst mustUseNodeAssociation = !groupSupportsMultiChannelAssociation\n\t\t\t|| !nodeSupportsMultiChannel\n\t\t\t|| assocConfig?.multiChannel === false;\n\t\tlet mustUseMultiChannelAssociation = false;\n\n\t\tif (groupSupportsMultiChannelAssociation && nodeSupportsMultiChannel) {\n\t\t\tif (assocConfig?.multiChannel === true) {\n\t\t\t\tmustUseMultiChannelAssociation = true;\n\t\t\t} else if (endpoint.index === 0) {\n\t\t\t\t// If the node has multiple endpoints but none of the extra ones support associations,\n\t\t\t\t// the root endpoints needs a Multi Channel Association\n\t\t\t\tconst allEndpoints = node.getAllEndpoints();\n\t\t\t\tif (\n\t\t\t\t\tallEndpoints.length > 1\n\t\t\t\t\t&& allEndpoints\n\t\t\t\t\t\t.filter((e) => e.index !== endpoint.index)\n\t\t\t\t\t\t.every(\n\t\t\t\t\t\t\t(e) =>\n\t\t\t\t\t\t\t\t!e.supportsCC(CommandClasses.Association)\n\t\t\t\t\t\t\t\t&& !e.supportsCC(\n\t\t\t\t\t\t\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tmustUseMultiChannelAssociation = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: endpoint.index,\n\t\t\tmessage: logText(`Configuring lifeline group #${group}:`, {\n\t\t\t\tnested: logDict({\n\t\t\t\t\t\"group supports multi channel\":\n\t\t\t\t\t\tgroupSupportsMultiChannelAssociation,\n\t\t\t\t\t\"configured strategy\": assocConfig?.multiChannel ?? \"auto\",\n\t\t\t\t\t\"must use node association\": mustUseNodeAssociation,\n\t\t\t\t\t\"must use endpoint association\":\n\t\t\t\t\t\tmustUseMultiChannelAssociation,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\t\t// Figure out which associations exist and may need to be removed\n\t\tconst isAssignedAsNodeAssociation = (\n\t\t\tendpoint: EndpointId,\n\t\t): boolean => {\n\t\t\tif (groupSupportsMultiChannelAssociation && mcInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tmcInstance.getMaxNodesCached(ctx, endpoint, group)\n\t\t\t\t\t\t> 0\n\t\t\t\t\t&& !!mcInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some(\n\t\t\t\t\t\t\t(addr) =>\n\t\t\t\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t\t\t\t&& addr.endpoint == undefined,\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (assocInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tassocInstance.getMaxNodesCached(ctx, endpoint, group)\n\t\t\t\t\t\t> 0\n\t\t\t\t\t&& !!assocInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some((addr) => addr.nodeId === ownNodeId)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\tconst isAssignedAsEndpointAssociation = (\n\t\t\tendpoint: EndpointId,\n\t\t): boolean => {\n\t\t\tif (mcInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tmcInstance.getMaxNodesCached(ctx, endpoint, group)\n\t\t\t\t\t\t> 0\n\t\t\t\t\t&& mcInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some(\n\t\t\t\t\t\t\t(addr) =>\n\t\t\t\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t\t\t\t&& addr.endpoint === 0,\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t\t// If the node was used with other controller software, there might be\n\t\t// invalid lifeline associations which cause reporting problems\n\t\tconst invalidEndpointAssociations: EndpointAddress[] = mcInstance\n\t\t\t?.getAllDestinationsCached(ctx, endpoint)\n\t\t\t.get(group)\n\t\t\t?.filter(\n\t\t\t\t(addr): addr is AssociationAddress & EndpointAddress =>\n\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t&& addr.endpoint != undefined\n\t\t\t\t\t&& addr.endpoint !== 0,\n\t\t\t) ?? [];\n\n\t\t// Clean them up first\n\t\tif (\n\t\t\tinvalidEndpointAssociations.length > 0\n\t\t\t&& mcAPI.isSupported()\n\t\t\t&& groupSupportsMultiChannelAssociation\n\t\t) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage:\n\t\t\t\t\t`Found invalid lifeline associations in group #${group}, removing them...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\tgroupId: group,\n\t\t\t\tendpoints: invalidEndpointAssociations,\n\t\t\t});\n\t\t\t// refresh the associations - don't trust that it worked\n\t\t\tawait mcAPI.getGroup(group);\n\t\t}\n\n\t\t// Assigning the correct lifelines depends on the association kind, source endpoint and the desired strategy:\n\t\t//\n\t\t// When `mustUseMultiChannelAssociation` is `true` - Use a multi channel association (if possible), no fallback\n\t\t// When `mustUseNodeAssociation` is `true` - Use a node association (if possible), no fallback\n\t\t// Otherwise:\n\t\t// 1. Try a node association on the current endpoint/root\n\t\t// 2. If Association CC is not supported, try assigning a node association with the Multi Channel Association CC\n\t\t// 3. If that did not work, fall back to a multi channel association (target endpoint 0)\n\t\t// 4. If that did not work either, the endpoint index is >0 and the node is Z-Wave+:\n\t\t// Fall back to a multi channel association (target endpoint 0) on the root, if it doesn't have one yet.\n\n\t\tlet hasLifeline = false;\n\n\t\t// First try: node association\n\t\tif (!mustUseMultiChannelAssociation) {\n\t\t\tif (isAssignedAsNodeAssociation(endpoint)) {\n\t\t\t\t// We already have the correct association\n\t\t\t\thasLifeline = true;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Lifeline group #${group} is already assigned with a node association`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tassocAPI.isSupported()\n\t\t\t\t// Some endpoint groups don't support having any destinations because they are shared with the root\n\t\t\t\t&& assocInstance!.getMaxNodesCached(ctx, endpoint, group)\n\t\t\t\t\t> 0\n\t\t\t) {\n\t\t\t\t// We can use a node association, but first remove any possible endpoint associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Assigning lifeline group #${group} with a node association via Association CC...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tisAssignedAsEndpointAssociation(endpoint)\n\t\t\t\t\t&& mcAPI.isSupported()\n\t\t\t\t) {\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t});\n\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\tawait mcAPI.getGroup(group);\n\t\t\t\t}\n\n\t\t\t\tawait assocAPI.addNodeIds(group, ownNodeId);\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await assocAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.nodeIds.includes(ownNodeId);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Lifeline group #${group} was assigned with a node association via Association CC`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Assigning lifeline group #${group} with a node association via Association CC did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Second try: Node association using the Multi Channel Association CC\n\t\t\tif (\n\t\t\t\t!hasLifeline\n\t\t\t\t&& mcAPI.isSupported()\n\t\t\t\t&& mcInstance!.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t) {\n\t\t\t\t// We can use a node association, but first remove any possible endpoint associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Assigning lifeline group #${group} with a node association via Multi Channel Association CC...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (isAssignedAsEndpointAssociation(endpoint)) {\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tawait mcAPI.addDestinations({\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t});\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await mcAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.nodeIds.includes(ownNodeId);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Lifeline group #${group} was assigned with a node association via Multi Channel Association CC`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Assigning lifeline group #${group} with a node association via Multi Channel Association CC did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Third try: Use an endpoint association (target endpoint 0)\n\t\t// This is only supported starting in Multi Channel Association CC V3\n\t\tif (!hasLifeline && !mustUseNodeAssociation) {\n\t\t\tif (isAssignedAsEndpointAssociation(endpoint)) {\n\t\t\t\t// We already have the correct association\n\t\t\t\thasLifeline = true;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Lifeline group #${group} is already assigned with an endpoint association`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tmcAPI.isSupported()\n\t\t\t\t&& mcAPI.version >= 3\n\t\t\t\t&& mcInstance!.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t) {\n\t\t\t\t// We can use a multi channel association, but first remove any possible node associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Assigning lifeline group #${group} with a multi channel association...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (isAssignedAsNodeAssociation(endpoint)) {\n\t\t\t\t\t// It has been found that some devices don't correctly share the node associations between\n\t\t\t\t\t// Association CC and Multi Channel Association CC, so we remove the nodes from both lists\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t});\n\t\t\t\t\tif (assocAPI.isSupported()) {\n\t\t\t\t\t\tawait assocAPI.removeNodeIds({\n\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\tawait assocAPI.getGroup(group);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tawait mcAPI.addDestinations({\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t});\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await mcAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.endpoints.some(\n\t\t\t\t\t(a) => a.nodeId === ownNodeId && a.endpoint === 0,\n\t\t\t\t);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Lifeline group #${group} was assigned with a multi channel association`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Assigning lifeline group #${group} with a multi channel association did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Last attempt (actual Z-Wave+ Lifelines only): Try a multi channel association on the root.\n\t\t// Endpoint interviews happen AFTER the root interview, so this enables us to overwrite what\n\t\t// we previously configured on the root.\n\t\tif (\n\t\t\t!hasLifeline\n\t\t\t&& group === 1\n\t\t\t&& node.supportsCC(CommandClasses[\"Z-Wave Plus Info\"])\n\t\t\t&& endpoint.index > 0\n\t\t) {\n\t\t\t// But first check if the root may have a multi channel association\n\t\t\tconst rootAssocConfig = deviceConfig\n\t\t\t\t?.getAssociationConfigForEndpoint(0, group);\n\t\t\tconst rootMustUseNodeAssociation = !nodeSupportsMultiChannel\n\t\t\t\t|| rootAssocConfig?.multiChannel === false;\n\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage:\n\t\t\t\t\t`Checking root device for fallback assignment of lifeline group #${group}:\nroot supports multi channel: ${nodeSupportsMultiChannel}\nconfigured strategy: ${rootAssocConfig?.multiChannel ?? \"auto\"}\nmust use node association: ${rootMustUseNodeAssociation}`,\n\t\t\t});\n\n\t\t\tif (!rootMustUseNodeAssociation) {\n\t\t\t\tif (isAssignedAsEndpointAssociation(node)) {\n\t\t\t\t\t// We already have the correct association\n\t\t\t\t\thasLifeline = true;\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`Lifeline group #${group} is already assigned with a multi channel association on the root device`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst rootMCAPI = CCAPI.create(\n\t\t\t\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t);\n\t\t\t\t\tconst rootAssocAPI = CCAPI.create(\n\t\t\t\t\t\tCommandClasses.Association,\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t);\n\t\t\t\t\tif (rootMCAPI.isSupported()) {\n\t\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t\t`Assigning lifeline group #${group} with a multi channel association on the root device...`,\n\t\t\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// Clean up node associations because they might prevent us from adding the endpoint association\n\t\t\t\t\t\tif (isAssignedAsNodeAssociation(node)) {\n\t\t\t\t\t\t\t// It has been found that some devices don't correctly share the node associations between\n\t\t\t\t\t\t\t// Association CC and Multi Channel Association CC, so we remove the nodes from both lists\n\t\t\t\t\t\t\tawait rootMCAPI.removeDestinations({\n\t\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (rootAssocAPI.isSupported()) {\n\t\t\t\t\t\t\t\tawait rootAssocAPI.removeNodeIds({\n\t\t\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\t\t\tawait rootAssocAPI.getGroup(group);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait rootMCAPI.addDestinations({\n\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\tconst groupReport = await rootMCAPI.getGroup(group);\n\t\t\t\t\t\thasLifeline = !!groupReport?.endpoints.some(\n\t\t\t\t\t\t\t(a) => a.nodeId === ownNodeId && a.endpoint === 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!hasLifeline) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage:\n\t\t\t\t\t`All attempts to assign lifeline group #${group} failed, skipping...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t}\n\t}\n\n\t// Remember that we did the association assignment\n\tvalueDB.setValue(\n\t\tAssociationCCValues.hasLifeline.endpoint(endpoint.index),\n\t\ttrue,\n\t);\n}\n\nexport async function assignLifelineIssueingCommand(\n\tctx: CCAPIHost<\n\t\t& CCAPINode\n\t\t& SupportsCC\n\t\t& ControlsCC\n\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t& QuerySecurityClasses\n\t>,\n\tendpoint: EndpointId,\n\tccId: CommandClasses,\n\tccCommand: number,\n): Promise<void> {\n\tconst node = ctx.getNodeOrThrow(endpoint.nodeId);\n\tif (\n\t\tnode.supportsCC(CommandClasses[\"Association Group Information\"])\n\t\t&& (node.supportsCC(CommandClasses.Association)\n\t\t\t|| node.supportsCC(CommandClasses[\"Multi Channel Association\"]))\n\t) {\n\t\tconst groupsIssueingNotifications = AssociationGroupInfoCC\n\t\t\t.findGroupsForIssuedCommand(\n\t\t\t\tctx,\n\t\t\t\tnode,\n\t\t\t\tccId,\n\t\t\t\tccCommand,\n\t\t\t);\n\t\tif (groupsIssueingNotifications.length > 0) {\n\t\t\t// We always grab the first group - usually it should be the lifeline\n\t\t\tconst groupId = groupsIssueingNotifications[0];\n\t\t\tconst existingAssociations = getAssociations(ctx, node).get(groupId)\n\t\t\t\t?? [];\n\n\t\t\tif (\n\t\t\t\t!existingAssociations.some(\n\t\t\t\t\t(a) => a.nodeId === ctx.ownNodeId,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Configuring associations to receive ${\n\t\t\t\t\t\tgetCCName(\n\t\t\t\t\t\t\tccId,\n\t\t\t\t\t\t)\n\t\t\t\t\t} commands...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tawait addAssociations(ctx, node, groupId, [\n\t\t\t\t\t{ nodeId: ctx.ownNodeId },\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function doesAnyLifelineSendActuatorOrSensorReports(\n\tctx: GetValueDB & GetDeviceConfig,\n\tnode: NodeId & SupportsCC,\n): MaybeNotKnown<boolean> {\n\t// No association support means no unsolicited reports\n\tif (\n\t\t!node.supportsCC(CommandClasses.Association)\n\t\t&& !node.supportsCC(CommandClasses[\"Multi Channel Association\"])\n\t) {\n\t\treturn false;\n\t}\n\n\t// No AGI support means we cannot know\n\tif (!node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\treturn NOT_KNOWN;\n\t}\n\n\t// Lifeline group IDs include the ones we added via a config file, so they may not be considered true lifelines\n\tconst lifelineGroupIds = getLifelineGroupIds(ctx, node);\n\t// If any potential lifeline group has the \"General: Lifeline\" profile, the node MUST send unsolicited reports that way\n\tif (\n\t\tlifelineGroupIds.some(\n\t\t\t(id) =>\n\t\t\t\tAssociationGroupInfoCC.getGroupProfileCached(\n\t\t\t\t\tctx,\n\t\t\t\t\tnode,\n\t\t\t\t\tid,\n\t\t\t\t) === AssociationGroupInfoProfile[\"General: Lifeline\"],\n\t\t)\n\t) {\n\t\treturn true;\n\t}\n\n\t// Otherwise check if any of the groups sends any actuator or sensor commands. We'll assume that those are reports\n\tfor (const groupId of lifelineGroupIds) {\n\t\tconst issuedCommands = AssociationGroupInfoCC.getIssuedCommandsCached(\n\t\t\tctx,\n\t\t\tnode,\n\t\t\tgroupId,\n\t\t);\n\t\tif (!issuedCommands) continue;\n\t\tconst commands = [...issuedCommands.keys()];\n\t\tif (commands.some((c) => isActuatorCC(c) || isSensorCC(c))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;;;AAAA,kBAwBO;AACP,oBAIO;AACP,oBAAyB;AACzB,2BAAmD;AACnD,oCAAuC;AACvC,uCAA0C;AAC1C,iBAAsD;AACtD,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ACC,IAAI,CAEN;UACA,WAAW;SACX;AACD,cAAM,gBAAgB,KAAK,MAAM,SAAS;UACzC,EAAE,QAAQ,IAAI,UAAS;SACvB;MACF;IACD;EACD;AACD;AAnDsB;AAqDhB,SAAU,2CACf,KACA,MAAyB;AAGzB,MACC,CAAC,KAAK,WAAW,2BAAe,WAAW,KACxC,CAAC,KAAK,WAAW,2BAAe,2BAA2B,CAAC,GAC9D;AACD,WAAO;EACR;AAGA,MAAI,CAAC,KAAK,WAAW,2BAAe,+BAA+B,CAAC,GAAG;AACtE,WAAO;EACR;AAGA,QAAM,mBAAmB,oBAAoB,KAAK,IAAI;AAEtD,MACC,iBAAiB,KAChB,CAAC,OACA,qDAAuB,sBACtB,KACA,MACA,EAAE,MACG,yCAA4B,mBAAmB,CAAC,GAEvD;AACD,WAAO;EACR;AAGA,aAAW,WAAW,kBAAkB;AACvC,UAAM,iBAAiB,qDAAuB,wBAC7C,KACA,MACA,OAAO;AAER,QAAI,CAAC;AAAgB;AACrB,UAAM,WAAW,CAAC,GAAG,eAAe,KAAI,CAAE;AAC1C,QAAI,SAAS,KAAK,CAAC,UAAM,0BAAa,CAAC,SAAK,wBAAW,CAAC,CAAC,GAAG;AAC3D,aAAO;IACR;EACD;AAEA,SAAO;AACR;AAhDgB;",
4
+ "sourcesContent": ["import type { AssociationConfig, GetDeviceConfig } from \"@zwave-js/config\";\nimport {\n\tCommandClasses,\n\ttype ControlsCC,\n\ttype EndpointId,\n\ttype GetAllEndpoints,\n\ttype GetEndpoint,\n\ttype GetNode,\n\ttype GetValueDB,\n\ttype HostIDs,\n\ttype MaybeNotKnown,\n\tNOT_KNOWN,\n\ttype NodeId,\n\ttype QuerySecurityClasses,\n\tSecurityClass,\n\ttype SupportsCC,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tactuatorCCs,\n\tgetCCName,\n\tisActuatorCC,\n\tisLongRangeNodeId,\n\tisSensorCC,\n\tlogDict,\n\tlogText,\n} from \"@zwave-js/core\";\nimport {\n\tObjectKeyMap,\n\ttype ReadonlyObjectKeyMap,\n\tgetEnumMemberName,\n} from \"@zwave-js/shared\";\nimport { distinct } from \"alcalzone-shared/arrays\";\n\nimport { AssociationCC, AssociationCCValues } from \"../cc/AssociationCC.js\";\nimport { AssociationGroupInfoCC } from \"../cc/AssociationGroupInfoCC.js\";\nimport { MultiChannelAssociationCC } from \"../cc/MultiChannelAssociationCC.js\";\n\nimport { CCAPI, type CCAPIHost, type CCAPINode } from \"./API.js\";\nimport {\n\ttype AssociationAddress,\n\tAssociationCheckResult,\n\ttype AssociationGroup,\n\tAssociationGroupInfoProfile,\n\ttype EndpointAddress,\n} from \"./_Types.js\";\n\nexport function getAssociations(\n\tctx: GetValueDB,\n\tendpoint: EndpointId & SupportsCC,\n): ReadonlyMap<number, readonly AssociationAddress[]> {\n\tconst ret = new Map<number, readonly AssociationAddress[]>();\n\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tconst destinations = AssociationCC.getAllDestinationsCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tfor (const [groupId, assocs] of destinations) {\n\t\t\tret.set(groupId, assocs);\n\t\t}\n\t} else {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Merge the \"normal\" destinations with multi channel destinations\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tconst destinations = MultiChannelAssociationCC.getAllDestinationsCached(\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tfor (const [groupId, assocs] of destinations) {\n\t\t\tif (ret.has(groupId)) {\n\t\t\t\tconst normalAssociations = ret.get(groupId)!;\n\t\t\t\tret.set(groupId, [\n\t\t\t\t\t...normalAssociations,\n\t\t\t\t\t// Eliminate potential duplicates\n\t\t\t\t\t...assocs.filter(\n\t\t\t\t\t\t(a1) =>\n\t\t\t\t\t\t\t!normalAssociations.some(\n\t\t\t\t\t\t\t\t(a2) =>\n\t\t\t\t\t\t\t\t\ta1.nodeId === a2.nodeId\n\t\t\t\t\t\t\t\t\t&& a1.endpoint === a2.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t]);\n\t\t\t} else {\n\t\t\t\tret.set(groupId, assocs);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ret;\n}\n\nexport function getAllAssociations(\n\tctx: GetValueDB,\n\tnode: NodeId & GetAllEndpoints<EndpointId & SupportsCC>,\n): ReadonlyObjectKeyMap<\n\tAssociationAddress,\n\tReadonlyMap<number, readonly AssociationAddress[]>\n> {\n\tconst ret = new ObjectKeyMap<\n\t\tAssociationAddress,\n\t\tReadonlyMap<number, readonly AssociationAddress[]>\n\t>();\n\tfor (const endpoint of node.getAllEndpoints()) {\n\t\tconst address: AssociationAddress = {\n\t\t\tnodeId: node.id,\n\t\t\tendpoint: endpoint.index,\n\t\t};\n\t\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\t\tret.set(address, getAssociations(ctx, endpoint));\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport function checkAssociation(\n\tctx: HostIDs\n\t\t& GetValueDB\n\t\t& GetNode<\n\t\t\tNodeId\n\t\t\t\t& SupportsCC\n\t\t\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t\t\t& QuerySecurityClasses\n\t\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestination: AssociationAddress,\n): AssociationCheckResult {\n\t// Check that the target endpoint exists except when adding an association to the controller\n\tconst targetNode = ctx.getNodeOrThrow(destination.nodeId);\n\tconst targetEndpoint =\n\t\tdestination.nodeId === ctx.ownNodeId\n\t\t\t? targetNode\n\t\t\t: targetNode.getEndpointOrThrow(destination.endpoint ?? 0);\n\n\tif (\n\t\t!endpoint.supportsCC(CommandClasses.Association)\n\t\t&& !endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])\n\t) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Associations to and from ZWLR devices are not allowed\n\tif (isLongRangeNodeId(destination.nodeId)) {\n\t\treturn AssociationCheckResult.Forbidden_DestinationIsLongRange;\n\t} else if (isLongRangeNodeId(endpoint.nodeId)) {\n\t\t// Except the lifeline back to the host\n\t\tif (group !== 1 || destination.nodeId !== ctx.ownNodeId) {\n\t\t\treturn AssociationCheckResult.Forbidden_SourceIsLongRange;\n\t\t}\n\t}\n\n\t// The following checks don't apply to Lifeline associations\n\tif (destination.nodeId === ctx.ownNodeId) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\t// Disallow self-associations\n\tif (destination.nodeId === endpoint.nodeId) {\n\t\treturn AssociationCheckResult.Forbidden_SelfAssociation;\n\t}\n\n\t// For Association version 1 and version 2 / MCA version 1-3:\n\t// A controlling node MUST NOT associate Node A to a Node B destination\n\t// if Node A and Node B\u2019s highest Security Class are not identical.\n\t// For Association version 3 / MCA version 4:\n\t// A controlling node MUST NOT associate Node A to a Node B destination\n\t// if Node A was not granted Node B\u2019s highest Security Class.\n\n\tconst sourceNode = ctx.getNode(endpoint.nodeId)!;\n\tlet securityClassMustMatch: boolean;\n\tif (destination.endpoint == undefined) {\n\t\t// \"normal\" association\n\t\tconst sourceNodeCCVersion = endpoint.getCCVersion(\n\t\t\tCommandClasses.Association,\n\t\t);\n\t\tsecurityClassMustMatch = sourceNodeCCVersion < 3;\n\t} else {\n\t\t// multi channel association\n\t\tconst sourceNodeCCVersion = endpoint.getCCVersion(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t);\n\t\tsecurityClassMustMatch = sourceNodeCCVersion < 4;\n\t}\n\n\tconst sourceSecurityClass = sourceNode.getHighestSecurityClass();\n\tconst targetSecurityClass = targetNode.getHighestSecurityClass();\n\n\t// If the security classes are unknown, all bets are off\n\tif (sourceSecurityClass != undefined && targetSecurityClass != undefined) {\n\t\tif (\n\t\t\tsecurityClassMustMatch\n\t\t\t&& sourceSecurityClass !== targetSecurityClass\n\t\t) {\n\t\t\treturn AssociationCheckResult.Forbidden_SecurityClassMismatch;\n\t\t} else if (\n\t\t\t// Commands to insecure nodes are allowed\n\t\t\ttargetSecurityClass !== SecurityClass.None\n\t\t\t// Otherwise, the sender must know the target's highest key\n\t\t\t&& !securityClassMustMatch\n\t\t\t&& !sourceNode.hasSecurityClass(targetSecurityClass)\n\t\t) {\n\t\t\treturn AssociationCheckResult.Forbidden_DestinationSecurityClassNotGranted;\n\t\t}\n\t}\n\n\t// SDS14223:\n\t// A controlling node MUST NOT associate Node A to a Node B destination that does not support\n\t// the Command Class that the Node A will be controlling\n\t//\n\t// To determine this, the node must support the AGI CC or we have no way of knowing which\n\t// CCs the node will control\n\tif (!endpoint.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\tconst groupCommandList = AssociationGroupInfoCC.getIssuedCommandsCached(\n\t\tctx,\n\t\tendpoint,\n\t\tgroup,\n\t);\n\tif (!groupCommandList || !groupCommandList.size) {\n\t\t// We don't know which CCs this group controls, just allow it\n\t\treturn AssociationCheckResult.OK;\n\t}\n\tconst groupCCs = [...groupCommandList.keys()];\n\n\t// A controlling node MAY create an association to a destination supporting an\n\t// actuator Command Class if the actual association group sends Basic Control Command Class.\n\tif (\n\t\tgroupCCs.includes(CommandClasses.Basic)\n\t\t&& actuatorCCs.some((cc) => targetEndpoint?.supportsCC(cc))\n\t) {\n\t\treturn AssociationCheckResult.OK;\n\t}\n\n\t// Enforce that at least one issued CC is supported\n\tif (groupCCs.some((cc) => targetEndpoint?.supportsCC(cc))) {\n\t\treturn AssociationCheckResult.OK;\n\t} else {\n\t\treturn AssociationCheckResult.Forbidden_NoSupportedCCs;\n\t}\n}\n\nexport function getAssociationGroups(\n\tctx: GetValueDB & GetDeviceConfig,\n\tendpoint: EndpointId & SupportsCC,\n): ReadonlyMap<number, AssociationGroup> {\n\t// Check whether we have multi channel support or not\n\tlet assocInstance: typeof AssociationCC;\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t} else {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${endpoint.nodeId}${\n\t\t\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t\t\t} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t}\n\n\tconst assocGroupCount =\n\t\tassocInstance.getGroupCountCached(ctx, endpoint) ?? 0;\n\tconst mcGroupCount = mcInstance?.getGroupCountCached(ctx, endpoint) ?? 0;\n\tconst groupCount = Math.max(assocGroupCount, mcGroupCount);\n\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\n\tconst ret = new Map<number, AssociationGroup>();\n\n\tif (endpoint.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\t// We can read all information we need from the AGI CC\n\t\tconst agiInstance = AssociationGroupInfoCC;\n\t\tfor (let group = 1; group <= groupCount; group++) {\n\t\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\t\tendpoint.index,\n\t\t\t\tgroup,\n\t\t\t);\n\t\t\tconst multiChannel = !!mcInstance && group <= mcGroupCount;\n\t\t\tret.set(group, {\n\t\t\t\tmaxNodes:\n\t\t\t\t\t(multiChannel\n\t\t\t\t\t\t? mcInstance!\n\t\t\t\t\t\t: assocInstance\n\t\t\t\t\t).getMaxNodesCached(ctx, endpoint, group) || 1,\n\t\t\t\t// AGI implies Z-Wave+ where group 1 is the lifeline\n\t\t\t\tisLifeline: group === 1,\n\t\t\t\tlabel:\n\t\t\t\t\t// prefer the configured label if we have one\n\t\t\t\t\tassocConfig?.label\n\t\t\t\t\t// the ones reported by AGI are sometimes pretty bad\n\t\t\t\t\t?? agiInstance.getGroupNameCached(ctx, endpoint, group)\n\t\t\t\t\t// but still better than \"unnamed\"\n\t\t\t\t\t?? `Unnamed group ${group}`,\n\t\t\t\tmultiChannel,\n\t\t\t\tprofile: agiInstance.getGroupProfileCached(\n\t\t\t\t\tctx,\n\t\t\t\t\tendpoint,\n\t\t\t\t\tgroup,\n\t\t\t\t),\n\t\t\t\tissuedCommands: agiInstance.getIssuedCommandsCached(\n\t\t\t\t\tctx,\n\t\t\t\t\tendpoint,\n\t\t\t\t\tgroup,\n\t\t\t\t),\n\t\t\t});\n\t\t}\n\t} else {\n\t\t// we need to consult the device config\n\t\tfor (let group = 1; group <= groupCount; group++) {\n\t\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\t\tendpoint.index,\n\t\t\t\tgroup,\n\t\t\t);\n\t\t\tconst multiChannel = !!mcInstance && group <= mcGroupCount;\n\t\t\tret.set(group, {\n\t\t\t\tmaxNodes:\n\t\t\t\t\t(multiChannel\n\t\t\t\t\t\t? mcInstance!\n\t\t\t\t\t\t: assocInstance\n\t\t\t\t\t).getMaxNodesCached(ctx, endpoint, group)\n\t\t\t\t\t|| assocConfig?.maxNodes\n\t\t\t\t\t|| 1,\n\t\t\t\tisLifeline: assocConfig?.isLifeline ?? group === 1,\n\t\t\t\tlabel: assocConfig?.label ?? `Unnamed group ${group}`,\n\t\t\t\tmultiChannel,\n\t\t\t});\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport function getAllAssociationGroups(\n\tctx: GetValueDB & GetDeviceConfig,\n\tnode: NodeId & GetAllEndpoints<EndpointId & SupportsCC>,\n): ReadonlyMap<number, ReadonlyMap<number, AssociationGroup>> {\n\tconst ret = new Map<number, ReadonlyMap<number, AssociationGroup>>();\n\tfor (const endpoint of node.getAllEndpoints()) {\n\t\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\t\tret.set(endpoint.index, getAssociationGroups(ctx, endpoint));\n\t\t}\n\t}\n\treturn ret;\n}\n\nexport async function addAssociations(\n\tctx: CCAPIHost<\n\t\tCCAPINode\n\t\t\t& SupportsCC\n\t\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t\t& QuerySecurityClasses\n\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestinations: AssociationAddress[],\n\toptions?: {\n\t\t/**\n\t\t * Whether to force creating associations even if they are not allowed.\n\t\t * **Note:** Invalid associations will most likely not work\n\t\t */\n\t\tforce?: boolean;\n\t},\n): Promise<void> {\n\tconst nodeAndEndpointString = `${endpoint.nodeId}${\n\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t}`;\n\n\t// Check whether we should add any associations the device does not have support for\n\tlet assocInstance: typeof AssociationCC | undefined;\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\t// Split associations into conventional and endpoint associations\n\tconst nodeAssociations = distinct(\n\t\tdestinations\n\t\t\t.filter((a) => a.endpoint == undefined)\n\t\t\t.map((a) => a.nodeId),\n\t);\n\tconst endpointAssociations = destinations.filter(\n\t\t(a) => a.endpoint != undefined,\n\t) as EndpointAddress[];\n\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t} else if (nodeAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t} else if (endpointAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Disallow associating a node with itself. This is technically checked as part of\n\t// checkAssociations, but here we provide a better error message.\n\tconst selfAssociations = destinations.filter(\n\t\t(d) => d.nodeId === endpoint.nodeId,\n\t);\n\tif (selfAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Associating a node with itself is not allowed!`,\n\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\tselfAssociations.map((a) => ({\n\t\t\t\t...a,\n\t\t\t\tcheckResult: AssociationCheckResult.Forbidden_SelfAssociation,\n\t\t\t})),\n\t\t);\n\t}\n\n\tconst assocGroupCount =\n\t\tassocInstance?.getGroupCountCached(ctx, endpoint) ?? 0;\n\tconst mcGroupCount = mcInstance?.getGroupCountCached(ctx, endpoint) ?? 0;\n\tconst groupCount = Math.max(assocGroupCount, mcGroupCount);\n\tif (group > groupCount) {\n\t\tthrow new ZWaveError(\n\t\t\t`Group ${group} does not exist on node ${nodeAndEndpointString}`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\n\tconst groupIsMultiChannel =\n\t\t!!mcInstance\n\t\t&& group <= mcGroupCount\n\t\t&& deviceConfig?.associations?.get(group)?.multiChannel !== false;\n\n\tif (groupIsMultiChannel) {\n\t\t// Check that all associations are allowed\n\t\tif (!options?.force) {\n\t\t\tconst disallowedAssociations = destinations\n\t\t\t\t.map((a) => ({\n\t\t\t\t\t...a,\n\t\t\t\t\tcheckResult: checkAssociation(ctx, endpoint, group, a),\n\t\t\t\t}))\n\t\t\t\t.filter(\n\t\t\t\t\t({ checkResult }) =>\n\t\t\t\t\t\tcheckResult !== AssociationCheckResult.OK,\n\t\t\t\t);\n\t\t\tif (disallowedAssociations.length) {\n\t\t\t\tlet message = `The following associations are not allowed:`;\n\t\t\t\tmessage += disallowedAssociations\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(a) =>\n\t\t\t\t\t\t\t`\\n\u00B7 Node ${a.nodeId}${\n\t\t\t\t\t\t\t\ta.endpoint ? `, endpoint ${a.endpoint}` : \"\"\n\t\t\t\t\t\t\t}: ${getEnumMemberName(\n\t\t\t\t\t\t\t\tAssociationCheckResult,\n\t\t\t\t\t\t\t\ta.checkResult,\n\t\t\t\t\t\t\t).replace(\"Forbidden_\", \"\")}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\");\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\tmessage,\n\t\t\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\t\t\tdisallowedAssociations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// And add them\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.addDestinations({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t\tendpoints: endpointAssociations,\n\t\t});\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t} else {\n\t\t// Although the node supports multi channel associations, this group only supports \"normal\" associations\n\t\tif (destinations.some((a) => a.endpoint != undefined)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`Node ${nodeAndEndpointString}, group ${group} does not support multi channel associations!`,\n\t\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t\t);\n\t\t}\n\n\t\t// Check that all associations are allowed\n\t\tif (!options?.force) {\n\t\t\tconst disallowedAssociations = destinations\n\t\t\t\t.map((a) => ({\n\t\t\t\t\t...a,\n\t\t\t\t\tcheckResult: checkAssociation(ctx, endpoint, group, a),\n\t\t\t\t}))\n\t\t\t\t.filter(\n\t\t\t\t\t({ checkResult }) =>\n\t\t\t\t\t\tcheckResult !== AssociationCheckResult.OK,\n\t\t\t\t);\n\t\t\tif (disallowedAssociations.length) {\n\t\t\t\tlet message = `The associations to the following nodes are not allowed`;\n\t\t\t\tmessage += disallowedAssociations\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(a) =>\n\t\t\t\t\t\t\t`\\n\u00B7 Node ${a.nodeId}: ${getEnumMemberName(\n\t\t\t\t\t\t\t\tAssociationCheckResult,\n\t\t\t\t\t\t\t\ta.checkResult,\n\t\t\t\t\t\t\t).replace(\"Forbidden_\", \"\")}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\");\n\n\t\t\t\tthrow new ZWaveError(\n\t\t\t\t\tmessage,\n\t\t\t\t\tZWaveErrorCodes.AssociationCC_NotAllowed,\n\t\t\t\t\tdisallowedAssociations,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst api = CCAPI.create(CommandClasses.Association, ctx, endpoint);\n\t\tawait api.addNodeIds(group, ...destinations.map((a) => a.nodeId));\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t}\n}\n\nexport async function removeAssociations(\n\tctx: CCAPIHost,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n\tgroup: number,\n\tdestinations: AssociationAddress[],\n): Promise<void> {\n\tconst nodeAndEndpointString = `${endpoint.nodeId}${\n\t\tendpoint.index > 0 ? `, endpoint ${endpoint.index}` : \"\"\n\t}`;\n\n\t// Split associations into conventional and endpoint associations\n\tconst nodeAssociations = distinct(\n\t\tdestinations\n\t\t\t.filter((a) => a.endpoint == undefined)\n\t\t\t.map((a) => a.nodeId),\n\t);\n\tconst endpointAssociations = destinations.filter(\n\t\t(a) => a.endpoint != undefined,\n\t) as EndpointAddress[];\n\n\t// Removing associations is not either/or - we could have a device with duplicated associations between\n\t// Association CC and Multi Channel Association CC\n\t// Figure out what we need to use to remove the associations\n\n\tlet groupExistsAsMultiChannel = false;\n\tlet groupExistsAsNodeAssociation = false;\n\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tlet assocInstance: typeof AssociationCC | undefined;\n\n\t// To remove a multi channel association, we need to make sure that the group exists\n\t// and the node supports multi channel associations\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t\tif (group <= mcInstance.getGroupCountCached(ctx, endpoint)) {\n\t\t\tgroupExistsAsMultiChannel = true;\n\t\t}\n\t} else if (endpointAssociations.length > 0) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// To remove a normal association, we need to make sure that the group exists either as a normal association\n\t// or as a multi channel association\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t\tif (group <= assocInstance.getGroupCountCached(ctx, endpoint)) {\n\t\t\tgroupExistsAsNodeAssociation = true;\n\t\t}\n\t}\n\n\tif (!mcInstance && !assocInstance) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString} does not support associations!`,\n\t\t\tZWaveErrorCodes.CC_NotSupported,\n\t\t);\n\t}\n\n\t// Ensure the group exists and can be used\n\tif (!groupExistsAsMultiChannel && !groupExistsAsNodeAssociation) {\n\t\tthrow new ZWaveError(\n\t\t\t` Association group ${group} does not exist for node ${nodeAndEndpointString}`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\tif (endpointAssociations.length > 0 && !groupExistsAsMultiChannel) {\n\t\tthrow new ZWaveError(\n\t\t\t`Node ${nodeAndEndpointString}, association group ${group} does not support multi channel associations!`,\n\t\t\tZWaveErrorCodes.AssociationCC_InvalidGroup,\n\t\t);\n\t}\n\n\t// Even if we only remove node associations, we use both CCs since it has been found that some\n\t// devices do not correctly share the node list between the two commands\n\tif (\n\t\tassocInstance\n\t\t&& nodeAssociations.length > 0\n\t\t&& groupExistsAsNodeAssociation\n\t) {\n\t\tconst api = CCAPI.create(CommandClasses.Association, ctx, endpoint);\n\t\tawait api.removeNodeIds({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t});\n\t\t// Refresh the association list\n\t\tawait api.getGroup(group);\n\t}\n\n\tif (mcInstance && groupExistsAsMultiChannel) {\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tawait api.removeDestinations({\n\t\t\tgroupId: group,\n\t\t\tnodeIds: nodeAssociations,\n\t\t\tendpoints: endpointAssociations,\n\t\t});\n\t\t// Refresh the multi channel association list\n\t\tawait api.getGroup(group);\n\t}\n}\n\nexport function getLifelineGroupIds(\n\tctx: GetValueDB & GetDeviceConfig,\n\tendpoint: EndpointId & SupportsCC,\n): number[] {\n\t// For now only support this for the root endpoint - i.e. node\n\tif (endpoint.index > 0) return [];\n\n\t// Some nodes define multiple lifeline groups, so we need to assign us to\n\t// all of them\n\tconst lifelineGroups: number[] = [];\n\n\t// If the target node supports Z-Wave+ info that means the lifeline MUST be group #1\n\tif (endpoint.supportsCC(CommandClasses[\"Z-Wave Plus Info\"])) {\n\t\tlifelineGroups.push(1);\n\t}\n\n\t// We have a device config file that tells us which (additional) association to assign\n\tlet associations: ReadonlyMap<number, AssociationConfig> | undefined;\n\tconst deviceConfig = ctx.getDeviceConfig?.(endpoint.nodeId);\n\tif (endpoint.index === 0) {\n\t\t// The root endpoint's associations may be configured separately or as part of \"endpoints\"\n\t\tassociations =\n\t\t\tdeviceConfig?.associations\n\t\t\t?? deviceConfig?.endpoints?.get(0)?.associations;\n\t} else {\n\t\t// The other endpoints can only have a configuration as part of \"endpoints\"\n\t\tassociations = deviceConfig?.endpoints?.get(\n\t\t\tendpoint.index,\n\t\t)?.associations;\n\t}\n\n\tif (associations?.size) {\n\t\tlifelineGroups.push(\n\t\t\t...[...associations.values()]\n\t\t\t\t.filter((a) => a.isLifeline)\n\t\t\t\t.map((a) => a.groupId),\n\t\t);\n\t}\n\n\treturn distinct(lifelineGroups).toSorted((a, b) => a - b);\n}\n\nexport async function configureLifelineAssociations(\n\tctx: CCAPIHost<\n\t\tCCAPINode\n\t\t\t& SupportsCC\n\t\t\t& ControlsCC\n\t\t\t& GetAllEndpoints<EndpointId & SupportsCC & ControlsCC>\n\t>,\n\tendpoint: EndpointId & SupportsCC & ControlsCC,\n): Promise<void> {\n\t// Assign the controller to all lifeline groups\n\tconst ownNodeId = ctx.ownNodeId;\n\tconst node = ctx.getNodeOrThrow(endpoint.nodeId);\n\tconst valueDB = ctx.getValueDB(node.id);\n\tconst deviceConfig = ctx.getDeviceConfig?.(node.id);\n\n\t// We check if a node supports Multi Channel CC before creating Multi Channel Lifeline Associations (#1109)\n\tconst nodeSupportsMultiChannel = node.supportsCC(\n\t\tCommandClasses[\"Multi Channel\"],\n\t);\n\n\tlet assocInstance: typeof AssociationCC | undefined;\n\tconst assocAPI = CCAPI.create(CommandClasses.Association, ctx, endpoint);\n\tif (endpoint.supportsCC(CommandClasses.Association)) {\n\t\tassocInstance = AssociationCC;\n\t}\n\n\tlet mcInstance: typeof MultiChannelAssociationCC | undefined;\n\tlet mcGroupCount = 0;\n\tconst mcAPI = CCAPI.create(\n\t\tCommandClasses[\"Multi Channel Association\"],\n\t\tctx,\n\t\tendpoint,\n\t);\n\tif (endpoint.supportsCC(CommandClasses[\"Multi Channel Association\"])) {\n\t\tmcInstance = MultiChannelAssociationCC;\n\t\tmcGroupCount = mcInstance.getGroupCountCached(ctx, endpoint) ?? 0;\n\t}\n\n\tconst lifelineGroups = getLifelineGroupIds(ctx, node);\n\tif (lifelineGroups.length === 0) {\n\t\t// We can look for the General Lifeline AGI profile as a last resort\n\t\tif (\n\t\t\tendpoint.supportsCC(CommandClasses[\"Association Group Information\"])\n\t\t) {\n\t\t\tconst agiAPI = CCAPI.create(\n\t\t\t\tCommandClasses[\"Association Group Information\"],\n\t\t\t\tctx,\n\t\t\t\tendpoint,\n\t\t\t);\n\n\t\t\t// The lifeline MUST be group 1\n\t\t\tconst lifeline = await agiAPI\n\t\t\t\t.getGroupInfo(1, true)\n\t\t\t\t.catch(() => undefined);\n\t\t\tif (\n\t\t\t\tlifeline?.profile\n\t\t\t\t=== AssociationGroupInfoProfile[\"General: Lifeline\"]\n\t\t\t) {\n\t\t\t\tlifelineGroups.push(1);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lifelineGroups.length === 0) {\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: endpoint.index,\n\t\t\tmessage:\n\t\t\t\t\"No information about Lifeline associations, cannot assign ourselves!\",\n\t\t\tlevel: \"warn\",\n\t\t});\n\t\t// Remember that we have NO lifeline association\n\t\tvalueDB.setValue(\n\t\t\tAssociationCCValues.hasLifeline.endpoint(endpoint.index),\n\t\t\tfalse,\n\t\t);\n\t\treturn;\n\t}\n\n\tctx.logNode(node.id, {\n\t\tendpoint: endpoint.index,\n\t\tmessage: logText(\n\t\t\t`Checking/assigning lifeline groups: ${lifelineGroups.join(\", \")}`,\n\t\t\t{\n\t\t\t\tnested: logDict({\n\t\t\t\t\t\"supports classic associations\": !!assocInstance,\n\t\t\t\t\t\"supports multi channel associations\": !!mcInstance,\n\t\t\t\t}),\n\t\t\t},\n\t\t),\n\t});\n\n\tfor (const group of lifelineGroups) {\n\t\tconst groupSupportsMultiChannelAssociation = group <= mcGroupCount;\n\t\tconst assocConfig = deviceConfig?.getAssociationConfigForEndpoint(\n\t\t\tendpoint.index,\n\t\t\tgroup,\n\t\t);\n\n\t\tconst mustUseNodeAssociation =\n\t\t\t!groupSupportsMultiChannelAssociation\n\t\t\t|| !nodeSupportsMultiChannel\n\t\t\t|| assocConfig?.multiChannel === false;\n\t\tlet mustUseMultiChannelAssociation = false;\n\n\t\tif (groupSupportsMultiChannelAssociation && nodeSupportsMultiChannel) {\n\t\t\tif (assocConfig?.multiChannel === true) {\n\t\t\t\tmustUseMultiChannelAssociation = true;\n\t\t\t} else if (endpoint.index === 0) {\n\t\t\t\t// If the node has multiple endpoints but none of the extra ones support associations,\n\t\t\t\t// the root endpoints needs a Multi Channel Association\n\t\t\t\tconst allEndpoints = node.getAllEndpoints();\n\t\t\t\tif (\n\t\t\t\t\tallEndpoints.length > 1\n\t\t\t\t\t&& allEndpoints\n\t\t\t\t\t\t.filter((e) => e.index !== endpoint.index)\n\t\t\t\t\t\t.every(\n\t\t\t\t\t\t\t(e) =>\n\t\t\t\t\t\t\t\t!e.supportsCC(CommandClasses.Association)\n\t\t\t\t\t\t\t\t&& !e.supportsCC(\n\t\t\t\t\t\t\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tmustUseMultiChannelAssociation = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: endpoint.index,\n\t\t\tmessage: logText(`Configuring lifeline group #${group}:`, {\n\t\t\t\tnested: logDict({\n\t\t\t\t\t\"group supports multi channel\":\n\t\t\t\t\t\tgroupSupportsMultiChannelAssociation,\n\t\t\t\t\t\"configured strategy\": assocConfig?.multiChannel ?? \"auto\",\n\t\t\t\t\t\"must use node association\": mustUseNodeAssociation,\n\t\t\t\t\t\"must use endpoint association\":\n\t\t\t\t\t\tmustUseMultiChannelAssociation,\n\t\t\t\t}),\n\t\t\t}),\n\t\t});\n\n\t\t// Figure out which associations exist and may need to be removed\n\t\tconst isAssignedAsNodeAssociation = (endpoint: EndpointId): boolean => {\n\t\t\tif (groupSupportsMultiChannelAssociation && mcInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tmcInstance.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t\t\t&& !!mcInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some(\n\t\t\t\t\t\t\t(addr) =>\n\t\t\t\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t\t\t\t&& addr.endpoint == undefined,\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (assocInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tassocInstance.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t\t\t&& !!assocInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some((addr) => addr.nodeId === ownNodeId)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\tconst isAssignedAsEndpointAssociation = (\n\t\t\tendpoint: EndpointId,\n\t\t): boolean => {\n\t\t\tif (mcInstance) {\n\t\t\t\tif (\n\t\t\t\t\t// Only consider a group if it doesn't share its associations with the root endpoint\n\t\t\t\t\tmcInstance.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t\t\t&& mcInstance\n\t\t\t\t\t\t.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t\t\t.get(group)\n\t\t\t\t\t\t?.some(\n\t\t\t\t\t\t\t(addr) =>\n\t\t\t\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t\t\t\t&& addr.endpoint === 0,\n\t\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t\t// If the node was used with other controller software, there might be\n\t\t// invalid lifeline associations which cause reporting problems\n\t\tconst invalidEndpointAssociations: EndpointAddress[] =\n\t\t\tmcInstance\n\t\t\t\t?.getAllDestinationsCached(ctx, endpoint)\n\t\t\t\t.get(group)\n\t\t\t\t?.filter(\n\t\t\t\t\t(addr): addr is AssociationAddress & EndpointAddress =>\n\t\t\t\t\t\taddr.nodeId === ownNodeId\n\t\t\t\t\t\t&& addr.endpoint != undefined\n\t\t\t\t\t\t&& addr.endpoint !== 0,\n\t\t\t\t) ?? [];\n\n\t\t// Clean them up first\n\t\tif (\n\t\t\tinvalidEndpointAssociations.length > 0\n\t\t\t&& mcAPI.isSupported()\n\t\t\t&& groupSupportsMultiChannelAssociation\n\t\t) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage: `Found invalid lifeline associations in group #${group}, removing them...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\tgroupId: group,\n\t\t\t\tendpoints: invalidEndpointAssociations,\n\t\t\t});\n\t\t\t// refresh the associations - don't trust that it worked\n\t\t\tawait mcAPI.getGroup(group);\n\t\t}\n\n\t\t// Assigning the correct lifelines depends on the association kind, source endpoint and the desired strategy:\n\t\t//\n\t\t// When `mustUseMultiChannelAssociation` is `true` - Use a multi channel association (if possible), no fallback\n\t\t// When `mustUseNodeAssociation` is `true` - Use a node association (if possible), no fallback\n\t\t// Otherwise:\n\t\t// 1. Try a node association on the current endpoint/root\n\t\t// 2. If Association CC is not supported, try assigning a node association with the Multi Channel Association CC\n\t\t// 3. If that did not work, fall back to a multi channel association (target endpoint 0)\n\t\t// 4. If that did not work either, the endpoint index is >0 and the node is Z-Wave+:\n\t\t// Fall back to a multi channel association (target endpoint 0) on the root, if it doesn't have one yet.\n\n\t\tlet hasLifeline = false;\n\n\t\t// First try: node association\n\t\tif (!mustUseMultiChannelAssociation) {\n\t\t\tif (isAssignedAsNodeAssociation(endpoint)) {\n\t\t\t\t// We already have the correct association\n\t\t\t\thasLifeline = true;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Lifeline group #${group} is already assigned with a node association`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tassocAPI.isSupported()\n\t\t\t\t// Some endpoint groups don't support having any destinations because they are shared with the root\n\t\t\t\t&& assocInstance!.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t) {\n\t\t\t\t// We can use a node association, but first remove any possible endpoint associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a node association via Association CC...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (\n\t\t\t\t\tisAssignedAsEndpointAssociation(endpoint)\n\t\t\t\t\t&& mcAPI.isSupported()\n\t\t\t\t) {\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t});\n\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\tawait mcAPI.getGroup(group);\n\t\t\t\t}\n\n\t\t\t\tawait assocAPI.addNodeIds(group, ownNodeId);\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await assocAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.nodeIds.includes(ownNodeId);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Lifeline group #${group} was assigned with a node association via Association CC`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a node association via Association CC did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Second try: Node association using the Multi Channel Association CC\n\t\t\tif (\n\t\t\t\t!hasLifeline\n\t\t\t\t&& mcAPI.isSupported()\n\t\t\t\t&& mcInstance!.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t) {\n\t\t\t\t// We can use a node association, but first remove any possible endpoint associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a node association via Multi Channel Association CC...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (isAssignedAsEndpointAssociation(endpoint)) {\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tawait mcAPI.addDestinations({\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t});\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await mcAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.nodeIds.includes(ownNodeId);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Lifeline group #${group} was assigned with a node association via Multi Channel Association CC`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a node association via Multi Channel Association CC did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Third try: Use an endpoint association (target endpoint 0)\n\t\t// This is only supported starting in Multi Channel Association CC V3\n\t\tif (!hasLifeline && !mustUseNodeAssociation) {\n\t\t\tif (isAssignedAsEndpointAssociation(endpoint)) {\n\t\t\t\t// We already have the correct association\n\t\t\t\thasLifeline = true;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Lifeline group #${group} is already assigned with an endpoint association`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\t\t\t} else if (\n\t\t\t\tmcAPI.isSupported()\n\t\t\t\t&& mcAPI.version >= 3\n\t\t\t\t&& mcInstance!.getMaxNodesCached(ctx, endpoint, group) > 0\n\t\t\t) {\n\t\t\t\t// We can use a multi channel association, but first remove any possible node associations\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a multi channel association...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tif (isAssignedAsNodeAssociation(endpoint)) {\n\t\t\t\t\t// It has been found that some devices don't correctly share the node associations between\n\t\t\t\t\t// Association CC and Multi Channel Association CC, so we remove the nodes from both lists\n\t\t\t\t\tawait mcAPI.removeDestinations({\n\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t});\n\t\t\t\t\tif (assocAPI.isSupported()) {\n\t\t\t\t\t\tawait assocAPI.removeNodeIds({\n\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\tawait assocAPI.getGroup(group);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tawait mcAPI.addDestinations({\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t});\n\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\tconst groupReport = await mcAPI.getGroup(group);\n\t\t\t\thasLifeline = !!groupReport?.endpoints.some(\n\t\t\t\t\t(a) => a.nodeId === ownNodeId && a.endpoint === 0,\n\t\t\t\t);\n\n\t\t\t\tif (hasLifeline) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Lifeline group #${group} was assigned with a multi channel association`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a multi channel association did not work`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Last attempt (actual Z-Wave+ Lifelines only): Try a multi channel association on the root.\n\t\t// Endpoint interviews happen AFTER the root interview, so this enables us to overwrite what\n\t\t// we previously configured on the root.\n\t\tif (\n\t\t\t!hasLifeline\n\t\t\t&& group === 1\n\t\t\t&& node.supportsCC(CommandClasses[\"Z-Wave Plus Info\"])\n\t\t\t&& endpoint.index > 0\n\t\t) {\n\t\t\t// But first check if the root may have a multi channel association\n\t\t\tconst rootAssocConfig =\n\t\t\t\tdeviceConfig?.getAssociationConfigForEndpoint(0, group);\n\t\t\tconst rootMustUseNodeAssociation =\n\t\t\t\t!nodeSupportsMultiChannel\n\t\t\t\t|| rootAssocConfig?.multiChannel === false;\n\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage: `Checking root device for fallback assignment of lifeline group #${group}:\nroot supports multi channel: ${nodeSupportsMultiChannel}\nconfigured strategy: ${rootAssocConfig?.multiChannel ?? \"auto\"}\nmust use node association: ${rootMustUseNodeAssociation}`,\n\t\t\t});\n\n\t\t\tif (!rootMustUseNodeAssociation) {\n\t\t\t\tif (isAssignedAsEndpointAssociation(node)) {\n\t\t\t\t\t// We already have the correct association\n\t\t\t\t\thasLifeline = true;\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\tmessage: `Lifeline group #${group} is already assigned with a multi channel association on the root device`,\n\t\t\t\t\t\tdirection: \"none\",\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst rootMCAPI = CCAPI.create(\n\t\t\t\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t);\n\t\t\t\t\tconst rootAssocAPI = CCAPI.create(\n\t\t\t\t\t\tCommandClasses.Association,\n\t\t\t\t\t\tctx,\n\t\t\t\t\t\tnode,\n\t\t\t\t\t);\n\t\t\t\t\tif (rootMCAPI.isSupported()) {\n\t\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\t\t\tmessage: `Assigning lifeline group #${group} with a multi channel association on the root device...`,\n\t\t\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// Clean up node associations because they might prevent us from adding the endpoint association\n\t\t\t\t\t\tif (isAssignedAsNodeAssociation(node)) {\n\t\t\t\t\t\t\t// It has been found that some devices don't correctly share the node associations between\n\t\t\t\t\t\t\t// Association CC and Multi Channel Association CC, so we remove the nodes from both lists\n\t\t\t\t\t\t\tawait rootMCAPI.removeDestinations({\n\t\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (rootAssocAPI.isSupported()) {\n\t\t\t\t\t\t\t\tawait rootAssocAPI.removeNodeIds({\n\t\t\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\t\t\tnodeIds: [ownNodeId],\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\t\t\tawait rootAssocAPI.getGroup(group);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tawait rootMCAPI.addDestinations({\n\t\t\t\t\t\t\tgroupId: group,\n\t\t\t\t\t\t\tendpoints: [{ nodeId: ownNodeId, endpoint: 0 }],\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// refresh the associations - don't trust that it worked\n\t\t\t\t\t\tconst groupReport = await rootMCAPI.getGroup(group);\n\t\t\t\t\t\thasLifeline = !!groupReport?.endpoints.some(\n\t\t\t\t\t\t\t(a) => a.nodeId === ownNodeId && a.endpoint === 0,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!hasLifeline) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: endpoint.index,\n\t\t\t\tmessage: `All attempts to assign lifeline group #${group} failed, skipping...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t}\n\t}\n\n\t// Remember that we did the association assignment\n\tvalueDB.setValue(\n\t\tAssociationCCValues.hasLifeline.endpoint(endpoint.index),\n\t\ttrue,\n\t);\n}\n\nexport async function assignLifelineIssueingCommand(\n\tctx: CCAPIHost<\n\t\tCCAPINode\n\t\t\t& SupportsCC\n\t\t\t& ControlsCC\n\t\t\t& GetEndpoint<EndpointId & SupportsCC>\n\t\t\t& QuerySecurityClasses\n\t>,\n\tendpoint: EndpointId,\n\tccId: CommandClasses,\n\tccCommand: number,\n): Promise<void> {\n\tconst node = ctx.getNodeOrThrow(endpoint.nodeId);\n\tif (\n\t\tnode.supportsCC(CommandClasses[\"Association Group Information\"])\n\t\t&& (node.supportsCC(CommandClasses.Association)\n\t\t\t|| node.supportsCC(CommandClasses[\"Multi Channel Association\"]))\n\t) {\n\t\tconst groupsIssueingNotifications =\n\t\t\tAssociationGroupInfoCC.findGroupsForIssuedCommand(\n\t\t\t\tctx,\n\t\t\t\tnode,\n\t\t\t\tccId,\n\t\t\t\tccCommand,\n\t\t\t);\n\t\tif (groupsIssueingNotifications.length > 0) {\n\t\t\t// We always grab the first group - usually it should be the lifeline\n\t\t\tconst groupId = groupsIssueingNotifications[0];\n\t\t\tconst existingAssociations =\n\t\t\t\tgetAssociations(ctx, node).get(groupId) ?? [];\n\n\t\t\tif (!existingAssociations.some((a) => a.nodeId === ctx.ownNodeId)) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: endpoint.index,\n\t\t\t\t\tmessage: `Configuring associations to receive ${getCCName(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)} commands...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tawait addAssociations(ctx, node, groupId, [\n\t\t\t\t\t{ nodeId: ctx.ownNodeId },\n\t\t\t\t]);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function doesAnyLifelineSendActuatorOrSensorReports(\n\tctx: GetValueDB & GetDeviceConfig,\n\tnode: NodeId & SupportsCC,\n): MaybeNotKnown<boolean> {\n\t// No association support means no unsolicited reports\n\tif (\n\t\t!node.supportsCC(CommandClasses.Association)\n\t\t&& !node.supportsCC(CommandClasses[\"Multi Channel Association\"])\n\t) {\n\t\treturn false;\n\t}\n\n\t// No AGI support means we cannot know\n\tif (!node.supportsCC(CommandClasses[\"Association Group Information\"])) {\n\t\treturn NOT_KNOWN;\n\t}\n\n\t// Lifeline group IDs include the ones we added via a config file, so they may not be considered true lifelines\n\tconst lifelineGroupIds = getLifelineGroupIds(ctx, node);\n\t// If any potential lifeline group has the \"General: Lifeline\" profile, the node MUST send unsolicited reports that way\n\tif (\n\t\tlifelineGroupIds.some(\n\t\t\t(id) =>\n\t\t\t\tAssociationGroupInfoCC.getGroupProfileCached(ctx, node, id)\n\t\t\t\t=== AssociationGroupInfoProfile[\"General: Lifeline\"],\n\t\t)\n\t) {\n\t\treturn true;\n\t}\n\n\t// Otherwise check if any of the groups sends any actuator or sensor commands. We'll assume that those are reports\n\tfor (const groupId of lifelineGroupIds) {\n\t\tconst issuedCommands = AssociationGroupInfoCC.getIssuedCommandsCached(\n\t\t\tctx,\n\t\t\tnode,\n\t\t\tgroupId,\n\t\t);\n\t\tif (!issuedCommands) continue;\n\t\tconst commands = [...issuedCommands.keys()];\n\t\tif (commands.some((c) => isActuatorCC(c) || isSensorCC(c))) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AACA;;;;;;;;;;;;;;;AAAA,kBAwBO;AACP,oBAIO;AACP,oBAAyB;AAEzB,2BAAmD;AACnD,oCAAuC;AACvC,uCAA0C;AAE1C,iBAAsD;AACtD,mBAMO;AAED,SAAU,gBACf,KACA,UAAiC;AAEjC,QAAM,MAAM,oBAAI,IAAG;AAEnB,MAAI,SAAS,WAAW,2BAAe,WAAW,GAAG;AACpD,UAAM,eAAe,mCAAc,yBAClC,KACA,QAAQ;AAET,eAAW,CAAC,SAAS,MAAM,KAAK,cAAc;AAC7C,UAAI,IAAI,SAAS,MAAM;IACxB;EACD,OAAO;AACN,UAAM,IAAI,uBACT,QAAQ,SAAS,MAAM,GACtB,SAAS,QAAQ,IAAI,cAAc,SAAS,KAAK,KAAK,EACvD,mCACA,4BAAgB,eAAe;EAEjC;AAGA,MAAI,SAAS,WAAW,2BAAe,2BAA2B,CAAC,GAAG;AACrE,UAAM,eAAe,2DAA0B,yBAC9C,KACA,QAAQ;AAET,eAAW,CAAC,SAAS,MAAM,KAAK,cAAc;AAC7C,UAAI,IAAI,IAAI,OAAO,GAAG;AACrB,cAAM,qBAAqB,IAAI,IAAI,OAAO;AAC1C,YAAI,IAAI,SAAS;UAChB,GAAG;;UAEH,GAAG,OAAO,OACT,CAAC,OACA,CAAC,mBAAmB,KACnB,CAAC,OACA,GAAG,WAAW,GAAG,UACd,GAAG,aAAa,GAAG,QAAQ,CAC/B;SAEH;MACF,OAAO;AACN,YAAI,IAAI,SAAS,MAAM;MACxB;IACD;EACD;AAEA,SAAO;AACR;AAnDgB;AAqDV,SAAU,mBACf,KACA,MAAuD;AAKvD,QAAM,MAAM,IAAI,2BAAY;AAI5B,aAAW,YAAY,KAAK,gBAAe,G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,UAAM,8BACL,qDAAuB,2BACtB,KACA,MACA,MACA,SAAS;AAEX,QAAI,4BAA4B,SAAS,GAAG;AAE3C,YAAM,UAAU,4BAA4B,CAAC;AAC7C,YAAM,uBACL,gBAAgB,KAAK,IAAI,EAAE,IAAI,OAAO,KAAK,CAAA;AAE5C,UAAI,CAAC,qBAAqB,KAAK,CAAC,MAAM,EAAE,WAAW,IAAI,SAAS,GAAG;AAClE,YAAI,QAAQ,KAAK,IAAI;UACpB,UAAU,SAAS;UACnB,SAAS,2CAAuC,uBAC/C,IAAI,CACJ;UACD,WAAW;SACX;AACD,cAAM,gBAAgB,KAAK,MAAM,SAAS;UACzC,EAAE,QAAQ,IAAI,UAAS;SACvB;MACF;IACD;EACD;AACD;AA7CsB;AA+ChB,SAAU,2CACf,KACA,MAAyB;AAGzB,MACC,CAAC,KAAK,WAAW,2BAAe,WAAW,KACxC,CAAC,KAAK,WAAW,2BAAe,2BAA2B,CAAC,GAC9D;AACD,WAAO;EACR;AAGA,MAAI,CAAC,KAAK,WAAW,2BAAe,+BAA+B,CAAC,GAAG;AACtE,WAAO;EACR;AAGA,QAAM,mBAAmB,oBAAoB,KAAK,IAAI;AAEtD,MACC,iBAAiB,KAChB,CAAC,OACA,qDAAuB,sBAAsB,KAAK,MAAM,EAAE,MACtD,yCAA4B,mBAAmB,CAAC,GAErD;AACD,WAAO;EACR;AAGA,aAAW,WAAW,kBAAkB;AACvC,UAAM,iBAAiB,qDAAuB,wBAC7C,KACA,MACA,OAAO;AAER,QAAI,CAAC;AAAgB;AACrB,UAAM,WAAW,CAAC,GAAG,eAAe,KAAI,CAAE;AAC1C,QAAI,SAAS,KAAK,CAAC,UAAM,0BAAa,CAAC,SAAK,wBAAW,CAAC,CAAC,GAAG;AAC3D,aAAO;IACR;EACD;AAEA,SAAO;AACR;AA7CgB;",
6
6
  "names": ["endpoint"]
7
7
  }
@@ -39,6 +39,7 @@ export declare class AlarmSensorCCReport extends AlarmSensorCC {
39
39
  readonly state: boolean;
40
40
  readonly severity: number | undefined;
41
41
  readonly duration: number | undefined;
42
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
42
43
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
43
44
  persistValues(ctx: PersistValuesContext): boolean;
44
45
  }
@@ -47,7 +48,7 @@ export interface AlarmSensorCCGetOptions {
47
48
  }
48
49
  export declare class AlarmSensorCCGet extends AlarmSensorCC {
49
50
  constructor(options: WithAddress<AlarmSensorCCGetOptions>);
50
- static from(_raw: CCRaw, _ctx: CCParsingContext): AlarmSensorCCGet;
51
+ static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCGet;
51
52
  sensorType: AlarmSensorType;
52
53
  serialize(ctx: CCEncodingContext): Promise<Bytes>;
53
54
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
@@ -59,6 +60,7 @@ export declare class AlarmSensorCCSupportedReport extends AlarmSensorCC {
59
60
  constructor(options: WithAddress<AlarmSensorCCSupportedReportOptions>);
60
61
  static from(raw: CCRaw, ctx: CCParsingContext): AlarmSensorCCSupportedReport;
61
62
  supportedSensorTypes: AlarmSensorType[];
63
+ serialize(ctx: CCEncodingContext): Promise<Bytes>;
62
64
  persistValues(ctx: PersistValuesContext): boolean;
63
65
  toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
64
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AlarmSensorCC.d.ts","sourceRoot":"","sources":["../../../src_gen/cc/AlarmSensorCC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAsD,KAAK,WAAW,EAA0F,MAAM,gBAAgB,CAAC;AAC9R,OAAO,EAAE,KAAK,EAAyC,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAS,aAAa,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,KAAK,EAAE,YAAY,EAAE,KAAK,gBAA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C5B,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAGvD;IACM,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,mBAAmB,CAOvD;CACJ;AAED,MAAM,WAAW,mCAAmC;IAChD,oBAAoB,EAAE,eAAe,EAAE,CAAC;CAC3C;AACD,qBAEa,4BAA6B,SAAQ,aAAa;IAC3D,YAAmB,OAAO,EAAE,WAAW,CAAC,mCAAmC,CAAC,EAI3E;IACD,OAAc,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,gBAAgB,GAAG,4BAA4B,CASlF;IACM,oBAAoB,EAAE,eAAe,EAAE,CAAC;IACxC,SAAS,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAKvD;IACM,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAQvD;IACM,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,mBAAmB,CASvD;CACJ;AACD,qBAEa,yBAA0B,SAAQ,aAAa;CAC3D"}
@@ -1,7 +1,7 @@
1
1
  import { __esDecorate, __runInitializers } from "tslib";
2
2
  import * as __validateArgs from "./AlarmSensorCC._validateArgs.js";
3
3
  const { validateArgs_AlarmSensorCCAPI_get } = __validateArgs;
4
- import { CommandClasses, MessagePriority, ZWaveError, ZWaveErrorCodes, logDict, logList, logText, parseBitMask, validatePayload, } from "@zwave-js/core";
4
+ import { CommandClasses, MessagePriority, encodeBitMask, logDict, logList, logText, parseBitMask, validatePayload, } from "@zwave-js/core";
5
5
  import { Bytes, getEnumMemberName, isEnumMember, pick } from "@zwave-js/shared";
6
6
  import { CCAPI, PhysicalCCAPI } from "../lib/API.js";
7
7
  import { CommandClass, } from "../lib/CommandClass.js";
@@ -148,8 +148,7 @@ let AlarmSensorCC = (() => {
148
148
  priority: options?.priority ?? MessagePriority.NodeQuery,
149
149
  tag: options?.tag,
150
150
  });
151
- const supportedSensorTypes = this.getValue(ctx, AlarmSensorCCValues.supportedSensorTypes)
152
- ?? [];
151
+ const supportedSensorTypes = this.getValue(ctx, AlarmSensorCCValues.supportedSensorTypes) ?? [];
153
152
  // Always query (all of) the sensor's current value(s)
154
153
  for (const type of supportedSensorTypes) {
155
154
  // Some devices report invalid sensor types, but the CC API checks
@@ -250,6 +249,18 @@ let AlarmSensorCCReport = (() => {
250
249
  state;
251
250
  severity;
252
251
  duration;
252
+ serialize(ctx) {
253
+ let severity;
254
+ if (this.state) {
255
+ severity = this.severity ?? 0xff;
256
+ }
257
+ else {
258
+ severity = 0;
259
+ }
260
+ this.payload = Bytes.from([0, this.sensorType, severity, 0, 0]);
261
+ this.payload.writeUInt16BE(this.duration ?? 0, 3);
262
+ return super.serialize(ctx);
263
+ }
253
264
  toLogEntry(ctx) {
254
265
  const message = {
255
266
  "sensor type": getEnumMemberName(AlarmSensorType, this.sensorType),
@@ -307,12 +318,12 @@ let AlarmSensorCCGet = (() => {
307
318
  super(options);
308
319
  this.sensorType = options.sensorType ?? AlarmSensorType.Any;
309
320
  }
310
- static from(_raw, _ctx) {
311
- // TODO: Deserialize payload
312
- throw new ZWaveError(`${this.name}: deserialization not implemented`, ZWaveErrorCodes.Deserialization_NotImplemented);
313
- // return new AlarmSensorCCGet({
314
- // nodeId: ctx.sourceNodeId,
315
- // });
321
+ static from(raw, ctx) {
322
+ validatePayload(raw.payload.length >= 1);
323
+ return new this({
324
+ nodeId: ctx.sourceNodeId,
325
+ sensorType: raw.payload[0],
326
+ });
316
327
  }
317
328
  sensorType;
318
329
  serialize(ctx) {
@@ -362,6 +373,12 @@ let AlarmSensorCCSupportedReport = (() => {
362
373
  });
363
374
  }
364
375
  supportedSensorTypes;
376
+ serialize(ctx) {
377
+ // Any is not a valid sensor type for the bit mask
378
+ const mask = encodeBitMask(this.supportedSensorTypes.filter((t) => t !== AlarmSensorType.Any), undefined, AlarmSensorType["General Purpose"]);
379
+ this.payload = Bytes.concat([[mask.length], mask]);
380
+ return super.serialize(ctx);
381
+ }
365
382
  persistValues(ctx) {
366
383
  if (!super.persistValues(ctx))
367
384
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"AlarmSensorCC.js","sourceRoot":"","sources":["../../../src_gen/cc/AlarmSensorCC.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,cAAc,MAAM,kCAAkC,CAAC;AACnE,MAAM,EAAE,iCAAiC,EAAE,GAAG,cAAc,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAkF,eAAe,EAAuD,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,GAAG,MAAM,gBAAgB,CAAC;AAC9R,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAc,YAAY,GAA2G,MAAM,wBAAwB,CAAC;AAC3K,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,GAAG,MAAM,kCAAkC,CAAC;AAEpJ,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,sCAAsC;IAEzB,gBAAgB;4BAD5B,GAAG,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;;;;sBACE,aAAa;;;gCAArB,SAAQ,WAAa;;;;+BAa9C,iCAAiC,EAAE;YAEpC,4JAAa,GAAG,6DAUf;YAzBL,6KAqCC;;;YArCY,uDAAgB;;QAClB,eAAe,CAAC,GAAuB;YAC1C,QAAQ,GAAG,EAAE,CAAC;gBACV,KAAK,kBAAkB,CAAC,GAAG,CAAC;gBAC5B,K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CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAGvD;IACM,UAAU,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,mBAAmB,CAKvD;CACJ;AACD,qBAEa,6BAA8B,SAAQ,aAAa;CAC/D"}
@@ -230,9 +230,9 @@ let AssociationCC = (() => {
230
230
  * This only works AFTER the interview process
231
231
  */
232
232
  static getGroupCountCached(ctx, endpoint) {
233
- return ctx
233
+ return (ctx
234
234
  .getValueDB(endpoint.nodeId)
235
- .getValue(AssociationCCValues.groupCount.endpoint(endpoint.index)) || 0;
235
+ .getValue(AssociationCCValues.groupCount.endpoint(endpoint.index)) || 0);
236
236
  }
237
237
  /**
238
238
  * Returns the number of nodes an association group supports.
@@ -453,10 +453,7 @@ let AssociationCCRemove = (() => {
453
453
  groupId;
454
454
  nodeIds;
455
455
  serialize(ctx) {
456
- this.payload = Bytes.from([
457
- this.groupId || 0,
458
- ...(this.nodeIds || []),
459
- ]);
456
+ this.payload = Bytes.from([this.groupId || 0, ...(this.nodeIds || [])]);
460
457
  return super.serialize(ctx);
461
458
  }
462
459
  toLogEntry(ctx) {
@@ -476,7 +473,11 @@ let AssociationCCRemove = (() => {
476
473
  })();
477
474
  export { AssociationCCRemove };
478
475
  let AssociationCCReport = (() => {
479
- let _classDecorators = [CCCommand(AssociationCommand.Report), ccValueProperty("maxNodes", AssociationCCValues.maxNodes, (self) => [self.groupId]), ccValueProperty("nodeIds", AssociationCCValues.nodeIds, (self) => [self.groupId])];
476
+ let _classDecorators = [CCCommand(AssociationCommand.Report), ccValueProperty("maxNodes", AssociationCCValues.maxNodes, (self) => [
477
+ self.groupId,
478
+ ]), ccValueProperty("nodeIds", AssociationCCValues.nodeIds, (self) => [
479
+ self.groupId,
480
+ ])];
480
481
  let _classDescriptor;
481
482
  let _classExtraInitializers = [];
482
483
  let _classThis;