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 homeassistant.components.nest as nest
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 (
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
DEPENDENCIES = ['nest']
@ -38,6 +39,7 @@ class NestThermostat(ClimateDevice):
self._unit = temp_unit
self.structure = structure
self.device = device
self._fan_list = [STATE_ON, STATE_AUTO]
@property
def name(self):
@ -164,17 +166,18 @@ class NestThermostat(ClimateDevice):
self.structure.away = False
@property
def is_fan_on(self):
def current_fan_mode(self):
"""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):
"""Turn fan on."""
self.device.fan = True
@property
def fan_list(self):
"""List of available fan modes."""
return self._fan_list
def turn_fan_off(self):
"""Turn fan off."""
self.device.fan = False
def set_fan_mode(self, fan):
"""Turn fan on/off."""
self.device.fan = fan.lower()
@property
def min_temp(self):