@zwave-js/cc 15.16.0 → 15.17.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.
- package/build/cjs/cc/AlarmSensorCC.js +1 -1
- package/build/cjs/cc/AlarmSensorCC.js.map +1 -1
- package/build/cjs/cc/ApplicationStatusCC.d.ts +33 -0
- package/build/cjs/cc/ApplicationStatusCC.js +229 -0
- package/build/cjs/cc/ApplicationStatusCC.js.map +7 -0
- package/build/cjs/cc/AssociationCC.js.map +1 -1
- package/build/cjs/cc/AssociationGroupInfoCC.js +4 -4
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/BarrierOperatorCC.js +9 -2
- package/build/cjs/cc/BarrierOperatorCC.js.map +2 -2
- package/build/cjs/cc/BasicCC.js +1 -1
- package/build/cjs/cc/BasicCC.js.map +1 -1
- package/build/cjs/cc/BatteryCC.js +2 -2
- package/build/cjs/cc/BatteryCC.js.map +1 -1
- package/build/cjs/cc/BinarySwitchCC.js +1 -1
- package/build/cjs/cc/BinarySwitchCC.js.map +1 -1
- package/build/cjs/cc/CRC16CC.js +2 -2
- package/build/cjs/cc/CRC16CC.js.map +2 -2
- package/build/cjs/cc/CentralSceneCC.js +2 -2
- package/build/cjs/cc/CentralSceneCC.js.map +1 -1
- package/build/cjs/cc/ClimateControlScheduleCC.js +5 -5
- package/build/cjs/cc/ClimateControlScheduleCC.js.map +2 -2
- package/build/cjs/cc/ClockCC.js +1 -1
- package/build/cjs/cc/ClockCC.js.map +1 -1
- package/build/cjs/cc/ColorSwitchCC.js.map +1 -1
- package/build/cjs/cc/ConfigurationCC.js +3 -3
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/DoorLockCC.js +3 -3
- package/build/cjs/cc/DoorLockCC.js.map +1 -1
- package/build/cjs/cc/EntryControlCC.js +3 -3
- package/build/cjs/cc/EntryControlCC.js.map +1 -1
- package/build/cjs/cc/IndicatorCC.js +5 -5
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js +3 -3
- package/build/cjs/cc/IrrigationCC.js.map +1 -1
- package/build/cjs/cc/LanguageCC.js +1 -1
- package/build/cjs/cc/LanguageCC.js.map +1 -1
- package/build/cjs/cc/ManufacturerProprietaryCC.js +1 -1
- package/build/cjs/cc/ManufacturerProprietaryCC.js.map +2 -2
- package/build/cjs/cc/ManufacturerSpecificCC.js +1 -1
- package/build/cjs/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/cjs/cc/MeterCC.js +3 -3
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/cjs/cc/MultiChannelCC.js +8 -8
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js.map +1 -1
- package/build/cjs/cc/MultilevelSwitchCC.js +1 -1
- package/build/cjs/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/cjs/cc/NotificationCC.js +29 -23
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/ProtectionCC.js +10 -3
- package/build/cjs/cc/ProtectionCC.js.map +2 -2
- package/build/cjs/cc/SceneActuatorConfigurationCC.js +0 -1
- package/build/cjs/cc/SceneActuatorConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js +0 -1
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/ScheduleEntryLockCC.js +1 -1
- package/build/cjs/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/cjs/cc/Security2CC.js +6 -5
- package/build/cjs/cc/Security2CC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.js +3 -3
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/SoundSwitchCC.js +2 -2
- package/build/cjs/cc/SoundSwitchCC.js.map +1 -1
- package/build/cjs/cc/SupervisionCC.js +1 -1
- package/build/cjs/cc/SupervisionCC.js.map +2 -2
- package/build/cjs/cc/ThermostatFanModeCC.js +1 -1
- package/build/cjs/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/cjs/cc/ThermostatFanStateCC.js +1 -1
- package/build/cjs/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/cjs/cc/ThermostatModeCC.js +2 -2
- package/build/cjs/cc/ThermostatModeCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetbackCC.js +1 -1
- package/build/cjs/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/cjs/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/cjs/cc/TimeCC.js +2 -2
- package/build/cjs/cc/TimeCC.js.map +1 -1
- package/build/cjs/cc/TransportServiceCC.js +1 -1
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.d.ts +8 -0
- package/build/cjs/cc/UserCodeCC.js +16 -4
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.js +3 -3
- package/build/cjs/cc/VersionCC.js.map +1 -1
- package/build/cjs/cc/WakeUpCC.js +2 -2
- package/build/cjs/cc/WakeUpCC.js.map +1 -1
- package/build/cjs/cc/WindowCoveringCC.d.ts +3 -1
- package/build/cjs/cc/WindowCoveringCC.js +28 -8
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/cc/ZWavePlusCC.js +1 -1
- package/build/cjs/cc/ZWavePlusCC.js.map +1 -1
- package/build/cjs/cc/ZWaveProtocolCC.js.map +2 -2
- package/build/cjs/cc/_CCValues.generated.js.map +1 -1
- package/build/cjs/cc/index.d.ts +3 -0
- package/build/cjs/cc/index.js +8 -0
- package/build/cjs/cc/index.js.map +2 -2
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/cjs/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/cjs/lib/API.d.ts +2 -0
- package/build/cjs/lib/API.js +2 -2
- package/build/cjs/lib/API.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +3 -3
- package/build/cjs/lib/CommandClass.js +6 -6
- package/build/cjs/lib/CommandClass.js.map +2 -2
- package/build/cjs/lib/_Types.d.ts +9 -0
- package/build/cjs/lib/_Types.js +15 -0
- package/build/cjs/lib/_Types.js.map +3 -3
- package/build/cjs/lib/utils.js +1 -1
- package/build/cjs/lib/utils.js.map +2 -2
- package/build/esm/cc/AlarmSensorCC.js +1 -1
- package/build/esm/cc/AlarmSensorCC.js.map +1 -1
- package/build/esm/cc/ApplicationStatusCC.d.ts +33 -0
- package/build/esm/cc/ApplicationStatusCC.d.ts.map +1 -0
- package/build/esm/cc/ApplicationStatusCC.js +175 -0
- package/build/esm/cc/ApplicationStatusCC.js.map +1 -0
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +4 -4
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.d.ts.map +1 -1
- package/build/esm/cc/BarrierOperatorCC.js +13 -2
- package/build/esm/cc/BarrierOperatorCC.js.map +1 -1
- package/build/esm/cc/BasicCC.js +1 -1
- package/build/esm/cc/BasicCC.js.map +1 -1
- package/build/esm/cc/BatteryCC.js +2 -2
- package/build/esm/cc/BatteryCC.js.map +1 -1
- package/build/esm/cc/BinarySwitchCC.js +1 -1
- package/build/esm/cc/BinarySwitchCC.js.map +1 -1
- package/build/esm/cc/CRC16CC.d.ts.map +1 -1
- package/build/esm/cc/CRC16CC.js +2 -2
- package/build/esm/cc/CRC16CC.js.map +1 -1
- package/build/esm/cc/CentralSceneCC.js +2 -2
- package/build/esm/cc/CentralSceneCC.js.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.d.ts.map +1 -1
- package/build/esm/cc/ClimateControlScheduleCC.js +5 -5
- package/build/esm/cc/ClimateControlScheduleCC.js.map +1 -1
- package/build/esm/cc/ClockCC.js +1 -1
- package/build/esm/cc/ClockCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +3 -4
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/DoorLockCC.js +3 -3
- package/build/esm/cc/DoorLockCC.js.map +1 -1
- package/build/esm/cc/EntryControlCC.js +3 -3
- package/build/esm/cc/EntryControlCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +6 -6
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.js +3 -3
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/LanguageCC.js +1 -1
- package/build/esm/cc/LanguageCC.js.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.d.ts.map +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js +1 -1
- package/build/esm/cc/ManufacturerProprietaryCC.js.map +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js +1 -1
- package/build/esm/cc/ManufacturerSpecificCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +3 -3
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +8 -8
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js +1 -1
- package/build/esm/cc/MultilevelSwitchCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +43 -31
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/ProtectionCC.d.ts.map +1 -1
- package/build/esm/cc/ProtectionCC.js +16 -3
- package/build/esm/cc/ProtectionCC.js.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js +0 -1
- package/build/esm/cc/SceneActuatorConfigurationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +0 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js +1 -1
- package/build/esm/cc/ScheduleEntryLockCC.js.map +1 -1
- package/build/esm/cc/Security2CC.d.ts.map +1 -1
- package/build/esm/cc/Security2CC.js +6 -5
- package/build/esm/cc/Security2CC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +3 -3
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/SoundSwitchCC.js +2 -2
- package/build/esm/cc/SoundSwitchCC.js.map +1 -1
- package/build/esm/cc/SupervisionCC.js +1 -1
- package/build/esm/cc/SupervisionCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js +1 -1
- package/build/esm/cc/ThermostatFanModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js +1 -1
- package/build/esm/cc/ThermostatFanStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatModeCC.js +2 -2
- package/build/esm/cc/ThermostatModeCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js +1 -1
- package/build/esm/cc/ThermostatSetbackCC.js.map +1 -1
- package/build/esm/cc/TimeCC.js +2 -2
- package/build/esm/cc/TimeCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +2 -1
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts +8 -0
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +20 -4
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/VersionCC.js +3 -3
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WakeUpCC.js +2 -2
- package/build/esm/cc/WakeUpCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts +3 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +30 -9
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/cc/ZWavePlusCC.js +1 -1
- package/build/esm/cc/ZWavePlusCC.js.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.d.ts.map +1 -1
- package/build/esm/cc/ZWaveProtocolCC.js.map +1 -1
- package/build/esm/cc/index.d.ts +3 -0
- package/build/esm/cc/index.d.ts.map +1 -1
- package/build/esm/cc/index.js +5 -0
- package/build/esm/cc/index.js.map +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js +1 -1
- package/build/esm/cc/manufacturerProprietary/FibaroCC.js.map +1 -1
- package/build/esm/lib/API.d.ts +2 -0
- package/build/esm/lib/API.d.ts.map +1 -1
- package/build/esm/lib/API.js +2 -2
- package/build/esm/lib/API.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +3 -3
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +6 -6
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/_Types.d.ts +9 -0
- package/build/esm/lib/_Types.d.ts.map +1 -1
- package/build/esm/lib/_Types.js +11 -0
- package/build/esm/lib/_Types.js.map +1 -1
- package/build/esm/lib/utils.js +1 -1
- package/build/esm/lib/utils.js.map +1 -1
- package/package.json +9 -10
- package/build/cjs/lib/ICommandClassContainer.d.ts +0 -2
- package/build/cjs/lib/ICommandClassContainer.js +0 -17
- package/build/cjs/lib/ICommandClassContainer.js.map +0 -7
- package/build/esm/lib/ICommandClassContainer.d.ts +0 -2
- package/build/esm/lib/ICommandClassContainer.d.ts.map +0 -1
- package/build/esm/lib/ICommandClassContainer.js +0 -2
- package/build/esm/lib/ICommandClassContainer.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/MultiChannelAssociationCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\tMAX_NODES,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, type BytesView, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\ttype AssociationAddress,\n\ttype EndpointAddress,\n\tMultiChannelAssociationCommand,\n} from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { AssociationCCValues } from \"./AssociationCC.js\";\n\nexport const MultiChannelAssociationCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel Association\"],\n\t{\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"maxNodes\",\n\t\t\t\"maxNodes\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"maxNodes\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"nodeIds\",\n\t\t\t\"nodeIds\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"nodeIds\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"endpoints\",\n\t\t\t\"endpoints\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"endpoints\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\nfunction endpointAddressesToString(\n\tendpoints: readonly EndpointAddress[],\n): string {\n\treturn endpoints\n\t\t.map(({ nodeId, endpoint }) => {\n\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t} else {\n\t\t\t\treturn `${nodeId}:[${endpoint.map(String).join(\", \")}]`;\n\t\t\t}\n\t\t})\n\t\t.join(\", \");\n}\n\nconst MULTI_CHANNEL_ASSOCIATION_MARKER = 0x00;\n\nfunction serializeMultiChannelAssociationDestination(\n\tnodeIds: number[],\n\tendpoints: EndpointAddress[],\n): Bytes {\n\tconst nodeAddressBytes = nodeIds.length;\n\tconst endpointAddressBytes = endpoints.length * 2;\n\tconst payload = new Bytes(\n\t\t// node addresses\n\t\tnodeAddressBytes\n\t\t\t// endpoint marker\n\t\t\t+ (endpointAddressBytes > 0 ? 1 : 0)\n\t\t\t// endpoints\n\t\t\t+ endpointAddressBytes,\n\t);\n\t// write node addresses\n\tfor (let i = 0; i < nodeIds.length; i++) {\n\t\tpayload[i] = nodeIds[i];\n\t}\n\t// write endpoint addresses\n\tif (endpointAddressBytes > 0) {\n\t\tlet offset = nodeIds.length;\n\t\tpayload[offset] = MULTI_CHANNEL_ASSOCIATION_MARKER;\n\t\toffset += 1;\n\t\tfor (let i = 0; i < endpoints.length; i++) {\n\t\t\tconst endpoint = endpoints[i];\n\t\t\tconst destination = typeof endpoint.endpoint === \"number\"\n\t\t\t\t// The destination is a single number\n\t\t\t\t? endpoint.endpoint & 0b0111_1111\n\t\t\t\t// The destination is a bit mask\n\t\t\t\t: encodeBitMask(endpoint.endpoint, 7)[0] | 0b1000_0000;\n\n\t\t\tpayload[offset + 2 * i] = endpoint.nodeId;\n\t\t\tpayload[offset + 2 * i + 1] = destination;\n\t\t}\n\t}\n\treturn payload;\n}\n\nfunction deserializeMultiChannelAssociationDestination(data: BytesView): {\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n} {\n\tconst nodeIds: number[] = [];\n\tlet endpointOffset = data.length;\n\t// Scan node ids until we find the marker\n\tfor (let i = 0; i < data.length; i++) {\n\t\tif (data[i] === MULTI_CHANNEL_ASSOCIATION_MARKER) {\n\t\t\tendpointOffset = i + 1;\n\t\t\tbreak;\n\t\t}\n\t\tnodeIds.push(data[i]);\n\t}\n\tconst endpoints: EndpointAddress[] = [];\n\tfor (let i = endpointOffset; i < data.length; i += 2) {\n\t\tconst nodeId = data[i];\n\t\tconst isBitMask = !!(data[i + 1] & 0b1000_0000);\n\t\tconst destination = data[i + 1] & 0b0111_1111;\n\t\tconst endpoint = isBitMask\n\t\t\t? parseBitMask(Bytes.from([destination]))\n\t\t\t: destination;\n\n\t\tendpoints.push({ nodeId, endpoint });\n\t}\n\n\treturn { nodeIds, endpoints };\n}\n\n// @noSetValueAPI\n\n@API(CommandClasses[\"Multi Channel Association\"])\nexport class MultiChannelAssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultiChannelAssociationCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultiChannelAssociationCommand.Get:\n\t\t\tcase MultiChannelAssociationCommand.Set:\n\t\t\tcase MultiChannelAssociationCommand.Report:\n\t\t\tcase MultiChannelAssociationCommand.Remove:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsGet:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true; // This is mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t/**\n\t * Returns the number of association groups a node supports.\n\t * Association groups are consecutive, starting at 1.\n\t */\n\tpublic async getGroupCount(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupCount,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Returns information about an association group.\n\t */\n\t@validateArgs()\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getGroup(groupId: number) {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maxNodes\", \"nodeIds\", \"endpoints\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MultiChannelAssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Adds new nodes or endpoints to an association group\n\t */\n\t@validateArgs()\n\tpublic async addDestinations(\n\t\toptions: MultiChannelAssociationCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes or endpoints from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeDestinations(\n\t\toptions: MultiChannelAssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Remove,\n\t\t);\n\n\t\tif (!options.groupId && this.version === 1) {\n\t\t\t// V1 does not support omitting the group, manually remove the destination from all groups\n\t\t\t// We don't want to do too much work, so find out which groups the destination is in\n\t\t\tconst currentDestinations = MultiChannelAssociationCC\n\t\t\t\t.getAllDestinationsCached(\n\t\t\t\t\tthis.host,\n\t\t\t\t\tthis.endpoint,\n\t\t\t\t);\n\t\t\tfor (const [group, destinations] of currentDestinations) {\n\t\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: destinations\n\t\t\t\t\t\t.filter((d) => d.endpoint != undefined)\n\t\t\t\t\t\t.map((d) => d.nodeId),\n\t\t\t\t\tendpoints: destinations.filter(\n\t\t\t\t\t\t(d): d is AssociationAddress & { endpoint: number } =>\n\t\t\t\t\t\t\td.endpoint != undefined,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t\t\t}\n\t\t} else if (options.groupId && options.groupId < 0) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must not be negative!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t} else {\n\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t...options,\n\t\t\t});\n\t\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses[\"Multi Channel Association\"])\n@implementedVersion(5)\n@ccValues(MultiChannelAssociationCCValues)\nexport class MultiChannelAssociationCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelAssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// MultiChannelAssociationCC must be interviewed after Z-Wave+ if that is supported\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses[\"Z-Wave Plus Info\"],\n\t\t\t// We need information about endpoints to correctly configure the lifeline associations\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\t// AssociationCC will short-circuit if this CC is supported\n\t\t\tCommandClasses.Association,\n\t\t];\n\t}\n\n\t/**\n\t * Returns the number of association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getGroupCountCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) || 0;\n\t}\n\n\t/**\n\t * Returns the number of nodes an association group supports.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMaxNodesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t}\n\n\t/**\n\t * Returns all the destinations of all association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getAllDestinationsCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): ReadonlyMap<number, readonly AssociationAddress[]> {\n\t\tconst ret = new Map<number, AssociationAddress[]>();\n\t\tconst groupCount = this.getGroupCountCached(ctx, endpoint);\n\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\t\tfor (let i = 1; i <= groupCount; i++) {\n\t\t\tconst groupDestinations: AssociationAddress[] = [];\n\t\t\t// Add all node destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tMultiChannelAssociationCCValues.nodeIds(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tgroupDestinations.push(...nodes.map((nodeId) => ({ nodeId })));\n\t\t\t// And all endpoint destinations\n\t\t\tconst endpoints = valueDB.getValue<EndpointAddress[]>(\n\t\t\t\tMultiChannelAssociationCCValues.endpoints(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tfor (const ep of endpoints) {\n\t\t\t\tif (typeof ep.endpoint === \"number\") {\n\t\t\t\t\tgroupDestinations.push({\n\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\tendpoint: ep.endpoint,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tgroupDestinations.push(\n\t\t\t\t\t\t...ep.endpoint.map((e) => ({\n\t\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\t\tendpoint: e,\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\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tgroupDestinations.filter(\n\t\t\t\t\t(addr, index) =>\n\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t=== groupDestinations.findIndex(\n\t\t\t\t\t\t\t\t({ nodeId, endpoint }) =>\n\t\t\t\t\t\t\t\t\tnodeId === addr.nodeId\n\t\t\t\t\t\t\t\t\t&& endpoint === addr.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// First find out how many groups are supported as multi channel\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of multi channel association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst mcGroupCount = await mcAPI.getGroupCount();\n\t\tif (mcGroupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`supports ${mcGroupCount} multi channel association groups`,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying multi channel association groups timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Query each association group for its members\n\t\tawait this.refreshValues(ctx);\n\n\t\t// And set up lifeline associations\n\t\tawait ccUtils.configureLifelineAssociations(ctx, endpoint);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst assocAPI = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst mcGroupCount: number = this.getValue(\n\t\t\tctx,\n\t\t\tMultiChannelAssociationCCValues.groupCount,\n\t\t) ?? 0;\n\n\t\t// Some devices report more association groups than multi channel association groups, so we need this info here\n\t\tconst assocGroupCount: number =\n\t\t\tthis.getValue(ctx, AssociationCCValues.groupCount)\n\t\t\t|| mcGroupCount;\n\n\t\t// Then query each multi channel association group\n\t\tfor (let groupId = 1; groupId <= mcGroupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying multi channel association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await mcAPI.getGroup(groupId);\n\t\t\tif (!group) continue;\n\t\t\tconst logMessage =\n\t\t\t\t`received information for multi channel association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}\ncurrently assigned endpoints: ${\n\t\t\t\t\tgroup.endpoints\n\t\t\t\t\t\t.map(({ nodeId, endpoint }) => {\n\t\t\t\t\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\t\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn `${nodeId}:[${\n\t\t\t\t\t\t\t\t\tendpoint.map(String).join(\", \")\n\t\t\t\t\t\t\t\t}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\t// Check if there are more non-multi-channel association groups we haven't queried yet\n\t\tif (assocAPI.isSupported() && assocGroupCount > mcGroupCount) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying additional non-multi-channel association groups...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tfor (\n\t\t\t\tlet groupId = mcGroupCount + 1;\n\t\t\t\tgroupId <= assocGroupCount;\n\t\t\t\tgroupId++\n\t\t\t) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst group = await assocAPI.getGroup(groupId);\n\t\t\t\tif (!group) continue;\n\t\t\t\tconst logMessage =\n\t\t\t\t\t`received information for association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport type MultiChannelAssociationCCSetOptions =\n\t& {\n\t\tgroupId: number;\n\t}\n\t& (\n\t\t| { nodeIds: number[] }\n\t\t| { endpoints: EndpointAddress[] }\n\t\t| { nodeIds: number[]; endpoints: EndpointAddress[] }\n\t);\n\n@CCCommand(MultiChannelAssociationCommand.Set)\n@useSupervision()\nexport class MultiChannelAssociationCCSet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = (\"nodeIds\" in options && options.nodeIds) || [];\n\t\tif (this.nodeIds.some((n) => n < 1 || n > MAX_NODES)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`All node IDs must be between 1 and ${MAX_NODES}!`,\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.endpoints = (\"endpoints\" in options && options.endpoints)\n\t\t\t|| [];\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds,\n\t\t\t\tthis.endpoints,\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all groups. */\n\tgroupId?: number;\n\t/** The nodes to remove. If no nodeIds and no endpoint addresses are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n\t/** The single endpoints to remove. If no nodeIds and no endpoint addresses are specified, ALL will be removed. */\n\tendpoints?: EndpointAddress[];\n}\n\n@CCCommand(MultiChannelAssociationCommand.Remove)\n@useSupervision()\nexport class MultiChannelAssociationCCRemove extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCRemoveOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// When removing associations, we allow invalid node IDs.\n\t\t// See GH#3606 - it is possible that those exist.\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId: number | undefined = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\tpublic endpoints?: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId || 0]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds || [],\n\t\t\t\tthis.endpoints || [],\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"group id\": this.groupId || \"(all groups)\",\n\t\t};\n\t\tif (this.nodeIds) {\n\t\t\tmessage[\"node ids\"] = this.nodeIds.join(\", \");\n\t\t}\n\t\tif (this.endpoints) {\n\t\t\tmessage.endpoints = endpointAddressesToString(this.endpoints);\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tMultiChannelAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tMultiChannelAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"endpoints\",\n\tMultiChannelAssociationCCValues.endpoints,\n\t(self) => [self.groupId],\n)\nexport class MultiChannelAssociationCCReport extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupId = options.groupId;\n\t\tthis.maxNodes = options.maxNodes;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst groupId = raw.payload[0];\n\t\tconst maxNodes = raw.payload[1];\n\t\tconst reportsToFollow = raw.payload[2];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(3),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t\treportsToFollow,\n\t\t});\n\t}\n\n\tpublic readonly groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\n\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic reportsToFollow: number;\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the association group ID\n\t\treturn { groupId: this.groupId };\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelAssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of nodes\n\t\tthis.nodeIds = [...partials, this]\n\t\t\t.map((report) => [...report.nodeIds])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\t// Concat the list of endpoints\n\t\tthis.endpoints = [...partials, this]\n\t\t\t.map((report) => [...report.endpoints])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst destinations = serializeMultiChannelAssociationDestination(\n\t\t\tthis.nodeIds,\n\t\t\tthis.endpoints,\n\t\t);\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.groupId,\n\t\t\t\tthis.maxNodes,\n\t\t\t\tthis.reportsToFollow,\n\t\t\t]),\n\t\t\tdestinations,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"maximum # of nodes\": this.maxNodes,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Get)\n@expectedCCResponse(MultiChannelAssociationCCReport)\nexport class MultiChannelAssociationCCGet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group id\": this.groupId },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", MultiChannelAssociationCCValues.groupCount)\nexport class MultiChannelAssociationCCSupportedGroupingsReport\n\textends MultiChannelAssociationCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReportOptions\n\t\t>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupCount = options.groupCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSupportedGroupingsReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupCount = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupCount,\n\t\t});\n\t}\n\n\tpublic readonly groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupCount]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group count\": this.groupCount },\n\t\t};\n\t}\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(MultiChannelAssociationCCSupportedGroupingsReport)\nexport class MultiChannelAssociationCCSupportedGroupingsGet\n\textends MultiChannelAssociationCC\n{}\n"],
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\tCommandClasses,\n\ttype EndpointId,\n\ttype GetValueDB,\n\tMAX_NODES,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SupervisionResult,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeBitMask,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes, type BytesView, pick } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { CCAPI, PhysicalCCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype RefreshValuesContext,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n\tuseSupervision,\n} from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport {\n\ttype AssociationAddress,\n\ttype EndpointAddress,\n\tMultiChannelAssociationCommand,\n} from \"../lib/_Types.js\";\nimport * as ccUtils from \"../lib/utils.js\";\nimport { AssociationCCValues } from \"./AssociationCC.js\";\n\nexport const MultiChannelAssociationCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel Association\"],\n\t{\n\t\t...V.staticProperty(\"groupCount\", undefined, { internal: true }),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"maxNodes\",\n\t\t\t\"maxNodes\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"maxNodes\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"nodeIds\",\n\t\t\t\"nodeIds\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"nodeIds\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"endpoints\",\n\t\t\t\"endpoints\",\n\t\t\t(groupId: number) => groupId,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"endpoints\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\nfunction endpointAddressesToString(\n\tendpoints: readonly EndpointAddress[],\n): string {\n\treturn endpoints\n\t\t.map(({ nodeId, endpoint }) => {\n\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t} else {\n\t\t\t\treturn `${nodeId}:[${endpoint.map(String).join(\", \")}]`;\n\t\t\t}\n\t\t})\n\t\t.join(\", \");\n}\n\nconst MULTI_CHANNEL_ASSOCIATION_MARKER = 0x00;\n\nfunction serializeMultiChannelAssociationDestination(\n\tnodeIds: number[],\n\tendpoints: EndpointAddress[],\n): Bytes {\n\tconst nodeAddressBytes = nodeIds.length;\n\tconst endpointAddressBytes = endpoints.length * 2;\n\tconst payload = new Bytes(\n\t\t// node addresses\n\t\tnodeAddressBytes\n\t\t\t// endpoint marker\n\t\t\t+ (endpointAddressBytes > 0 ? 1 : 0)\n\t\t\t// endpoints\n\t\t\t+ endpointAddressBytes,\n\t);\n\t// write node addresses\n\tfor (let i = 0; i < nodeIds.length; i++) {\n\t\tpayload[i] = nodeIds[i];\n\t}\n\t// write endpoint addresses\n\tif (endpointAddressBytes > 0) {\n\t\tlet offset = nodeIds.length;\n\t\tpayload[offset] = MULTI_CHANNEL_ASSOCIATION_MARKER;\n\t\toffset += 1;\n\t\tfor (let i = 0; i < endpoints.length; i++) {\n\t\t\tconst endpoint = endpoints[i];\n\t\t\tconst destination = typeof endpoint.endpoint === \"number\"\n\t\t\t\t// The destination is a single number\n\t\t\t\t? endpoint.endpoint & 0b0111_1111\n\t\t\t\t// The destination is a bit mask\n\t\t\t\t: encodeBitMask(endpoint.endpoint, 7)[0] | 0b1000_0000;\n\n\t\t\tpayload[offset + 2 * i] = endpoint.nodeId;\n\t\t\tpayload[offset + 2 * i + 1] = destination;\n\t\t}\n\t}\n\treturn payload;\n}\n\nfunction deserializeMultiChannelAssociationDestination(data: BytesView): {\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n} {\n\tconst nodeIds: number[] = [];\n\tlet endpointOffset = data.length;\n\t// Scan node ids until we find the marker\n\tfor (let i = 0; i < data.length; i++) {\n\t\tif (data[i] === MULTI_CHANNEL_ASSOCIATION_MARKER) {\n\t\t\tendpointOffset = i + 1;\n\t\t\tbreak;\n\t\t}\n\t\tnodeIds.push(data[i]);\n\t}\n\tconst endpoints: EndpointAddress[] = [];\n\tfor (let i = endpointOffset; i < data.length; i += 2) {\n\t\tconst nodeId = data[i];\n\t\tconst isBitMask = !!(data[i + 1] & 0b1000_0000);\n\t\tconst destination = data[i + 1] & 0b0111_1111;\n\t\tconst endpoint = isBitMask\n\t\t\t? parseBitMask(Bytes.from([destination]))\n\t\t\t: destination;\n\n\t\tendpoints.push({ nodeId, endpoint });\n\t}\n\n\treturn { nodeIds, endpoints };\n}\n\n// @noSetValueAPI\n\n@API(CommandClasses[\"Multi Channel Association\"])\nexport class MultiChannelAssociationCCAPI extends PhysicalCCAPI {\n\tpublic supportsCommand(\n\t\tcmd: MultiChannelAssociationCommand,\n\t): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\tcase MultiChannelAssociationCommand.Get:\n\t\t\tcase MultiChannelAssociationCommand.Set:\n\t\t\tcase MultiChannelAssociationCommand.Report:\n\t\t\tcase MultiChannelAssociationCommand.Remove:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsGet:\n\t\t\tcase MultiChannelAssociationCommand.SupportedGroupingsReport:\n\t\t\t\treturn true; // This is mandatory\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t/**\n\t * Returns the number of association groups a node supports.\n\t * Association groups are consecutive, starting at 1.\n\t */\n\tpublic async getGroupCount(): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.groupCount;\n\t}\n\n\t@validateArgs()\n\tpublic async reportGroupCount(groupCount: number): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.SupportedGroupingsReport,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSupportedGroupingsReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupCount,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Returns information about an association group.\n\t */\n\t@validateArgs()\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async getGroup(groupId: number) {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Get,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgroupId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelAssociationCCReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn pick(response, [\"maxNodes\", \"nodeIds\", \"endpoints\"]);\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async sendReport(\n\t\toptions: MultiChannelAssociationCCReportOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Report,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCReport({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Adds new nodes or endpoints to an association group\n\t */\n\t@validateArgs()\n\tpublic async addDestinations(\n\t\toptions: MultiChannelAssociationCCSetOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Set,\n\t\t);\n\n\t\tconst cc = new MultiChannelAssociationCCSet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t...options,\n\t\t});\n\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t/**\n\t * Removes nodes or endpoints from an association group\n\t */\n\t@validateArgs()\n\tpublic async removeDestinations(\n\t\toptions: MultiChannelAssociationCCRemoveOptions,\n\t): Promise<SupervisionResult | undefined> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelAssociationCommand,\n\t\t\tMultiChannelAssociationCommand.Remove,\n\t\t);\n\n\t\tif (!options.groupId && this.version === 1) {\n\t\t\t// V1 does not support omitting the group, manually remove the destination from all groups\n\t\t\t// We don't want to do too much work, so find out which groups the destination is in\n\t\t\tconst currentDestinations = MultiChannelAssociationCC\n\t\t\t\t.getAllDestinationsCached(\n\t\t\t\t\tthis.host,\n\t\t\t\t\tthis.endpoint,\n\t\t\t\t);\n\t\t\tfor (const [group, destinations] of currentDestinations) {\n\t\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t\tgroupId: group,\n\t\t\t\t\tnodeIds: destinations\n\t\t\t\t\t\t.filter((d) => d.endpoint != undefined)\n\t\t\t\t\t\t.map((d) => d.nodeId),\n\t\t\t\t\tendpoints: destinations.filter(\n\t\t\t\t\t\t(d): d is AssociationAddress & { endpoint: number } =>\n\t\t\t\t\t\t\td.endpoint != undefined,\n\t\t\t\t\t),\n\t\t\t\t});\n\t\t\t\t// TODO: evaluate intermediate supervision results\n\t\t\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t\t\t}\n\t\t} else if (options.groupId && options.groupId < 0) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must not be negative!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t} else {\n\t\t\tconst cc = new MultiChannelAssociationCCRemove({\n\t\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t\tendpointIndex: this.endpoint.index,\n\t\t\t\t...options,\n\t\t\t});\n\t\t\treturn this.host.sendCommand(cc, this.commandOptions);\n\t\t}\n\t}\n}\n\n@commandClass(CommandClasses[\"Multi Channel Association\"])\n@implementedVersion(5)\n@ccValues(MultiChannelAssociationCCValues)\nexport class MultiChannelAssociationCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelAssociationCommand;\n\n\tpublic determineRequiredCCInterviews(): readonly CommandClasses[] {\n\t\t// MultiChannelAssociationCC must be interviewed after Z-Wave+ if that is supported\n\t\treturn [\n\t\t\t...super.determineRequiredCCInterviews(),\n\t\t\tCommandClasses[\"Z-Wave Plus Info\"],\n\t\t\t// We need information about endpoints to correctly configure the lifeline associations\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\t// AssociationCC will short-circuit if this CC is supported\n\t\t\tCommandClasses.Association,\n\t\t];\n\t}\n\n\t/**\n\t * Returns the number of association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getGroupCountCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.groupCount.endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) || 0;\n\t}\n\n\t/**\n\t * Returns the number of nodes an association group supports.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getMaxNodesCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t\tgroupId: number,\n\t): number {\n\t\treturn ctx\n\t\t\t.getValueDB(endpoint.nodeId)\n\t\t\t.getValue(\n\t\t\t\tMultiChannelAssociationCCValues.maxNodes(groupId).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? 0;\n\t}\n\n\t/**\n\t * Returns all the destinations of all association groups reported by the node/endpoint.\n\t * This only works AFTER the interview process\n\t */\n\tpublic static getAllDestinationsCached(\n\t\tctx: GetValueDB,\n\t\tendpoint: EndpointId,\n\t): ReadonlyMap<number, readonly AssociationAddress[]> {\n\t\tconst ret = new Map<number, AssociationAddress[]>();\n\t\tconst groupCount = this.getGroupCountCached(ctx, endpoint);\n\t\tconst valueDB = ctx.getValueDB(endpoint.nodeId);\n\t\tfor (let i = 1; i <= groupCount; i++) {\n\t\t\tconst groupDestinations: AssociationAddress[] = [];\n\t\t\t// Add all node destinations\n\t\t\tconst nodes = valueDB.getValue<number[]>(\n\t\t\t\tMultiChannelAssociationCCValues.nodeIds(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tgroupDestinations.push(...nodes.map((nodeId) => ({ nodeId })));\n\t\t\t// And all endpoint destinations\n\t\t\tconst endpoints = valueDB.getValue<EndpointAddress[]>(\n\t\t\t\tMultiChannelAssociationCCValues.endpoints(i).endpoint(\n\t\t\t\t\tendpoint.index,\n\t\t\t\t),\n\t\t\t) ?? [];\n\t\t\tfor (const ep of endpoints) {\n\t\t\t\tif (typeof ep.endpoint === \"number\") {\n\t\t\t\t\tgroupDestinations.push({\n\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\tendpoint: ep.endpoint,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tgroupDestinations.push(\n\t\t\t\t\t\t...ep.endpoint.map((e) => ({\n\t\t\t\t\t\t\tnodeId: ep.nodeId,\n\t\t\t\t\t\t\tendpoint: e,\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\tret.set(\n\t\t\t\ti,\n\t\t\t\t// Filter out duplicates\n\t\t\t\tgroupDestinations.filter(\n\t\t\t\t\t(addr, index) =>\n\t\t\t\t\t\tindex\n\t\t\t\t\t\t\t=== groupDestinations.findIndex(\n\t\t\t\t\t\t\t\t({ nodeId, endpoint }) =>\n\t\t\t\t\t\t\t\t\tnodeId === addr.nodeId\n\t\t\t\t\t\t\t\t\t&& endpoint === addr.endpoint,\n\t\t\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn ret;\n\t}\n\n\tpublic async interview(\n\t\tctx: InterviewContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// First find out how many groups are supported as multi channel\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying number of multi channel association groups...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst mcGroupCount = await mcAPI.getGroupCount();\n\t\tif (mcGroupCount != undefined) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`supports ${mcGroupCount} multi channel association groups`,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t} else {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying multi channel association groups timed out, skipping interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Query each association group for its members\n\t\tawait this.refreshValues(ctx);\n\n\t\t// And set up lifeline associations\n\t\tawait ccUtils.configureLifelineAssociations(ctx, endpoint);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tpublic async refreshValues(\n\t\tctx: RefreshValuesContext,\n\t): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst mcAPI = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel Association\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst assocAPI = CCAPI.create(\n\t\t\tCommandClasses.Association,\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\n\t\tconst mcGroupCount: number = this.getValue(\n\t\t\tctx,\n\t\t\tMultiChannelAssociationCCValues.groupCount,\n\t\t) ?? 0;\n\n\t\t// Some devices report more association groups than multi channel association groups, so we need this info here\n\t\tconst assocGroupCount: number =\n\t\t\tthis.getValue(ctx, AssociationCCValues.groupCount)\n\t\t\t|| mcGroupCount;\n\n\t\t// Then query each multi channel association group\n\t\tfor (let groupId = 1; groupId <= mcGroupCount; groupId++) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying multi channel association group #${groupId}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst group = await mcAPI.getGroup(groupId);\n\t\t\tif (!group) continue;\n\t\t\tconst logMessage =\n\t\t\t\t`received information for multi channel association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}\ncurrently assigned endpoints: ${\n\t\t\t\t\tgroup.endpoints\n\t\t\t\t\t\t.map(({ nodeId, endpoint }) => {\n\t\t\t\t\t\t\tif (typeof endpoint === \"number\") {\n\t\t\t\t\t\t\t\treturn `${nodeId}:${endpoint}`;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn `${nodeId}:[${\n\t\t\t\t\t\t\t\t\tendpoint.map(String).join(\", \")\n\t\t\t\t\t\t\t\t}]`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.join(\"\")\n\t\t\t\t}`;\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: logMessage,\n\t\t\t\tdirection: \"inbound\",\n\t\t\t});\n\t\t}\n\n\t\t// Check if there are more non-multi-channel association groups we haven't queried yet\n\t\tif (assocAPI.isSupported() && assocGroupCount > mcGroupCount) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`querying additional non-multi-channel association groups...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tfor (\n\t\t\t\tlet groupId = mcGroupCount + 1;\n\t\t\t\tgroupId <= assocGroupCount;\n\t\t\t\tgroupId++\n\t\t\t) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `querying association group #${groupId}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst group = await assocAPI.getGroup(groupId);\n\t\t\t\tif (!group) continue;\n\t\t\t\tconst logMessage =\n\t\t\t\t\t`received information for association group #${groupId}:\nmaximum # of nodes: ${group.maxNodes}\ncurrently assigned nodes: ${group.nodeIds.map(String).join(\", \")}`;\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\n// @publicAPI\nexport type MultiChannelAssociationCCSetOptions =\n\t& {\n\t\tgroupId: number;\n\t}\n\t& (\n\t\t| { nodeIds: number[] }\n\t\t| { endpoints: EndpointAddress[] }\n\t\t| { nodeIds: number[]; endpoints: EndpointAddress[] }\n\t);\n\n@CCCommand(MultiChannelAssociationCommand.Set)\n@useSupervision()\nexport class MultiChannelAssociationCCSet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCSetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = (\"nodeIds\" in options && options.nodeIds) || [];\n\t\tif (this.nodeIds.some((n) => n < 1 || n > MAX_NODES)) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t`All node IDs must be between 1 and ${MAX_NODES}!`,\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.endpoints = (\"endpoints\" in options && options.endpoints)\n\t\t\t|| [];\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\tpublic nodeIds: number[];\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds,\n\t\t\t\tthis.endpoints,\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCRemoveOptions {\n\t/** The group from which to remove the nodes. If none is specified, the nodes will be removed from all groups. */\n\tgroupId?: number;\n\t/** The nodes to remove. If no nodeIds and no endpoint addresses are specified, ALL nodes will be removed. */\n\tnodeIds?: number[];\n\t/** The single endpoints to remove. If no nodeIds and no endpoint addresses are specified, ALL will be removed. */\n\tendpoints?: EndpointAddress[];\n}\n\n@CCCommand(MultiChannelAssociationCommand.Remove)\n@useSupervision()\nexport class MultiChannelAssociationCCRemove extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCRemoveOptions>,\n\t) {\n\t\tsuper(options);\n\t\t// When removing associations, we allow invalid node IDs.\n\t\t// See GH#3606 - it is possible that those exist.\n\t\tthis.groupId = options.groupId;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCRemove {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId: number | undefined = raw.payload[0];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(1),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t});\n\t}\n\n\tpublic groupId?: number;\n\tpublic nodeIds?: number[];\n\tpublic endpoints?: EndpointAddress[];\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.groupId || 0]),\n\t\t\tserializeMultiChannelAssociationDestination(\n\t\t\t\tthis.nodeIds || [],\n\t\t\t\tthis.endpoints || [],\n\t\t\t),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"group id\": this.groupId || \"(all groups)\",\n\t\t};\n\t\tif (this.nodeIds) {\n\t\t\tmessage[\"node ids\"] = this.nodeIds.join(\", \");\n\t\t}\n\t\tif (this.endpoints) {\n\t\t\tmessage.endpoints = endpointAddressesToString(this.endpoints);\n\t\t}\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCReportOptions {\n\tgroupId: number;\n\tmaxNodes: number;\n\tnodeIds: number[];\n\tendpoints: EndpointAddress[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Report)\n@ccValueProperty(\n\t\"maxNodes\",\n\tMultiChannelAssociationCCValues.maxNodes,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"nodeIds\",\n\tMultiChannelAssociationCCValues.nodeIds,\n\t(self) => [self.groupId],\n)\n@ccValueProperty(\n\t\"endpoints\",\n\tMultiChannelAssociationCCValues.endpoints,\n\t(self) => [self.groupId],\n)\nexport class MultiChannelAssociationCCReport extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupId = options.groupId;\n\t\tthis.maxNodes = options.maxNodes;\n\t\tthis.nodeIds = options.nodeIds;\n\t\tthis.endpoints = options.endpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst groupId = raw.payload[0];\n\t\tconst maxNodes = raw.payload[1];\n\t\tconst reportsToFollow = raw.payload[2];\n\n\t\tconst { nodeIds, endpoints } =\n\t\t\tdeserializeMultiChannelAssociationDestination(\n\t\t\t\traw.payload.subarray(3),\n\t\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t\tmaxNodes,\n\t\t\tnodeIds,\n\t\t\tendpoints,\n\t\t\treportsToFollow,\n\t\t});\n\t}\n\n\tpublic readonly groupId: number;\n\n\tpublic maxNodes: number;\n\n\tpublic nodeIds: number[];\n\n\tpublic endpoints: EndpointAddress[];\n\n\tpublic reportsToFollow: number;\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the association group ID\n\t\treturn { groupId: this.groupId };\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelAssociationCCReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of nodes\n\t\tthis.nodeIds = [...partials, this]\n\t\t\t.map((report) => [...report.nodeIds])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\t// Concat the list of endpoints\n\t\tthis.endpoints = [...partials, this]\n\t\t\t.map((report) => [...report.endpoints])\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tconst destinations = serializeMultiChannelAssociationDestination(\n\t\t\tthis.nodeIds,\n\t\t\tthis.endpoints,\n\t\t);\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.groupId,\n\t\t\t\tthis.maxNodes,\n\t\t\t\tthis.reportsToFollow,\n\t\t\t]),\n\t\t\tdestinations,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"group id\": this.groupId,\n\t\t\t\t\"maximum # of nodes\": this.maxNodes,\n\t\t\t\t\"node ids\": this.nodeIds.join(\", \"),\n\t\t\t\tendpoints: endpointAddressesToString(this.endpoints),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCGetOptions {\n\tgroupId: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.Get)\n@expectedCCResponse(MultiChannelAssociationCCReport)\nexport class MultiChannelAssociationCCGet extends MultiChannelAssociationCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelAssociationCCGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tif (options.groupId < 1) {\n\t\t\tthrow new ZWaveError(\n\t\t\t\t\"The group id must be positive!\",\n\t\t\t\tZWaveErrorCodes.Argument_Invalid,\n\t\t\t);\n\t\t}\n\t\tthis.groupId = options.groupId;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupId = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupId,\n\t\t});\n\t}\n\n\tpublic groupId: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupId]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group id\": this.groupId },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelAssociationCCSupportedGroupingsReportOptions {\n\tgroupCount: number;\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsReport)\n@ccValueProperty(\"groupCount\", MultiChannelAssociationCCValues.groupCount)\nexport class MultiChannelAssociationCCSupportedGroupingsReport\n\textends MultiChannelAssociationCC\n{\n\tpublic constructor(\n\t\toptions: WithAddress<\n\t\t\tMultiChannelAssociationCCSupportedGroupingsReportOptions\n\t\t>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.groupCount = options.groupCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelAssociationCCSupportedGroupingsReport {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst groupCount = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgroupCount,\n\t\t});\n\t}\n\n\tpublic readonly groupCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.groupCount]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { \"group count\": this.groupCount },\n\t\t};\n\t}\n}\n\n@CCCommand(MultiChannelAssociationCommand.SupportedGroupingsGet)\n@expectedCCResponse(MultiChannelAssociationCCSupportedGroupingsReport)\nexport class MultiChannelAssociationCCSupportedGroupingsGet\n\textends MultiChannelAssociationCC\n{}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAgBO;AACP,oBAA4C;AAE5C,iBAAqC;AACrC,0BAKO;AACP,oCASO;AACP,oBAAkB;AAClB,mBAIO;AACP,cAAyB;AACzB,2BAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCpC,SAAS,0BACR,WAAqC;AAErC,SAAO,UACL,IAAI,CAAC,EAAE,QAAQ,SAAQ,MAAM;AAC7B,QAAI,OAAO,aAAa,UAAU;AACjC,aAAO,GAAG,MAAM,IAAI,QAAQ;IAC7B,OAAO;AACN,aAAO,GAAG,MAAM,KAAK,SAAS,IAAI,MAAM,EAAE,KAAK,IAAI,CAAC;IACrD;EACD,CAAC,EACA,KAAK,IAAI;AACZ;AAZS;AAcT,MAAM,mCAAmC;AAEzC,SAAS,4CACR,SACA,WAA4B;AAE5B,QA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;;;AADlC,mBAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,wBAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": ["endpoint"]
|
|
7
7
|
}
|
|
@@ -114,7 +114,7 @@ function areEndpointsUnnecessary(ctx, nodeId, endpointIndizes) {
|
|
|
114
114
|
if (distinctDeviceClasses.length !== endpointIndizes.length) {
|
|
115
115
|
return false;
|
|
116
116
|
}
|
|
117
|
-
const switchTypeDeviceClasses = [
|
|
117
|
+
const switchTypeDeviceClasses = /* @__PURE__ */ new Set([
|
|
118
118
|
16,
|
|
119
119
|
// Binary Switch
|
|
120
120
|
17,
|
|
@@ -123,8 +123,8 @@ function areEndpointsUnnecessary(ctx, nodeId, endpointIndizes) {
|
|
|
123
123
|
// Remote Switch
|
|
124
124
|
19
|
|
125
125
|
// Toggle Switch
|
|
126
|
-
];
|
|
127
|
-
const numSwitchEndpoints = [...deviceClasses.values()].filter(({ generic }) => switchTypeDeviceClasses.
|
|
126
|
+
]);
|
|
127
|
+
const numSwitchEndpoints = [...deviceClasses.values()].filter(({ generic }) => switchTypeDeviceClasses.has(generic)).length;
|
|
128
128
|
if (numSwitchEndpoints > 1)
|
|
129
129
|
return false;
|
|
130
130
|
return true;
|
|
@@ -184,7 +184,7 @@ let MultiChannelCCAPI = (() => {
|
|
|
184
184
|
}
|
|
185
185
|
return super.supportsCommand(cmd);
|
|
186
186
|
}
|
|
187
|
-
//
|
|
187
|
+
// oxlint-disable-next-line typescript/explicit-module-boundary-types
|
|
188
188
|
async getEndpoints() {
|
|
189
189
|
this.assertSupportsCommand(import_Types.MultiChannelCommand, import_Types.MultiChannelCommand.EndPointGet);
|
|
190
190
|
const cc = new MultiChannelCCEndPointGet({
|
|
@@ -1032,8 +1032,8 @@ let MultiChannelCCAggregatedMembersGet = (() => {
|
|
|
1032
1032
|
};
|
|
1033
1033
|
return MultiChannelCCAggregatedMembersGet2 = _classThis;
|
|
1034
1034
|
})();
|
|
1035
|
-
function getCCResponseForCommandEncapsulation(sent) {
|
|
1036
|
-
if (typeof sent.destination === "number" && sent.encapsulated.expectsCCResponse()) {
|
|
1035
|
+
function getCCResponseForCommandEncapsulation(ctx, sent) {
|
|
1036
|
+
if (typeof sent.destination === "number" && sent.encapsulated.expectsCCResponse(ctx)) {
|
|
1037
1037
|
return [
|
|
1038
1038
|
MultiChannelCCCommandEncapsulation,
|
|
1039
1039
|
MultiChannelCCV1CommandEncapsulation
|
|
@@ -1248,8 +1248,8 @@ let MultiChannelCCV1Get = (() => {
|
|
|
1248
1248
|
};
|
|
1249
1249
|
return MultiChannelCCV1Get2 = _classThis;
|
|
1250
1250
|
})();
|
|
1251
|
-
function getResponseForV1CommandEncapsulation(sent) {
|
|
1252
|
-
if (sent.encapsulated.expectsCCResponse()) {
|
|
1251
|
+
function getResponseForV1CommandEncapsulation(ctx, sent) {
|
|
1252
|
+
if (sent.encapsulated.expectsCCResponse(ctx)) {
|
|
1253
1253
|
return MultiChannelCCV1CommandEncapsulation;
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cc/MultiChannelCC.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\ttype ApplicationNodeInformation,\n\tCommandClasses,\n\ttype GenericDeviceClass,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype SpecificDeviceClass,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeApplicationNodeInformation,\n\tencodeBitMask,\n\tgetCCName,\n\tgetGenericDeviceClass,\n\tgetSpecificDeviceClass,\n\tparseApplicationNodeInformation,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { distinct } from \"alcalzone-shared/arrays\";\nimport { CCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport {\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"../lib/EncapsulatingCommandClass.js\";\nimport { V } from \"../lib/Values.js\";\nimport { MultiChannelCommand } from \"../lib/_Types.js\";\n\n// TODO: Handle removal reports of dynamic endpoints\n\nexport const MultiChannelCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel\"],\n\t{\n\t\t...V.staticProperty(\"endpointIndizes\", undefined, {\n\t\t\tinternal: true,\n\t\t\tsupportsEndpoints: false,\n\t\t}),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"individualEndpointCount\",\n\t\t\t\"individualCount\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"aggregatedEndpointCount\",\n\t\t\t\"aggregatedCount\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointCountIsDynamic\",\n\t\t\t\"countIsDynamic\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointsHaveIdenticalCapabilities\",\n\t\t\t\"identicalCapabilities\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointCCs\",\n\t\t\t\"commandClasses\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointDeviceClass\",\n\t\t\t\"deviceClass\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"aggregatedEndpointMembers\",\n\t\t\t\"members\",\n\t\t\t(endpointIndex: number) => endpointIndex,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"members\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\n// @noSetValueAPI\n\n/**\n * Many devices unnecessarily use endpoints when they could (or do) provide all functionality via the root device.\n * This function gives an estimate if this is the case (i.e. all endpoints have a different device class)\n */\nfunction areEndpointsUnnecessary(\n\tctx: GetValueDB,\n\tnodeId: number,\n\tendpointIndizes: number[],\n): boolean {\n\t// Gather all device classes\n\tconst deviceClasses = new Map<\n\t\tnumber,\n\t\t{\n\t\t\tgeneric: number;\n\t\t\tspecific: number;\n\t\t}\n\t>();\n\tfor (const endpoint of endpointIndizes) {\n\t\tconst devClassValueId = MultiChannelCCValues.endpointDeviceClass\n\t\t\t.endpoint(endpoint);\n\t\tconst deviceClass = ctx.getValueDB(nodeId).getValue<{\n\t\t\tgeneric: number;\n\t\t\tspecific: number;\n\t\t}>(devClassValueId);\n\t\tif (deviceClass) {\n\t\t\tdeviceClasses.set(endpoint, {\n\t\t\t\tgeneric: deviceClass.generic,\n\t\t\t\tspecific: deviceClass.specific,\n\t\t\t});\n\t\t}\n\t}\n\n\t// Endpoints may be useless if all of them have different device classes\n\tconst distinctDeviceClasses = distinct(\n\t\t[...deviceClasses.values()].map(\n\t\t\t({ generic, specific }) => generic * 256 + specific,\n\t\t),\n\t);\n\tif (distinctDeviceClasses.length !== endpointIndizes.length) {\n\t\t// There are endpoints with the same device class, so they are not unnecessary\n\t\treturn false;\n\t}\n\n\t// Endpoints are necessary if more than 1 of them has a switch-type device class\n\tconst switchTypeDeviceClasses = [\n\t\t0x10, // Binary Switch\n\t\t0x11, // Multilevel Switch\n\t\t0x12, // Remote Switch\n\t\t0x13, // Toggle Switch\n\t];\n\tconst numSwitchEndpoints = [...deviceClasses.values()].filter(\n\t\t({ generic }) => switchTypeDeviceClasses.includes(generic),\n\t).length;\n\tif (numSwitchEndpoints > 1) return false;\n\n\treturn true;\n}\n\n@API(CommandClasses[\"Multi Channel\"])\nexport class MultiChannelCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: MultiChannelCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\t// Legacy commands:\n\t\t\tcase MultiChannelCommand.GetV1:\n\t\t\t\treturn this.isSinglecast() && this.version === 1;\n\t\t\tcase MultiChannelCommand.CommandEncapsulationV1:\n\t\t\t\treturn this.version === 1;\n\n\t\t\t// The specs start at version 3 but according to OZW,\n\t\t\t// these do seem to be supported in version 2\n\t\t\tcase MultiChannelCommand.EndPointGet:\n\t\t\tcase MultiChannelCommand.CapabilityGet:\n\t\t\t\treturn this.version >= 2 && this.isSinglecast();\n\t\t\tcase MultiChannelCommand.CommandEncapsulation:\n\t\t\t\treturn this.version >= 2;\n\t\t\tcase MultiChannelCommand.EndPointFind:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t\tcase MultiChannelCommand.AggregatedMembersGet:\n\t\t\t\treturn this.version >= 4 && this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\tpublic async getEndpoints() {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.EndPointGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCEndPointGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCEndPointReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tisDynamicEndpointCount: response.countIsDynamic,\n\t\t\t\tidenticalCapabilities: response.identicalCapabilities,\n\t\t\t\tindividualEndpointCount: response.individualCount,\n\t\t\t\taggregatedEndpointCount: response.aggregatedCount,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async getEndpointCapabilities(\n\t\tendpoint: number,\n\t): Promise<MaybeNotKnown<EndpointCapability>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CapabilityGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCCapabilityGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\trequestedEndpoint: endpoint,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCCapabilityReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\tconst generic = getGenericDeviceClass(\n\t\t\t\tresponse.genericDeviceClass,\n\t\t\t);\n\t\t\tconst specific = getSpecificDeviceClass(\n\t\t\t\tresponse.genericDeviceClass,\n\t\t\t\tresponse.specificDeviceClass,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tisDynamic: response.isDynamic,\n\t\t\t\twasRemoved: response.wasRemoved,\n\t\t\t\tsupportedCCs: response.supportedCCs,\n\t\t\t\tgeneric,\n\t\t\t\tspecific,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async findEndpoints(\n\t\tgenericClass: number,\n\t\tspecificClass: number,\n\t): Promise<MaybeNotKnown<readonly number[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.EndPointFind,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCEndPointFind({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCEndPointFindReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.foundEndpoints;\n\t}\n\n\t@validateArgs()\n\tpublic async getAggregatedMembers(\n\t\tendpoint: number,\n\t): Promise<MaybeNotKnown<readonly number[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.AggregatedMembersGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCAggregatedMembersGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\trequestedEndpoint: endpoint,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCAggregatedMembersReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.members;\n\t}\n\n\t// Encapsulation is used internally and too frequently that we\n\t// want to pay the cost of validating each call\n\t// eslint-disable-next-line @zwave-js/ccapi-validate-args\n\tpublic async sendEncapsulated(\n\t\toptions: MultiChannelCCCommandEncapsulationOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CommandEncapsulation,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCCommandEncapsulation({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async getEndpointCountV1(\n\t\tccId: CommandClasses,\n\t): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.GetV1,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCV1Get({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\trequestedCC: ccId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCV1Report\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.endpointCount;\n\t}\n\n\t// Encapsulation is used internally and too frequently that we\n\t// want to pay the cost of validating each call\n\t// eslint-disable-next-line @zwave-js/ccapi-validate-args\n\tpublic async sendEncapsulatedV1(encapsulated: CommandClass): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CommandEncapsulationV1,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCV1CommandEncapsulation({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tencapsulated,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\nexport interface EndpointCapability {\n\tgeneric: GenericDeviceClass;\n\tspecific: SpecificDeviceClass;\n\tsupportedCCs: CommandClasses[];\n\tisDynamic: boolean;\n\twasRemoved: boolean;\n}\n\n@commandClass(CommandClasses[\"Multi Channel\"])\n@implementedVersion(4)\n@ccValues(MultiChannelCCValues)\nexport class MultiChannelCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelCommand;\n\n\t/** Tests if a command targets a specific endpoint and thus requires encapsulation */\n\tpublic static requiresEncapsulation(cc: CommandClass): boolean {\n\t\treturn (\n\t\t\tcc.endpointIndex !== 0\n\t\t\t&& !(cc instanceof MultiChannelCCCommandEncapsulation)\n\t\t\t&& !(cc instanceof MultiChannelCCV1CommandEncapsulation)\n\t\t);\n\t}\n\n\t/** Encapsulates a command that targets a specific endpoint, with version 2+ of the Multi Channel CC */\n\tpublic static encapsulate(\n\t\tcc: CommandClass,\n\t): MultiChannelCCCommandEncapsulation {\n\t\tconst ret = new MultiChannelCCCommandEncapsulation({\n\t\t\tnodeId: cc.nodeId,\n\t\t\tencapsulated: cc,\n\t\t\tdestination: cc.endpointIndex,\n\t\t});\n\n\t\t// Copy the encapsulation flags from the encapsulated command\n\t\tret.encapsulationFlags = cc.encapsulationFlags;\n\n\t\treturn ret;\n\t}\n\n\t/** Encapsulates a command that targets a specific endpoint, with version 1 of the Multi Channel CC */\n\tpublic static encapsulateV1(\n\t\tcc: CommandClass,\n\t): MultiChannelCCV1CommandEncapsulation {\n\t\tconst ret = new MultiChannelCCV1CommandEncapsulation({\n\t\t\tnodeId: cc.nodeId,\n\t\t\tendpointIndex: cc.endpointIndex,\n\t\t\tencapsulated: cc,\n\t\t});\n\n\t\t// Copy the encapsulation flags from the encapsulated command\n\t\tret.encapsulationFlags = cc.encapsulationFlags;\n\n\t\treturn ret;\n\t}\n\n\tpublic skipEndpointInterview(): boolean {\n\t\t// The endpoints are discovered by querying the root device\n\t\treturn true;\n\t}\n\n\tpublic async interview(ctx: InterviewContext): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tconst removeEndpoints = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t?.removeEndpoints;\n\t\tif (removeEndpoints === \"*\") {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`Skipping ${this.ccName} interview b/c all endpoints are ignored by the device config file...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Special interview procedure for legacy nodes\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (ccVersion === 1) return this.interviewV1(ctx);\n\n\t\tconst endpoint = node.getEndpoint(this.endpointIndex)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst valueDB = this.getValueDB(ctx);\n\n\t\t// Step 1: Retrieve general information about end points\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying device endpoint information...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst multiResponse = await api.getEndpoints();\n\t\tif (!multiResponse) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying device endpoint information timed out, aborting interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn this.throwMissingCriticalInterviewResponse();\n\t\t}\n\n\t\tlet logMessage = `received response for device endpoints:\nendpoint count (individual): ${multiResponse.individualEndpointCount}\ncount is dynamic: ${multiResponse.isDynamicEndpointCount}\nidentical capabilities: ${multiResponse.identicalCapabilities}`;\n\t\tif (multiResponse.aggregatedEndpointCount != undefined) {\n\t\t\tlogMessage +=\n\t\t\t\t`\\nendpoint count (aggregated): ${multiResponse.aggregatedEndpointCount}`;\n\t\t}\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: logMessage,\n\t\t\tdirection: \"inbound\",\n\t\t});\n\n\t\tlet allEndpoints: number[] = [];\n\t\tconst addSequentialEndpoints = (): void => {\n\t\t\tfor (\n\t\t\t\tlet i = 1;\n\t\t\t\ti\n\t\t\t\t\t<= multiResponse.individualEndpointCount\n\t\t\t\t\t\t+ (multiResponse.aggregatedEndpointCount ?? 0);\n\t\t\t\ti++\n\t\t\t) {\n\t\t\t\tallEndpoints.push(i);\n\t\t\t}\n\t\t};\n\t\tif (api.supportsCommand(MultiChannelCommand.EndPointFind)) {\n\t\t\t// Step 2a: Find all endpoints\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying all endpoints...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst foundEndpoints = await api.findEndpoints(0xff, 0xff);\n\t\t\tif (foundEndpoints) allEndpoints.push(...foundEndpoints);\n\t\t\tif (!allEndpoints.length) {\n\t\t\t\t// Create a sequential list of endpoints\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoint query returned no results, assuming that endpoints are sequential`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t\taddSequentialEndpoints();\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `received endpoints: ${\n\t\t\t\t\t\tallEndpoints\n\t\t\t\t\t\t\t.map(String)\n\t\t\t\t\t\t\t.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Step 2b: Assume that the endpoints are in sequential order\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`does not support EndPointFind, assuming that endpoints are sequential`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\taddSequentialEndpoints();\n\t\t}\n\n\t\t// Step 2.5: remove ignored endpoints\n\t\tif (removeEndpoints?.length) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`The following endpoints are ignored through the config file: ${\n\t\t\t\t\t\tremoveEndpoints.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\tallEndpoints = allEndpoints.filter(\n\t\t\t\t(e) => !removeEndpoints.includes(e),\n\t\t\t);\n\t\t}\n\n\t\t// Step 3: Query endpoints\n\t\tlet hasQueriedCapabilities = false;\n\t\tfor (const endpoint of allEndpoints) {\n\t\t\tif (\n\t\t\t\tendpoint > multiResponse.individualEndpointCount\n\t\t\t\t&& ccVersion >= 4\n\t\t\t) {\n\t\t\t\t// Find members of aggregated end point\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`querying members of aggregated endpoint #${endpoint}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst members = await api.getAggregatedMembers(endpoint);\n\t\t\t\tif (members) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`aggregated endpoint #${endpoint} has members ${\n\t\t\t\t\t\t\t\tmembers\n\t\t\t\t\t\t\t\t\t.map(String)\n\t\t\t\t\t\t\t\t\t.join(\", \")\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// When the device reports identical capabilities for all endpoints,\n\t\t\t// we don't need to query them all\n\t\t\tif (multiResponse.identicalCapabilities && hasQueriedCapabilities) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`all endpoints identical, skipping capability query for endpoint #${endpoint}...`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\n\t\t\t\t// copy the capabilities from the first endpoint\n\t\t\t\tconst devClass = valueDB.getValue(\n\t\t\t\t\tMultiChannelCCValues.endpointDeviceClass.endpoint(\n\t\t\t\t\t\tallEndpoints[0],\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointDeviceClass.endpoint(endpoint),\n\t\t\t\t\tdevClass,\n\t\t\t\t);\n\t\t\t\tconst ep1Caps = valueDB.getValue<CommandClasses[]>(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(allEndpoints[0]),\n\t\t\t\t)!;\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(endpoint),\n\t\t\t\t\t[...ep1Caps],\n\t\t\t\t);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying capabilities for endpoint #${endpoint}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst caps = await api.getEndpointCapabilities(endpoint);\n\t\t\tif (caps) {\n\t\t\t\thasQueriedCapabilities = true;\n\t\t\t\tlogMessage =\n\t\t\t\t\t`received response for endpoint capabilities (#${endpoint}):\ngeneric device class: ${caps.generic.label}\nspecific device class: ${caps.specific.label}\nis dynamic end point: ${caps.isDynamic}\nsupported CCs:`;\n\t\t\t\tfor (const cc of caps.supportedCCs) {\n\t\t\t\t\tlogMessage += `\\n \u00B7 ${getCCName(cc)}`;\n\t\t\t\t}\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Querying endpoint #${endpoint} capabilities timed out, aborting interview...`,\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn this.throwMissingCriticalInterviewResponse();\n\t\t\t}\n\t\t}\n\n\t\t// Now that all endpoints have been interviewed, remember which ones are there\n\t\t// But first figure out if they seem unnecessary and if they do, which ones should be preserved\n\t\tif (\n\t\t\t!multiResponse.identicalCapabilities\n\t\t\t&& areEndpointsUnnecessary(ctx, node.id, allEndpoints)\n\t\t) {\n\t\t\tconst preserve = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t\t?.preserveEndpoints;\n\t\t\tif (!preserve) {\n\t\t\t\tallEndpoints = [];\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoints seem unnecessary b/c they have different device classes, ignoring all...`,\n\t\t\t\t});\n\t\t\t} else if (preserve === \"*\") {\n\t\t\t\t// preserve all endpoints, do nothing\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoints seem unnecessary, but are configured to be preserved.`,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tallEndpoints = allEndpoints.filter((ep) =>\n\t\t\t\t\tpreserve.includes(ep)\n\t\t\t\t);\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage: `Endpoints seem unnecessary, but endpoints ${\n\t\t\t\t\t\tallEndpoints.join(\n\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t)\n\t\t\t\t\t} are configured to be preserved.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointIndizes,\n\t\t\tallEndpoints,\n\t\t);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tprivate async interviewV1(ctx: InterviewContext): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst removeEndpoints = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t?.removeEndpoints;\n\t\tif (removeEndpoints === \"*\") {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`Skipping ${this.ccName} interview b/c all endpoints are ignored by the device config file...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tconst valueDB = this.getValueDB(ctx);\n\n\t\t// V1 works the opposite way - we scan all CCs and remember how many\n\t\t// endpoints they have\n\t\tconst supportedCCs = [...node.getCCs()]\n\t\t\t// Don't query CCs the node only controls\n\t\t\t.filter(([, info]) => info.isSupported)\n\t\t\t.map(([cc]) => cc)\n\t\t\t// Don't query CCs that want to skip the endpoint interview\n\t\t\t.filter(\n\t\t\t\t(cc) =>\n\t\t\t\t\t!CommandClass.createInstanceUnchecked(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tcc,\n\t\t\t\t\t)?.skipEndpointInterview(),\n\t\t\t);\n\t\tconst endpointCounts = new Map<CommandClasses, number>();\n\t\tfor (const ccId of supportedCCs) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage: `Querying endpoint count for CommandClass ${\n\t\t\t\t\tgetCCName(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst endpointCount = await api.getEndpointCountV1(ccId);\n\t\t\tif (endpointCount != undefined) {\n\t\t\t\tendpointCounts.set(ccId, endpointCount);\n\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage: `CommandClass ${\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} has ${endpointCount} endpoints`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Store the collected information\n\t\t// We have only individual and no dynamic and no aggregated endpoints\n\t\tconst numEndpoints = Math.max(...endpointCounts.values());\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointCountIsDynamic,\n\t\t\tfalse,\n\t\t);\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.aggregatedEndpointCount,\n\t\t\t0,\n\t\t);\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.individualEndpointCount,\n\t\t\tnumEndpoints,\n\t\t);\n\t\t// Since we queried all CCs separately, we can assume that all\n\t\t// endpoints have different capabilities\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointsHaveIdenticalCapabilities,\n\t\t\tfalse,\n\t\t);\n\n\t\tif (removeEndpoints?.length) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`The following endpoints are ignored through the config file: ${\n\t\t\t\t\t\tremoveEndpoints.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\n\t\tconst allEndpoints: number[] = [];\n\t\tfor (let endpoint = 1; endpoint <= numEndpoints; endpoint++) {\n\t\t\t// Skip this endpoint if flagged for removal\n\t\t\tif (!removeEndpoints?.includes(endpoint)) {\n\t\t\t\t// Check which CCs exist on this endpoint\n\t\t\t\tconst endpointCCs = [...endpointCounts.entries()]\n\t\t\t\t\t.filter(([, ccEndpoints]) => ccEndpoints >= endpoint)\n\t\t\t\t\t.map(([ccId]) => ccId);\n\t\t\t\t// And store it per endpoint\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(endpoint),\n\t\t\t\t\tendpointCCs,\n\t\t\t\t);\n\t\t\t\tallEndpoints.push(endpoint);\n\t\t\t}\n\t\t}\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointIndizes,\n\t\t\tallEndpoints,\n\t\t);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointReportOptions {\n\tcountIsDynamic: boolean;\n\tidenticalCapabilities: boolean;\n\tindividualCount: number;\n\taggregatedCount?: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointReport)\n@ccValueProperty(\"countIsDynamic\", MultiChannelCCValues.endpointCountIsDynamic)\n@ccValueProperty(\n\t\"identicalCapabilities\",\n\tMultiChannelCCValues.endpointsHaveIdenticalCapabilities,\n)\n@ccValueProperty(\n\t\"individualCount\",\n\tMultiChannelCCValues.individualEndpointCount,\n)\n@ccValueProperty(\n\t\"aggregatedCount\",\n\tMultiChannelCCValues.aggregatedEndpointCount,\n)\nexport class MultiChannelCCEndPointReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.countIsDynamic = options.countIsDynamic;\n\t\tthis.identicalCapabilities = options.identicalCapabilities;\n\t\tthis.individualCount = options.individualCount;\n\t\tthis.aggregatedCount = options.aggregatedCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst countIsDynamic = !!(raw.payload[0] & 0b10000000);\n\t\tconst identicalCapabilities = !!(raw.payload[0] & 0b01000000);\n\t\tconst individualCount = raw.payload[1] & 0b01111111;\n\t\tlet aggregatedCount: MaybeNotKnown<number>;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\taggregatedCount = raw.payload[2] & 0b01111111;\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcountIsDynamic,\n\t\t\tidenticalCapabilities,\n\t\t\tindividualCount,\n\t\t\taggregatedCount,\n\t\t});\n\t}\n\n\tpublic countIsDynamic: boolean;\n\n\tpublic identicalCapabilities: boolean;\n\n\tpublic individualCount: number;\n\n\tpublic aggregatedCount: MaybeNotKnown<number>;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\t(this.countIsDynamic ? 0b10000000 : 0)\n\t\t\t| (this.identicalCapabilities ? 0b01000000 : 0),\n\t\t\tthis.individualCount & 0b01111111,\n\t\t\tthis.aggregatedCount ?? 0,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"endpoint count (individual)\": this.individualCount,\n\t\t\t\"count is dynamic\": this.countIsDynamic,\n\t\t\t\"identical capabilities\": this.identicalCapabilities,\n\t\t};\n\t\tif (this.aggregatedCount != undefined) {\n\t\t\tmessage[\"endpoint count (aggregated)\"] = this.aggregatedCount;\n\t\t}\n\t\tconst ret = {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t\treturn ret;\n\t}\n}\n\n@CCCommand(MultiChannelCommand.EndPointGet)\n@expectedCCResponse(MultiChannelCCEndPointReport)\nexport class MultiChannelCCEndPointGet extends MultiChannelCC {}\n\n// @publicAPI\nexport interface MultiChannelCCCapabilityReportOptions {\n\tendpointIndex: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass: number;\n\tsupportedCCs: CommandClasses[];\n\tisDynamic: boolean;\n\twasRemoved: boolean;\n}\n\n@CCCommand(MultiChannelCommand.CapabilityReport)\nexport class MultiChannelCCCapabilityReport extends MultiChannelCC\n\timplements ApplicationNodeInformation\n{\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCapabilityReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.endpointIndex = options.endpointIndex;\n\t\tthis.genericDeviceClass = options.genericDeviceClass;\n\t\tthis.specificDeviceClass = options.specificDeviceClass;\n\t\tthis.supportedCCs = options.supportedCCs;\n\t\tthis.isDynamic = options.isDynamic;\n\t\tthis.wasRemoved = options.wasRemoved;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCCapabilityReport {\n\t\t// Only validate the bytes we expect to see here\n\t\t// parseApplicationNodeInformation does its own validation\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst endpointIndex = raw.payload[0] & 0b01111111;\n\t\tconst isDynamic = !!(raw.payload[0] & 0b10000000);\n\t\tconst NIF = parseApplicationNodeInformation(\n\t\t\traw.payload.subarray(1),\n\t\t);\n\t\tconst genericDeviceClass = NIF.genericDeviceClass;\n\t\tconst specificDeviceClass = NIF.specificDeviceClass;\n\t\tconst supportedCCs: CommandClasses[] = NIF.supportedCCs;\n\n\t\t// Removal reports have very specific information\n\t\tconst wasRemoved: boolean = isDynamic\n\t\t\t&& genericDeviceClass === 0xff // \"Non-Interoperable\"\n\t\t\t&& specificDeviceClass === 0x00;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tisDynamic,\n\t\t\tgenericDeviceClass,\n\t\t\tspecificDeviceClass,\n\t\t\tsupportedCCs,\n\t\t\twasRemoved,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\tconst deviceClassValue = MultiChannelCCValues.endpointDeviceClass;\n\t\tconst ccsValue = MultiChannelCCValues.endpointCCs;\n\n\t\tif (this.wasRemoved) {\n\t\t\tthis.removeValue(ctx, deviceClassValue);\n\t\t\tthis.removeValue(ctx, ccsValue);\n\t\t} else {\n\t\t\tthis.setValue(ctx, deviceClassValue, {\n\t\t\t\tgeneric: this.genericDeviceClass,\n\t\t\t\tspecific: this.specificDeviceClass,\n\t\t\t});\n\t\t\tthis.setValue(ctx, ccsValue, this.supportedCCs);\n\t\t}\n\t\treturn true;\n\t}\n\n\t// The endpoint index must be overridden to be able to attribute the information to the correct endpoint\n\tpublic readonly genericDeviceClass: number;\n\tpublic readonly specificDeviceClass: number;\n\tpublic readonly supportedCCs: CommandClasses[];\n\tpublic readonly isDynamic: boolean;\n\tpublic readonly wasRemoved: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t(this.endpointIndex & 0b01111111)\n\t\t\t\t| (this.isDynamic ? 0b10000000 : 0),\n\t\t\t]),\n\t\t\tencodeApplicationNodeInformation(this),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"endpoint index\": this.endpointIndex,\n\t\t\t\t\"generic device class\": getGenericDeviceClass(\n\t\t\t\t\tthis.genericDeviceClass,\n\t\t\t\t).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericDeviceClass,\n\t\t\t\t\tthis.specificDeviceClass,\n\t\t\t\t).label,\n\t\t\t\t\"is dynamic end point\": this.isDynamic,\n\t\t\t\t\"supported CCs\": this.supportedCCs\n\t\t\t\t\t.map((cc) => `\\n\u00B7 ${getCCName(cc)}`)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCCapabilityGetOptions {\n\trequestedEndpoint: number;\n}\n\nfunction testResponseForMultiChannelCapabilityGet(\n\tsent: MultiChannelCCCapabilityGet,\n\treceived: MultiChannelCCCapabilityReport,\n) {\n\treturn received.endpointIndex === sent.requestedEndpoint;\n}\n\n@CCCommand(MultiChannelCommand.CapabilityGet)\n@expectedCCResponse(\n\tMultiChannelCCCapabilityReport,\n\ttestResponseForMultiChannelCapabilityGet,\n)\nexport class MultiChannelCCCapabilityGet extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCapabilityGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedEndpoint = options.requestedEndpoint;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCCapabilityGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst requestedEndpoint = raw.payload[0] & 0b01111111;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedEndpoint,\n\t\t});\n\t}\n\n\tpublic requestedEndpoint: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedEndpoint & 0b01111111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { endpoint: this.requestedEndpoint },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointFindReportOptions {\n\tgenericClass: number;\n\tspecificClass: number;\n\tfoundEndpoints: number[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointFindReport)\nexport class MultiChannelCCEndPointFindReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointFindReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.genericClass = options.genericClass;\n\t\tthis.specificClass = options.specificClass;\n\t\tthis.foundEndpoints = options.foundEndpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointFindReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst reportsToFollow = raw.payload[0];\n\t\tconst genericClass = raw.payload[1];\n\t\tconst specificClass = raw.payload[2];\n\n\t\t// Some devices omit the endpoint list although that is not allowed in the specs\n\t\t// therefore don't validatePayload here.\n\t\tconst foundEndpoints = [...raw.payload.subarray(3)]\n\t\t\t.map((e) => e & 0b01111111)\n\t\t\t.filter((e) => e !== 0);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\treportsToFollow,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t\tfoundEndpoints,\n\t\t});\n\t}\n\n\tpublic genericClass: number;\n\tpublic specificClass: number;\n\tpublic foundEndpoints: number[];\n\tpublic reportsToFollow: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.reportsToFollow,\n\t\t\t\tthis.genericClass,\n\t\t\t\tthis.specificClass,\n\t\t\t]),\n\t\t\tBytes.from(this.foundEndpoints.map((e) => e & 0b01111111)),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the requested device classes\n\t\treturn {\n\t\t\tgenericClass: this.genericClass,\n\t\t\tspecificClass: this.specificClass,\n\t\t};\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelCCEndPointFindReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of end points\n\t\tthis.foundEndpoints = [...partials, this]\n\t\t\t.map((report) => report.foundEndpoints)\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"generic device class\": getGenericDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t\tthis.specificClass,\n\t\t\t\t).label,\n\t\t\t\t\"found endpoints\": this.foundEndpoints.join(\", \"),\n\t\t\t\t\"# of reports to follow\": this.reportsToFollow,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointFindOptions {\n\tgenericClass: number;\n\tspecificClass: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointFind)\n@expectedCCResponse(MultiChannelCCEndPointFindReport)\nexport class MultiChannelCCEndPointFind extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointFindOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.genericClass = options.genericClass;\n\t\tthis.specificClass = options.specificClass;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointFind {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst genericClass = raw.payload[0];\n\t\tconst specificClass = raw.payload[1];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t});\n\t}\n\n\tpublic genericClass: number;\n\tpublic specificClass: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.genericClass, this.specificClass]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"generic device class\":\n\t\t\t\t\tgetGenericDeviceClass(this.genericClass).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t\tthis.specificClass,\n\t\t\t\t).label,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCAggregatedMembersReportOptions {\n\taggregatedEndpointIndex: number;\n\tmembers: number[];\n}\n\n@CCCommand(MultiChannelCommand.AggregatedMembersReport)\n@ccValueProperty(\n\t\"members\",\n\tMultiChannelCCValues.aggregatedEndpointMembers,\n\t(self) => [self.aggregatedEndpointIndex],\n)\nexport class MultiChannelCCAggregatedMembersReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCAggregatedMembersReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.aggregatedEndpointIndex = options.aggregatedEndpointIndex;\n\t\tthis.members = options.members;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCAggregatedMembersReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst aggregatedEndpointIndex = raw.payload[0] & 0b0111_1111;\n\t\tconst bitMaskLength = raw.payload[1];\n\t\tvalidatePayload(raw.payload.length >= 2 + bitMaskLength);\n\t\tconst bitMask = raw.payload.subarray(2, 2 + bitMaskLength);\n\t\tconst members = parseBitMask(bitMask);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\taggregatedEndpointIndex,\n\t\t\tmembers,\n\t\t});\n\t}\n\n\tpublic readonly aggregatedEndpointIndex: number;\n\n\tpublic readonly members: readonly number[];\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"aggregated endpoint\": this.aggregatedEndpointIndex,\n\t\t\t\tmembers: this.members.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCAggregatedMembersGetOptions {\n\trequestedEndpoint: number;\n}\n\n@CCCommand(MultiChannelCommand.AggregatedMembersGet)\n@expectedCCResponse(MultiChannelCCAggregatedMembersReport)\nexport class MultiChannelCCAggregatedMembersGet extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCAggregatedMembersGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedEndpoint = options.requestedEndpoint;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): MultiChannelCCAggregatedMembersGet {\n\t\t// TODO: Deserialize payload\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new MultiChannelCCAggregatedMembersGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic requestedEndpoint: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedEndpoint & 0b0111_1111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { endpoint: this.requestedEndpoint },\n\t\t};\n\t}\n}\n\ntype MultiChannelCCDestination = number | (1 | 2 | 3 | 4 | 5 | 6 | 7)[];\n\n// @publicAPI\nexport interface MultiChannelCCCommandEncapsulationOptions {\n\tencapsulated: CommandClass;\n\tdestination: MultiChannelCCDestination;\n}\n\n// SDS13783: A receiving node MAY respond to a Multi Channel encapsulated command if the Destination\n// End Point field specifies a single End Point. In that case, the response MUST be Multi Channel\n// encapsulated.\n// A receiving node MUST NOT respond to a Multi Channel encapsulated command if the\n// Destination End Point field specifies multiple End Points via bit mask addressing.\n\nfunction getCCResponseForCommandEncapsulation(\n\tsent: MultiChannelCCCommandEncapsulation,\n) {\n\tif (\n\t\ttypeof sent.destination === \"number\"\n\t\t&& sent.encapsulated.expectsCCResponse()\n\t) {\n\t\t// Allow both versions of the encapsulation command\n\t\t// Our implementation check is a bit too strict, so change the return type\n\t\treturn [\n\t\t\tMultiChannelCCCommandEncapsulation,\n\t\t\tMultiChannelCCV1CommandEncapsulation,\n\t\t] as any as (typeof MultiChannelCCCommandEncapsulation)[];\n\t}\n}\n\nfunction testResponseForCommandEncapsulation(\n\tsent: MultiChannelCCCommandEncapsulation,\n\treceived:\n\t\t| MultiChannelCCCommandEncapsulation\n\t\t| MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (\n\t\ttypeof sent.destination === \"number\"\n\t\t&& sent.destination === received.endpointIndex\n\t) {\n\t\treturn \"checkEncapsulated\";\n\t}\n\treturn false;\n}\n\n@CCCommand(MultiChannelCommand.CommandEncapsulation)\n@expectedCCResponse(\n\tgetCCResponseForCommandEncapsulation,\n\ttestResponseForCommandEncapsulation,\n)\nexport class MultiChannelCCCommandEncapsulation extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCommandEncapsulationOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.encapsulated = options.encapsulated;\n\t\tthis.encapsulated.encapsulatingCC = this as any;\n\t\t// Propagate the endpoint index all the way down\n\t\tlet cur: CommandClass = this;\n\t\twhile (cur) {\n\t\t\tif (isMultiEncapsulatingCommandClass(cur)) {\n\t\t\t\tfor (const cc of cur.encapsulated) {\n\t\t\t\t\tcc.endpointIndex = this.endpointIndex;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (isEncapsulatingCommandClass(cur)) {\n\t\t\t\tcur.encapsulated.endpointIndex = this.endpointIndex;\n\t\t\t\tcur = cur.encapsulated;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.destination = options.destination;\n\t}\n\n\tpublic static async from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): Promise<MultiChannelCCCommandEncapsulation> {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\n\t\tlet endpointIndex: number;\n\t\tlet destination: MultiChannelCCDestination;\n\n\t\tif (\n\t\t\tctx.getDeviceConfig?.(ctx.sourceNodeId)\n\t\t\t\t?.compat?.treatDestinationEndpointAsSource\n\t\t) {\n\t\t\t// This device incorrectly uses the destination field to indicate the source endpoint\n\t\t\tendpointIndex = raw.payload[1] & 0b0111_1111;\n\t\t\tdestination = 0;\n\t\t} else {\n\t\t\t// Parse normally\n\t\t\tendpointIndex = raw.payload[0] & 0b0111_1111;\n\t\t\tconst isBitMask = !!(raw.payload[1] & 0b1000_0000);\n\t\t\tdestination = raw.payload[1] & 0b0111_1111;\n\t\t\tif (isBitMask) {\n\t\t\t\tdestination = parseBitMask(\n\t\t\t\t\tBytes.from([destination]),\n\t\t\t\t) as any;\n\t\t\t}\n\t\t}\n\t\t// No need to validate further, each CC does it for itself\n\t\tconst encapsulated = await CommandClass.parse(\n\t\t\traw.payload.subarray(2),\n\t\t\tctx,\n\t\t);\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tdestination,\n\t\t\tencapsulated,\n\t\t});\n\t}\n\n\tpublic encapsulated: CommandClass;\n\t/** The destination end point (0-127) or an array of destination end points (1-7) */\n\tpublic destination: MultiChannelCCDestination;\n\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tif (\n\t\t\tctx.getDeviceConfig?.(this.nodeId as number)?.compat\n\t\t\t\t?.treatDestinationEndpointAsSource\n\t\t) {\n\t\t\t// This device incorrectly responds from the endpoint we've passed as our source endpoint\n\t\t\tif (typeof this.destination === \"number\") {\n\t\t\t\tthis.endpointIndex = this.destination;\n\t\t\t}\n\t\t}\n\n\t\tconst destination = typeof this.destination === \"number\"\n\t\t\t// The destination is a single number\n\t\t\t? this.destination & 0b0111_1111\n\t\t\t// The destination is a bit mask\n\t\t\t: encodeBitMask(this.destination, 7)[0] | 0b1000_0000;\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.endpointIndex & 0b0111_1111, destination]),\n\t\t\tawait this.encapsulated.serialize(ctx),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tsource: this.endpointIndex,\n\t\t\t\tdestination: typeof this.destination === \"number\"\n\t\t\t\t\t? this.destination\n\t\t\t\t\t: this.destination.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Multi Channel CC adds two bytes for the source and destination endpoint\n\t\treturn super.computeEncapsulationOverhead() + 2;\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1ReportOptions {\n\trequestedCC: CommandClasses;\n\tendpointCount: number;\n}\n\n@CCCommand(MultiChannelCommand.ReportV1)\nexport class MultiChannelCCV1Report extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1ReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.requestedCC = options.requestedCC;\n\t\tthis.endpointCount = options.endpointCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCV1Report {\n\t\t// V1 won't be extended in the future, so do an exact check\n\t\tvalidatePayload(raw.payload.length === 2);\n\t\tconst requestedCC: CommandClasses = raw.payload[0];\n\t\tconst endpointCount = raw.payload[1];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedCC,\n\t\t\tendpointCount,\n\t\t});\n\t}\n\n\tpublic readonly requestedCC: CommandClasses;\n\tpublic readonly endpointCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.requestedCC,\n\t\t\tthis.endpointCount,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tCC: getCCName(this.requestedCC),\n\t\t\t\t\"# of endpoints\": this.endpointCount,\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction testResponseForMultiChannelV1Get(\n\tsent: MultiChannelCCV1Get,\n\treceived: MultiChannelCCV1Report,\n) {\n\treturn sent.requestedCC === received.requestedCC;\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1GetOptions {\n\trequestedCC: CommandClasses;\n}\n\n@CCCommand(MultiChannelCommand.GetV1)\n@expectedCCResponse(MultiChannelCCV1Report, testResponseForMultiChannelV1Get)\nexport class MultiChannelCCV1Get extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1GetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedCC = options.requestedCC;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCV1Get {\n\t\t// V1 won't be extended in the future, so do an exact check\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst requestedCC: CommandClasses = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedCC,\n\t\t});\n\t}\n\n\tpublic requestedCC: CommandClasses;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedCC]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { CC: getCCName(this.requestedCC) },\n\t\t};\n\t}\n}\n\nfunction getResponseForV1CommandEncapsulation(\n\tsent: MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (sent.encapsulated.expectsCCResponse()) {\n\t\treturn MultiChannelCCV1CommandEncapsulation;\n\t}\n}\n\nfunction testResponseForV1CommandEncapsulation(\n\tsent: MultiChannelCCV1CommandEncapsulation,\n\treceived: MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (sent.endpointIndex === received.endpointIndex) {\n\t\treturn \"checkEncapsulated\";\n\t}\n\treturn false;\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1CommandEncapsulationOptions {\n\tencapsulated: CommandClass;\n}\n\n@CCCommand(MultiChannelCommand.CommandEncapsulationV1)\n@expectedCCResponse(\n\tgetResponseForV1CommandEncapsulation,\n\ttestResponseForV1CommandEncapsulation,\n)\nexport class MultiChannelCCV1CommandEncapsulation extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1CommandEncapsulationOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.encapsulated = options.encapsulated;\n\t\tthis.encapsulated.encapsulatingCC = this as any;\n\t\t// Propagate the endpoint index all the way down\n\t\tlet cur: CommandClass = this;\n\t\twhile (cur) {\n\t\t\tif (isMultiEncapsulatingCommandClass(cur)) {\n\t\t\t\tfor (const cc of cur.encapsulated) {\n\t\t\t\t\tcc.endpointIndex = this.endpointIndex;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (isEncapsulatingCommandClass(cur)) {\n\t\t\t\tcur.encapsulated.endpointIndex = this.endpointIndex;\n\t\t\t\tcur = cur.encapsulated;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static async from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): Promise<MultiChannelCCV1CommandEncapsulation> {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst endpointIndex = raw.payload[0];\n\n\t\t// Some devices send invalid reports, i.e. MultiChannelCCV1CommandEncapsulation, but with V2+ binary format\n\t\t// This would be a NoOp CC, but it makes no sense to encapsulate that.\n\t\tconst isV2withV1Header = raw.payload.length >= 2\n\t\t\t&& raw.payload[1] === 0x00;\n\n\t\t// No need to validate further, each CC does it for itself\n\t\tconst encapsulated = await CommandClass.parse(\n\t\t\traw.payload.subarray(isV2withV1Header ? 2 : 1),\n\t\t\tctx,\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tencapsulated,\n\t\t});\n\t}\n\n\tpublic encapsulated!: CommandClass;\n\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.endpointIndex]),\n\t\t\tawait this.encapsulated.serialize(ctx),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Multi Channel CC V1 adds one byte for the endpoint index\n\t\treturn super.computeEncapsulationOverhead() + 1;\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { source: this.endpointIndex },\n\t\t};\n\t}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAqBO;AACP,oBAAsB;AAEtB,oBAAyB;AACzB,iBAAsB;AACtB,0BAMO;AACP,oCAQO;AACP,uCAGO;AACP,oBAAkB;AAClB,mBAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EpC,SAAS,wBACR,KACA,QACA,iBAAyB;AAGzB,QAAM,gBAAgB,oBAAI,IAAG;AAO7B,aAAW,YAAY,iBAAiB;AACvC,UAAM,kBAAkB,+CAAqB,oBAC3C,SAAS,QAAQ;AACnB,UAAM,cAAc,IAAI,WAAW,MAAM,EAAE,SAGxC,eAAe;AAClB,QAAI,aAAa;AAChB,oBAAc,IAAI,UAAU;QAC3B,SAAS,YAAY;QACrB,UAAU,YAAY;OACtB;IACF;EACD;AAGA,QAAM,4BAAwB,wBAC7B,CAAC,GAAG,cAAc,OAAM,CAAE,EAAE,IAC3B,CAAC,EAAE,SAAS,SAAQ,MAAO,UAAU,MAAM,QAAQ,CACnD;AAEF,MAAI,sBAAsB,WAAW,gBAAgB,QAAQ;AAE5D,WAAO;EACR;AAGA,QAAM,0BAA0B;IAC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C;AACvC,YAAM,gBAAgB,IAAI,QAAQ,CAAC;AAInC,YAAM,mBAAmB,IAAI,QAAQ,UAAU,KAC3C,IAAI,QAAQ,CAAC,MAAM;AAGvB,YAAM,eAAe,MAAM,iCAAa,MACvC,IAAI,QAAQ,SAAS,mBAAmB,IAAI,CAAC,GAC7C,GAAG;AAGJ,aAAO,IAAI,KAAK;QACf,QAAQ,IAAI;QACZ;QACA;OACA;IACF;IAEO;IAEA,MAAM,UAAU,KAAsB;AAC5C,WAAK,UAAU,oBAAM,OAAO;QAC3B,oBAAM,KAAK,CAAC,KAAK,aAAa,CAAC;QAC/B,MAAM,KAAK,aAAa,UAAU,GAAG;OACrC;AACD,aAAO,MAAM,UAAU,GAAG;IAC3B;IAEU,+BAA4B;AAErC,aAAO,MAAM,6BAA4B,IAAK;IAC/C;IAEO,WAAW,KAAgB;AACjC,aAAO;QACN,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,QAAQ,KAAK,cAAa;;IAEvC;;;;",
|
|
4
|
+
"sourcesContent": ["import type { CCEncodingContext, CCParsingContext } from \"@zwave-js/cc\";\nimport {\n\ttype ApplicationNodeInformation,\n\tCommandClasses,\n\ttype GenericDeviceClass,\n\ttype GetNode,\n\ttype GetValueDB,\n\ttype MaybeNotKnown,\n\ttype MessageOrCCLogEntry,\n\tMessagePriority,\n\ttype MessageRecord,\n\ttype NodeId,\n\ttype SpecificDeviceClass,\n\ttype SupportsCC,\n\ttype WithAddress,\n\tZWaveError,\n\tZWaveErrorCodes,\n\tencodeApplicationNodeInformation,\n\tencodeBitMask,\n\tgetCCName,\n\tgetGenericDeviceClass,\n\tgetSpecificDeviceClass,\n\tparseApplicationNodeInformation,\n\tparseBitMask,\n\tvalidatePayload,\n} from \"@zwave-js/core\";\nimport { Bytes } from \"@zwave-js/shared\";\nimport { validateArgs } from \"@zwave-js/transformers\";\nimport { distinct } from \"alcalzone-shared/arrays\";\nimport { CCAPI } from \"../lib/API.js\";\nimport {\n\ttype CCRaw,\n\tCommandClass,\n\ttype InterviewContext,\n\ttype PersistValuesContext,\n\tgetEffectiveCCVersion,\n} from \"../lib/CommandClass.js\";\nimport {\n\tAPI,\n\tCCCommand,\n\tccValueProperty,\n\tccValues,\n\tcommandClass,\n\texpectedCCResponse,\n\timplementedVersion,\n} from \"../lib/CommandClassDecorators.js\";\nimport {\n\tisEncapsulatingCommandClass,\n\tisMultiEncapsulatingCommandClass,\n} from \"../lib/EncapsulatingCommandClass.js\";\nimport { V } from \"../lib/Values.js\";\nimport { MultiChannelCommand } from \"../lib/_Types.js\";\n\n// TODO: Handle removal reports of dynamic endpoints\n\nexport const MultiChannelCCValues = V.defineCCValues(\n\tCommandClasses[\"Multi Channel\"],\n\t{\n\t\t...V.staticProperty(\"endpointIndizes\", undefined, {\n\t\t\tinternal: true,\n\t\t\tsupportsEndpoints: false,\n\t\t}),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"individualEndpointCount\",\n\t\t\t\"individualCount\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"aggregatedEndpointCount\",\n\t\t\t\"aggregatedCount\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointCountIsDynamic\",\n\t\t\t\"countIsDynamic\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointsHaveIdenticalCapabilities\",\n\t\t\t\"identicalCapabilities\",\n\t\t\tundefined,\n\t\t\t{\n\t\t\t\tinternal: true,\n\t\t\t\tsupportsEndpoints: false,\n\t\t\t},\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointCCs\",\n\t\t\t\"commandClasses\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.staticPropertyWithName(\n\t\t\t\"endpointDeviceClass\",\n\t\t\t\"deviceClass\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t\t...V.dynamicPropertyAndKeyWithName(\n\t\t\t\"aggregatedEndpointMembers\",\n\t\t\t\"members\",\n\t\t\t(endpointIndex: number) => endpointIndex,\n\t\t\t({ property, propertyKey }) =>\n\t\t\t\tproperty === \"members\" && typeof propertyKey === \"number\",\n\t\t\tundefined,\n\t\t\t{ internal: true },\n\t\t),\n\t},\n);\n\n// @noSetValueAPI\n\n/**\n * Many devices unnecessarily use endpoints when they could (or do) provide all functionality via the root device.\n * This function gives an estimate if this is the case (i.e. all endpoints have a different device class)\n */\nfunction areEndpointsUnnecessary(\n\tctx: GetValueDB,\n\tnodeId: number,\n\tendpointIndizes: number[],\n): boolean {\n\t// Gather all device classes\n\tconst deviceClasses = new Map<\n\t\tnumber,\n\t\t{\n\t\t\tgeneric: number;\n\t\t\tspecific: number;\n\t\t}\n\t>();\n\tfor (const endpoint of endpointIndizes) {\n\t\tconst devClassValueId = MultiChannelCCValues.endpointDeviceClass\n\t\t\t.endpoint(endpoint);\n\t\tconst deviceClass = ctx.getValueDB(nodeId).getValue<{\n\t\t\tgeneric: number;\n\t\t\tspecific: number;\n\t\t}>(devClassValueId);\n\t\tif (deviceClass) {\n\t\t\tdeviceClasses.set(endpoint, {\n\t\t\t\tgeneric: deviceClass.generic,\n\t\t\t\tspecific: deviceClass.specific,\n\t\t\t});\n\t\t}\n\t}\n\n\t// Endpoints may be useless if all of them have different device classes\n\tconst distinctDeviceClasses = distinct(\n\t\t[...deviceClasses.values()].map(\n\t\t\t({ generic, specific }) => generic * 256 + specific,\n\t\t),\n\t);\n\tif (distinctDeviceClasses.length !== endpointIndizes.length) {\n\t\t// There are endpoints with the same device class, so they are not unnecessary\n\t\treturn false;\n\t}\n\n\t// Endpoints are necessary if more than 1 of them has a switch-type device class\n\tconst switchTypeDeviceClasses = new Set([\n\t\t0x10, // Binary Switch\n\t\t0x11, // Multilevel Switch\n\t\t0x12, // Remote Switch\n\t\t0x13, // Toggle Switch\n\t]);\n\tconst numSwitchEndpoints = [...deviceClasses.values()].filter(\n\t\t({ generic }) => switchTypeDeviceClasses.has(generic),\n\t).length;\n\tif (numSwitchEndpoints > 1) return false;\n\n\treturn true;\n}\n\n@API(CommandClasses[\"Multi Channel\"])\nexport class MultiChannelCCAPI extends CCAPI {\n\tpublic supportsCommand(cmd: MultiChannelCommand): MaybeNotKnown<boolean> {\n\t\tswitch (cmd) {\n\t\t\t// Legacy commands:\n\t\t\tcase MultiChannelCommand.GetV1:\n\t\t\t\treturn this.isSinglecast() && this.version === 1;\n\t\t\tcase MultiChannelCommand.CommandEncapsulationV1:\n\t\t\t\treturn this.version === 1;\n\n\t\t\t// The specs start at version 3 but according to OZW,\n\t\t\t// these do seem to be supported in version 2\n\t\t\tcase MultiChannelCommand.EndPointGet:\n\t\t\tcase MultiChannelCommand.CapabilityGet:\n\t\t\t\treturn this.version >= 2 && this.isSinglecast();\n\t\t\tcase MultiChannelCommand.CommandEncapsulation:\n\t\t\t\treturn this.version >= 2;\n\t\t\tcase MultiChannelCommand.EndPointFind:\n\t\t\t\treturn this.version >= 3 && this.isSinglecast();\n\t\t\tcase MultiChannelCommand.AggregatedMembersGet:\n\t\t\t\treturn this.version >= 4 && this.isSinglecast();\n\t\t}\n\t\treturn super.supportsCommand(cmd);\n\t}\n\n\t// oxlint-disable-next-line typescript/explicit-module-boundary-types\n\tpublic async getEndpoints() {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.EndPointGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCEndPointGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCEndPointReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\treturn {\n\t\t\t\tisDynamicEndpointCount: response.countIsDynamic,\n\t\t\t\tidenticalCapabilities: response.identicalCapabilities,\n\t\t\t\tindividualEndpointCount: response.individualCount,\n\t\t\t\taggregatedEndpointCount: response.aggregatedCount,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async getEndpointCapabilities(\n\t\tendpoint: number,\n\t): Promise<MaybeNotKnown<EndpointCapability>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CapabilityGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCCapabilityGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\trequestedEndpoint: endpoint,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCCapabilityReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\tif (response) {\n\t\t\tconst generic = getGenericDeviceClass(\n\t\t\t\tresponse.genericDeviceClass,\n\t\t\t);\n\t\t\tconst specific = getSpecificDeviceClass(\n\t\t\t\tresponse.genericDeviceClass,\n\t\t\t\tresponse.specificDeviceClass,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tisDynamic: response.isDynamic,\n\t\t\t\twasRemoved: response.wasRemoved,\n\t\t\t\tsupportedCCs: response.supportedCCs,\n\t\t\t\tgeneric,\n\t\t\t\tspecific,\n\t\t\t};\n\t\t}\n\t}\n\n\t@validateArgs()\n\tpublic async findEndpoints(\n\t\tgenericClass: number,\n\t\tspecificClass: number,\n\t): Promise<MaybeNotKnown<readonly number[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.EndPointFind,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCEndPointFind({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCEndPointFindReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.foundEndpoints;\n\t}\n\n\t@validateArgs()\n\tpublic async getAggregatedMembers(\n\t\tendpoint: number,\n\t): Promise<MaybeNotKnown<readonly number[]>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.AggregatedMembersGet,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCAggregatedMembersGet({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tendpointIndex: this.endpoint.index,\n\t\t\trequestedEndpoint: endpoint,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCAggregatedMembersReport\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.members;\n\t}\n\n\t// Encapsulation is used internally and too frequently that we\n\t// want to pay the cost of validating each call\n\t// eslint-disable-next-line @zwave-js/ccapi-validate-args\n\tpublic async sendEncapsulated(\n\t\toptions: MultiChannelCCCommandEncapsulationOptions,\n\t): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CommandEncapsulation,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCCommandEncapsulation({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\t...options,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n\n\t@validateArgs()\n\tpublic async getEndpointCountV1(\n\t\tccId: CommandClasses,\n\t): Promise<MaybeNotKnown<number>> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.GetV1,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCV1Get({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\trequestedCC: ccId,\n\t\t});\n\t\tconst response = await this.host.sendCommand<\n\t\t\tMultiChannelCCV1Report\n\t\t>(\n\t\t\tcc,\n\t\t\tthis.commandOptions,\n\t\t);\n\t\treturn response?.endpointCount;\n\t}\n\n\t// Encapsulation is used internally and too frequently that we\n\t// want to pay the cost of validating each call\n\t// eslint-disable-next-line @zwave-js/ccapi-validate-args\n\tpublic async sendEncapsulatedV1(encapsulated: CommandClass): Promise<void> {\n\t\tthis.assertSupportsCommand(\n\t\t\tMultiChannelCommand,\n\t\t\tMultiChannelCommand.CommandEncapsulationV1,\n\t\t);\n\n\t\tconst cc = new MultiChannelCCV1CommandEncapsulation({\n\t\t\tnodeId: this.endpoint.nodeId,\n\t\t\tencapsulated,\n\t\t});\n\t\tawait this.host.sendCommand(cc, this.commandOptions);\n\t}\n}\n\nexport interface EndpointCapability {\n\tgeneric: GenericDeviceClass;\n\tspecific: SpecificDeviceClass;\n\tsupportedCCs: CommandClasses[];\n\tisDynamic: boolean;\n\twasRemoved: boolean;\n}\n\n@commandClass(CommandClasses[\"Multi Channel\"])\n@implementedVersion(4)\n@ccValues(MultiChannelCCValues)\nexport class MultiChannelCC extends CommandClass {\n\tdeclare ccCommand: MultiChannelCommand;\n\n\t/** Tests if a command targets a specific endpoint and thus requires encapsulation */\n\tpublic static requiresEncapsulation(cc: CommandClass): boolean {\n\t\treturn (\n\t\t\tcc.endpointIndex !== 0\n\t\t\t&& !(cc instanceof MultiChannelCCCommandEncapsulation)\n\t\t\t&& !(cc instanceof MultiChannelCCV1CommandEncapsulation)\n\t\t);\n\t}\n\n\t/** Encapsulates a command that targets a specific endpoint, with version 2+ of the Multi Channel CC */\n\tpublic static encapsulate(\n\t\tcc: CommandClass,\n\t): MultiChannelCCCommandEncapsulation {\n\t\tconst ret = new MultiChannelCCCommandEncapsulation({\n\t\t\tnodeId: cc.nodeId,\n\t\t\tencapsulated: cc,\n\t\t\tdestination: cc.endpointIndex,\n\t\t});\n\n\t\t// Copy the encapsulation flags from the encapsulated command\n\t\tret.encapsulationFlags = cc.encapsulationFlags;\n\n\t\treturn ret;\n\t}\n\n\t/** Encapsulates a command that targets a specific endpoint, with version 1 of the Multi Channel CC */\n\tpublic static encapsulateV1(\n\t\tcc: CommandClass,\n\t): MultiChannelCCV1CommandEncapsulation {\n\t\tconst ret = new MultiChannelCCV1CommandEncapsulation({\n\t\t\tnodeId: cc.nodeId,\n\t\t\tendpointIndex: cc.endpointIndex,\n\t\t\tencapsulated: cc,\n\t\t});\n\n\t\t// Copy the encapsulation flags from the encapsulated command\n\t\tret.encapsulationFlags = cc.encapsulationFlags;\n\n\t\treturn ret;\n\t}\n\n\tpublic skipEndpointInterview(): boolean {\n\t\t// The endpoints are discovered by querying the root device\n\t\treturn true;\n\t}\n\n\tpublic async interview(ctx: InterviewContext): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\n\t\tconst removeEndpoints = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t?.removeEndpoints;\n\t\tif (removeEndpoints === \"*\") {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`Skipping ${this.ccName} interview b/c all endpoints are ignored by the device config file...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: `Interviewing ${this.ccName}...`,\n\t\t\tdirection: \"none\",\n\t\t});\n\n\t\t// Special interview procedure for legacy nodes\n\t\tconst ccVersion = getEffectiveCCVersion(ctx, this);\n\t\tif (ccVersion === 1) return this.interviewV1(ctx);\n\n\t\tconst endpoint = node.getEndpoint(this.endpointIndex)!;\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t).withOptions({\n\t\t\tpriority: MessagePriority.NodeQuery,\n\t\t});\n\t\tconst valueDB = this.getValueDB(ctx);\n\n\t\t// Step 1: Retrieve general information about end points\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: \"querying device endpoint information...\",\n\t\t\tdirection: \"outbound\",\n\t\t});\n\t\tconst multiResponse = await api.getEndpoints();\n\t\tif (!multiResponse) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t\"Querying device endpoint information timed out, aborting interview...\",\n\t\t\t\tlevel: \"warn\",\n\t\t\t});\n\t\t\treturn this.throwMissingCriticalInterviewResponse();\n\t\t}\n\n\t\tlet logMessage = `received response for device endpoints:\nendpoint count (individual): ${multiResponse.individualEndpointCount}\ncount is dynamic: ${multiResponse.isDynamicEndpointCount}\nidentical capabilities: ${multiResponse.identicalCapabilities}`;\n\t\tif (multiResponse.aggregatedEndpointCount != undefined) {\n\t\t\tlogMessage +=\n\t\t\t\t`\\nendpoint count (aggregated): ${multiResponse.aggregatedEndpointCount}`;\n\t\t}\n\t\tctx.logNode(node.id, {\n\t\t\tendpoint: this.endpointIndex,\n\t\t\tmessage: logMessage,\n\t\t\tdirection: \"inbound\",\n\t\t});\n\n\t\tlet allEndpoints: number[] = [];\n\t\tconst addSequentialEndpoints = (): void => {\n\t\t\tfor (\n\t\t\t\tlet i = 1;\n\t\t\t\ti\n\t\t\t\t\t<= multiResponse.individualEndpointCount\n\t\t\t\t\t\t+ (multiResponse.aggregatedEndpointCount ?? 0);\n\t\t\t\ti++\n\t\t\t) {\n\t\t\t\tallEndpoints.push(i);\n\t\t\t}\n\t\t};\n\t\tif (api.supportsCommand(MultiChannelCommand.EndPointFind)) {\n\t\t\t// Step 2a: Find all endpoints\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: \"querying all endpoints...\",\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\n\t\t\tconst foundEndpoints = await api.findEndpoints(0xff, 0xff);\n\t\t\tif (foundEndpoints) allEndpoints.push(...foundEndpoints);\n\t\t\tif (!allEndpoints.length) {\n\t\t\t\t// Create a sequential list of endpoints\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoint query returned no results, assuming that endpoints are sequential`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t\taddSequentialEndpoints();\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: `received endpoints: ${\n\t\t\t\t\t\tallEndpoints\n\t\t\t\t\t\t\t.map(String)\n\t\t\t\t\t\t\t.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\t// Step 2b: Assume that the endpoints are in sequential order\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`does not support EndPointFind, assuming that endpoints are sequential`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\taddSequentialEndpoints();\n\t\t}\n\n\t\t// Step 2.5: remove ignored endpoints\n\t\tif (removeEndpoints?.length) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`The following endpoints are ignored through the config file: ${\n\t\t\t\t\t\tremoveEndpoints.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\tallEndpoints = allEndpoints.filter(\n\t\t\t\t(e) => !removeEndpoints.includes(e),\n\t\t\t);\n\t\t}\n\n\t\t// Step 3: Query endpoints\n\t\tlet hasQueriedCapabilities = false;\n\t\tfor (const endpoint of allEndpoints) {\n\t\t\tif (\n\t\t\t\tendpoint > multiResponse.individualEndpointCount\n\t\t\t\t&& ccVersion >= 4\n\t\t\t) {\n\t\t\t\t// Find members of aggregated end point\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`querying members of aggregated endpoint #${endpoint}...`,\n\t\t\t\t\tdirection: \"outbound\",\n\t\t\t\t});\n\t\t\t\tconst members = await api.getAggregatedMembers(endpoint);\n\t\t\t\tif (members) {\n\t\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t`aggregated endpoint #${endpoint} has members ${\n\t\t\t\t\t\t\t\tmembers\n\t\t\t\t\t\t\t\t\t.map(String)\n\t\t\t\t\t\t\t\t\t.join(\", \")\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// When the device reports identical capabilities for all endpoints,\n\t\t\t// we don't need to query them all\n\t\t\tif (multiResponse.identicalCapabilities && hasQueriedCapabilities) {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`all endpoints identical, skipping capability query for endpoint #${endpoint}...`,\n\t\t\t\t\tdirection: \"none\",\n\t\t\t\t});\n\n\t\t\t\t// copy the capabilities from the first endpoint\n\t\t\t\tconst devClass = valueDB.getValue(\n\t\t\t\t\tMultiChannelCCValues.endpointDeviceClass.endpoint(\n\t\t\t\t\t\tallEndpoints[0],\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointDeviceClass.endpoint(endpoint),\n\t\t\t\t\tdevClass,\n\t\t\t\t);\n\t\t\t\tconst ep1Caps = valueDB.getValue<CommandClasses[]>(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(allEndpoints[0]),\n\t\t\t\t)!;\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(endpoint),\n\t\t\t\t\t[...ep1Caps],\n\t\t\t\t);\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage: `querying capabilities for endpoint #${endpoint}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst caps = await api.getEndpointCapabilities(endpoint);\n\t\t\tif (caps) {\n\t\t\t\thasQueriedCapabilities = true;\n\t\t\t\tlogMessage =\n\t\t\t\t\t`received response for endpoint capabilities (#${endpoint}):\ngeneric device class: ${caps.generic.label}\nspecific device class: ${caps.specific.label}\nis dynamic end point: ${caps.isDynamic}\nsupported CCs:`;\n\t\t\t\tfor (const cc of caps.supportedCCs) {\n\t\t\t\t\tlogMessage += `\\n \u00B7 ${getCCName(cc)}`;\n\t\t\t\t}\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage: logMessage,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Querying endpoint #${endpoint} capabilities timed out, aborting interview...`,\n\t\t\t\t\tlevel: \"warn\",\n\t\t\t\t});\n\t\t\t\treturn this.throwMissingCriticalInterviewResponse();\n\t\t\t}\n\t\t}\n\n\t\t// Now that all endpoints have been interviewed, remember which ones are there\n\t\t// But first figure out if they seem unnecessary and if they do, which ones should be preserved\n\t\tif (\n\t\t\t!multiResponse.identicalCapabilities\n\t\t\t&& areEndpointsUnnecessary(ctx, node.id, allEndpoints)\n\t\t) {\n\t\t\tconst preserve = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t\t?.preserveEndpoints;\n\t\t\tif (!preserve) {\n\t\t\t\tallEndpoints = [];\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoints seem unnecessary b/c they have different device classes, ignoring all...`,\n\t\t\t\t});\n\t\t\t} else if (preserve === \"*\") {\n\t\t\t\t// preserve all endpoints, do nothing\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t`Endpoints seem unnecessary, but are configured to be preserved.`,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tallEndpoints = allEndpoints.filter((ep) =>\n\t\t\t\t\tpreserve.includes(ep)\n\t\t\t\t);\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage: `Endpoints seem unnecessary, but endpoints ${\n\t\t\t\t\t\tallEndpoints.join(\n\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t)\n\t\t\t\t\t} are configured to be preserved.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointIndizes,\n\t\t\tallEndpoints,\n\t\t);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n\n\tprivate async interviewV1(ctx: InterviewContext): Promise<void> {\n\t\tconst node = this.getNode(ctx)!;\n\t\tconst endpoint = this.getEndpoint(ctx)!;\n\t\tconst removeEndpoints = ctx.getDeviceConfig?.(node.id)?.compat\n\t\t\t?.removeEndpoints;\n\t\tif (removeEndpoints === \"*\") {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`Skipping ${this.ccName} interview b/c all endpoints are ignored by the device config file...`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst api = CCAPI.create(\n\t\t\tCommandClasses[\"Multi Channel\"],\n\t\t\tctx,\n\t\t\tendpoint,\n\t\t);\n\t\tconst valueDB = this.getValueDB(ctx);\n\n\t\t// V1 works the opposite way - we scan all CCs and remember how many\n\t\t// endpoints they have\n\t\tconst supportedCCs = [...node.getCCs()]\n\t\t\t// Don't query CCs the node only controls\n\t\t\t.filter(([, info]) => info.isSupported)\n\t\t\t.map(([cc]) => cc)\n\t\t\t// Don't query CCs that want to skip the endpoint interview\n\t\t\t.filter(\n\t\t\t\t(cc) =>\n\t\t\t\t\t!CommandClass.createInstanceUnchecked(\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tcc,\n\t\t\t\t\t)?.skipEndpointInterview(),\n\t\t\t);\n\t\tconst endpointCounts = new Map<CommandClasses, number>();\n\t\tfor (const ccId of supportedCCs) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tmessage: `Querying endpoint count for CommandClass ${\n\t\t\t\t\tgetCCName(\n\t\t\t\t\t\tccId,\n\t\t\t\t\t)\n\t\t\t\t}...`,\n\t\t\t\tdirection: \"outbound\",\n\t\t\t});\n\t\t\tconst endpointCount = await api.getEndpointCountV1(ccId);\n\t\t\tif (endpointCount != undefined) {\n\t\t\t\tendpointCounts.set(ccId, endpointCount);\n\n\t\t\t\tctx.logNode(node.id, {\n\t\t\t\t\tmessage: `CommandClass ${\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} has ${endpointCount} endpoints`,\n\t\t\t\t\tdirection: \"inbound\",\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Store the collected information\n\t\t// We have only individual and no dynamic and no aggregated endpoints\n\t\tconst numEndpoints = Math.max(...endpointCounts.values());\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointCountIsDynamic,\n\t\t\tfalse,\n\t\t);\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.aggregatedEndpointCount,\n\t\t\t0,\n\t\t);\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.individualEndpointCount,\n\t\t\tnumEndpoints,\n\t\t);\n\t\t// Since we queried all CCs separately, we can assume that all\n\t\t// endpoints have different capabilities\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointsHaveIdenticalCapabilities,\n\t\t\tfalse,\n\t\t);\n\n\t\tif (removeEndpoints?.length) {\n\t\t\tctx.logNode(node.id, {\n\t\t\t\tendpoint: this.endpointIndex,\n\t\t\t\tmessage:\n\t\t\t\t\t`The following endpoints are ignored through the config file: ${\n\t\t\t\t\t\tremoveEndpoints.join(\", \")\n\t\t\t\t\t}`,\n\t\t\t\tdirection: \"none\",\n\t\t\t});\n\t\t}\n\n\t\tconst allEndpoints: number[] = [];\n\t\tfor (let endpoint = 1; endpoint <= numEndpoints; endpoint++) {\n\t\t\t// Skip this endpoint if flagged for removal\n\t\t\tif (!removeEndpoints?.includes(endpoint)) {\n\t\t\t\t// Check which CCs exist on this endpoint\n\t\t\t\tconst endpointCCs = [...endpointCounts.entries()]\n\t\t\t\t\t.filter(([, ccEndpoints]) => ccEndpoints >= endpoint)\n\t\t\t\t\t.map(([ccId]) => ccId);\n\t\t\t\t// And store it per endpoint\n\t\t\t\tvalueDB.setValue(\n\t\t\t\t\tMultiChannelCCValues.endpointCCs.endpoint(endpoint),\n\t\t\t\t\tendpointCCs,\n\t\t\t\t);\n\t\t\t\tallEndpoints.push(endpoint);\n\t\t\t}\n\t\t}\n\t\tthis.setValue(\n\t\t\tctx,\n\t\t\tMultiChannelCCValues.endpointIndizes,\n\t\t\tallEndpoints,\n\t\t);\n\n\t\t// Remember that the interview is complete\n\t\tthis.setInterviewComplete(ctx, true);\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointReportOptions {\n\tcountIsDynamic: boolean;\n\tidenticalCapabilities: boolean;\n\tindividualCount: number;\n\taggregatedCount?: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointReport)\n@ccValueProperty(\"countIsDynamic\", MultiChannelCCValues.endpointCountIsDynamic)\n@ccValueProperty(\n\t\"identicalCapabilities\",\n\tMultiChannelCCValues.endpointsHaveIdenticalCapabilities,\n)\n@ccValueProperty(\n\t\"individualCount\",\n\tMultiChannelCCValues.individualEndpointCount,\n)\n@ccValueProperty(\n\t\"aggregatedCount\",\n\tMultiChannelCCValues.aggregatedEndpointCount,\n)\nexport class MultiChannelCCEndPointReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.countIsDynamic = options.countIsDynamic;\n\t\tthis.identicalCapabilities = options.identicalCapabilities;\n\t\tthis.individualCount = options.individualCount;\n\t\tthis.aggregatedCount = options.aggregatedCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst countIsDynamic = !!(raw.payload[0] & 0b10000000);\n\t\tconst identicalCapabilities = !!(raw.payload[0] & 0b01000000);\n\t\tconst individualCount = raw.payload[1] & 0b01111111;\n\t\tlet aggregatedCount: MaybeNotKnown<number>;\n\n\t\tif (raw.payload.length >= 3) {\n\t\t\taggregatedCount = raw.payload[2] & 0b01111111;\n\t\t}\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tcountIsDynamic,\n\t\t\tidenticalCapabilities,\n\t\t\tindividualCount,\n\t\t\taggregatedCount,\n\t\t});\n\t}\n\n\tpublic countIsDynamic: boolean;\n\n\tpublic identicalCapabilities: boolean;\n\n\tpublic individualCount: number;\n\n\tpublic aggregatedCount: MaybeNotKnown<number>;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\t(this.countIsDynamic ? 0b10000000 : 0)\n\t\t\t| (this.identicalCapabilities ? 0b01000000 : 0),\n\t\t\tthis.individualCount & 0b01111111,\n\t\t\tthis.aggregatedCount ?? 0,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\tconst message: MessageRecord = {\n\t\t\t\"endpoint count (individual)\": this.individualCount,\n\t\t\t\"count is dynamic\": this.countIsDynamic,\n\t\t\t\"identical capabilities\": this.identicalCapabilities,\n\t\t};\n\t\tif (this.aggregatedCount != undefined) {\n\t\t\tmessage[\"endpoint count (aggregated)\"] = this.aggregatedCount;\n\t\t}\n\t\tconst ret = {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage,\n\t\t};\n\t\treturn ret;\n\t}\n}\n\n@CCCommand(MultiChannelCommand.EndPointGet)\n@expectedCCResponse(MultiChannelCCEndPointReport)\nexport class MultiChannelCCEndPointGet extends MultiChannelCC {}\n\n// @publicAPI\nexport interface MultiChannelCCCapabilityReportOptions {\n\tendpointIndex: number;\n\tgenericDeviceClass: number;\n\tspecificDeviceClass: number;\n\tsupportedCCs: CommandClasses[];\n\tisDynamic: boolean;\n\twasRemoved: boolean;\n}\n\n@CCCommand(MultiChannelCommand.CapabilityReport)\nexport class MultiChannelCCCapabilityReport extends MultiChannelCC\n\timplements ApplicationNodeInformation\n{\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCapabilityReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.endpointIndex = options.endpointIndex;\n\t\tthis.genericDeviceClass = options.genericDeviceClass;\n\t\tthis.specificDeviceClass = options.specificDeviceClass;\n\t\tthis.supportedCCs = options.supportedCCs;\n\t\tthis.isDynamic = options.isDynamic;\n\t\tthis.wasRemoved = options.wasRemoved;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCCapabilityReport {\n\t\t// Only validate the bytes we expect to see here\n\t\t// parseApplicationNodeInformation does its own validation\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst endpointIndex = raw.payload[0] & 0b01111111;\n\t\tconst isDynamic = !!(raw.payload[0] & 0b10000000);\n\t\tconst NIF = parseApplicationNodeInformation(\n\t\t\traw.payload.subarray(1),\n\t\t);\n\t\tconst genericDeviceClass = NIF.genericDeviceClass;\n\t\tconst specificDeviceClass = NIF.specificDeviceClass;\n\t\tconst supportedCCs: CommandClasses[] = NIF.supportedCCs;\n\n\t\t// Removal reports have very specific information\n\t\tconst wasRemoved: boolean = isDynamic\n\t\t\t&& genericDeviceClass === 0xff // \"Non-Interoperable\"\n\t\t\t&& specificDeviceClass === 0x00;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tisDynamic,\n\t\t\tgenericDeviceClass,\n\t\t\tspecificDeviceClass,\n\t\t\tsupportedCCs,\n\t\t\twasRemoved,\n\t\t});\n\t}\n\n\tpublic persistValues(ctx: PersistValuesContext): boolean {\n\t\tif (!super.persistValues(ctx)) return false;\n\n\t\tconst deviceClassValue = MultiChannelCCValues.endpointDeviceClass;\n\t\tconst ccsValue = MultiChannelCCValues.endpointCCs;\n\n\t\tif (this.wasRemoved) {\n\t\t\tthis.removeValue(ctx, deviceClassValue);\n\t\t\tthis.removeValue(ctx, ccsValue);\n\t\t} else {\n\t\t\tthis.setValue(ctx, deviceClassValue, {\n\t\t\t\tgeneric: this.genericDeviceClass,\n\t\t\t\tspecific: this.specificDeviceClass,\n\t\t\t});\n\t\t\tthis.setValue(ctx, ccsValue, this.supportedCCs);\n\t\t}\n\t\treturn true;\n\t}\n\n\t// The endpoint index must be overridden to be able to attribute the information to the correct endpoint\n\tpublic readonly genericDeviceClass: number;\n\tpublic readonly specificDeviceClass: number;\n\tpublic readonly supportedCCs: CommandClasses[];\n\tpublic readonly isDynamic: boolean;\n\tpublic readonly wasRemoved: boolean;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\t(this.endpointIndex & 0b01111111)\n\t\t\t\t| (this.isDynamic ? 0b10000000 : 0),\n\t\t\t]),\n\t\t\tencodeApplicationNodeInformation(this),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"endpoint index\": this.endpointIndex,\n\t\t\t\t\"generic device class\": getGenericDeviceClass(\n\t\t\t\t\tthis.genericDeviceClass,\n\t\t\t\t).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericDeviceClass,\n\t\t\t\t\tthis.specificDeviceClass,\n\t\t\t\t).label,\n\t\t\t\t\"is dynamic end point\": this.isDynamic,\n\t\t\t\t\"supported CCs\": this.supportedCCs\n\t\t\t\t\t.map((cc) => `\\n\u00B7 ${getCCName(cc)}`)\n\t\t\t\t\t.join(\"\"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCCapabilityGetOptions {\n\trequestedEndpoint: number;\n}\n\nfunction testResponseForMultiChannelCapabilityGet(\n\tsent: MultiChannelCCCapabilityGet,\n\treceived: MultiChannelCCCapabilityReport,\n) {\n\treturn received.endpointIndex === sent.requestedEndpoint;\n}\n\n@CCCommand(MultiChannelCommand.CapabilityGet)\n@expectedCCResponse(\n\tMultiChannelCCCapabilityReport,\n\ttestResponseForMultiChannelCapabilityGet,\n)\nexport class MultiChannelCCCapabilityGet extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCapabilityGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedEndpoint = options.requestedEndpoint;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCCapabilityGet {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst requestedEndpoint = raw.payload[0] & 0b01111111;\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedEndpoint,\n\t\t});\n\t}\n\n\tpublic requestedEndpoint: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedEndpoint & 0b01111111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { endpoint: this.requestedEndpoint },\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointFindReportOptions {\n\tgenericClass: number;\n\tspecificClass: number;\n\tfoundEndpoints: number[];\n\treportsToFollow: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointFindReport)\nexport class MultiChannelCCEndPointFindReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointFindReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\tthis.genericClass = options.genericClass;\n\t\tthis.specificClass = options.specificClass;\n\t\tthis.foundEndpoints = options.foundEndpoints;\n\t\tthis.reportsToFollow = options.reportsToFollow;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointFindReport {\n\t\tvalidatePayload(raw.payload.length >= 3);\n\t\tconst reportsToFollow = raw.payload[0];\n\t\tconst genericClass = raw.payload[1];\n\t\tconst specificClass = raw.payload[2];\n\n\t\t// Some devices omit the endpoint list although that is not allowed in the specs\n\t\t// therefore don't validatePayload here.\n\t\tconst foundEndpoints = [...raw.payload.subarray(3)]\n\t\t\t.map((e) => e & 0b01111111)\n\t\t\t.filter((e) => e !== 0);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\treportsToFollow,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t\tfoundEndpoints,\n\t\t});\n\t}\n\n\tpublic genericClass: number;\n\tpublic specificClass: number;\n\tpublic foundEndpoints: number[];\n\tpublic reportsToFollow: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([\n\t\t\t\tthis.reportsToFollow,\n\t\t\t\tthis.genericClass,\n\t\t\t\tthis.specificClass,\n\t\t\t]),\n\t\t\tBytes.from(this.foundEndpoints.map((e) => e & 0b01111111)),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic getPartialCCSessionId(): Record<string, any> | undefined {\n\t\t// Distinguish sessions by the requested device classes\n\t\treturn {\n\t\t\tgenericClass: this.genericClass,\n\t\t\tspecificClass: this.specificClass,\n\t\t};\n\t}\n\n\tpublic expectMoreMessages(): boolean {\n\t\treturn this.reportsToFollow > 0;\n\t}\n\n\tpublic mergePartialCCs(\n\t\tpartials: MultiChannelCCEndPointFindReport[],\n\t\t_ctx: CCParsingContext,\n\t): Promise<void> {\n\t\t// Concat the list of end points\n\t\tthis.foundEndpoints = [...partials, this]\n\t\t\t.map((report) => report.foundEndpoints)\n\t\t\t.reduce((prev, cur) => prev.concat(...cur), []);\n\t\treturn Promise.resolve();\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"generic device class\": getGenericDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t\tthis.specificClass,\n\t\t\t\t).label,\n\t\t\t\t\"found endpoints\": this.foundEndpoints.join(\", \"),\n\t\t\t\t\"# of reports to follow\": this.reportsToFollow,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCEndPointFindOptions {\n\tgenericClass: number;\n\tspecificClass: number;\n}\n\n@CCCommand(MultiChannelCommand.EndPointFind)\n@expectedCCResponse(MultiChannelCCEndPointFindReport)\nexport class MultiChannelCCEndPointFind extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCEndPointFindOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.genericClass = options.genericClass;\n\t\tthis.specificClass = options.specificClass;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCEndPointFind {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst genericClass = raw.payload[0];\n\t\tconst specificClass = raw.payload[1];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tgenericClass,\n\t\t\tspecificClass,\n\t\t});\n\t}\n\n\tpublic genericClass: number;\n\tpublic specificClass: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.genericClass, this.specificClass]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"generic device class\":\n\t\t\t\t\tgetGenericDeviceClass(this.genericClass).label,\n\t\t\t\t\"specific device class\": getSpecificDeviceClass(\n\t\t\t\t\tthis.genericClass,\n\t\t\t\t\tthis.specificClass,\n\t\t\t\t).label,\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCAggregatedMembersReportOptions {\n\taggregatedEndpointIndex: number;\n\tmembers: number[];\n}\n\n@CCCommand(MultiChannelCommand.AggregatedMembersReport)\n@ccValueProperty(\n\t\"members\",\n\tMultiChannelCCValues.aggregatedEndpointMembers,\n\t(self) => [self.aggregatedEndpointIndex],\n)\nexport class MultiChannelCCAggregatedMembersReport extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCAggregatedMembersReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.aggregatedEndpointIndex = options.aggregatedEndpointIndex;\n\t\tthis.members = options.members;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCAggregatedMembersReport {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\t\tconst aggregatedEndpointIndex = raw.payload[0] & 0b0111_1111;\n\t\tconst bitMaskLength = raw.payload[1];\n\t\tvalidatePayload(raw.payload.length >= 2 + bitMaskLength);\n\t\tconst bitMask = raw.payload.subarray(2, 2 + bitMaskLength);\n\t\tconst members = parseBitMask(bitMask);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\taggregatedEndpointIndex,\n\t\t\tmembers,\n\t\t});\n\t}\n\n\tpublic readonly aggregatedEndpointIndex: number;\n\n\tpublic readonly members: readonly number[];\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\t\"aggregated endpoint\": this.aggregatedEndpointIndex,\n\t\t\t\tmembers: this.members.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCAggregatedMembersGetOptions {\n\trequestedEndpoint: number;\n}\n\n@CCCommand(MultiChannelCommand.AggregatedMembersGet)\n@expectedCCResponse(MultiChannelCCAggregatedMembersReport)\nexport class MultiChannelCCAggregatedMembersGet extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCAggregatedMembersGetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedEndpoint = options.requestedEndpoint;\n\t}\n\n\tpublic static from(\n\t\t_raw: CCRaw,\n\t\t_ctx: CCParsingContext,\n\t): MultiChannelCCAggregatedMembersGet {\n\t\t// TODO: Deserialize payload\n\t\tthrow new ZWaveError(\n\t\t\t`${this.name}: deserialization not implemented`,\n\t\t\tZWaveErrorCodes.Deserialization_NotImplemented,\n\t\t);\n\n\t\t// return new MultiChannelCCAggregatedMembersGet({\n\t\t// \tnodeId: ctx.sourceNodeId,\n\t\t// });\n\t}\n\n\tpublic requestedEndpoint: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedEndpoint & 0b0111_1111]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { endpoint: this.requestedEndpoint },\n\t\t};\n\t}\n}\n\ntype MultiChannelCCDestination = number | (1 | 2 | 3 | 4 | 5 | 6 | 7)[];\n\n// @publicAPI\nexport interface MultiChannelCCCommandEncapsulationOptions {\n\tencapsulated: CommandClass;\n\tdestination: MultiChannelCCDestination;\n}\n\n// SDS13783: A receiving node MAY respond to a Multi Channel encapsulated command if the Destination\n// End Point field specifies a single End Point. In that case, the response MUST be Multi Channel\n// encapsulated.\n// A receiving node MUST NOT respond to a Multi Channel encapsulated command if the\n// Destination End Point field specifies multiple End Points via bit mask addressing.\n\nfunction getCCResponseForCommandEncapsulation(\n\tctx: GetNode<NodeId & SupportsCC>,\n\tsent: MultiChannelCCCommandEncapsulation,\n) {\n\tif (\n\t\ttypeof sent.destination === \"number\"\n\t\t&& sent.encapsulated.expectsCCResponse(ctx)\n\t) {\n\t\t// Allow both versions of the encapsulation command\n\t\t// Our implementation check is a bit too strict, so change the return type\n\t\treturn [\n\t\t\tMultiChannelCCCommandEncapsulation,\n\t\t\tMultiChannelCCV1CommandEncapsulation,\n\t\t] as any as (typeof MultiChannelCCCommandEncapsulation)[];\n\t}\n}\n\nfunction testResponseForCommandEncapsulation(\n\tsent: MultiChannelCCCommandEncapsulation,\n\treceived:\n\t\t| MultiChannelCCCommandEncapsulation\n\t\t| MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (\n\t\ttypeof sent.destination === \"number\"\n\t\t&& sent.destination === received.endpointIndex\n\t) {\n\t\treturn \"checkEncapsulated\";\n\t}\n\treturn false;\n}\n\n@CCCommand(MultiChannelCommand.CommandEncapsulation)\n@expectedCCResponse(\n\tgetCCResponseForCommandEncapsulation,\n\ttestResponseForCommandEncapsulation,\n)\nexport class MultiChannelCCCommandEncapsulation extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCCommandEncapsulationOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.encapsulated = options.encapsulated;\n\t\tthis.encapsulated.encapsulatingCC = this as any;\n\t\t// Propagate the endpoint index all the way down\n\t\tlet cur: CommandClass = this;\n\t\twhile (cur) {\n\t\t\tif (isMultiEncapsulatingCommandClass(cur)) {\n\t\t\t\tfor (const cc of cur.encapsulated) {\n\t\t\t\t\tcc.endpointIndex = this.endpointIndex;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (isEncapsulatingCommandClass(cur)) {\n\t\t\t\tcur.encapsulated.endpointIndex = this.endpointIndex;\n\t\t\t\tcur = cur.encapsulated;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tthis.destination = options.destination;\n\t}\n\n\tpublic static async from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): Promise<MultiChannelCCCommandEncapsulation> {\n\t\tvalidatePayload(raw.payload.length >= 2);\n\n\t\tlet endpointIndex: number;\n\t\tlet destination: MultiChannelCCDestination;\n\n\t\tif (\n\t\t\tctx.getDeviceConfig?.(ctx.sourceNodeId)\n\t\t\t\t?.compat?.treatDestinationEndpointAsSource\n\t\t) {\n\t\t\t// This device incorrectly uses the destination field to indicate the source endpoint\n\t\t\tendpointIndex = raw.payload[1] & 0b0111_1111;\n\t\t\tdestination = 0;\n\t\t} else {\n\t\t\t// Parse normally\n\t\t\tendpointIndex = raw.payload[0] & 0b0111_1111;\n\t\t\tconst isBitMask = !!(raw.payload[1] & 0b1000_0000);\n\t\t\tdestination = raw.payload[1] & 0b0111_1111;\n\t\t\tif (isBitMask) {\n\t\t\t\tdestination = parseBitMask(\n\t\t\t\t\tBytes.from([destination]),\n\t\t\t\t) as any;\n\t\t\t}\n\t\t}\n\t\t// No need to validate further, each CC does it for itself\n\t\tconst encapsulated = await CommandClass.parse(\n\t\t\traw.payload.subarray(2),\n\t\t\tctx,\n\t\t);\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tdestination,\n\t\t\tencapsulated,\n\t\t});\n\t}\n\n\tpublic encapsulated: CommandClass;\n\t/** The destination end point (0-127) or an array of destination end points (1-7) */\n\tpublic destination: MultiChannelCCDestination;\n\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tif (\n\t\t\tctx.getDeviceConfig?.(this.nodeId as number)?.compat\n\t\t\t\t?.treatDestinationEndpointAsSource\n\t\t) {\n\t\t\t// This device incorrectly responds from the endpoint we've passed as our source endpoint\n\t\t\tif (typeof this.destination === \"number\") {\n\t\t\t\tthis.endpointIndex = this.destination;\n\t\t\t}\n\t\t}\n\n\t\tconst destination = typeof this.destination === \"number\"\n\t\t\t// The destination is a single number\n\t\t\t? this.destination & 0b0111_1111\n\t\t\t// The destination is a bit mask\n\t\t\t: encodeBitMask(this.destination, 7)[0] | 0b1000_0000;\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.endpointIndex & 0b0111_1111, destination]),\n\t\t\tawait this.encapsulated.serialize(ctx),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tsource: this.endpointIndex,\n\t\t\t\tdestination: typeof this.destination === \"number\"\n\t\t\t\t\t? this.destination\n\t\t\t\t\t: this.destination.join(\", \"),\n\t\t\t},\n\t\t};\n\t}\n\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Multi Channel CC adds two bytes for the source and destination endpoint\n\t\treturn super.computeEncapsulationOverhead() + 2;\n\t}\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1ReportOptions {\n\trequestedCC: CommandClasses;\n\tendpointCount: number;\n}\n\n@CCCommand(MultiChannelCommand.ReportV1)\nexport class MultiChannelCCV1Report extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1ReportOptions>,\n\t) {\n\t\tsuper(options);\n\n\t\t// TODO: Check implementation:\n\t\tthis.requestedCC = options.requestedCC;\n\t\tthis.endpointCount = options.endpointCount;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCV1Report {\n\t\t// V1 won't be extended in the future, so do an exact check\n\t\tvalidatePayload(raw.payload.length === 2);\n\t\tconst requestedCC: CommandClasses = raw.payload[0];\n\t\tconst endpointCount = raw.payload[1];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedCC,\n\t\t\tendpointCount,\n\t\t});\n\t}\n\n\tpublic readonly requestedCC: CommandClasses;\n\tpublic readonly endpointCount: number;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([\n\t\t\tthis.requestedCC,\n\t\t\tthis.endpointCount,\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: {\n\t\t\t\tCC: getCCName(this.requestedCC),\n\t\t\t\t\"# of endpoints\": this.endpointCount,\n\t\t\t},\n\t\t};\n\t}\n}\n\nfunction testResponseForMultiChannelV1Get(\n\tsent: MultiChannelCCV1Get,\n\treceived: MultiChannelCCV1Report,\n) {\n\treturn sent.requestedCC === received.requestedCC;\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1GetOptions {\n\trequestedCC: CommandClasses;\n}\n\n@CCCommand(MultiChannelCommand.GetV1)\n@expectedCCResponse(MultiChannelCCV1Report, testResponseForMultiChannelV1Get)\nexport class MultiChannelCCV1Get extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1GetOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.requestedCC = options.requestedCC;\n\t}\n\n\tpublic static from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): MultiChannelCCV1Get {\n\t\t// V1 won't be extended in the future, so do an exact check\n\t\tvalidatePayload(raw.payload.length === 1);\n\t\tconst requestedCC: CommandClasses = raw.payload[0];\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\trequestedCC,\n\t\t});\n\t}\n\n\tpublic requestedCC: CommandClasses;\n\n\tpublic serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.from([this.requestedCC]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { CC: getCCName(this.requestedCC) },\n\t\t};\n\t}\n}\n\nfunction getResponseForV1CommandEncapsulation(\n\tctx: GetNode<NodeId & SupportsCC>,\n\tsent: MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (sent.encapsulated.expectsCCResponse(ctx)) {\n\t\treturn MultiChannelCCV1CommandEncapsulation;\n\t}\n}\n\nfunction testResponseForV1CommandEncapsulation(\n\tsent: MultiChannelCCV1CommandEncapsulation,\n\treceived: MultiChannelCCV1CommandEncapsulation,\n) {\n\tif (sent.endpointIndex === received.endpointIndex) {\n\t\treturn \"checkEncapsulated\";\n\t}\n\treturn false;\n}\n\n// @publicAPI\nexport interface MultiChannelCCV1CommandEncapsulationOptions {\n\tencapsulated: CommandClass;\n}\n\n@CCCommand(MultiChannelCommand.CommandEncapsulationV1)\n@expectedCCResponse(\n\tgetResponseForV1CommandEncapsulation,\n\ttestResponseForV1CommandEncapsulation,\n)\nexport class MultiChannelCCV1CommandEncapsulation extends MultiChannelCC {\n\tpublic constructor(\n\t\toptions: WithAddress<MultiChannelCCV1CommandEncapsulationOptions>,\n\t) {\n\t\tsuper(options);\n\t\tthis.encapsulated = options.encapsulated;\n\t\tthis.encapsulated.encapsulatingCC = this as any;\n\t\t// Propagate the endpoint index all the way down\n\t\tlet cur: CommandClass = this;\n\t\twhile (cur) {\n\t\t\tif (isMultiEncapsulatingCommandClass(cur)) {\n\t\t\t\tfor (const cc of cur.encapsulated) {\n\t\t\t\t\tcc.endpointIndex = this.endpointIndex;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t} else if (isEncapsulatingCommandClass(cur)) {\n\t\t\t\tcur.encapsulated.endpointIndex = this.endpointIndex;\n\t\t\t\tcur = cur.encapsulated;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static async from(\n\t\traw: CCRaw,\n\t\tctx: CCParsingContext,\n\t): Promise<MultiChannelCCV1CommandEncapsulation> {\n\t\tvalidatePayload(raw.payload.length >= 1);\n\t\tconst endpointIndex = raw.payload[0];\n\n\t\t// Some devices send invalid reports, i.e. MultiChannelCCV1CommandEncapsulation, but with V2+ binary format\n\t\t// This would be a NoOp CC, but it makes no sense to encapsulate that.\n\t\tconst isV2withV1Header = raw.payload.length >= 2\n\t\t\t&& raw.payload[1] === 0x00;\n\n\t\t// No need to validate further, each CC does it for itself\n\t\tconst encapsulated = await CommandClass.parse(\n\t\t\traw.payload.subarray(isV2withV1Header ? 2 : 1),\n\t\t\tctx,\n\t\t);\n\n\t\treturn new this({\n\t\t\tnodeId: ctx.sourceNodeId,\n\t\t\tendpointIndex,\n\t\t\tencapsulated,\n\t\t});\n\t}\n\n\tpublic encapsulated!: CommandClass;\n\n\tpublic async serialize(ctx: CCEncodingContext): Promise<Bytes> {\n\t\tthis.payload = Bytes.concat([\n\t\t\tBytes.from([this.endpointIndex]),\n\t\t\tawait this.encapsulated.serialize(ctx),\n\t\t]);\n\t\treturn super.serialize(ctx);\n\t}\n\n\tprotected computeEncapsulationOverhead(): number {\n\t\t// Multi Channel CC V1 adds one byte for the endpoint index\n\t\treturn super.computeEncapsulationOverhead() + 1;\n\t}\n\n\tpublic toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n\t\treturn {\n\t\t\t...super.toLogEntry(ctx),\n\t\t\tmessage: { source: this.endpointIndex },\n\t\t};\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAwBO;AACP,oBAAsB;AAEtB,oBAAyB;AACzB,iBAAsB;AACtB,0BAMO;AACP,oCAQO;AACP,uCAGO;AACP,oBAAkB;AAClB,mBAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EpC,SAAS,wBACR,KACA,QACA,iBAAyB;AAGzB,QAAM,gBAAgB,oBAAI,IAAG;AAO7B,aAAW,YAAY,iBAAiB;AACvC,UAAM,kBAAkB,+CAAqB,oBAC3C,SAAS,QAAQ;AACnB,UAAM,cAAc,IAAI,WAAW,MAAM,EAAE,SAGxC,eAAe;AAClB,QAAI,aAAa;AAChB,oBAAc,IAAI,UAAU;QAC3B,SAAS,YAAY;QACrB,UAAU,YAAY;OACtB;IACF;EACD;AAGA,QAAM,4BAAwB,wBAC7B,CAAC,GAAG,cAAc,OAAM,CAAE,EAAE,IAC3B,CAAC,EAAE,SAAS,SAAQ,MAAO,UAAU,MAAM,QAAQ,CACnD;AAEF,MAAI,sBAAsB,WAAW,gBAAgB,QAAQ;AAE5D,WAAO;EACR;AAGA,QAAM,0BAA0B,oBAAI,IAAI;IACvC;;IACA;;IACA;;IACA;;GACA;AACD,QAAM,qBAAqB,CAAC,GAAG,cAAc,OAAM,CAAE,EAAE,OACtD,CAAC,EA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