diff --git a/lib/gateway3.js b/lib/gateway3.js index 7223896..1923dfe 100644 --- a/lib/gateway3.js +++ b/lib/gateway3.js @@ -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 */