Skip to content

Commit

Permalink
fix: do not mark Basic CC as supported if in secure command list (#7010)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Jul 15, 2024
1 parent da9951a commit c2c8eef
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
15 changes: 11 additions & 4 deletions packages/cc/src/cc/Security2CC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,17 @@ export class Security2CC extends CommandClass {

// Remember which commands are supported securely
for (const cc of supportedCCs) {
endpoint.addCC(cc, {
isSupported: true,
secure: true,
});
// Basic CC has special rules for when it is considered supported
// Therefore we mark all other CCs as supported, but not Basic CC,
// for which support is determined later.
if (cc === CommandClasses.Basic) {
endpoint.addCC(cc, { secure: true });
} else {
endpoint.addCC(cc, {
isSupported: true,
secure: true,
});
}
}
}
}
Expand Down
24 changes: 22 additions & 2 deletions packages/cc/src/cc/SecurityCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,30 @@ export class SecurityCC extends CommandClass {

// Remember which commands are supported securely
for (const cc of supportedCCs) {
endpoint.addCC(cc, { isSupported: true, secure: true });
// Basic CC has special rules for when it is considered supported
// Therefore we mark all other CCs as supported, but not Basic CC,
// for which support is determined later.
if (cc === CommandClasses.Basic) {
endpoint.addCC(cc, { secure: true });
} else {
endpoint.addCC(cc, {
isSupported: true,
secure: true,
});
}
}
for (const cc of controlledCCs) {
endpoint.addCC(cc, { isControlled: true, secure: true });
// Basic CC has special rules for when it is considered supported
// Therefore we mark all other CCs as supported, but not Basic CC,
// for which support is determined later.
if (cc === CommandClasses.Basic) {
endpoint.addCC(cc, { secure: true });
} else {
endpoint.addCC(cc, {
isControlled: true,
secure: true,
});
}
}

// We know for sure that the node is included securely
Expand Down
4 changes: 1 addition & 3 deletions packages/cc/src/cc/VersionCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,7 @@ export class VersionCC extends CommandClass {
// Therefore we mark all other CCs as supported, but not Basic CC,
// for which support is determined later.
if (cc === CommandClasses.Basic) {
endpoint.addCC(cc, {
version: supportedVersion,
});
endpoint.addCC(cc, { version: supportedVersion });
} else {
endpoint.addCC(cc, {
isSupported: true,
Expand Down

0 comments on commit c2c8eef

Please sign in to comment.