Skip to content

Commit

Permalink
fix: Do not trigger "special" events when they are not received
Browse files Browse the repository at this point in the history
close #326
  • Loading branch information
sebbo2002 committed Jul 11, 2024
1 parent c668148 commit c63dfe6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib/device-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export default class NodePyATVDeviceEvents extends EventEmitter {
applyStateAndEmitEvents(newState: NodePyATVState): void {
let keys = Object.keys(this.state);

// Remove special fields from the list
keys = keys.filter(k =>
!['powerState', 'focusState', 'outputDevices', 'volume'].includes(k)
);

if('powerState' in newState && newState.powerState) {
keys = ['powerState'];
}
Expand Down

0 comments on commit c63dfe6

Please sign in to comment.