Fix rule trigger support for status 11

Fix rule trigger support for status 11 (#9053)
This commit is contained in:
Theo Arends 2020-08-11 16:08:53 +02:00
parent 89e7822975
commit ecd06b6c83
1 changed files with 10 additions and 5 deletions

View File

@ -497,9 +497,12 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
rule_name = rule_name.substring(0, pos); // "SUBTYPE1#CURRENT"
}
StaticJsonBuffer<1024> jsonBuf;
StaticJsonBuffer<1280> jsonBuf; // Was 1024 until 20200811
JsonObject &root = jsonBuf.parseObject(event);
if (!root.success()) { return false; } // No valid JSON data
if (!root.success()) {
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event too long (%d)"), event.length());
return false;
} // No valid JSON data
JsonObject *obj = &root;
String subtype;
uint32_t i = 0;
@ -512,6 +515,8 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
rule_name = rule_name.substring(pos +1);
if (i++ > 10) { return false; } // Abandon possible loop
yield();
}
const JsonVariant & val = GetCaseInsensitive(*obj, rule_name.c_str());