I remember ST had something like this. If a door was open for a certain amount of time the thermostat would pause then resume when closed. I'm having trouble with how to pull this off.
I don't have a coded example, but the overview is that you need two rules, The first rule is triggered by the door being opened. That first rule delays the certain amount of time and then sets the thermostat mode to off. The second rule is triggered by the door being closed. The second rule cancels actions of the first rule and sets the thermostat mode to auto (or heat or cool). If you have other things that cause thermostat mode changes, then you have to be aware of interactions with those rules. For example, if the thermostat was off for some completely different reason, then the second rule would turn it back on when the door closes even if the other reason was still applicable.
Can certainly do this in a single rule. Turning the thermostat off when a wait for elapsed time condition is met. Turn it back on when the sensor is closed.
Do I need to put any kind of cancel into that or is it taken care of on it's own?
I'm sure I'm missing some details.
Trigger = Front Door changed
IF Front Door open THEN
Wait for event: --> elapsed time: 0:04:00
ELSE-IF Front Door closed THEN
OOOOH! So close!
Hopefully I got it right myself
I'm not pretending to be the god of rules. His name is Bruce.
This is how I do it.
If the doors or window have been open for one minute then the thermostat turns off. After they are all shut it will turn the thermostat back to auto after a 4 minute delay. (The delay is there to prevent the system from cycling too quickly, not sure if it's needed but it makes me feel better.
This rule will not prevent someone from turning the system on if something is open. I haven't tackled that part yet because it's never been a problem in my home.
I am not sure if having delayed actions is worse than "wait for event", and it seems like the other examples are simpler, but this has worked perfectly for me for months.
This seems to cover more bases. I'm going to try this out.
I just came to see what other people have done. I have setup mine a bit different and curious to see people's thoughts.
I start with a delay since there is nothing I need to do immediately, then I do a last second check to confirm I still want to do the action. If I don't do this check the situation needs to be corrected another way such as a rule that disables this one or stops it.
If some windows are open and some are closed, doesn't this rule turn your thermostat off and then immediately turn it back on again?
Ah I think you are correct. Should I set a private boolean to stop the rule from executing multiple times?
The issue is not that the rule runs multiple times. In a single execution, it turns the HVAC off and then back on again. If you want the HVAC off when ANY window is open, then the second condition should be ALL closed (or simply be an ELSE block).