mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
allow multiple onChange schedules with same trigger #1806
This commit is contained in:
@@ -371,16 +371,17 @@ bool WebSchedulerService::command(const char * cmd, const char * data) {
|
|||||||
#include "shuntingYard.hpp"
|
#include "shuntingYard.hpp"
|
||||||
|
|
||||||
bool WebSchedulerService::onChange(const char * cmd) {
|
bool WebSchedulerService::onChange(const char * cmd) {
|
||||||
|
bool cmd_ok = false;
|
||||||
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
||||||
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_ONCHANGE
|
if (scheduleItem.active && scheduleItem.flags == SCHEDULEFLAG_SCHEDULE_ONCHANGE
|
||||||
&& Helpers::toLower(scheduleItem.time).find(Helpers::toLower(cmd)) != std::string::npos) {
|
&& Helpers::toLower(scheduleItem.time).find(Helpers::toLower(cmd)) != std::string::npos) {
|
||||||
#ifdef EMESESP_DEBUG
|
#ifdef EMESESP_DEBUG
|
||||||
// emsesp::EMSESP::logger().debug(scheduleItem.cmd.c_str());
|
// emsesp::EMSESP::logger().debug(scheduleItem.cmd.c_str());
|
||||||
#endif
|
#endif
|
||||||
return command(scheduleItem.cmd.c_str(), compute(scheduleItem.value).c_str());
|
cmd_ok |= command(scheduleItem.cmd.c_str(), compute(scheduleItem.value).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return cmd_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSchedulerService::condition() {
|
void WebSchedulerService::condition() {
|
||||||
|
|||||||
Reference in New Issue
Block a user