From 04a71e021ef52737145637a23355bf0e01252689 Mon Sep 17 00:00:00 2001 From: Ingo Fischer Date: Mon, 6 Jan 2025 13:30:57 +0100 Subject: [PATCH] Infos --- index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5a5410e..d5b8a91 100644 --- a/index.js +++ b/index.js @@ -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. })); } @@ -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