Quick Fix for MQTT Init Problem

This commit is contained in:
jomjol
2022-12-04 15:12:20 +01:00
parent 85905a7045
commit a122b37c81
5 changed files with 31 additions and 2 deletions

View File

@@ -189,6 +189,15 @@ string ClassFlowMQTT::GetMQTTMainTopic()
bool ClassFlowMQTT::Start(float AutoIntervall) {
// printf("URI: %s, MAINTOPIC: %s", uri.c_str(), maintopic.c_str());
if ((uri.length() == 0) || (maintopic.length() == 0))
{
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "MQTT not started because URI or Maintopic is not set. MQTT will be disabled.");
MQTTdisable();
return false;
}
roundInterval = AutoIntervall; // Minutes
keepAlive = roundInterval * 60 * 2.5; // Seconds, make sure it is greater thatn 2 rounds!