From 8d71ade035a0b344e4d316af0f13fec0cfd9a671 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 25 Oct 2020 17:38:06 +0100 Subject: [PATCH] Fixed rule Break not working as expected Fixed rule Break not working as expected when ONCE is enabled (#9245) --- CHANGELOG.md | 3 +++ RELEASENOTES.md | 7 ++++--- tasmota/xdrv_10_rules.ino | 13 +++++++------ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8ef98d9..35a1c370f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 58c6117f2..3f9f212ba 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -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 diff --git a/tasmota/xdrv_10_rules.ino b/tasmota/xdrv_10_rules.ino index e5a041674..35b7525dc 100644 --- a/tasmota/xdrv_10_rules.ino +++ b/tasmota/xdrv_10_rules.ino @@ -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,8 +698,8 @@ 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 (plen == plen2) { stop_all_rules = true; } // If BREAK was used on a triggered rule, Stop execution of this rule set + 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; ucommand.toUpperCase(); @@ -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]++;