diff --git a/lib/restApi.js b/lib/restApi.js index dc308a2..25a4a69 100644 --- a/lib/restApi.js +++ b/lib/restApi.js @@ -146,17 +146,20 @@ class RestApiFully { const response = await axios.get(url, config); if (response.status == 200) { - - const result = { - clientId: 9999, - ip: device.ip, - topic: 'fake', - infoObj: response.data - }; - - this.adapter.onMqttInfo(result); - await this.adapter.setStateAsync('info.connection', { val: true, ack: true }); - + if (response.data.status == 'Error') { + this.adapter.aliveUpdate(device.id,false); + const cmd = 'first Login '; + this.errorFunction(result.infoObj.statustext,device, cmd); + } else { + const result = { + clientId: 9999, + ip: device.ip, + topic: 'fake', + infoObj: response.data + }; + this.adapter.onMqttInfo(result); + await this.adapter.setStateAsync('info.connection', {val: true, ack: true}); + } } } catch (err) { this.adapter.aliveUpdate(device.id,false);