Skip to content

Commit

Permalink
fix: auto-enable all supported Barrier Operator signaling subsystem d…
Browse files Browse the repository at this point in the history
…uring the interview (#6979)
  • Loading branch information
AlCalzone authored Jul 5, 2024
1 parent 774ff77 commit 39a7635
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion packages/cc/src/cc/BarrierOperatorCC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import {
validatePayload,
} from "@zwave-js/core/safe";
import type { ZWaveApplicationHost, ZWaveHost } from "@zwave-js/host/safe";
import { getEnumMemberName, isEnumMember, pick } from "@zwave-js/shared/safe";
import {
getEnumMemberName,
isEnumMember,
noop,
pick,
} from "@zwave-js/shared/safe";
import { validateArgs } from "@zwave-js/transformers";
import {
CCAPI,
Expand Down Expand Up @@ -449,6 +454,25 @@ export class BarrierOperatorCC extends CommandClass {
}`,
direction: "inbound",
});

// Enable all supported subsystems
for (const subsystemType of resp) {
// Some devices report invalid subsystem types, but the CC API checks
// for valid values and throws otherwise.
if (!isEnumMember(SubsystemType, subsystemType)) continue;

applHost.controllerLog.logNode(node.id, {
message: `Enabling subsystem ${
getEnumMemberName(
SubsystemType,
subsystemType,
)
}...`,
direction: "outbound",
});
await api.setEventSignaling(subsystemType, SubsystemState.On)
.catch(noop);
}
}

await this.refreshValues(applHost);
Expand Down

0 comments on commit 39a7635

Please sign in to comment.