From 6ef1507d7906f0bdadbd75f3ea1004b1dd8f7ba2 Mon Sep 17 00:00:00 2001 From: Dennis Twardowsky Date: Sat, 4 Feb 2023 22:11:12 +0100 Subject: [PATCH] Disable resetTimeout when configured value is 0 --- src/platformAccessory.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/platformAccessory.ts b/src/platformAccessory.ts index a7988f0..c17ab30 100644 --- a/src/platformAccessory.ts +++ b/src/platformAccessory.ts @@ -158,8 +158,12 @@ export class DeviceAccessory { if (this.SwitchResetTimer) { clearTimeout(this.SwitchResetTimer); } - // Start the reset timer - this.SwitchResetTimer = setTimeout(this.resetTrigger.bind(this), this.State.triggerTimeout * 1000); + + // Start the reset timer, if paramter is greater than 0. + // Otherwise, do nothing. + if (this.State.triggerTimeout > 0) { + this.SwitchResetTimer = setTimeout(this.resetTrigger.bind(this), this.State.triggerTimeout * 1000); + } // Trigger Scene this.triggerNext();