Skip to content

Commit

Permalink
Fixes entry delay default of having a constantly 'on' state for beepe…
Browse files Browse the repository at this point in the history
…rs that don't have any custom momentary settings.
  • Loading branch information
mkormendy committed Jul 31, 2021
1 parent 3c3d0d4 commit 2949256
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,13 +949,11 @@ export class KonnectedHomebridgePlatform implements DynamicPlatformPlugin {
// find beepers and actuate audible delay sound
this.accessoriesRuntimeCache.forEach((beeperAccessory) => {
if (beeperAccessory.type === 'beeper') {
let beeperSettings;
if (this.config.advanced?.entryDelaySettings?.pulseDuration) {
beeperSettings = this.config.advanced?.entryDelaySettings;
this.actuateAccessory(beeperAccessory.UUID, true, this.config.advanced?.entryDelaySettings);
} else {
beeperSettings = null;
this.actuateAccessory(beeperAccessory.UUID, true, {});
}
this.actuateAccessory(beeperAccessory.UUID, true, beeperSettings);
}
});

Expand Down Expand Up @@ -986,12 +984,13 @@ export class KonnectedHomebridgePlatform implements DynamicPlatformPlugin {
*
* @param zoneUUID string HAP UUID for the switch zone accessory.
* @param value boolean The value of the state as represented in HomeKit (may be adjusted by config trigger settings).
* @param inboundSwitchSettings object Settings object that can override the default accessory settings.
* @param inboundSwitchSettings object | null | undefined Settings object that can override the default accessory settings.
*/
actuateAccessory(zoneUUID: string, value: boolean | number, inboundSwitchSettings: Record<string, unknown> | null) {
// retrieve the matching accessory
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === zoneUUID);

// set the representative state in HomeKit
this.konnectedPlatformAccessories[zoneUUID].service.updateCharacteristic(this.Characteristic.On, value);

if (existingAccessory) {
Expand Down

0 comments on commit 2949256

Please sign in to comment.