Skip to content

Commit

Permalink
Fixes #520 (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonzhan authored Oct 14, 2022
1 parent 9635294 commit 5123f25
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/irdevice/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,20 @@ export class Others {

async ActiveSet(value: CharacteristicValue): Promise<void> {
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${value}`);
this.Active = value;
this.accessory.context.Active = this.Active;
if (value) {
await this.pushOnChanges();
} else {
await this.pushOffChanges();
}

/*
pushOnChanges and pushOffChanges above assume they are measuring the state of the accessory BEFORE
they are updated, so we are only updating the accessory state after calling the above.
*/

this.Active = value;
this.accessory.context.Active = this.Active;

}

/**
Expand Down

0 comments on commit 5123f25

Please sign in to comment.