Fix race condition when Zigbee starts. #2591

This commit is contained in:
Koen Kanters
2020-01-03 23:43:04 +01:00
parent d3aba2689c
commit d0e9889f7d
+2 -4
View File
@@ -89,9 +89,10 @@ class Controller {
// Start zigbee
try {
await this.zigbee.start();
this.callExtensionMethod('onZigbeeStarted', []);
this.zigbee.on('event', this.onZigbeeEvent.bind(this));
this.zigbee.on('adapterDisconnected', this.onZigbeeAdapterDisconnected);
await this.zigbee.start();
} catch (error) {
logger.error('Failed to start zigbee');
logger.error('Exiting...');
@@ -123,9 +124,6 @@ class Controller {
this.zigbee.permitJoin(settings.get().permit_join);
// Call extensions
this.callExtensionMethod('onZigbeeStarted', []);
// MQTT
this.mqtt.on('message', this.onMQTTMessage.bind(this));
await this.mqtt.connect();