Posting this as an easy solution to a problem that maybe others have too. It would be really useful if something similar was implemented.
My WiFi router (which my EasyESP sensors connect to) seems to reboot itself one or two times every 24 hours (haven't really looked into why and if it can be changed). The EasyESP automatically restores the WiFi connection to the router when it's back online. But the MQTT/mosquitto connection does not restore. I solved this by adding a few lines of code in the watchdog starting on line 374 in ESPEasy.ino (meaning it will run every 30 sec):
Code: Select all
if (MQTTclient.connected()) {
Serial.println("Mosquitto connetion ok.");
} else {
Serial.println("Mosquitto disconneted. Trying to reconnect.");
MQTTclient.disconnect();
delay(1000);
MQTTConnect();
}