Added additional checks which hides functions which are not supported by Nest (#3751)

* Added additional checks which hides functions which are not support (like fans / humidity / cooling)

* Fixed pylint and flake8 errors (not test file available)

* Fixed pydocstyle error

* Refactored Code and Comments as described in pull-request

* Added additional comment and requesting retest

* Upgraded to python-nest 2.11 which contains previously hidden functions
This commit is contained in:
Ferry van Zeelst 2016-10-11 08:57:14 +02:00 committed by Paulus Schoutsen
parent 941fccd3fc
commit 8c9d1d9af1
3 changed files with 30 additions and 10 deletions

View file

@ -40,8 +40,19 @@ class NestThermostat(ClimateDevice):
self.structure = structure
self.device = device
self._fan_list = [STATE_ON, STATE_AUTO]
self._operation_list = [STATE_HEAT, STATE_COOL, STATE_AUTO,
STATE_OFF]
# Not all nest devices support cooling and heating remove unused
self._operation_list = [STATE_OFF]
# Add supported nest thermostat features
if self.device.can_heat:
self._operation_list.append(STATE_HEAT)
if self.device.can_cool:
self._operation_list.append(STATE_COOL)
if self.device.can_heat and self.device.can_cool:
self._operation_list.append(STATE_AUTO)
@property
def name(self):
@ -64,11 +75,15 @@ class NestThermostat(ClimateDevice):
@property
def device_state_attributes(self):
"""Return the device specific state attributes."""
# Move these to Thermostat Device and make them global
return {
"humidity": self.device.humidity,
"target_humidity": self.device.target_humidity,
}
if self.device.has_humidifier or self.device.has_dehumidifier:
# Move these to Thermostat Device and make them global
return {
"humidity": self.device.humidity,
"target_humidity": self.device.target_humidity,
}
else:
# No way to control humidity not show setting
return {}
@property
def current_temperature(self):
@ -164,7 +179,12 @@ class NestThermostat(ClimateDevice):
@property
def current_fan_mode(self):
"""Return whether the fan is on."""
return STATE_ON if self.device.fan else STATE_AUTO
if self.device.has_fan:
# Return whether the fan is on
return STATE_ON if self.device.fan else STATE_AUTO
else:
# No Fan available so disable slider
return None
@property
def fan_list(self):

View file

@ -14,7 +14,7 @@ from homeassistant.const import (CONF_PASSWORD, CONF_USERNAME, CONF_STRUCTURE)
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['python-nest==2.10.0']
REQUIREMENTS = ['python-nest==2.11.0']
DOMAIN = 'nest'

View file

@ -389,7 +389,7 @@ python-mpd2==0.5.5
python-mystrom==0.3.6
# homeassistant.components.nest
python-nest==2.10.0
python-nest==2.11.0
# homeassistant.components.device_tracker.nmap_tracker
python-nmap==0.6.1