add wifi reconnection logic
This commit is contained in:
parent
208b6b51d9
commit
0358a39a59
|
@ -101,6 +101,7 @@ void setup() {
|
|||
|
||||
void reconnect() {
|
||||
while (!mqttClient.connected()) {
|
||||
if (WiFi.status() != WL_CONNECTED) WiFi.reconnect();
|
||||
Serial.println("Attempting MQTT connection...");
|
||||
if (mqttClient.connect("ESP32Client")) {
|
||||
Serial.println("connected");
|
||||
|
|
Loading…
Reference in New Issue