mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
260 add uptime to iot manager
This commit is contained in:
2
src/Class/LineParsing.cpp
Normal file
2
src/Class/LineParsing.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "Class/LineParsing.h"
|
||||
LineParsing myLineParsing;
|
||||
@@ -45,6 +45,8 @@ void cmd_init() {
|
||||
|
||||
//sCmd.addCommand("modbus", modbus);
|
||||
|
||||
sCmd.addCommand("uptime", sysUptime);
|
||||
|
||||
handle_time_init();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "items/SensorAnalogClass.h"
|
||||
#ifdef ANALOG_ENABLED
|
||||
//==============================================Модуль аналогового сенсора===========================================================================================
|
||||
//analog-adc;id;anydata;Сенсоры;Аналоговый;order;pin-adc;map[1,1024,1,100];c[1]
|
||||
//===================================================================================================================================================================
|
||||
SensorAnalogClass mySensorAnalog;
|
||||
void analogAdc() {
|
||||
|
||||
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