Skip to content

Commit

Permalink
Fix .find() when returning all devices
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Feb 16, 2019
1 parent a29c93c commit 05d0d73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ class TuyaDevice extends EventEmitter {
const thisID = dataRes.data.gwId;
const thisIP = dataRes.data.ip;

this.foundDevices.push({id: thisID, ip: thisIP});
// Add to array if it doesn't exist
if (!this.foundDevices.includes({id: thisID, ip: thisIP})) {
this.foundDevices.push({id: thisID, ip: thisIP});
}

if (!options.all &&
(this.device.id === thisID || this.device.ip === thisIP) &&
Expand Down

0 comments on commit 05d0d73

Please sign in to comment.