Add key mqtt events logging

This commit is contained in:
Mike Vostrikov committed 2023-08-19 01:49:31 -04:00
1 parent 7effbdb27a
commit 6544556202
1 file changed
+3
+3
View File
@@ -210,15 +210,18 @@ function register_allbuttons(){
//This runs on startup, it performs the actual "discovery" announcement for
//HomeAssistant to add the device to its inventory
mqtt.on('connected', function(){
console.log("\n'Connected' event\n");
register_allbuttons();
});
// Added by heroash88 to reconnect if MQTT server goes down
mqtt.on('disconnected', function() {
console.log("\n'Disconnected' event\n");
mqtt.connect();
});
mqtt.on('error', function () {
console.log("\n'Error' event\n");
setTimeout(function () {
throw new Error("Crashed")
}, 1000);