From 27d524893750278f62503b3f28299fd48d2fbc95 Mon Sep 17 00:00:00 2001 From: Todd Ingarfield Date: Mon, 19 Oct 2015 15:33:23 -0500 Subject: [PATCH 1/3] Fix configuration for multiple hosts and add example configuration.yaml section --- homeassistant/components/thermostat/radiotherm.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 3acd3ef8986..6cd886149be 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -2,6 +2,18 @@ homeassistant.components.thermostat.radiotherm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Adds support for Radio Thermostat wifi-enabled home thermostats + +Config: + +Example: +thermostat: + platform: radiotherm + host: + - 192.168.99.137 + - 192.168.99.202 + +Configure two thermostats via the configuration.yaml + """ import logging import datetime @@ -22,7 +34,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): hosts = [] if CONF_HOST in config: - hosts = [config[CONF_HOST]] + hosts = config[CONF_HOST] else: hosts.append(radiotherm.discover.discover_address()) From 9464e2a13bbbaa3f9cc59b03668bb756e629d2b0 Mon Sep 17 00:00:00 2001 From: Todd Ingarfield Date: Mon, 19 Oct 2015 16:18:45 -0500 Subject: [PATCH 2/3] Add hass configuration parameter hold_temp & config documentation --- .../components/thermostat/radiotherm.py | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 6cd886149be..3de6fafd75d 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -4,15 +4,23 @@ homeassistant.components.thermostat.radiotherm Adds support for Radio Thermostat wifi-enabled home thermostats Config: +thermostat: + platform: radiotherm + hold_temp: boolean to control if hass temp adjustments hold(True) or are temporary(False) + host: list of thermostat host/ips to control Example: thermostat: platform: radiotherm + hold_temp: True host: - 192.168.99.137 - 192.168.99.202 -Configure two thermostats via the configuration.yaml +Configure two thermostats via the configuration.yaml. Temperature settings sent from +hass will be sent to thermostat and then hold at that temp. Set to False if you set +a thermostat schedule on the tstat itself and just want hass to send temporary temp +changes. """ import logging @@ -25,6 +33,8 @@ from homeassistant.const import (CONF_HOST, TEMP_FAHRENHEIT) REQUIREMENTS = ['radiotherm==1.2'] +HOLD_TEMP = 'hold_temp' + def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the Radio Thermostat. """ @@ -42,12 +52,13 @@ def setup_platform(hass, config, add_devices, discovery_info=None): logger.error("no radiotherm thermostats detected") return + hold_temp = config.get(HOLD_TEMP, False) tstats = [] for host in hosts: try: tstat = radiotherm.get_thermostat(host) - tstats.append(RadioThermostat(tstat)) + tstats.append(RadioThermostat(tstat, hold_temp)) except (URLError, OSError): logger.exception( "Unable to connect to Radio Thermostat: %s", host) @@ -58,13 +69,14 @@ def setup_platform(hass, config, add_devices, discovery_info=None): class RadioThermostat(ThermostatDevice): """ Represent a Radio Thermostat. """ - def __init__(self, device): + def __init__(self, device, hold_temp): self.device = device self.set_time() self._target_temperature = None self._current_temperature = None self._operation = STATE_IDLE self._name = None + self.hold_temp = hold_temp self.update() @property @@ -119,7 +131,10 @@ class RadioThermostat(ThermostatDevice): self.device.t_cool = temperature elif self._operation == STATE_HEAT: self.device.t_heat = temperature - self.device.hold = 1 + if self.hold_temp: + self.device.hold = 1 + else: + self.device.hold = 0 def set_time(self): """ Set device time """ From 661f4c594e749d512c78af5ff89804b8c7cc7e20 Mon Sep 17 00:00:00 2001 From: Todd Ingarfield Date: Mon, 19 Oct 2015 16:54:42 -0500 Subject: [PATCH 3/3] formatting --- homeassistant/components/thermostat/radiotherm.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 3de6fafd75d..831fd18f009 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -6,7 +6,8 @@ Adds support for Radio Thermostat wifi-enabled home thermostats Config: thermostat: platform: radiotherm - hold_temp: boolean to control if hass temp adjustments hold(True) or are temporary(False) + hold_temp: boolean to control if hass temp adjustments hold(True) or are + temporary(False) host: list of thermostat host/ips to control Example: @@ -17,10 +18,10 @@ thermostat: - 192.168.99.137 - 192.168.99.202 -Configure two thermostats via the configuration.yaml. Temperature settings sent from -hass will be sent to thermostat and then hold at that temp. Set to False if you set -a thermostat schedule on the tstat itself and just want hass to send temporary temp -changes. +Configure two thermostats via the configuration.yaml. Temperature settings +sent from hass will be sent to thermostat and then hold at that temp. Set +to False if you set a thermostat schedule on the tstat itself and just want +hass to send temporary temp changes. """ import logging