Skip to content

Commit c19f4fe

Browse files
authored
Merge pull request #16 from sajmonr/5-fan-does-not-turn-off-when-turned-off-
5 Fan does not turn off when turned off from HomeKit
2 parents 19aa2f5 + 4ff8326 commit c19f4fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/accessories/fan-accessory.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export class FanAccessory extends HubspaceAccessory{
2323

2424
private configureActive(): void{
2525
this.service.getCharacteristic(this.platform.Characteristic.Active)
26-
.onGet(this.getActive.bind(this));
26+
.onGet(this.getActive.bind(this))
27+
.onSet(this.setActive.bind(this));
2728
}
2829

2930
private configureRotationSpeed(): void{
@@ -37,6 +38,10 @@ export class FanAccessory extends HubspaceAccessory{
3738
});
3839
}
3940

41+
private async setActive(value: CharacteristicValue): Promise<void>{
42+
this.deviceService.setValue(this.device.deviceId, DeviceFunction.FanPower, value);
43+
}
44+
4045
private async getActive(): Promise<CharacteristicValue>{
4146
// Try to get the value
4247
const value = await this.deviceService.getValue(this.device.deviceId, DeviceFunction.FanPower);

0 commit comments

Comments
 (0)