Improve MQTT connection handling (#1462)

* modify mqtt init at startup + after disconnection

* mqtt_init only when not initialized

* Minor udapte

* Apply suggestions from code review

Co-authored-by: CaCO3 <caco3@ruinelli.ch>

* Correct typo

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
This commit is contained in:
Slider0007
2022-12-03 19:10:44 +01:00
committed by GitHub
parent 6c8a45f2dc
commit 85905a7045
5 changed files with 45 additions and 30 deletions

View File

@@ -203,9 +203,8 @@ bool ClassFlowMQTT::Start(float AutoIntervall) {
keepAlive, SetRetainFlag, (void *)&GotConnected);
if (!MQTT_Init()) {
if (!MQTT_Init()) { // Retry
return false;
}
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, "Init at startup failed! Retry with next publish call");
return false;
}
return true;