Added code for thermostat.