Add A Sonoff To Home Thermostat?
This is an old question, but there are several solutions here that may help others who stumble upon it.

The easiest and most consumer-friendly way to do this is with a "smart" thermostat, these are designed to be controlled remotely and also can be activated when you're home/away, at a set time of day, minimum/maximum temperature, or when you reach a certain distance from your house (tracked by GPS).

The Sonoff you mentioned is capable of doing this as well, in a tinker/hacker way. I would actually recommend you use a 2-channel Sonoff so one channel can control heating and one channel control cooling. As you're configuring the Sonoff remember that "inching" means "momentary connection" and "locking" means "closed circuit" like a normal switch. I believe thermostats "lock" until the desired temperature is reached. Sonoffs contain relays with several hundred volts and several amps of capacity.

As @dandavis commented previously, I would wire these in parallel with your thermostat wiring so that your thermostat still controls your system also. The answers about what to connect with what should be in your thermostat manual, I haven't read it. If you're more of a "do-er" than a reader, you can use a voltmeter to check the thermostat's continuity during operation and figure out where to bridge your Sonoff that way.