MQTT improvements (#1302)

* Update server_mqtt.cpp

* Update server_mqtt.cpp

* skipp all MQTT publishing until the next round if an error occures

* improve logging

* only use group for uid and topic if there is more than one number

* .

* .
This commit is contained in:
CaCO3
2022-11-09 18:25:24 +01:00
committed by GitHub
parent 2314d7ef18
commit 2b0e0f7d4e
7 changed files with 32 additions and 26 deletions

View File

@@ -230,6 +230,8 @@ bool ClassFlowMQTT::doFlow(string zwtime)
{
std::vector<NumberPost*>* NUMBERS = flowpostprocessing->GetNumbers();
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Publishing MQTT topics...");
for (int i = 0; i < (*NUMBERS).size(); ++i)
{
result = (*NUMBERS)[i]->ReturnValue;
@@ -245,7 +247,6 @@ bool ClassFlowMQTT::doFlow(string zwtime)
else
namenumber = maintopic + "/" + namenumber + "/";
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Publishing MQTT topics...");
if (result.length() > 0)
MQTTPublish(namenumber + "value", result, SetRetainFlag);