Help with Door Sensor

Hello all

I have added two new door sensors to my house (front and lanai) with the following use case:

  1. If someone opens either door and leaves it open for three minutes, then the thermostat will turn off.
  2. If someone has opened the door and closes it in less than three minutes, then nothing should happen.
  3. If the door closes, then it should re-run the appropriate rule to set the thermostat based upon the current mode.

I would like to see if I could get help making is smarter and simpler, as I don't feel as though I have grasped all of the potential use cases:

Can I remove line 3 (Second IF statement), by adding a "Cancel" to the line 2 (Delay 0:03:00)? That is the only reason I have line 3, is to cancel any changes if someone just walks outside.

Triggers any door opens

Wait for conditon all doors closed - timeout 3 min
If any doors open
Thermostat off

Second rule
Trigger thermostat off

Wait for conditon all doors closed
Thermostat auto (and all your mode settings)

Just to follow-up, this is what I ended up with: