Skip to content

Commit

Permalink
info.connection state ack
Browse files Browse the repository at this point in the history
  • Loading branch information
arteck authored Apr 30, 2021
1 parent 7a460a8 commit 4142148
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Zigbee extends utils.Adapter {

this.subscribeStates('*');
// set connection false before connect to zigbee
this.setState('info.connection', false);
this.setState('info.connection', false, true);
const zigbeeOptions = this.getZigbeeOptions();
this.zbController = new ZigbeeController();
this.zbController.on('log', this.onLog.bind(this));
Expand Down Expand Up @@ -230,7 +230,7 @@ class Zigbee extends utils.Adapter {

await this.zbController.start();
} catch (error) {
this.setState('info.connection', false);
this.setState('info.connection', false, true);
this.log.error(`Failed to start Zigbee`);
if (error.stack) {
this.log.error(error.stack);
Expand All @@ -246,7 +246,7 @@ class Zigbee extends utils.Adapter {
async onZigbeeAdapterDisconnected() {
this.reconnectCounter = 5;
this.log.error('Adapter disconnected, stopping');
this.setState('info.connection', false);
this.setState('info.connection', false, true);
await this.callPluginMethod('stop');
this.tryToReconnect();
}
Expand Down Expand Up @@ -316,7 +316,7 @@ class Zigbee extends utils.Adapter {
}
}

this.setState('info.connection', true);
this.setState('info.connection', true, true);

const devicesFromDB = await this.zbController.getClients(false);
for (const device of devicesFromDB) {
Expand Down

0 comments on commit 4142148

Please sign in to comment.