diff --git a/src/net/mqtt.cpp b/src/net/mqtt.cpp index 73e152b..0f29cc9 100644 --- a/src/net/mqtt.cpp +++ b/src/net/mqtt.cpp @@ -89,7 +89,15 @@ static void onMessage(char* topicC, byte* payload, unsigned len) { static void tryConnect() { if (netwifi::state() != netwifi::State::Connected) return; String host = settings::getMqttHost(); - if (host.length() == 0) return; + if (host.length() == 0) { + // MQTT host not configured. Back off instead of returning straight + // to loop(), which (with s_nextTryMs unchanged) re-invokes us every + // iteration — re-reading NVS and logging "mqtt_host NOT_FOUND" ~16x + // a second. A minute-scale recheck still picks up creds set later + // without flooding the log or spinning the CPU. + s_nextTryMs = millis() + 60000; + return; + } uint16_t port = settings::getMqttPort(); String user = settings::getMqttUser(); String pw = settings::getMqttPw();