MQTT is still timing out and dropping my room sensors after updating to 0.100.3.
error log:
1571842935: New client connected from 192.168.1.57 as SB-2 (p2, c1, k15, u’testMQTT’).
1571843030: Client SB-2 has exceeded timeout, disconnecting.
My ESP32 firmware hasn’t change for over a year.
This issue has be happening for at least the last 4 version updates.
Here is my MQTT re-connect Arduino code:
// MQTT re-connect function
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("SB-2", "user", "password")) {
Serial.println("connected");
/* subscribe topic with default QoS 0*/
client.subscribe("mqtt_client"); /* 1=on, 0=off */
// Once connected, publish an announcement...
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}