From aaf56eeb2f0447e88f2da0632b1e8623a54109c3 Mon Sep 17 00:00:00 2001 From: Actardnes Date: Wed, 16 Dec 2020 15:26:12 +0100 Subject: [PATCH] fix: first parsing device data --- blebox/abstractBox.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blebox/abstractBox.js b/blebox/abstractBox.js index 54bf20d..66f1f7f 100644 --- a/blebox/abstractBox.js +++ b/blebox/abstractBox.js @@ -99,7 +99,7 @@ class AbstractAccessoryWrapper { } if (!device.ip) { const currentDevice = this.getDevice(); - device.ip = currentDevice.ip; + device.ip = currentDevice && currentDevice.ip; } device.deviceName = device.deviceName ? device.deviceName.replace(NON_ALPHANUMERIC_REGEX, ' ') : ""; return device; @@ -110,7 +110,7 @@ class AbstractAccessoryWrapper { const newDevice = this.parseDeviceInfo(deviceInfo); if (newDevice) { const device = this.getDevice(); - if(device.id === newDevice.id) { + if (!device || device.id === newDevice.id) { this.accessory.context.blebox.device = newDevice; if (device && device.deviceName !== newDevice.deviceName) { this.updateDeviceInfoCharacteristics();