diff --git a/data/config.json b/data/config.json
index 592a7138..88fa28c5 100644
--- a/data/config.json
+++ b/data/config.json
@@ -5,13 +5,13 @@
"appass": "",
"routerssid": "VOLODYA",
"routerpass": "BELCHENKO",
- "timezone": 2,
+ "timezone": 1,
"ntp": "pool.ntp.org",
- "mqttServer": "91.204.228.124",
- "mqttPort": 1883,
+ "mqttServer": "m12.cloudmqtt.com",
+ "mqttPort": 14053,
"mqttPrefix": "/iotTest",
- "mqttUser": "rise",
- "mqttPass": "23ri22se32",
+ "mqttUser": "lbscvzuj",
+ "mqttPass": "bLxlveOgaF8F",
"scen": "1",
"telegramApi": "1416711569:AAEI0j83GmXqwzb_gnK1B0Am0gDwZoJt5xo",
"telegonof": "0",
diff --git a/data/items/input-time.txt b/data/items/input-time.txt
index e90f7689..14c29d89 100644
--- a/data/items/input-time.txt
+++ b/data/items/input-time.txt
@@ -1 +1 @@
-0;input-time;id;inputTime;Ввод;Введите#время;order;st[10:00:00]
\ No newline at end of file
+0;input-time;id;inputTime;Ввод;Введите#время;order;st[10:00]
\ No newline at end of file
diff --git a/data/presets/rel.c.txt b/data/presets/rel.c.txt
new file mode 100644
index 00000000..af8550f0
--- /dev/null
+++ b/data/presets/rel.c.txt
@@ -0,0 +1,4 @@
+0;button-out;button1;toggle;Реле;Освещение;1;pin[12];st[0]
+0;button-out;button2;toggle;Реле;Освещение;2;pin[13];st[0]
+0;input-time;T1;inputTime;Реле;Введите#время#включения;3;st[10:00]
+0;input-time;T2;inputTime;Реле;Введите#время#выключения;4;st[11:00]
\ No newline at end of file
diff --git a/data/presets/rel.s.txt b/data/presets/rel.s.txt
new file mode 100644
index 00000000..844d1c5b
--- /dev/null
+++ b/data/presets/rel.s.txt
@@ -0,0 +1,8 @@
+timenow = T1
+button1 1
+button2 0
+end
+timenow = T2
+button1 0
+button2 1
+end
\ No newline at end of file
diff --git a/data/set.device.json b/data/set.device.json
index 4ba722d1..55a874a1 100644
--- a/data/set.device.json
+++ b/data/set.device.json
@@ -43,7 +43,7 @@
},
{
"type": "h4",
- "title": "LittleFS version: 266"
+ "title": "LittleFS version: 267"
},
{
"type": "hr"
@@ -88,7 +88,8 @@
"title": {
"#": "Выберите пресет из списка",
"/set?addPreset=dal.c": "1.Термостат на основе ds18b20 с оповещением в телеграм",
- "/set?addPreset=dht.c": "2.Контроль влажности на основе DHT с оповещением в телеграм"
+ "/set?addPreset=dht.c": "2.Контроль влажности на основе DHT с оповещением в телеграм",
+ "/set?addPreset=rel.c": "3.Включение выключение реле в заданное время"
}
},
{
@@ -184,6 +185,15 @@
"action": "/check",
"response": "[[my-block]]",
"class": "btn btn-block btn-default"
+ },
+ {
+ "type": "hr"
+ },
+ {
+ "type": "link",
+ "title": "Перезагрузить устройство",
+ "action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/set?device=ok');}",
+ "class": "btn btn-block btn-danger"
}
]
}
\ No newline at end of file
diff --git a/data/set.telegram.json b/data/set.telegram.json
index e4a22bb7..76560093 100644
--- a/data/set.telegram.json
+++ b/data/set.telegram.json
@@ -54,6 +54,15 @@
{
"type": "text",
"title": "
После настройки telegram перезагрузите устройство что бы изменения вступили в силу
"
+ },
+ {
+ "type": "hr"
+ },
+ {
+ "type": "link",
+ "title": "Перезагрузить устройство",
+ "action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/set?device=ok');}",
+ "class": "btn btn-block btn-danger"
}
]
}
\ No newline at end of file
diff --git a/include/Class/ScenarioClass2.h b/include/Class/ScenarioClass2.h
index 4b7434fb..6dc84eb6 100644
--- a/include/Class/ScenarioClass2.h
+++ b/include/Class/ScenarioClass2.h
@@ -24,6 +24,7 @@ public:
String setEventSign = selectFromMarkerToMarker(condition, " ", 1);
String setEventValue = selectFromMarkerToMarker(condition, " ", 2);
if (!isDigitStr(setEventValue)) setEventValue = jsonReadStr(configLiveJson, setEventValue);
+
String incommingEventValue = jsonReadStr(configLiveJson, incommingEvent);
if (incommingEvent == setEvent) {
diff --git a/include/Class/ScenarioClass3.h b/include/Class/ScenarioClass3.h
new file mode 100644
index 00000000..3bedf2bc
--- /dev/null
+++ b/include/Class/ScenarioClass3.h
@@ -0,0 +1,70 @@
+#pragma once
+#include
+#include "Cmd.h"
+#include "Global.h"
+
+class Scenario {
+
+public:
+
+ void loop() {
+
+ String allBlocks = scenario;
+ allBlocks.replace("\r\n", "\n");
+ allBlocks.replace("\r", "\n");
+ allBlocks += "\n";
+
+ String incommingEvent = selectToMarker(eventBuf, ",");
+ String incommingEventKey = selectToMarker(incommingEvent, " ");
+ String incommingEventValue = selectToMarkerLast(incommingEvent, " ");
+
+ while (allBlocks.length() > 1) {
+ String oneBlock = selectToMarker(allBlocks, "end\n");
+ String condition = selectToMarker(oneBlock, "\n");
+
+ String setEventKey = selectFromMarkerToMarker(condition, " ", 0);
+
+ if (incommingEventKey == setEventKey) {
+
+ String setEventSign = selectFromMarkerToMarker(condition, " ", 1);
+ String setEventValue = selectFromMarkerToMarker(condition, " ", 2);
+ if (!isDigitStr(setEventValue)) setEventValue = jsonReadStr(configLiveJson, setEventValue);
+
+ boolean flag = false;
+
+ if (setEventSign == "=") {
+ flag = incommingEventValue == setEventValue;
+ }
+ else if (setEventSign == "!=") {
+ flag = incommingEventValue != setEventValue;
+ }
+ else if (setEventSign == "<") {
+ flag = incommingEventValue.toFloat() < setEventValue.toFloat();
+ }
+ else if (setEventSign == ">") {
+ flag = incommingEventValue.toFloat() > setEventValue.toFloat();
+ }
+ else if (setEventSign == ">=") {
+ flag = incommingEventValue.toFloat() >= setEventValue.toFloat();
+ }
+ else if (setEventSign == "<=") {
+ flag = incommingEventValue.toFloat() <= setEventValue.toFloat();
+ }
+
+ if (flag) {
+ //SerialPrint("I", "Scenario", "incomming Event Value: " + incommingEventValue);
+ //SerialPrint("I", "Scenario", "set Event Value: " + setEventValue);
+
+ oneBlock = deleteBeforeDelimiter(oneBlock, "\n");
+ oneBlock.replace("end", "");
+ SerialPrint("I", "Scenario", condition + " \n" + oneBlock);
+ spaceCmdExecute(oneBlock);
+ }
+ }
+ allBlocks = deleteBeforeDelimiter(allBlocks, "end\n");
+ }
+ eventBuf = deleteBeforeDelimiter(eventBuf, ",");
+ }
+};
+
+extern Scenario* myScenario;
\ No newline at end of file
diff --git a/include/Consts.h b/include/Consts.h
index a81d1977..e0679110 100644
--- a/include/Consts.h
+++ b/include/Consts.h
@@ -3,11 +3,11 @@
//===========Firmware=============================================================================================================================================
#ifdef ESP8266
#define FIRMWARE_NAME "esp8266-iotm"
-#define FIRMWARE_VERSION 266
+#define FIRMWARE_VERSION 267
#endif
#ifdef ESP32
#define FIRMWARE_NAME "esp32-iotm"
-#define FIRMWARE_VERSION 266
+#define FIRMWARE_VERSION 267
#endif
#define FLASH_4MB true
@@ -105,4 +105,8 @@ enum LedStatus_t {
enum ConfigType_t {
CT_CONFIG,
CT_SCENARIO
-};
\ No newline at end of file
+};
+
+//07.11.2020
+//RAM: [===== ] 46.8% (used 38376 bytes from 81920 bytes)
+//Flash: [===== ] 54.2% (used 566004 bytes from 1044464 bytes)
\ No newline at end of file
diff --git a/include/Global.h b/include/Global.h
index 11de486a..59226d64 100644
--- a/include/Global.h
+++ b/include/Global.h
@@ -93,7 +93,7 @@ extern void servo_();
extern void setLedStatus(LedStatus_t);
//Scenario
-extern void eventGen(String event_name, String number);
+extern void eventGen2(String eventName, String eventValue);
extern String add_set(String param_name);
//Timers
diff --git a/include/items/ButtonInClass.h b/include/items/ButtonInClass.h
index 07f3793f..1c66b945 100644
--- a/include/items/ButtonInClass.h
+++ b/include/items/ButtonInClass.h
@@ -52,7 +52,7 @@ class ButtonInClass : public LineParsing {
}
void switchChangeVirtual(String key, String state) {
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteInt(configLiveJson, key, state.toInt());
publishStatus(key, state);
}
diff --git a/include/items/ButtonOutClass.h b/include/items/ButtonOutClass.h
index bd3587c3..1afebc63 100644
--- a/include/items/ButtonOutClass.h
+++ b/include/items/ButtonOutClass.h
@@ -32,7 +32,7 @@ public:
else {
digitalWrite(pinInt, !state.toInt());
}
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteInt(configLiveJson, key, state.toInt());
publishStatus(key, state);
}
diff --git a/include/items/InputClass.h b/include/items/InputClass.h
index afe5a0f8..447fccfe 100644
--- a/include/items/InputClass.h
+++ b/include/items/InputClass.h
@@ -16,13 +16,13 @@ class InputClass : public LineParsing {
}
void inputSetFloat(String key, String state) {
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteFloat(configLiveJson, key, state.toFloat());
publishStatus(key, state);
}
void inputSetStr(String key, String state) {
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteStr(configLiveJson, key, state);
publishStatus(key, state);
}
diff --git a/include/items/OutputTextClass.h b/include/items/OutputTextClass.h
index c52cd54c..8e3867ba 100644
--- a/include/items/OutputTextClass.h
+++ b/include/items/OutputTextClass.h
@@ -15,7 +15,7 @@ class OutputTextClass : public LineParsing {
void OutputModuleChange(String key, String state) {
state.replace("#", " ");
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteStr(configLiveJson, key, state);
publishStatus(key, state);
}
diff --git a/include/items/PwmOutClass.h b/include/items/PwmOutClass.h
index 807762d6..bd6570ba 100644
--- a/include/items/PwmOutClass.h
+++ b/include/items/PwmOutClass.h
@@ -22,7 +22,7 @@ class PwmOutClass : public LineParsing {
void pwmChange(String key, String pin, String state) {
int pinInt = pin.toInt();
analogWrite(pinInt, state.toInt());
- eventGen(key, "");
+ eventGen2(key, state);
jsonWriteInt(configLiveJson, key, state.toInt());
publishStatus(key, state);
}
diff --git a/include/items/SensorAnalogClass.h b/include/items/SensorAnalogClass.h
index f1659263..ccaba263 100644
--- a/include/items/SensorAnalogClass.h
+++ b/include/items/SensorAnalogClass.h
@@ -26,7 +26,7 @@ class SensorAnalogClass : public SensorConvertingClass {
#endif
value = this->mapping(key, value);
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
diff --git a/include/items/SensorBme280Class.h b/include/items/SensorBme280Class.h
index 11e97169..42b7d532 100644
--- a/include/items/SensorBme280Class.h
+++ b/include/items/SensorBme280Class.h
@@ -25,7 +25,7 @@ class SensorBme280Class : public SensorConvertingClass {
float value;
value = bme.readTemperature();
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
@@ -35,7 +35,7 @@ class SensorBme280Class : public SensorConvertingClass {
float value;
value = bme.readHumidity();
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
@@ -46,7 +46,7 @@ class SensorBme280Class : public SensorConvertingClass {
value = bme.readPressure();
value = value / 1.333224 / 100;
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
diff --git a/include/items/SensorBmp280Class.h b/include/items/SensorBmp280Class.h
index 28ef71a0..934245a1 100644
--- a/include/items/SensorBmp280Class.h
+++ b/include/items/SensorBmp280Class.h
@@ -26,7 +26,7 @@ class SensorBmp280Class : public SensorConvertingClass {
bmp_temp->getEvent(&temp_event);
value = temp_event.temperature;
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
@@ -39,7 +39,7 @@ class SensorBmp280Class : public SensorConvertingClass {
value = pressure_event.pressure;
value = value / 1.333224;
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
diff --git a/include/items/SensorDhtClass.h b/include/items/SensorDhtClass.h
index c90fc578..6eb4433b 100644
--- a/include/items/SensorDhtClass.h
+++ b/include/items/SensorDhtClass.h
@@ -41,7 +41,7 @@ class SensorDhtClass : public SensorConvertingClass {
if (String(value) != "nan") {
//value = this->mapping(key, value);
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
@@ -65,7 +65,7 @@ class SensorDhtClass : public SensorConvertingClass {
if (String(value) != "nan") {
//value = this->mapping(key, value);
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
diff --git a/include/items/SensorModbusClass.h b/include/items/SensorModbusClass.h
index 39c3d8bd..a93063c8 100644
--- a/include/items/SensorModbusClass.h
+++ b/include/items/SensorModbusClass.h
@@ -35,7 +35,7 @@
// }
//
// int valueFl = this->correction(key, value);
-// eventGen(key, "");
+// eventGen2(key, String(valueFl));
// jsonWriteStr(configLiveJson, key, String(valueFl));
// publishStatus(key, String(valueFl));
// SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl) + ", Slave dev addr: " + String(slaveAddress) + ", Register: " + String(regAddress));
diff --git a/include/items/SensorUltrasonicClass.h b/include/items/SensorUltrasonicClass.h
index 5dee38dd..6adce30d 100644
--- a/include/items/SensorUltrasonicClass.h
+++ b/include/items/SensorUltrasonicClass.h
@@ -40,7 +40,7 @@ class SensorUltrasonic : public SensorConvertingClass {
value = this->mapping(key, value);
float valueFl = this->correction(key, value);
- eventGen(key, "");
+ eventGen2(key, String(valueFl));
jsonWriteStr(configLiveJson, key, String(valueFl));
publishStatus(key, String(valueFl));
SerialPrint("I", "Sensor", "'" + key + "' data: " + String(valueFl));
diff --git a/src/Class/ScenarioClass2.cpp b/src/Class/ScenarioClass2.cpp
deleted file mode 100644
index 113a4ee3..00000000
--- a/src/Class/ScenarioClass2.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "Class/ScenarioClass2.h"
-Scenario* myScenario;
-
-void eventGen(String event_name, String number) {
- if (!jsonReadBool(configSetupJson, "scen")) {
- return;
- }
- SerialPrint("", "", event_name);
- eventBuf += event_name + number + ",";
-}
\ No newline at end of file
diff --git a/src/Class/ScenarioClass3.cpp b/src/Class/ScenarioClass3.cpp
new file mode 100644
index 00000000..1876711f
--- /dev/null
+++ b/src/Class/ScenarioClass3.cpp
@@ -0,0 +1,18 @@
+#include "Class/ScenarioClass3.h"
+Scenario* myScenario;
+
+//void eventGen(String event_name, String number) {
+// if (!jsonReadBool(configSetupJson, "scen")) {
+// return;
+// }
+// SerialPrint("", "", event_name);
+// eventBuf += event_name + number + ",";
+//}
+
+void eventGen2(String eventName, String eventValue) {
+ if (!jsonReadBool(configSetupJson, "scen")) {
+ return;
+ }
+ //Serial.println(eventName + " " + eventValue);
+ eventBuf += eventName + " " + eventValue + ",";
+}
\ No newline at end of file
diff --git a/src/ItemsCmd.cpp b/src/ItemsCmd.cpp
index 0b448b42..be6330ac 100644
--- a/src/ItemsCmd.cpp
+++ b/src/ItemsCmd.cpp
@@ -249,7 +249,7 @@
// servo->write(value);
// }
//
-// eventGen("servo", number);
+// eventGen2("servo", number);
// jsonWriteInt(configLiveJson, "servo" + number, value);
// publishStatus("servo" + number, String(value, DEC));
//}
diff --git a/src/Sensors.cpp b/src/Sensors.cpp
index d3a0817b..4b657757 100644
--- a/src/Sensors.cpp
+++ b/src/Sensors.cpp
@@ -54,7 +54,7 @@
// counter = 0;
// value = dht.getTemperature();
// if (String(value) != "nan") {
-// //eventGen(dhtT_value_name, "");
+// //eventGen2(dhtT_value_name, "");
// //jsonWriteStr(configLiveJson, dhtT_value_name, String(value));
// // publishStatus(dhtT_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + dhtT_value_name + "' data: " + String(value));
@@ -92,7 +92,7 @@
// counter = 0;
// value = dht.getHumidity();
// if (String(value) != "nan") {
-// //eventGen(dhtH_value_name, "");
+// //eventGen2(dhtH_value_name, "");
// //jsonWriteStr(configLiveJson, dhtH_value_name, String(value));
// // publishStatus(dhtH_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + dhtH_value_name + "' data: " + String(value));
@@ -117,7 +117,7 @@
// //value = dht.computePerception(jsonReadStr(configLiveJson, dhtT_value_name).toFloat(), jsonReadStr(configLiveJson, dhtH_value_name).toFloat(), false);
// String final_line = perceptionStr(value);
// jsonWriteStr(configLiveJson, "dhtPerception", final_line);
-// eventGen("dhtPerception", "");
+// eventGen2("dhtPerception", "");
// publishStatus("dhtPerception", final_line);
// if (mqtt.connected()) {
// SerialPrint("I", "Sensor", "'dhtPerception' data: " + final_line);
@@ -142,7 +142,7 @@
// //dht.getComfortRatio(cf, jsonReadStr(configLiveJson, dhtT_value_name).toFloat(), jsonReadStr(configLiveJson, dhtH_value_name).toFloat(), false);
// String final_line = comfortStr(cf);
// jsonWriteStr(configLiveJson, "dhtComfort", final_line);
-// eventGen("dhtComfort", "");
+// eventGen2("dhtComfort", "");
// publishStatus("dhtComfort", final_line);
// SerialPrint("I", "Sensor", "'dhtComfort' send date " + final_line);
// }
@@ -234,7 +234,7 @@
// } else {
// //value = dht.computeDewPoint(jsonReadStr(configLiveJson, dhtT_value_name).toFloat(), jsonReadStr(configLiveJson, dhtH_value_name).toFloat(), false);
// jsonWriteInt(configLiveJson, "dhtDewpoint", value);
-// eventGen("dhtDewpoint", "");
+// eventGen2("dhtDewpoint", "");
// publishStatus("dhtDewpoint", String(value));
// SerialPrint("I", "Sensor", "'dhtDewpoint' data: " + String(value));
// }
@@ -270,7 +270,7 @@
// bmp_temp->getEvent(&temp_event);
// value = temp_event.temperature;
// //jsonWriteStr(configLiveJson, bmp280T_value_name, String(value));
-// //eventGen(bmp280T_value_name, "");
+// //eventGen2(bmp280T_value_name, "");
// // publishStatus(bmp280T_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + bmp280T_value_name + "' data: " + String(value));
//}
@@ -302,7 +302,7 @@
// value = pressure_event.pressure;
// value = value / 1.333224;
// //jsonWriteStr(configLiveJson, bmp280P_value_name, String(value));
-// //eventGen(bmp280P_value_name, "");
+// //eventGen2(bmp280P_value_name, "");
// // publishStatus(bmp280P_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + bmp280P_value_name + "' data: " + String(value));
//}
@@ -327,7 +327,7 @@
// float value = 0;
// value = bme.readTemperature();
// //jsonWriteStr(configLiveJson, bme280T_value_name, String(value));
-// //eventGen(bme280T_value_name, "");
+// //eventGen2(bme280T_value_name, "");
// // publishStatus(bme280T_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + bme280T_value_name + "' data: " + String(value));
//}
@@ -351,7 +351,7 @@
// value = bme.readPressure();
// value = value / 1.333224 / 100;
// //jsonWriteStr(configLiveJson, bme280P_value_name, String(value));
-// //eventGen(bme280P_value_name, "");
+// //eventGen2(bme280P_value_name, "");
// // publishStatus(bme280P_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + bme280P_value_name + "' data: " + String(value));
//}
@@ -374,7 +374,7 @@
// float value = 0;
// value = bme.readHumidity();
// //jsonWriteStr(configLiveJson, bme280H_value_name, String(value));
-// //eventGen(bme280H_value_name, "");
+// //eventGen2(bme280H_value_name, "");
// // publishStatus(bme280H_value_name, String(value));
// //SerialPrint("I", "Sensor", "'" + bme280H_value_name + "' data: " + String(value));
//}
@@ -397,7 +397,7 @@
// float value = bme.readAltitude(1013.25);
// //jsonWriteStr(configLiveJson, bme280A_value_name, String(value, 2));
//
-// //eventGen(bme280A_value_name, "");
+// //eventGen2(bme280A_value_name, "");
//
// // publishStatus(bme280A_value_name, String(value));
//
diff --git a/src/Timers.cpp b/src/Timers.cpp
index dda1007b..b45ab7b6 100644
--- a/src/Timers.cpp
+++ b/src/Timers.cpp
@@ -19,7 +19,7 @@ void Timer_countdown_init() {
if (time == 0) {
delTimer(String(number));
jsonWriteStr(configLiveJson, "timer" + String(number), "0");
- eventGen("timer", String(number));
+ eventGen2("timer", String(number));
} else {
time--;
addTimer(String(number), String(time));
diff --git a/src/Utils/statUtils.cpp b/src/Utils/statUtils.cpp
index f924ec05..0145e5f2 100644
--- a/src/Utils/statUtils.cpp
+++ b/src/Utils/statUtils.cpp
@@ -141,7 +141,8 @@ String updateDeviceStatus() {
"&uptime=" + timeNow->getUptime() +
"&uptimeTotal=" + getUptimeTotal() +
"&version=" + FIRMWARE_VERSION +
- "&resetsTotal=" + String(getCurrentNumber("stat.txt")) + "");
+ "&resetsTotal=" + String(getCurrentNumber("stat.txt")) +
+ "&heap=" + String(ESP.getFreeHeap()) + "");
if (httpCode > 0) {
ret = httpCode;
if (httpCode == HTTP_CODE_OK) {
diff --git a/src/items/InputTimeClass.cpp b/src/items/InputTimeClass.cpp
index 4d632550..9dc16dd4 100644
--- a/src/items/InputTimeClass.cpp
+++ b/src/items/InputTimeClass.cpp
@@ -19,9 +19,14 @@ void inputTimeSet() {
void handle_time_init() {
ts.add(
- TIME, 1000, [&](void *) {
- jsonWriteStr(configLiveJson, "timenow", timeNow->getTime());
- eventGen("timenow", "");
+ TIME, 1000, [&](void*) {
+ String timenow = timeNow->getTimeWOsec();
+ static String prevTime;
+ if (prevTime != timenow) {
+ prevTime = timenow;
+ jsonWriteStr(configLiveJson, "timenow", timenow);
+ eventGen2("timenow", timenow);
+ }
},
nullptr, true);
}
\ No newline at end of file
diff --git a/src/items/SensorDallas.cpp b/src/items/SensorDallas.cpp
index f30983fc..1abadc25 100644
--- a/src/items/SensorDallas.cpp
+++ b/src/items/SensorDallas.cpp
@@ -30,7 +30,7 @@ void SensorDallas::loop() {
void SensorDallas::readDallas() {
sensors.requestTemperaturesByIndex(_index);
float value = sensors.getTempCByIndex(_index);
- eventGen(_key, "");
+ eventGen2(_key, String(value));
jsonWriteStr(configLiveJson, _key, String(value));
publishStatus(_key, String(value));
SerialPrint("I", "Sensor", "'" + _key + "' data: " + String(value));
diff --git a/src/main.cpp b/src/main.cpp
index c10b8cbc..08c03929 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,7 +5,7 @@
#include "Bus.h"
#include "Class/CallBackTest.h"
#include "Class/NotAsync.h"
-#include "Class/ScenarioClass2.h"
+#include "Class/ScenarioClass3.h"
#include "Cmd.h"
#include "Global.h"
#include "Init.h"