From a7f46a7e3e8c040d7bb87c7550a5f0cb0acce27f Mon Sep 17 00:00:00 2001 From: Eugene Abramov Date: Mon, 16 May 2022 19:37:26 +0300 Subject: [PATCH] Add check is `_device.spec` not undefined --- lib/gateway3.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 */