mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
Add rule trigger on one level deeper
Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...``
This commit is contained in:
parent
ac486f2186
commit
9afbf854cf
@ -66,6 +66,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
|||||||
- Fix ``WakeUp <x>`` ignores provided value (#7473)
|
- Fix ``WakeUp <x>`` ignores provided value (#7473)
|
||||||
- Fix exception 9 restart on log message in Ticker interrupt service routines NTP, Wemos and Hue emulation (#7496)
|
- 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 ``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 ``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 ``SetOption82 0/1`` to limit the CT range for Alexa to 200..380
|
||||||
- Add command ``ShutterButton <parameters>`` to control shutter(s) by to-scho (#7403)
|
- Add command ``ShutterButton <parameters>`` 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 most SetOptions as defines to my_user_config.h
|
||||||
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
||||||
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
|
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
|
||||||
|
- Add rule trigger on one level deeper using syntax with two ``#`` like ``on zigbeereceived#vibration_sensor#aqaracubeside=0 do ...``
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
- Fix ``PowerDelta`` zero power detection (#7515)
|
- Fix ``PowerDelta`` zero power detection (#7515)
|
||||||
- Fix OTA minimal gzipped detection regression from 8.1.0.3
|
- 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 web page sliders when ``SetOption37 128`` is active allowing control of white(s)
|
||||||
- Add Zigbee persistence and friendly names
|
- Add Zigbee persistence and friendly names
|
||||||
- Add most SetOptions as defines to my_user_config.h
|
- Add most SetOptions as defines to my_user_config.h
|
||||||
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
- Add SoftwareSerial to CSE7766 driver allowing different GPIOs (#7563)
|
||||||
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` to control initial start color
|
- Add optional parameter <startcolor> to command ``Scheme <scheme>, <startcolor>`` 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
|
### 8.1.0.3 20200106
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
|
|||||||
JsonObject &root = jsonBuf.parseObject(event);
|
JsonObject &root = jsonBuf.parseObject(event);
|
||||||
if (!root.success()) { return false; } // No valid JSON data
|
if (!root.success()) { return false; } // No valid JSON data
|
||||||
|
|
||||||
|
String rule_subfield = "";
|
||||||
const char* str_value;
|
const char* str_value;
|
||||||
if ((pos = rule_name.indexOf("[")) > 0) { // "CURRENT[1]"
|
if ((pos = rule_name.indexOf("[")) > 0) { // "CURRENT[1]"
|
||||||
int rule_name_idx = rule_name.substring(pos +1).toInt();
|
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"
|
rule_name = rule_name.substring(0, pos); // "CURRENT"
|
||||||
str_value = root[rule_task][rule_name][rule_name_idx -1]; // "ENERGY" and "CURRENT" and 0
|
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 {
|
} else {
|
||||||
str_value = root[rule_task][rule_name]; // "INA219" and "CURRENT"
|
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"),
|
//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");
|
// 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
|
// No value but rule_name is ok
|
||||||
|
|
||||||
Rules.event_value = str_value; // Prepare %value%
|
Rules.event_value = str_value; // Prepare %value%
|
||||||
|
Loading…
x
Reference in New Issue
Block a user