260 add uptime to iot manager

This commit is contained in:
Dmitry Borisenko
2020-10-20 17:22:26 +03:00
parent c389792081
commit 6064b9eac9
11 changed files with 50 additions and 4 deletions

22
src/items/sysUptime.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include "Class/LineParsing.h"
#include "ItemsCmd.h"
#include "Global.h"
#include <Arduino.h>
void sysUptime() {
myLineParsing.update();
String key = myLineParsing.gkey();
sCmd.addCommand(key.c_str(), uptimeReading);
sensorReadingMap += key + ",";
myLineParsing.clear();
}
void uptimeReading() {
String key = sCmd.order();
eventGen(key, "");
String uptime = timeNow->getUptime();
uptime.replace(":", "-");
jsonWriteStr(configLiveJson, key, uptime);
publishStatus(key, uptime);
Serial.println("I sensor '" + key + "' data: " + uptime);
}