diff --git a/src/fluxAccessory.ts b/src/fluxAccessory.ts index 0183e47..21ca05f 100644 --- a/src/fluxAccessory.ts +++ b/src/fluxAccessory.ts @@ -130,6 +130,8 @@ export class FluxAccessory { .on("set", this.onSetEnabled) //@ts-ignore .on("get", this.onGetEnabled); + + this.test(); } public name: string = "Flux"; @@ -320,6 +322,9 @@ export class FluxAccessory { } catch (err: any) { this._platform.log.error(err.message); } + if (!pilot) { + return; + } this._platform.log.info(`Adjusting wiz bulb: ${wizBulb.getMac()}`); wizBulb.set(this._wizRGB, pilot?.state ? pilot.dimming : 0, this._fade); }; @@ -359,4 +364,23 @@ export class FluxAccessory { private disable() { this._tasks.forEach((task) => task.stop()); } + + private test = async () => { + for (let i = 2500; i > 0; i--) { + this._platform.log.info(`i: ${i}`); + for (const wizBulb of this._wizLights) { + let pilot; + try { + pilot = await wizBulb.get(); + } catch (err: any) { + this._platform.log.error(err.message); + } + this._platform.log.info( + `Adjusting wiz bulb: ${wizBulb.getMac()}` + ); + wizBulb.set(colorTemperature2rgb(i), 100, this._fade); + } + await Sleep(100); + } + }; }