Only execute action if a certain period of time is expired and the state is not adjusted

I have a windowsensor which sets the heating to “off” when opened. After the window is closed again, the heating will resume it’s schedule.

How can I set a delay for 2 minutes? So, if the window is open for 2 minutes, the heating must switched to off. When the window is shut within 2 minutes, the heating must still be set to “on”.

Can anybody help me out on this?