From 0358a39a59c4d5a15d55e9d9fd6afdd3b485a40d Mon Sep 17 00:00:00 2001 From: Hunter Date: Tue, 8 Oct 2024 10:01:07 -0400 Subject: [PATCH] add wifi reconnection logic --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index c2b1754..3511903 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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");