Skip to content

Commit

Permalink
check credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
arteck authored Nov 20, 2023
1 parent f9e4800 commit 1cf4b61
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions lib/restApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check failure on line 152 in lib/restApi.js

View workflow job for this annotation

GitHub Actions / check-and-lint

'result' is not defined
} 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);
Expand Down

0 comments on commit 1cf4b61

Please sign in to comment.