Skip to content

Commit

Permalink
Infos
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed Jan 6, 2025
1 parent 566b4d5 commit 04a71e0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ class TuyaDevice extends EventEmitter {
'Timeout waiting for status response from device id: ' + this.device.id
);
// This case returns an undefined when set-for-get is used!
// Alternative would be to throw but this would be breaking.
}));
}

Expand Down Expand Up @@ -568,13 +569,19 @@ class TuyaDevice extends EventEmitter {
// Automatically ask for dp_refresh so we
// can emit a `dp_refresh` event as soon as possible
if (this.globalOptions.issueRefreshOnConnect) {
this.refresh();
this.refresh().catch(error => {
debug('Error refreshing on connect: ' + error);
this.emit('error', error);
});
}

// Automatically ask for current state so we
// can emit a `data` event as soon as possible
if (this.globalOptions.issueGetOnConnect) {
this.get();
this.get().catch(error => {
debug('Error getting on connect: ' + error)
this.emit('error', error);
});
}

// Resolve
Expand Down

0 comments on commit 04a71e0

Please sign in to comment.