thermostat: move fan attribute up to thermostat

This commit is contained in:
Michael Auchter 2016-01-11 19:08:41 -06:00
parent afa4fc4ef5
commit a0ed469aa2
2 changed files with 18 additions and 1 deletions

View file

@ -34,6 +34,7 @@ STATE_IDLE = "idle"
ATTR_CURRENT_TEMPERATURE = "current_temperature"
ATTR_AWAY_MODE = "away_mode"
ATTR_FAN = "fan"
ATTR_MAX_TEMP = "max_temp"
ATTR_MIN_TEMP = "min_temp"
ATTR_TEMPERATURE_LOW = "target_temp_low"
@ -167,6 +168,10 @@ class ThermostatDevice(Entity):
if is_away is not None:
data[ATTR_AWAY_MODE] = STATE_ON if is_away else STATE_OFF
is_fan_on = self.is_fan_on
if is_fan_on is not None:
data[ATTR_FAN] = STATE_ON if is_fan_on else STATE_OFF
device_attr = self.device_state_attributes
if device_attr is not None:
@ -212,6 +217,14 @@ class ThermostatDevice(Entity):
"""
return None
@property
def is_fan_on(self):
"""
Returns if the fan is on
Return None if not available.
"""
return None
def set_temperate(self, temperature):
""" Set new target temperature. """
pass

View file

@ -66,7 +66,6 @@ class NestThermostat(ThermostatDevice):
return {
"humidity": self.device.humidity,
"target_humidity": self.device.target_humidity,
"fan": self.device.fan,
"mode": self.device.mode
}
@ -143,6 +142,11 @@ class NestThermostat(ThermostatDevice):
""" Turns away off. """
self.structure.away = False
@property
def is_fan_on(self):
""" Returns whether the fan is on """
return self.device.fan
@property
def min_temp(self):
""" Identifies min_temp in Nest API or defaults if not available. """