Skip to content

Commit

Permalink
fix(mqtt): Don't try to publish anything if there is no mqtt connection
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed Dec 29, 2021
1 parent 42a5613 commit 9051ac0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/lib/mqtt/MqttController.js
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,14 @@ class MqttController {
return new Promise(resolve => {
resolve();
});
} else {
} else if (this.asyncClient) {
return this.asyncClient.publish(topic, message, options);
} else {
Logger.warn(`Aborting publish to ${topic} since we're currently not connected to any MQTT broker`);

return new Promise(resolve => {
resolve();
});
}
}
}
Expand Down

0 comments on commit 9051ac0

Please sign in to comment.