From 5dc28b2409ddb435f13a792158df99d99546648a Mon Sep 17 00:00:00 2001 From: Brandon Watson Date: Wed, 9 Jun 2021 17:10:49 -0400 Subject: [PATCH] Successfully adding sequences --- src/Accessories/Sequence.ts | 8 ++++++-- src/platform.ts | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Accessories/Sequence.ts b/src/Accessories/Sequence.ts index 5fc1265..ea6992c 100644 --- a/src/Accessories/Sequence.ts +++ b/src/Accessories/Sequence.ts @@ -1,6 +1,7 @@ import { CharacteristicGetCallback, CharacteristicSetCallback, + CharacteristicValue, PlatformAccessory, Service, } from "homebridge"; @@ -73,7 +74,10 @@ export class Sequence { * Handler for switchSet command * @param callback */ - public async onSwitchSet(callback: CharacteristicSetCallback): Promise { + public onSwitchSet = async ( + _value: CharacteristicValue, + callback: CharacteristicSetCallback + ): Promise => { // Execute sequence for (const step of this._sequence.Steps) { await sleep(step.Delay); @@ -97,5 +101,5 @@ export class Sequence { .updateValue(false); callback(null); - } + }; } diff --git a/src/platform.ts b/src/platform.ts index 0dcf19d..0c5b9fa 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -15,6 +15,7 @@ import { ISequence } from "./Models/Config/ISequence"; import { HarmonyDevice } from "./Models/HarmonyDevice"; import { HarmonyHub } from "./Models/HarmonyHub"; import { PLATFORM_NAME, PLUGIN_NAME } from "./settings"; +import { sleep } from "./Util"; export class Platform implements DynamicPlatformPlugin { constructor( @@ -33,8 +34,10 @@ export class Platform implements DynamicPlatformPlugin { log: this.log, }); + let didFinishLaunching = false; this.api.on("didFinishLaunching", async () => { log.debug("Executed didFinishLaunching callback"); + didFinishLaunching = true; }); this.dataProvider = null;