Skip to content

Commit

Permalink
Merge pull request #16 from sajmonr/5-fan-does-not-turn-off-when-turn…
Browse files Browse the repository at this point in the history
…ed-off-

5 Fan does not turn off when turned off from HomeKit
  • Loading branch information
sajmonr authored Mar 9, 2023
2 parents 19aa2f5 + 4ff8326 commit c19f4fe
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 c19f4fe

Please sign in to comment.