Skip to content

Commit

Permalink
fix(mqtt): Don't show MQTT startup info when MQTT is disabled
Browse files Browse the repository at this point in the history
Fixes #913
  • Loading branch information
Göran Sander committed Dec 12, 2023
1 parent 001f99f commit 7f48bd3
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/butler.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,22 @@ const start = async () => {

// ------------------------------------
// Create MQTT client object and connect to MQTT broker, if MQTT is enabled
mqttInitHandlers();

// Sleep 5 seconds to allow MQTT to connect
globals.logger.info('MAIN: Sleeping 5 seconds to allow MQTT to connect.');
globals.logger.info('5...');
await globals.sleep(1000);
globals.logger.info('4...');
await globals.sleep(1000);
globals.logger.info('3...');
await globals.sleep(1000);
globals.logger.info('2...');
await globals.sleep(1000);
globals.logger.info('1...');
await globals.sleep(1000);
if (globals.config.get('Butler.mqttConfig.enable')) {
mqttInitHandlers();

// Sleep 5 seconds to allow MQTT to connect
globals.logger.info('MAIN: Sleeping 5 seconds to allow MQTT to connect.');
globals.logger.info('5...');
await globals.sleep(1000);
globals.logger.info('4...');
await globals.sleep(1000);
globals.logger.info('3...');
await globals.sleep(1000);
globals.logger.info('2...');
await globals.sleep(1000);
globals.logger.info('1...');
await globals.sleep(1000);
}

// Set up service monitoring, if enabled in the config file
if (globals.config.has('Butler.serviceMonitor.enable') && globals.config.get('Butler.serviceMonitor.enable') === true) {
Expand Down

0 comments on commit 7f48bd3

Please sign in to comment.