So, this rule lets me close the blind behind my couch based on the light value actions on motion and AV receiver power state. It uses two global variables to step through some of the logic (both are boolean and set by secondary rm rules.)
It's pretty much if the av is on and it's too bright (Westtoobright), close the blind. Then wait for it to get darker and open the blind but the open also is checking to see if my other west facing blinds are partially closed (westtoohot) and when it opens it's either full or if it's hot (temperature) then 10%.
The last part is just checking if the av is off and the blind is closed it makes a check to see if another blind is open to make sure it should open. Then checks if it's hot and opens like the above example.
The problem is that the couch blind opens after the 10:00 minute wait even after the mode change. I put the required expression with the cancel in it to kill the wait, but it seems like I'm missing something probably simple.
Can I cancel the wait from within the If-Then section? I'm thinking it's because I loop through the wait regardless of the state. I've been messing with this for a while now and I'm just thinking that I've got something in the wrong place. Plus my head hurts. lol
Thanks in advance for anyone's input or assistance.
If you enable all logging for this rule (and then look at or share that output, filtered to just this rule), it may give more clues. I read your description but admit that I'm a little lost and what the rule is supposed to do and what is happening when it shouldn't, and this normally makes things clearer all-around.
To directly answer some questions or give some ideas that may or may not actually help you with this automation:
a "Cancel Rule Timers" will cancel waits for time, delays, periodic triggers, and other scheduled jobs in the rule (more than you need but probably not a problem)
if you want to make sure a condition is still true after the wait, you can check the condition again or add it to your wait expression (if the latter makes sense to do with the logic you need)
I want to close the window across from the tv if its bright outside so no glare and open it when it's not going to be a problem. Variable westtoobright is lumens >800 true, else false.
Trigger is on motion active.
This rule on motion checks to see if it's day, then checks my av receiver to see if it is on, if it is then it checks westtoobright and if it is true it closes the blind. When westtobright is false it waits 10 minutes and then opens the blind.
If the mode is day and the AV receiver is off it just skips the lumens test and opens the blind.
The problem I am having is that the blind is opening if the wait is triggered right before the mode change. (i.e. mode changes to night, X minutes later blind opens.)
When the mode changes will the cancel delayed actions action cancel a pending wait to open if there is one?
No, the "IF (Mode is Day) THEN" expression is evaluated when it's reached. If it's true, then everything inside it runs (from the IF THEN to the corresponding ELSE). If it's false, then everything inside the ELSE runs. You will never have a scenario where both run.
You could add another check for Day around whatever actions you don't want to happen in that case, you could add it to your required expression if you don't want it to trigger at all (and leave the cancel pending option on), among other possibilities.
The second rule posted was just streamlined to ask the question, the original rule has the cancel in the required expression. I have been converting most of my RE to conditional triggers and was not sure (and confusing myself) with the wait in the process).