Not sure this possible, complex rule

I am new to custom rules.

I have a door sensor that I would like to test if it has been open for more than 5 minutes and if someone changes the temperature to reset the temperature to a specific value after one minute.

The app for routines won’t allow me to state if it’s been open for more than 5 minutes do this, best I can do is say if the door has been open for 5 minutes and the temperature is not my value set it to that value, but this does not work if the value changes after 5 minutes.

Is there a way to do this?

Might be possible with the Rules API, but there is another way to accomplish the time trigger using the Edge Counter Utility. The challenge for your Routine is that there is no trigger for just “changes” for the temperature. It must be “temperature is above” or “temperature is below” or “temperature in range” or “temperature is”.

For the time trigger, create a Routine to turn on a counter when the sensor opens. Then when the temperature changes and is above/below/in range AND the duration of the timer is at or above 5 mins, set the heat/cool temperature to a specific value delayed by 1 min.

Create a Routine to turn off the counter when the sensor closes.

If you don’t need the Routine to run locally on your hub, you might consider using a 3rd party rules engine like sharptools.io which offers triggers like “changes” and more complex evaluation logic.

Oh, that’s surprising. As long as you are using two conditions (not preconditions) I would have thought that would have worked.

To me the key to addressing the requirement is to appreciate that the key event is the temperature being changed. When that happens you want to know if the door has already been open for five minutes.