mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-28 07:02:17 +03:00
260 add uptime to iot manager
This commit is contained in:
22
src/items/sysUptime.cpp
Normal file
22
src/items/sysUptime.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user