Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Fix: correctly return state for lamps.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhjd committed Sep 16, 2023
1 parent f80a0e1 commit 9d6d3cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/myq-lamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class myQLamp extends myQAccessory {
});

switchService.getCharacteristic(this.hap.Characteristic.On).onSet(this.setLampState.bind(this));
switchService.updateCharacteristic(this.hap.Characteristic.On, this.accessory.context.lampState as boolean);
switchService.updateCharacteristic(this.hap.Characteristic.On, (this.accessory.context.lampState as boolean) === true);

// Add the configured name for this device.
switchService.addOptionalCharacteristic(this.hap.Characteristic.ConfiguredName);
Expand Down Expand Up @@ -179,7 +179,7 @@ export class myQLamp extends myQAccessory {
}

this.accessory.context.lampState = myQState === true;
this.accessory.getService(this.hap.Service.Switch)?.updateCharacteristic(this.hap.Characteristic.On, this.accessory.context.lampState as boolean);
this.accessory.getService(this.hap.Service.Switch)?.updateCharacteristic(this.hap.Characteristic.On, (this.accessory.context.lampState as boolean) === true);

// eslint-disable-next-line camelcase
this.myQ.state.lamp_state = this.accessory.context.lampState ? "on" : "off";
Expand Down

0 comments on commit 9d6d3cf

Please sign in to comment.