Refactoring NestThermostat.py.