From 2949256f078d556e0a5c1f4847a1b4c1cedf5891 Mon Sep 17 00:00:00 2001 From: Mike Kormendy Date: Sat, 31 Jul 2021 02:18:33 -0500 Subject: [PATCH] Fixes entry delay default of having a constantly 'on' state for beepers that don't have any custom momentary settings. --- src/platform.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/platform.ts b/src/platform.ts index 494d695..2f14b5e 100755 --- a/src/platform.ts +++ b/src/platform.ts @@ -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); } }); @@ -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 | 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) {