diff --git a/packages/zwave-js/src/lib/node/Endpoint.ts b/packages/zwave-js/src/lib/node/Endpoint.ts index e6f738531418..45bb317295a9 100644 --- a/packages/zwave-js/src/lib/node/Endpoint.ts +++ b/packages/zwave-js/src/lib/node/Endpoint.ts @@ -194,11 +194,15 @@ export class Endpoint implements IZWaveEndpoint { } } - /** Removes the BasicCC from the supported CCs if the device type forbids it */ - public removeBasicCCSupportIfForbidden(): void { + /** Removes the BasicCC from the supported CCs if necessary */ + public hideBasicCCSupportIfForbidden(): void { + if (!this.supportsCC(CommandClasses.Basic)) return; + if ( - this.supportsCC(CommandClasses.Basic) - && !this.maySupportBasicCC() + // Basic CC must not be offered if any other actuator CC is supported + actuatorCCs.some((cc) => this.supportsCC(cc)) + // ...or the device class forbids it + || !this.maySupportBasicCC() ) { // We assume that the device reports support for this CC in error, and that it actually controls it. // TODO: Consider if we should check additional sources, like the issued commands in AGI CC @@ -209,26 +213,6 @@ export class Endpoint implements IZWaveEndpoint { } } - /** Removes the BasicCC from the supported CCs if any other actuator CCs are supported */ - public hideBasicCCInFavorOfActuatorCCs(): void { - // This behavior is defined in SDS14223 - if ( - this.supportsCC(CommandClasses.Basic) - && actuatorCCs.some((cc) => this.supportsCC(cc)) - ) { - // Mark the CC as not supported, but remember if it is controlled - this.addCC(CommandClasses.Basic, { isSupported: false }); - - // If the record is now only a dummy, remove the CC entirely - if ( - !this.supportsCC(CommandClasses.Basic) - && !this.controlsCC(CommandClasses.Basic) - ) { - this.removeCC(CommandClasses.Basic); - } - } - } - /** Determines if support for a CC was force-removed via config file */ public wasCCRemovedViaConfig(cc: CommandClasses): boolean { if (this.supportsCC(cc)) return false; diff --git a/packages/zwave-js/src/lib/node/Node.ts b/packages/zwave-js/src/lib/node/Node.ts index db20f1cfd8bb..51dc04da39f4 100644 --- a/packages/zwave-js/src/lib/node/Node.ts +++ b/packages/zwave-js/src/lib/node/Node.ts @@ -1856,7 +1856,7 @@ export class ZWaveNode extends Endpoint // Some device types are not allowed to support it, but there are devices that do. // If a device type is forbidden to support Basic CC, remove the "support" portion of it for (const endpoint of this.getAllEndpoints()) { - endpoint.removeBasicCCSupportIfForbidden(); + endpoint.hideBasicCCSupportIfForbidden(); } this.setInterviewStage(InterviewStage.CommandClasses); @@ -2997,7 +2997,7 @@ protocol version: ${this.protocolVersion}`; } // Mark Basic CC as not supported if any other actuator CC is supported - endpoint.hideBasicCCInFavorOfActuatorCCs(); + endpoint.hideBasicCCSupportIfForbidden(); // Window Covering CC: // CL:006A.01.51.01.2: A controlling node MUST NOT interview and provide controlling functionalities for the @@ -6309,7 +6309,7 @@ protocol version: ${this.protocolVersion}`; // compat?.mapBasicReport !== false && compat?.mapBasicSet !== "event" // ) { for (const endpoint of this.getAllEndpoints()) { - endpoint.hideBasicCCInFavorOfActuatorCCs(); + endpoint.hideBasicCCSupportIfForbidden(); } // }