A device for controlling an 
HVAC system in which opening a door or window for more than a shutdown 
delay period causes the fan and compressor to be deactivated, but opening and closing the door or window for less than the shutdown 
delay period does not affect the fan and compressor. Reactivation of the compressor is delayed for a startup 
delay, in order to avoid overcycling of the compressor and the additional 
wear and tear and maintenance that would be caused thereby. Preferably, the door / window sensors are 
wireless for ease of installation and maintenance. Optionally, an 
occupancy sensor and occupancy 
timer are provided to turn off the 
system if the room is unoccupied for an unoccupied 
delay time. Optionally, a secondary 
thermostat with energy saving settings is provided so that if the room is unoccupied for the occupancy delay, then instead of being shut off, the 
HVAC system will be operated at energy saving settings.