Skip to content

Commit

Permalink
Add check is _device.spec not undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
lasthead0 committed May 16, 2022
1 parent 42c5ca8 commit a7f46a7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/gateway3.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,12 @@ class Gateway3 extends XiaomiDevice {
})({debugOutput, msgReceivedStat});

_devices.forEach(_device => {
_device.spec.forEach(([, , state], idx) => {
if (excludedStates.includes(state.stateName))
_device.spec[idx] = undefined;
});
if (_device.spec != undefined) {
_device.spec.forEach(([, , state], idx) => {
if (excludedStates.includes(state.stateName))
_device.spec[idx] = undefined;
});
}
});

/* Setup devices */
Expand Down

0 comments on commit a7f46a7

Please sign in to comment.