diff --git a/README.md b/README.md index f0f5d99..c15569a 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Currently only supports smart plugs, but it should be fairly trivial to add othe id: 'xxxxxxxxxxxxxxxxxxxx', key: 'xxxxxxxxxxxxxxxx'}); + tuya.resolveIds().then(() => { tuya.get().then(status => { console.log('Status: ' + status); @@ -27,6 +28,7 @@ Currently only supports smart plugs, but it should be fairly trivial to add othe }); }); }); + }); This should report the current status, set the device to the opposite of what it currently is, then report the changed status. diff --git a/index.js b/index.js index f68bb94..6aa02a7 100644 --- a/index.js +++ b/index.js @@ -164,8 +164,8 @@ TuyaDevice.prototype.get = function (options) { } else { resolve(data.dps['1']); } - }).catch(error => { - reject(error); + }).catch(err => { + reject(err); }); }); }; @@ -271,7 +271,7 @@ TuyaDevice.prototype._send = function (ip, buffer) { resolve(data); }); client.on('error', error => { - error.message = "Error communicating with device. Make sure nothing else is trying to control it or connected to it." + error.message = 'Error communicating with device. Make sure nothing else is trying to control it or connected to it.'; reject(error); }); });