From 65445562020a0935e16a3980324ed39e59f59f21 Mon Sep 17 00:00:00 2001 From: Mike Vostrikov <11011125+mikevostrikov@users.noreply.github.com> Date: Sat, 19 Aug 2023 01:49:31 -0400 Subject: [PATCH] Add key mqtt events logging --- main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.js b/main.js index ee8faad..bb0033e 100644 --- a/main.js +++ b/main.js @@ -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);