App to shut off heat/AC if window is open for longer then specified time?

What thermostat are you using? If Ecobee, try (free) Ecobee Suite smartapp.