add MQTT status topic (#1438)

This commit is contained in:
CaCO3
2022-11-30 20:26:11 +01:00
committed by GitHub
parent 6c51af7107
commit 7e997889aa
3 changed files with 20 additions and 8 deletions

View File

@@ -19,6 +19,8 @@ extern "C" {
#include "time_sntp.h"
#include "Helper.h"
#include "server_ota.h"
#include "interface_mqtt.h"
#include "server_mqtt.h"
//#include "CImg.h"
@@ -30,7 +32,6 @@ extern "C" {
static const char* TAG = "FLOW CTRL";
std::string ClassFlowControll::doSingleStep(std::string _stepname, std::string _host){
std::string _classname = "";
std::string result = "";
@@ -275,7 +276,10 @@ void ClassFlowControll::doFlowMakeImageOnly(string time){
if (FlowControll[i]->name() == "ClassFlowMakeImage") {
// zw_time = gettimestring("%Y%m%d-%H%M%S");
zw_time = gettimestring("%H:%M:%S");
aktstatus = TranslateAktstatus(FlowControll[i]->name()) + " (" + zw_time + ")";
std::string flowStatus = TranslateAktstatus(FlowControll[i]->name());
aktstatus = flowStatus + " (" + zw_time + ")";
MQTTPublish(mqttServer_getMainTopic() + "/" + "status", flowStatus, false);
FlowControll[i]->doFlow(time);
}
}
@@ -302,12 +306,10 @@ bool ClassFlowControll::doFlow(string time)
for (int i = 0; i < FlowControll.size(); ++i)
{
zw_time = gettimestring("%H:%M:%S");
aktstatus = TranslateAktstatus(FlowControll[i]->name()) + " (" + zw_time + ")";
std::string flowStatus = TranslateAktstatus(FlowControll[i]->name());
aktstatus = flowStatus + " (" + zw_time + ")";
MQTTPublish(mqttServer_getMainTopic() + "/" + "status", flowStatus, false);
// zw_time = gettimestring("%Y%m%d-%H%M%S");
// aktstatus = zw_time + ": " + FlowControll[i]->name();
string zw = "FlowControll.doFlow - " + FlowControll[i]->name();
LogFile.WriteHeapInfo(zw);
@@ -333,7 +335,9 @@ bool ClassFlowControll::doFlow(string time)
}
zw_time = gettimestring("%H:%M:%S");
aktstatus = "Flow finished (" + zw_time + ")";
std::string flowStatus = "Flow finished";
aktstatus = flowStatus + " (" + zw_time + ")";
MQTTPublish(mqttServer_getMainTopic() + "/" + "status", flowStatus, false);
return result;
}