Closed mrneutron42 closed 7 months ago
What you seem to be misunderstanding is that rules is not some sort of sequential execution where you can mix different triggers to manage filtering and timing. It is instead events where each new event (like separate Ping command results) is starting independent (but possibly partially interleaved) passes through the rules engine, and break
only works within each of those passes.
The references to break
facilitating some sort of if/else
logic is only within the processing of the same event, like results from a single Ping
command, not when you are firing off more than one. Using break
within your 224 rule is not affecting the 223 rules, and vice versa.
Also, using Delay
in rules is a broken strategy, as these intervals can be cut short by other commands executing. Use RuleTimer when you want to control "later execution".
PROBLEM DESCRIPTION
A clear and concise description of what the problem is. In trying to write a rule that has the BREAK command, I discovered that BREAK does not function as described in the documentation. Putting BREAK at the end of a rule section does not stop the execution of the remaining rules that follow, within the rule set. Rule3 in my ruleset listed below shows the failing behavior.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior: Enter rule including BREAK command, and enable rule. You will observe that the last section of the rule runs EVERY TIME, instead of being skipped over when the ping to 192.168.7.223 or 192.168.7.224 fails.
Rule3 ON Time#Minute|2 DO Backlog Ping4 192.168.7.223; Ping4 192.168.7.224 ENDON ON Ping#192.168.7.223#Success<1 DO DELAY 10 BREAK ON Ping#192.168.7.224#Success<1 DO DELAY 10 BREAK ON Ping#192.168.7.223#Success>1 DO Backlog DELAY 10; Power1 0; Delay 100; Power1 1 ENDON Rule3 1
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen. If the ping command to 192.168.7.223 fails to get a response, I expect the BREAK command to skip the rest of the rule. If the ping command to 192.168.7.224 fails to get a response, I expect the BREAK command to skip the rest of the rule. In my weblog 4 console output, the ping to 192.168.7.224 failed, and the BREAK command should have skipped the last part of the rule that power cycled the switch, but it was executed anyway and a power cycle ocurred.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
This issue existed in 2020 and it still does. https://github.com/arendst/Tasmota/issues/7985
(Please, remember to close the issue when the problem has been addressed)