mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-10 14:01:43 +00:00
Try to recover in zigbee-shepherd start failure. #79
This commit is contained in:
+16
-3
@@ -28,12 +28,25 @@ class Zigbee {
|
||||
|
||||
this.shepherd.start((error) => {
|
||||
if (error) {
|
||||
logger.error('Error while starting zigbee-shepherd!');
|
||||
logger.warn('Error while starting zigbee-shepherd, attemping to fix...');
|
||||
this.shepherd.controller._znp.close((() => null));
|
||||
logger.info(`Starting zigbee-shepherd`);
|
||||
|
||||
setTimeout(() => {
|
||||
this.shepherd.start((error) => {
|
||||
if (error) {
|
||||
logger.error('Error while starting zigbee-shepherd!');
|
||||
callback(error);
|
||||
} else {
|
||||
logger.info('zigbee-shepherd started');
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
}, 5 * 1000);
|
||||
} else {
|
||||
logger.info('zigbee-shepherd started');
|
||||
callback(null);
|
||||
}
|
||||
|
||||
callback(error);
|
||||
});
|
||||
|
||||
// Register callbacks.
|
||||
|
||||
Reference in New Issue
Block a user