From 6c106a87f16d506dc12efb1bb4ec705b760e1f18 Mon Sep 17 00:00:00 2001 From: sander Date: Thu, 15 Oct 2015 15:02:09 +0200 Subject: [PATCH 01/10] had to change to let this work on windows. --- script/bootstrap_server | 4 ++-- script/release | 2 +- script/server | 2 +- script/setup | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/bootstrap_server b/script/bootstrap_server index 8d71e01fa78..91a6a36027c 100755 --- a/script/bootstrap_server +++ b/script/bootstrap_server @@ -4,7 +4,7 @@ echo "Update the submodule to latest version..." git submodule update echo "Installing dependencies..." -python3 -m pip install --upgrade -r requirements_all.txt +python -m pip install --upgrade -r requirements_all.txt echo "Installing development dependencies.." -python3 -m pip install --upgrade flake8 pylint coveralls pytest pytest-cov +python -m pip install --upgrade flake8 pylint coveralls pytest pytest-cov diff --git a/script/release b/script/release index 40d906b17bf..31d298ddf8b 100755 --- a/script/release +++ b/script/release @@ -18,4 +18,4 @@ then exit 1 fi -python3 setup.py sdist bdist_wheel upload +python setup.py sdist bdist_wheel upload diff --git a/script/server b/script/server index 0904bfd728e..e0949b2d098 100755 --- a/script/server +++ b/script/server @@ -5,4 +5,4 @@ cd "$(dirname "$0")/.." -python3 -m homeassistant -c config +python -m homeassistant -c config diff --git a/script/setup b/script/setup index 6d3a774dd54..614cadd9b98 100755 --- a/script/setup +++ b/script/setup @@ -2,4 +2,4 @@ cd "$(dirname "$0")/.." git submodule init script/bootstrap -python3 setup.py develop +python setup.py develop From 076b3db5e81ebf796aff6f43daadb86f68818f7e Mon Sep 17 00:00:00 2001 From: sander Date: Wed, 21 Oct 2015 19:00:15 +0200 Subject: [PATCH 02/10] first try --- .../thermostat/honeywell_round_connected.py | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 homeassistant/components/thermostat/honeywell_round_connected.py diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py new file mode 100644 index 00000000000..c26efd51624 --- /dev/null +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -0,0 +1,175 @@ +__author__ = 'sander' + +""" +homeassistant.components.thermostat.honeywell_round_connected +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Adds support for Honeywell Round Connected thermostats. +""" +import socket +import logging + +from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, + STATE_IDLE, STATE_HEAT) +from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) + +REQUIREMENTS = ['evohomeclient'] + +from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE + +# pylint: disable=unused-argument +def setup_platform(hass, config, add_devices, discovery_info=None): + """ Sets up the nest thermostat. """ + logger = logging.getLogger(__name__) + + username = config.get(CONF_USERNAME) + password = config.get(CONF_PASSWORD) + + if username is None or password is None: + logger.error("Missing required configuration items %s or %s", + CONF_USERNAME, CONF_PASSWORD) + return + + try: + from evohomeclient import EvohomeClient + except ImportError: + logger.exception( + "Error while importing dependency nest. " + "Did you maybe not install the python-nest dependency?") + + return + + evo_api = EvohomeClient(username, password) + try: + add_devices([ + RoundThermostat(evo_api) + ]) + except socket.error: + logger.error( + "Connection error logging into the nest web service" + ) + + +class RoundThermostat(ThermostatDevice): + """ Represents a Nest thermostat. """ + + def __init__(self, device): + #self.structure = structure + self.device = device + + + @property + def name(self): + """ Returns the name of the nest, if any. """ + return 'round' + + @property + def unit_of_measurement(self): + """ Unit of measurement this thermostat expresses itself in. """ + return TEMP_CELCIUS + + @property + def device_state_attributes(self): + """ Returns device specific state attributes. """ + # Move these to Thermostat Device and make them global + data = self.device.temperatures(force_refresh=True)[0] + return { + ATTR_CURRENT_TEMPERATURE: data['temp'], + ATTR_TEMPERATURE: data['setpoint'] + } + + + + # @property + # def current_temperature(self): + # """ Returns the current temperature. """ + # return round(self.device.temperature, 1) + + # @property + # def operation(self): + # """ Returns current operation ie. heat, cool, idle """ + # if self.device.hvac_ac_state is True: + # return STATE_COOL + # elif self.device.hvac_heater_state is True: + # return STATE_HEAT + # else: + # return STATE_IDLE + + # @property + # def target_temperature(self): + # """ Returns the temperature we try to reach. """ + # target = self.device.target + # + # if self.device.mode == 'range': + # low, high = target + # if self.operation == STATE_COOL: + # temp = high + # elif self.operation == STATE_HEAT: + # temp = low + # else: + # range_average = (low + high)/2 + # if self.current_temperature < range_average: + # temp = low + # elif self.current_temperature >= range_average: + # temp = high + # else: + # temp = target + # + # return round(temp, 1) + + # @property + # def target_temperature_low(self): + # """ Returns the lower bound temperature we try to reach. """ + # if self.device.mode == 'range': + # return round(self.device.target[0], 1) + # return round(self.target_temperature, 1) + # + # @property + # def target_temperature_high(self): + # """ Returns the upper bound temperature we try to reach. """ + # if self.device.mode == 'range': + # return round(self.device.target[1], 1) + # return round(self.target_temperature, 1) + # + # @property + # def is_away_mode_on(self): + # """ Returns if away mode is on. """ + # return self.structure.away + + # def set_temperature(self, temperature): + # """ Set new target temperature """ + # if self.device.mode == 'range': + # if self.target_temperature == self.target_temperature_low: + # temperature = (temperature, self.target_temperature_high) + # elif self.target_temperature == self.target_temperature_high: + # temperature = (self.target_temperature_low, temperature) + # self.device.target = temperature + # + # def turn_away_mode_on(self): + # """ Turns away on. """ + # self.structure.away = True + # + # def turn_away_mode_off(self): + # """ Turns away off. """ + # self.structure.away = False + # + # @property + # def min_temp(self): + # """ Identifies min_temp in Nest API or defaults if not available. """ + # temp = self.device.away_temperature.low + # if temp is None: + # return super().min_temp + # else: + # return temp + + # @property + # def max_temp(self): + # """ Identifies mxn_temp in Nest API or defaults if not available. """ + # temp = self.device.away_temperature.high + # if temp is None: + # return super().max_temp + # else: + # return temp + + def update(self): + """ Python-nest has its own mechanism for staying up to date. """ + pass From f376061e2337a67029f050358051708dc0c5d37d Mon Sep 17 00:00:00 2001 From: sander Date: Wed, 21 Oct 2015 19:00:23 +0200 Subject: [PATCH 03/10] Revert "had to change to let this work on windows." This reverts commit 6c106a87f16d506dc12efb1bb4ec705b760e1f18. --- script/bootstrap_server | 4 ++-- script/release | 2 +- script/server | 2 +- script/setup | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/bootstrap_server b/script/bootstrap_server index 91a6a36027c..8d71e01fa78 100755 --- a/script/bootstrap_server +++ b/script/bootstrap_server @@ -4,7 +4,7 @@ echo "Update the submodule to latest version..." git submodule update echo "Installing dependencies..." -python -m pip install --upgrade -r requirements_all.txt +python3 -m pip install --upgrade -r requirements_all.txt echo "Installing development dependencies.." -python -m pip install --upgrade flake8 pylint coveralls pytest pytest-cov +python3 -m pip install --upgrade flake8 pylint coveralls pytest pytest-cov diff --git a/script/release b/script/release index 31d298ddf8b..40d906b17bf 100755 --- a/script/release +++ b/script/release @@ -18,4 +18,4 @@ then exit 1 fi -python setup.py sdist bdist_wheel upload +python3 setup.py sdist bdist_wheel upload diff --git a/script/server b/script/server index e0949b2d098..0904bfd728e 100755 --- a/script/server +++ b/script/server @@ -5,4 +5,4 @@ cd "$(dirname "$0")/.." -python -m homeassistant -c config +python3 -m homeassistant -c config diff --git a/script/setup b/script/setup index 614cadd9b98..6d3a774dd54 100755 --- a/script/setup +++ b/script/setup @@ -2,4 +2,4 @@ cd "$(dirname "$0")/.." git submodule init script/bootstrap -python setup.py develop +python3 setup.py develop From 863955e1bdda5fb8c142080632d37870f9d2fa03 Mon Sep 17 00:00:00 2001 From: sander Date: Wed, 21 Oct 2015 21:48:21 +0200 Subject: [PATCH 04/10] got the basics working --- .../thermostat/honeywell_round_connected.py | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py index c26efd51624..15f27e0d9aa 100644 --- a/homeassistant/components/thermostat/honeywell_round_connected.py +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -14,7 +14,7 @@ from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) REQUIREMENTS = ['evohomeclient'] -from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE +# from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): @@ -30,7 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): return try: - from evohomeclient import EvohomeClient + from evohomeclient2 import EvohomeClient except ImportError: logger.exception( "Error while importing dependency nest. " @@ -55,6 +55,9 @@ class RoundThermostat(ThermostatDevice): def __init__(self, device): #self.structure = structure self.device = device + self._current_temperature=None + self._target_temperature=None + self.update() @property @@ -71,18 +74,20 @@ class RoundThermostat(ThermostatDevice): def device_state_attributes(self): """ Returns device specific state attributes. """ # Move these to Thermostat Device and make them global - data = self.device.temperatures(force_refresh=True)[0] - return { - ATTR_CURRENT_TEMPERATURE: data['temp'], - ATTR_TEMPERATURE: data['setpoint'] - } + return {} - # @property - # def current_temperature(self): - # """ Returns the current temperature. """ - # return round(self.device.temperature, 1) + + @property + def current_temperature(self): + """ Returns the current temperature. """ + return self._current_temperature + #return round(self.device.temperature, 1) + + @current_temperature.setter + def current_temparature(self,value): + self._current_temperature=value # @property # def operation(self): @@ -94,10 +99,16 @@ class RoundThermostat(ThermostatDevice): # else: # return STATE_IDLE - # @property - # def target_temperature(self): - # """ Returns the temperature we try to reach. """ - # target = self.device.target + @property + def target_temperature(self): + """ Returns the temperature we try to reach. """ + return self._target_temperature + + @target_temperature.setter + def target_temperature(self,value): + self._target_temperature=value + + # target = self.device.target # # if self.device.mode == 'range': # low, high = target @@ -170,6 +181,12 @@ class RoundThermostat(ThermostatDevice): # else: # return temp + @property + def should_poll(self): + """ No polling needed for a demo thermostat. """ + return True + def update(self): - """ Python-nest has its own mechanism for staying up to date. """ - pass + for dev in self.device.temperatures(): + self._current_temperature=dev['temp'] + self._target_temperature=dev['setpoint'] From 85bb828149ec7f9f5af337777d45ebd007f9d5cb Mon Sep 17 00:00:00 2001 From: sander Date: Thu, 29 Oct 2015 21:17:10 +0100 Subject: [PATCH 05/10] changed requirements to the latest evohome version. --- .../thermostat/honeywell_round_connected.py | 86 +++++++------------ 1 file changed, 32 insertions(+), 54 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py index 15f27e0d9aa..f4c4af4d010 100644 --- a/homeassistant/components/thermostat/honeywell_round_connected.py +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -12,7 +12,7 @@ from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, STATE_IDLE, STATE_HEAT) from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) -REQUIREMENTS = ['evohomeclient'] +REQUIREMENTS = ['evohomeclient==0.2.3'] # from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE @@ -30,11 +30,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None): return try: - from evohomeclient2 import EvohomeClient + from evohomeclient import EvohomeClient except ImportError: logger.exception( - "Error while importing dependency nest. " - "Did you maybe not install the python-nest dependency?") + "Error while importing dependency evohomeclient. " + "Did you maybe not install the python evohomeclient dependency?") return @@ -45,25 +45,31 @@ def setup_platform(hass, config, add_devices, discovery_info=None): ]) except socket.error: logger.error( - "Connection error logging into the nest web service" + "Connection error logging into the honeywell evohome web service" ) class RoundThermostat(ThermostatDevice): - """ Represents a Nest thermostat. """ + """ Represents a Honeywell Round Connected thermostat. """ def __init__(self, device): #self.structure = structure self.device = device self._current_temperature=None self._target_temperature=None + self._name="round connected" + self._sensorid=None self.update() @property def name(self): """ Returns the name of the nest, if any. """ - return 'round' + return self._name + + @name.setter + def name(self,value): + self._name=value @property def unit_of_measurement(self): @@ -77,17 +83,11 @@ class RoundThermostat(ThermostatDevice): return {} - - @property def current_temperature(self): """ Returns the current temperature. """ return self._current_temperature - #return round(self.device.temperature, 1) - @current_temperature.setter - def current_temparature(self,value): - self._current_temperature=value # @property # def operation(self): @@ -104,28 +104,7 @@ class RoundThermostat(ThermostatDevice): """ Returns the temperature we try to reach. """ return self._target_temperature - @target_temperature.setter - def target_temperature(self,value): - self._target_temperature=value - # target = self.device.target - # - # if self.device.mode == 'range': - # low, high = target - # if self.operation == STATE_COOL: - # temp = high - # elif self.operation == STATE_HEAT: - # temp = low - # else: - # range_average = (low + high)/2 - # if self.current_temperature < range_average: - # temp = low - # elif self.current_temperature >= range_average: - # temp = high - # else: - # temp = target - # - # return round(temp, 1) # @property # def target_temperature_low(self): @@ -144,25 +123,21 @@ class RoundThermostat(ThermostatDevice): # @property # def is_away_mode_on(self): # """ Returns if away mode is on. """ - # return self.structure.away + # return True + + def set_temperature(self, temperature): + """ Set new target temperature """ + self.device.set_temperature(self._name,temperature) + + + def turn_away_mode_on(self): + """ Turns away on. """ + self.structure.away = True + + def turn_away_mode_off(self): + """ Turns away off. """ + self.structure.away = False - # def set_temperature(self, temperature): - # """ Set new target temperature """ - # if self.device.mode == 'range': - # if self.target_temperature == self.target_temperature_low: - # temperature = (temperature, self.target_temperature_high) - # elif self.target_temperature == self.target_temperature_high: - # temperature = (self.target_temperature_low, temperature) - # self.device.target = temperature - # - # def turn_away_mode_on(self): - # """ Turns away on. """ - # self.structure.away = True - # - # def turn_away_mode_off(self): - # """ Turns away off. """ - # self.structure.away = False - # # @property # def min_temp(self): # """ Identifies min_temp in Nest API or defaults if not available. """ @@ -183,10 +158,13 @@ class RoundThermostat(ThermostatDevice): @property def should_poll(self): - """ No polling needed for a demo thermostat. """ + """ Should poll the evohome cloud service """ return True def update(self): - for dev in self.device.temperatures(): + for dev in self.device.temperatures(force_refresh=True): self._current_temperature=dev['temp'] self._target_temperature=dev['setpoint'] + self._name=dev['name'] + self._sensorid=dev['id'] + From efacd66bec297abdfb6db78c286c0d3873aee815 Mon Sep 17 00:00:00 2001 From: sander Date: Sat, 31 Oct 2015 20:35:23 +0100 Subject: [PATCH 06/10] linting and flakeing.. --- .../thermostat/honeywell_round_connected.py | 92 ++----------------- 1 file changed, 10 insertions(+), 82 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py index f4c4af4d010..f5d741a4f47 100644 --- a/homeassistant/components/thermostat/honeywell_round_connected.py +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -1,5 +1,3 @@ -__author__ = 'sander' - """ homeassistant.components.thermostat.honeywell_round_connected ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -7,14 +5,11 @@ Adds support for Honeywell Round Connected thermostats. """ import socket import logging - -from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, - STATE_IDLE, STATE_HEAT) +from homeassistant.components.thermostat import ThermostatDevice from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) REQUIREMENTS = ['evohomeclient==0.2.3'] -# from . import ATTR_CURRENT_TEMPERATURE,ATTR_TEMPERATURE # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): @@ -53,24 +48,18 @@ class RoundThermostat(ThermostatDevice): """ Represents a Honeywell Round Connected thermostat. """ def __init__(self, device): - #self.structure = structure self.device = device - self._current_temperature=None - self._target_temperature=None - self._name="round connected" - self._sensorid=None + self._current_temperature = None + self._target_temperature = None + self._name = "round connected" + self._sensorid = None self.update() - @property def name(self): """ Returns the name of the nest, if any. """ return self._name - @name.setter - def name(self,value): - self._name=value - @property def unit_of_measurement(self): """ Unit of measurement this thermostat expresses itself in. """ @@ -82,79 +71,19 @@ class RoundThermostat(ThermostatDevice): # Move these to Thermostat Device and make them global return {} - @property def current_temperature(self): """ Returns the current temperature. """ return self._current_temperature - - # @property - # def operation(self): - # """ Returns current operation ie. heat, cool, idle """ - # if self.device.hvac_ac_state is True: - # return STATE_COOL - # elif self.device.hvac_heater_state is True: - # return STATE_HEAT - # else: - # return STATE_IDLE - @property def target_temperature(self): """ Returns the temperature we try to reach. """ return self._target_temperature - - - # @property - # def target_temperature_low(self): - # """ Returns the lower bound temperature we try to reach. """ - # if self.device.mode == 'range': - # return round(self.device.target[0], 1) - # return round(self.target_temperature, 1) - # - # @property - # def target_temperature_high(self): - # """ Returns the upper bound temperature we try to reach. """ - # if self.device.mode == 'range': - # return round(self.device.target[1], 1) - # return round(self.target_temperature, 1) - # - # @property - # def is_away_mode_on(self): - # """ Returns if away mode is on. """ - # return True - def set_temperature(self, temperature): """ Set new target temperature """ - self.device.set_temperature(self._name,temperature) - - - def turn_away_mode_on(self): - """ Turns away on. """ - self.structure.away = True - - def turn_away_mode_off(self): - """ Turns away off. """ - self.structure.away = False - - # @property - # def min_temp(self): - # """ Identifies min_temp in Nest API or defaults if not available. """ - # temp = self.device.away_temperature.low - # if temp is None: - # return super().min_temp - # else: - # return temp - - # @property - # def max_temp(self): - # """ Identifies mxn_temp in Nest API or defaults if not available. """ - # temp = self.device.away_temperature.high - # if temp is None: - # return super().max_temp - # else: - # return temp + self.device.set_temperature(self._name, temperature) @property def should_poll(self): @@ -163,8 +92,7 @@ class RoundThermostat(ThermostatDevice): def update(self): for dev in self.device.temperatures(force_refresh=True): - self._current_temperature=dev['temp'] - self._target_temperature=dev['setpoint'] - self._name=dev['name'] - self._sensorid=dev['id'] - + self._current_temperature = dev['temp'] + self._target_temperature = dev['setpoint'] + self._name = dev['name'] + self._sensorid = dev['id'] From ea06d946e6203e68a0c2932b107b8ee19af62b79 Mon Sep 17 00:00:00 2001 From: sander Date: Wed, 4 Nov 2015 21:15:56 +0100 Subject: [PATCH 07/10] modified .converagerc and requirements_all.txt --- .coveragerc | 2 ++ requirements_all.txt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.coveragerc b/.coveragerc index 81ad15076ec..e24dcd7b99a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -94,6 +94,8 @@ omit = homeassistant/components/switch/transmission.py homeassistant/components/switch/wemo.py homeassistant/components/thermostat/nest.py + homeassistant/components/thermostat/honeywell_round_connected.py + [report] diff --git a/requirements_all.txt b/requirements_all.txt index 57f117ec3cd..f9599c8b765 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -144,3 +144,6 @@ blinkstick==1.1.7 # Telegram (notify.telegram) python-telegram-bot==2.8.7 + +# Honeywell Evo Home Client +evohomeclient==0.2.3 \ No newline at end of file From 26a6438e9315102ca801e6c2e5016fb58f21219c Mon Sep 17 00:00:00 2001 From: sander Date: Thu, 5 Nov 2015 09:37:05 +0100 Subject: [PATCH 08/10] learning the alphabet ;-) --- .coveragerc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.coveragerc b/.coveragerc index e24dcd7b99a..44d83549ec9 100644 --- a/.coveragerc +++ b/.coveragerc @@ -93,9 +93,8 @@ omit = homeassistant/components/switch/rpi_gpio.py homeassistant/components/switch/transmission.py homeassistant/components/switch/wemo.py - homeassistant/components/thermostat/nest.py homeassistant/components/thermostat/honeywell_round_connected.py - + homeassistant/components/thermostat/nest.py [report] From e49dc94d4bce5caab007e36cab5623f5c4a91048 Mon Sep 17 00:00:00 2001 From: sander Date: Thu, 5 Nov 2015 09:58:35 +0100 Subject: [PATCH 09/10] slightly better update method. --- .../thermostat/honeywell_round_connected.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py index f5d741a4f47..eaacd6c025b 100644 --- a/homeassistant/components/thermostat/honeywell_round_connected.py +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -7,13 +7,14 @@ import socket import logging from homeassistant.components.thermostat import ThermostatDevice from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, TEMP_CELCIUS) +logger=logging.getLogger(__name__) REQUIREMENTS = ['evohomeclient==0.2.3'] # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): - """ Sets up the nest thermostat. """ + """ Sets up the honeywel thermostat. """ logger = logging.getLogger(__name__) username = config.get(CONF_USERNAME) @@ -57,7 +58,7 @@ class RoundThermostat(ThermostatDevice): @property def name(self): - """ Returns the name of the nest, if any. """ + """ Returns the name of the honeywell, if any. """ return self._name @property @@ -91,8 +92,12 @@ class RoundThermostat(ThermostatDevice): return True def update(self): - for dev in self.device.temperatures(force_refresh=True): - self._current_temperature = dev['temp'] - self._target_temperature = dev['setpoint'] - self._name = dev['name'] - self._sensorid = dev['id'] + try: + # assuming I am only receiving one temperature sensor from the api.. + _device = next(self.device.temperatures(force_refresh=True)) + self._current_temperature = _device['temp'] + self._target_temperature = _device['setpoint'] + self._name = _device['name'] + self._sensorid = _device['id'] + except StopIteration: + logger.error("Did not receive any temperature data from the evohomeclient api.") From f60f3fa4a293cfbe164633eacf7d6b53f40b3b8d Mon Sep 17 00:00:00 2001 From: sander Date: Fri, 6 Nov 2015 08:37:22 +0100 Subject: [PATCH 10/10] Removed unused `self._sensorid`. --- .../components/thermostat/honeywell_round_connected.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/homeassistant/components/thermostat/honeywell_round_connected.py b/homeassistant/components/thermostat/honeywell_round_connected.py index eaacd6c025b..cba05e06871 100644 --- a/homeassistant/components/thermostat/honeywell_round_connected.py +++ b/homeassistant/components/thermostat/honeywell_round_connected.py @@ -53,7 +53,6 @@ class RoundThermostat(ThermostatDevice): self._current_temperature = None self._target_temperature = None self._name = "round connected" - self._sensorid = None self.update() @property @@ -98,6 +97,5 @@ class RoundThermostat(ThermostatDevice): self._current_temperature = _device['temp'] self._target_temperature = _device['setpoint'] self._name = _device['name'] - self._sensorid = _device['id'] except StopIteration: logger.error("Did not receive any temperature data from the evohomeclient api.")