From d7452f9d5d100d126d52dca3e46ae709fab8b339 Mon Sep 17 00:00:00 2001 From: Jeff Wilson Date: Fri, 16 Sep 2016 00:01:32 -0400 Subject: [PATCH] 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 --- homeassistant/components/climate/nest.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/climate/nest.py b/homeassistant/components/climate/nest.py index 1b3c38ce449..86b63d4229b 100644 --- a/homeassistant/components/climate/nest.py +++ b/homeassistant/components/climate/nest.py @@ -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):