Wi-Fi capable thermostat

Hi everybody,
I’m very new to this amazing Arduino world, so I need help. I want to build a wifi capable thermostat to control an HVAC unit which can be controlled from a remote pc. Can u guys guide me through the right direction to accomplish this project? I have attached a block diagram of what I think I need. I need to know how to put all this in one code so that it works as a one unit.
In the diagram the second temperature sensor is to check the outside temps so that in an extreme condition some default values can be used to control the HVAC unit. Please let me know the right way of doing this.

Simple old school.