HVAC Rule for window/door open

I wrote a rule that was working great in RM3 for making it so if my windows/doors were opened my HVAC would turn off until they were closed again. I converted the rule to RM4 and I'm having an issue. I feel like I have my cancels wrong. My HVAC is turning off even when it shouldn't. Can anyone see anything obvious here?

RM3 rule that worked fine:

RM4 rule that isn't working:

Note: I have no clue what the blank line is before the OR... Assuming it's an RM bug because I removed devices that were used in that part of the rule and I can't seem to remove the rule line

I think I'd approach it a slightly different way in RM4. Something like:

Trigger:
Long list of sensors any *changed*

Actions:
IF long list of sensors any open THEN
   do the stuff from RM3 "true"
ELSE
   do the stuff from RM3 "false"
END-IF

Hmm did a cancel on truth change cancel in that scenario... What is a "truth change" when the event is simply changed?

RM4 doesn't really have a "truth change" per se.

When the event is "changed," the rule will trigger whenever the state of any of your sensors changes, whether it opens or closes.

If any of them open, that's the same as your RM3 rule's "true" section. If none of them are open, that's the same as "false."

So how does a cancel work with this? I only want it to trigger if something is open for 5 mins. If it closes within 5 mins, cancel. That was super easy in rm3

The cancel you have on your wait only means that the wait can be cancelled. But then you have to explicitly cancel it in another action.

You could do something like:

Trigger:
Long list of sensors any *changed*

Actions:
IF long list of sensors any open THEN
   DELAY 5 minutes
   IF sensors any open THEN
      do the stuff from RM3 "true"
   ELSE
      EXIT RULE
   END-IF
ELSE
   do the stuff from RM3 "false"
END-IF

Not quite. If it was open after the 5 mins, it could have opened/closed during the 5 mins. I don't think a delay will account for that. Each time they all close the 5 mins needs to reset.

So, if one sensor opens, the 5 minute wait starts. If a second sensor opens during that 5 minutes, do you want the wait to reset, or does the first 5 minutes still apply?

The reason I suggested the second check for open sensors was to account for the case of all sensors being closed during the 5 minute delay. If they're all closed, the rule exits, which resets the 5 minutes.

The rule will run every time a sensor opens or closes, so you might have multiple instances of this rule running at the same time.

Hmm I see what you're doing here. I guess my point is sensor 1 opens, start 5 min counter. If sensor 1 closes after 1 minute, cancel. If it opens again 30 seconds later, start a 5 minute counter. I would have thought, because it closed and reopened during the 5 min delay, the if at the end would say it's open and shut stuff off whereas really it shouldn't because it didn't "remain open" for 5 minutes, it closed and reopened during the 5 mins. Make sense? I might be explaining it poorly

From my experience those blank lines have indicated broken rules. In many cases devices were removed from the system after a rule was built. Sometimes you can select and delete the blank lines, other times you need to delete the rule and rewrite.

So, this is what I hear you saying you want for one sensor:

S1 opens
Start 5 minute clock
If S1 is now closed at end of 5 minutes
   Don't do anything and exit rule
Else
   If it's still open, do stuff
End-if

Correct so far?

Now what happens when you add S2, or other sensors from your list? Do you want each sensor to have it's own 5 minute timer? Or do you want all of the sensors to be treated as one thing, so that when any are opened the clock starts, and other sensors only contribute to the "open" or "closed" state, but do not reset the timer.

S1 opens
Start 5 minute clock
S2 opens
 -- what now? start new clock? continue with current clock?
S1 closes
-- what now? stop 5 minute clock? continue from S2 clock? 
If some time has passed and everything is closed
   don't do anything and exit rule
else
   If something (S1? S2?) is still open, do some stuff
End-if

This does not take into account that there's stuff you want to do if everything is closed (i.e. the "false" stuff from your RM3 rule).

If you want to use a cancel on your delay, you need to do something like this:

Delay 0:05:00 (cancel)
If S1 is closed
   Cancel Delayed Actions
End-If

Here is my HVAC rule.

The Doors virtual contact sensor is controlled by this rule, similar for Windows obviously

I use a rule to change the variable and then I use the variable to change the AC state. Then I use two Simple Conditional Actions to do the actions.