Update main.js

This commit is contained in:
id628 authored and GitHub committed 2023-07-15 19:05:32 -04:00
1 parent a04ac40061
commit 36640d28bd
1 file changed
+13
+13
View File
@@ -182,4 +182,17 @@ mqtt.on('connected', function(){
register_allbuttons();
});
// Added by heroash88 to reconnect if MQTT server goes down
mqtt.on('disconnected', function() {
mqtt.connect();
});
mqtt.on('error', function() {
setTimeout(function (){
mqtt.connect();
}, 1000);
});
mqtt.connect();