diff --git a/data_svelte/items.json b/data_svelte/items.json index 69bdf142..8395e9f4 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -55,8 +55,9 @@ "widget": "", "page": "", "descr": "", - "int": "0", - "val": "0" + "int": "1", + "val": "0", + "dtFormat": "" }, { "header": "Модули управления" diff --git a/src/modules/system/Variable/Variable.cpp b/src/modules/system/Variable/Variable.cpp index e0d8b111..cc9037e5 100644 --- a/src/modules/system/Variable/Variable.cpp +++ b/src/modules/system/Variable/Variable.cpp @@ -1,15 +1,29 @@ #include "Global.h" #include "classes/IoTItem.h" +#include "classes/IoTRTC.h" +extern IoTRTC *watch; class Variable : public IoTItem { + private: + String _dtFormat; public: - Variable(String parameters): IoTItem(parameters) { } + Variable(String parameters): IoTItem(parameters) { + jsonRead(parameters, "dtFormat", _dtFormat); + _dtFormat = _dtFormat; + } // особенность данного модуля - просто хранение значения для сценария, нет событий // void setValue(IoTValue Value) { // value = Value; // } + + void doByInterval() { + if (_dtFormat != "") { + value.isDecimal = false; + value.valS = watch->gettime(_dtFormat + " "); + } + } }; void* getAPI_Variable(String subtype, String param) { diff --git a/src/modules/system/Variable/items.json b/src/modules/system/Variable/items.json index d86f6d58..4d36fa3d 100644 --- a/src/modules/system/Variable/items.json +++ b/src/modules/system/Variable/items.json @@ -9,7 +9,8 @@ "page": "", "descr": "", - "int": "0", - "val": "0" + "int": "1", + "val": "0", + "dtFormat": "" } ] \ No newline at end of file