gysmo38 / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266 module
GNU Lesser General Public License v2.1
371 stars 132 forks source link

HVAC connection stuck #244

Open lightoze opened 7 months ago

lightoze commented 7 months ago

Periodically I get a situation when HVAC connection is stuck in disconnected state. Going to web interface and rebooting helps, so probably reconnect logic is not resetting connection state well enough. Perhaps it could be improved so that the connection is restored without the need to manually reboot?

sean-leach commented 7 months ago

I have the exact same issue, and web UI reboot does fix it

lightoze commented 5 months ago

I implemented a workaround by adding this in the main loop() function:

         hpConnectionRetries = min(hpConnectionRetries + 1u, HP_MAX_RETRIES);
         hpConnectionTotalRetries++;
         hp.sync();
+        if (hpConnectionTotalRetries > 10 && mqtt_client.state() == MQTT_CONNECTED) {
+            ESP.restart();
+        }