Add ability to set fan made to Nest climate component (#3399)

* Add ability to set fan made to Nest climate component

* Use constants for fan values

* Use STATE_ON from cost

* Fix lint error
pull/3258/head^2
Jeff Wilson 2016-09-16 00:01:32 -04:00 committed by Paulus Schoutsen
parent c23ad3e285
commit d7452f9d5d
1 changed files with 13 additions and 10 deletions

View File

@ -8,9 +8,10 @@ import logging
import voluptuous as vol import voluptuous as vol
import homeassistant.components.nest as nest import homeassistant.components.nest as nest
from homeassistant.components.climate import ( from homeassistant.components.climate import (
STATE_COOL, STATE_HEAT, STATE_IDLE, ClimateDevice, PLATFORM_SCHEMA) STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_IDLE, ClimateDevice,
PLATFORM_SCHEMA)
from homeassistant.const import ( from homeassistant.const import (
TEMP_CELSIUS, CONF_SCAN_INTERVAL, ATTR_TEMPERATURE) TEMP_CELSIUS, CONF_SCAN_INTERVAL, ATTR_TEMPERATURE, STATE_ON)
from homeassistant.util.temperature import convert as convert_temperature from homeassistant.util.temperature import convert as convert_temperature
DEPENDENCIES = ['nest'] DEPENDENCIES = ['nest']
@ -38,6 +39,7 @@ class NestThermostat(ClimateDevice):
self._unit = temp_unit self._unit = temp_unit
self.structure = structure self.structure = structure
self.device = device self.device = device
self._fan_list = [STATE_ON, STATE_AUTO]
@property @property
def name(self): def name(self):
@ -164,17 +166,18 @@ class NestThermostat(ClimateDevice):
self.structure.away = False self.structure.away = False
@property @property
def is_fan_on(self): def current_fan_mode(self):
"""Return whether the fan is on.""" """Return whether the fan is on."""
return self.device.fan return STATE_ON if self.device.fan else STATE_AUTO
def turn_fan_on(self): @property
"""Turn fan on.""" def fan_list(self):
self.device.fan = True """List of available fan modes."""
return self._fan_list
def turn_fan_off(self): def set_fan_mode(self, fan):
"""Turn fan off.""" """Turn fan on/off."""
self.device.fan = False self.device.fan = fan.lower()
@property @property
def min_temp(self): def min_temp(self):