From 4ff8326d883ffef417be6ef771171c4c2dd9bae4 Mon Sep 17 00:00:00 2001 From: Adam Simonicek Date: Wed, 8 Mar 2023 21:05:26 -0500 Subject: [PATCH] Added active setter --- src/accessories/fan-accessory.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/accessories/fan-accessory.ts b/src/accessories/fan-accessory.ts index 2cc5173..08e4dae 100644 --- a/src/accessories/fan-accessory.ts +++ b/src/accessories/fan-accessory.ts @@ -23,7 +23,8 @@ export class FanAccessory extends HubspaceAccessory{ private configureActive(): void{ this.service.getCharacteristic(this.platform.Characteristic.Active) - .onGet(this.getActive.bind(this)); + .onGet(this.getActive.bind(this)) + .onSet(this.setActive.bind(this)); } private configureRotationSpeed(): void{ @@ -37,6 +38,10 @@ export class FanAccessory extends HubspaceAccessory{ }); } + private async setActive(value: CharacteristicValue): Promise{ + this.deviceService.setValue(this.device.deviceId, DeviceFunction.FanPower, value); + } + private async getActive(): Promise{ // Try to get the value const value = await this.deviceService.getValue(this.device.deviceId, DeviceFunction.FanPower);