Fixed rule Break not working as expected

Fixed rule Break not working as expected when ONCE is enabled (#9245)
This commit is contained in:
Theo Arends 2020-10-25 17:38:06 +01:00
parent a96218fc1c
commit 8d71ade035
3 changed files with 14 additions and 9 deletions

View File

@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file.
### Added
- TLS in binary tasmota-zbbridge (#9620)
### Fixed
- Rule Break not working as expected when ONCE is enabled (#9245)
## [9.0.0.2] - 20201025
### Added
- Support for Vietnamese language translations by Tâm.NT

View File

@ -19,13 +19,13 @@ See [migration path](https://tasmota.github.io/docs/Upgrading#migration-path) fo
--- Major change in internal GPIO function representation ---
8. Migrate to **Tasmota 9.x**
8. Migrate to **Tasmota 9.1**
While fallback or downgrading is common practice it was never supported due to Settings additions or changes in newer releases. Starting with release **v9.1.0 Imogen** the internal GPIO function representation has changed in such a way that fallback is only possible to the latest GPIO configuration before installing **v9.1.0**.
## Supported Core versions
This release will be supported from ESP8266/Arduino library Core version **2.7.4.3** due to reported security and stability issues on previous Core version. This will also support gzipped binaries.
This release will be supported from ESP8266/Arduino library Core version **2.7.4.5** due to reported security and stability issues on previous Core version. This will also support gzipped binaries.
Support of Core versions before 2.7.1 has been removed.
@ -39,7 +39,7 @@ For initial configuration this release supports Webserver based **WifiManager**
## Provided Binary Downloads
The following binary downloads have been compiled with ESP8266/Arduino library core version **2.7.4.3**.
The following binary downloads have been compiled with ESP8266/Arduino library core version **2.7.4.5**.
- **tasmota.bin** = The Tasmota version with most drivers. **RECOMMENDED RELEASE BINARY**
- **tasmota-BG.bin** to **tasmota-TW.bin** = The Tasmota version in different languages.
@ -112,6 +112,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Scripter memory alignment (#9608)
- Zigbee battery percentage (#9607)
- HassAnyKey anomaly (#9601)
- Rule Break not working as expected when ONCE is enabled (#9245)
### Removed
- Support for direct upgrade from Tasmota versions before v7.0

View File

@ -401,7 +401,7 @@ int32_t SetRule(uint32_t idx, const char *content, bool append = false) {
/*******************************************************************************************/
bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule, bool stop_all_rules)
{
// event = {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}}
// event = {"System":{"Boot":1}}
@ -575,7 +575,9 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
}
} else match = true;
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match 1 %d"), match);
if (stop_all_rules) { match = false; }
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match 1 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
if (bitRead(Settings.rule_once, rule_set)) {
if (match) { // Only allow match state changes
@ -589,7 +591,7 @@ bool RulesRuleMatch(uint8_t rule_set, String &event, String &rule)
}
}
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match 2 %d"), match);
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Match 2 %d, Triggers %08X, TriggerCount %d"), match, Rules.triggers[rule_set], Rules.trigger_count[rule_set]);
return match;
}
@ -696,7 +698,7 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("RUL: Event |%s|, Rule |%s|, Command(s) |%s|"), event.c_str(), event_trigger.c_str(), commands.c_str());
if (RulesRuleMatch(rule_set, event, event_trigger)) {
if (RulesRuleMatch(rule_set, event, event_trigger, stop_all_rules)) {
if (plen == plen2) { stop_all_rules = true; } // If BREAK was used on a triggered rule, Stop execution of this rule set
commands.trim();
String ucommand = commands;
@ -754,7 +756,6 @@ bool RuleSetProcess(uint8_t rule_set, String &event_saved)
#endif
ExecuteCommand(command, SRC_RULE);
serviced = true;
if (stop_all_rules) { return serviced; } // If BREAK was used, Stop execution of this rule set
}
plen += 6;
Rules.trigger_count[rule_set]++;