A heating and cooling thermostat requires a web-connected microcontroller, relays for activating the external circuits, and analog inputs for reading the temperature ...
When you want to connect an IoT device to anything (or, for that matter, anything to anything), you should take a serious look at Node-RED, a free, open source visual process wiring system from IBM ...