Ecobee-like energy saving based on sensors

Ecobee has 2 really clever features:

  • Adjust the temperature to the room I’m occupied in so that I’m not trying to make upstairs 70F when I’m downstairs all day
  • when a door/window is open for let’s say 5 minutes turn off the ac until its closed again

I’m less interested in the room activity since temp sensors are cheap and easy ( that said I already have many more of these sensors from other brands so it would be nic to leverage those in addition to ) but the door window one is a big investment to change over considering I have 20 windows with ring contact sensors already. I shared the first one because I’m sure anyone reading this would also be interested in that.

My question is what is the best way to accomplish the 2nd feature around turning off the ac. I’m thinking a simple script could do this.