Skip to content

Commit

Permalink
Update usage example, fix style error
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Jan 12, 2018
1 parent b92f73c commit 3406628
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ TuyaDevice.prototype.get = function (options) {
} else {
resolve(data.dps['1']);
}
}).catch(error => {
reject(error);
}).catch(err => {
reject(err);
});
});
};
Expand Down Expand Up @@ -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);
});
});
Expand Down

0 comments on commit 3406628

Please sign in to comment.