mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
extract isScenarioEnabled()
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
|
||||
static const char* MODULE = "Scen";
|
||||
|
||||
boolean isScenarioEnabled() {
|
||||
return jsonReadBool(configSetupJson, "scen") && jsonReadStr(configOptionJson, "scenario_status") != "";
|
||||
}
|
||||
|
||||
void loopScenario() {
|
||||
bool enabled = jsonReadBool(configSetupJson, "scen");
|
||||
if (enabled) {
|
||||
if ((jsonReadStr(configOptionJson, "scenario_status") != "")) {
|
||||
if (!isScenarioEnabled()) {
|
||||
return;
|
||||
}
|
||||
String str = scenario;
|
||||
str += "\n";
|
||||
str.replace("\r\n", "\n");
|
||||
@@ -71,17 +75,17 @@ void loopScenario() {
|
||||
String tmp2 = jsonReadStr(configOptionJson, "scenario_status"); //читаем файл событий
|
||||
tmp2 = deleteBeforeDelimiter(tmp2, ","); //удаляем выполненное событие
|
||||
jsonWriteStr(configOptionJson, "scenario_status", tmp2); //записываем обновленный файл событий
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//событие выглядит как имя плюс set плюс номер: button+Set+1
|
||||
// событие: имя + Set + номер
|
||||
// button+Set+1
|
||||
void eventGen(String event_name, String number) {
|
||||
if (jsonReadStr(configSetupJson, "scen") == "1") {
|
||||
String tmp = jsonReadStr(configOptionJson, "scenario_status"); //генерирование события
|
||||
jsonWriteStr(configOptionJson, "scenario_status", tmp + event_name + number + ",");
|
||||
if (!jsonReadBool(configSetupJson, "scen")) {
|
||||
return;
|
||||
}
|
||||
// генерирование события
|
||||
String tmp = jsonReadStr(configOptionJson, "scenario_status");
|
||||
jsonWriteStr(configOptionJson, "scenario_status", tmp + event_name + number + ",");
|
||||
}
|
||||
|
||||
String add_set(String str) {
|
||||
|
||||
Reference in New Issue
Block a user