diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 5eef31626..ef8df5f8d 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -66,6 +66,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Fix ``WakeUp `` ignores provided value (#7473) - Fix exception 9 restart on log message in Ticker interrupt service routines NTP, Wemos and Hue emulation (#7496) - Fix ``PowerDelta`` zero power detection (#7515) +- Fix ``RGBWWTable`` ignored (#7572) - Add command ``SetOption79 0/1`` to enable reset of counters at teleperiod time by Andre Thomas (#7355) - Add command ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380 - Add command ``ShutterButton `` to control shutter(s) by to-scho (#7403) @@ -83,3 +84,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add most SetOptions as defines to my_user_config.h - Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563) - Add optional parameter to command ``Scheme , `` to control initial start color +- Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...`` diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index b35d22064..5c7073c6e 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -4,12 +4,13 @@ - Fix ``PowerDelta`` zero power detection (#7515) - Fix OTA minimal gzipped detection regression from 8.1.0.3 +- Fix ``RGBWWTable`` ignored (#7572) - Add web page sliders when ``SetOption37 128`` is active allowing control of white(s) - Add Zigbee persistence and friendly names - Add most SetOptions as defines to my_user_config.h - Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563) - Add optional parameter to command ``Scheme , `` to control initial start color -- Fix ``RGBWWTable`` ignored (#7572) +- Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...`` ### 8.1.0.3 20200106 diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index 13287d009..b750ebcbe 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -259,6 +259,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) JsonObject &root = jsonBuf.parseObject(event); if (!root.success()) { return false; } // No valid JSON data + String rule_subfield = ""; const char* str_value; if ((pos = rule_name.indexOf("[")) > 0) { // "CURRENT[1]" int rule_name_idx = rule_name.substring(pos +1).toInt(); @@ -267,6 +268,11 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) } rule_name = rule_name.substring(0, pos); // "CURRENT" str_value = root[rule_task][rule_name][rule_name_idx -1]; // "ENERGY" and "CURRENT" and 0 + } + else if ((pos = rule_name.indexOf("#")) > 0) { // "VIBRATION_SENSOR#AQARACUBESIDE" + rule_subfield = rule_name.substring(pos +1); // "AQARACUBESIDE" + rule_name = rule_name.substring(0, pos); // "VIBRATION_SENSOR" + str_value = root[rule_task][rule_name][rule_subfield]; // "ZIGBEERECEIVED", "VIBRATION_SENSOR" and "AQARACUBESIDE" } else { str_value = root[rule_task][rule_name]; // "INA219" and "CURRENT" } @@ -274,7 +280,11 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule) //AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Task %s, Name %s, Value |%s|, TrigCnt %d, TrigSt %d, Source %s, Json %s"), // rule_task.c_str(), rule_name.c_str(), rule_svalue, Rules.trigger_count[rule_set], bitRead(Rules.triggers[rule_set], Rules.trigger_count[rule_set]), event.c_str(), (str_value) ? str_value : "none"); - if (!root[rule_task][rule_name].success()) { return false; } + if (rule_subfield.length()) { + if (!root[rule_task][rule_name][rule_subfield].success()) { return false; } + } else { + if (!root[rule_task][rule_name].success()) { return false; } + } // No value but rule_name is ok Rules.event_value = str_value; // Prepare %value%