Skip to content

Commit

Permalink
Added active setter
Browse files Browse the repository at this point in the history
  • Loading branch information
sajmonr committed Mar 9, 2023
1 parent 19aa2f5 commit 4ff8326
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/accessories/fan-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -37,6 +38,10 @@ export class FanAccessory extends HubspaceAccessory{
});
}

private async setActive(value: CharacteristicValue): Promise<void>{
this.deviceService.setValue(this.device.deviceId, DeviceFunction.FanPower, value);
}

private async getActive(): Promise<CharacteristicValue>{
// Try to get the value
const value = await this.deviceService.getValue(this.device.deviceId, DeviceFunction.FanPower);
Expand Down

0 comments on commit 4ff8326

Please sign in to comment.