mirror of https://github.com/arendst/Tasmota.git
Trim pre/pst spaces on rule trigger
This commit is contained in:
parent
e1c0942811
commit
26916f62de
|
@ -696,7 +696,9 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
|
||||
delay(0); // Prohibit possible loop software watchdog
|
||||
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("RUL-RP1: Event = %s, Rule = %s"), event_saved.c_str(), Settings->rules[rule_set]);
|
||||
#ifdef DEBUG_RULES
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("RUL-RP1: Event = %s, Rule = %s"), event_saved.c_str(), Settings->rules[rule_set]);
|
||||
#endif
|
||||
|
||||
String rules = GetRule(rule_set);
|
||||
|
||||
|
@ -716,6 +718,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
int pevt = rule.indexOf(F(" DO "));
|
||||
if (pevt == -1) { return serviced; } // Bad syntax - Nothing to do
|
||||
String event_trigger = rule.substring(3, pevt); // "INA219#CURRENT>0.100"
|
||||
event_trigger.trim();
|
||||
|
||||
plen = rule.indexOf(F(" ENDON"));
|
||||
plen2 = rule.indexOf(F(" BREAK"));
|
||||
|
@ -730,7 +733,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
|
|||
String event = event_saved;
|
||||
|
||||
#ifdef DEBUG_RULES
|
||||
// AddLog(LOG_LEVEL_DEBUG, PSTR("RUL-RP2: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str());
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("RUL-RP2: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str());
|
||||
#endif
|
||||
|
||||
if (RulesRuleMatch(rule_set, event, event_trigger, stop_all_rules)) {
|
||||
|
@ -813,7 +816,9 @@ bool RulesProcessEvent(const char *json_event)
|
|||
|
||||
SHOW_FREE_MEM(PSTR("RulesProcessEvent"));
|
||||
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: ProcessEvent |%s|"), json_event);
|
||||
#ifdef DEBUG_RULES
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: ProcessEvent |%s|"), json_event);
|
||||
#endif
|
||||
|
||||
String event_saved = json_event;
|
||||
// json_event = {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}}
|
||||
|
@ -827,7 +832,9 @@ bool RulesProcessEvent(const char *json_event)
|
|||
}
|
||||
event_saved.toUpperCase();
|
||||
|
||||
//AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|"), event_saved.c_str());
|
||||
#ifdef DEBUG_RULES
|
||||
AddLog(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|"), event_saved.c_str());
|
||||
#endif
|
||||
|
||||
for (uint32_t i = 0; i < MAX_RULE_SETS; i++) {
|
||||
if (GetRuleLen(i) && bitRead(Settings->rule_enabled, i)) {
|
||||
|
|
Loading…
Reference in New Issue