Skip to content

Commit

Permalink
#178: Ensure a missing specification doesn't break the device list
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvandevijver committed Aug 22, 2024
1 parent 678ece8 commit 7239a9e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/TuyaOAuth2Driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ export default class TuyaOAuth2Driver extends OAuth2Driver<TuyaOAuth2Client> {
(await oAuth2Client.queryDataPoints(device.id).catch(e => this.log('Device properties retrieval failed', e))) ??
undefined;

// GitHub #178: Some device do not have the status property at all.
// Make sure to populate it with an empty array instead.
if (!Array.isArray(device.status)) {
device.status = [];
}

const deviceProperties = this.onTuyaPairListDeviceProperties({ ...device }, deviceSpecs, dataPoints);

listDevices.push({
Expand Down

0 comments on commit 7239a9e

Please sign in to comment.