As per the two Gentleman’s posts above, there are many methods.
Here below sharing mine, it can be improved a lot, I am sure.
A door/window open for X amount of time. I want to stop the heating if specific door or windows are opened. In my case those door/windows have various type of sensors (Xiaomi, Fibaro). First I did create a group of all those particular sensors, using the Group App Then I created a Countdown Timer using the Countdown app as per above post by Roco. My first simple flow looks like this.
I want my heating to stop after 60 sec. of door/window open, in your case have 300 sec.
After the timer has lapsed, I set my thermostat to AWAY. I have a Netatmo, perhaps Tado can do the same or maybe just set it to a low temperature which will have your boiler off.
Here is the second simple flow.
If my sensor group is now closed before the timer runs out, then I want the timer to stop so it does not turn off the heating. Say for example I opened the back door to go out in the backyard then closed it after me. So I don’t want the heating to stop just because of that.
Here is my second flow. This one accounts for both door closed before timer runs out (it stops then the timer) and door closed after time runs out (by now the thermostat has been stoped by the flow at point 2 above) by using the ELSE condition.
One last thing I have implemented, when the Thermostat is set on “Frost-Guard” mode I disable all the above three flows (I do this with a flow of course). This is so the above flows don’t run during summer time. When the weather gets warm I usually set manually my thermostat in Frost-Guard mode. Of course you can have this automated, too.