Add hass configuration parameter hold_temp & config documentation

This commit is contained in:
Todd Ingarfield 2015-10-19 16:18:45 -05:00
parent 27d5248937
commit 9464e2a13b

View File

@ -4,15 +4,23 @@ homeassistant.components.thermostat.radiotherm
Adds support for Radio Thermostat wifi-enabled home thermostats Adds support for Radio Thermostat wifi-enabled home thermostats
Config: 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: Example:
thermostat: thermostat:
platform: radiotherm platform: radiotherm
hold_temp: True
host: host:
- 192.168.99.137 - 192.168.99.137
- 192.168.99.202 - 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 import logging
@ -25,6 +33,8 @@ from homeassistant.const import (CONF_HOST, TEMP_FAHRENHEIT)
REQUIREMENTS = ['radiotherm==1.2'] REQUIREMENTS = ['radiotherm==1.2']
HOLD_TEMP = 'hold_temp'
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Radio Thermostat. """ """ 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") logger.error("no radiotherm thermostats detected")
return return
hold_temp = config.get(HOLD_TEMP, False)
tstats = [] tstats = []
for host in hosts: for host in hosts:
try: try:
tstat = radiotherm.get_thermostat(host) tstat = radiotherm.get_thermostat(host)
tstats.append(RadioThermostat(tstat)) tstats.append(RadioThermostat(tstat, hold_temp))
except (URLError, OSError): except (URLError, OSError):
logger.exception( logger.exception(
"Unable to connect to Radio Thermostat: %s", host) "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): class RadioThermostat(ThermostatDevice):
""" Represent a Radio Thermostat. """ """ Represent a Radio Thermostat. """
def __init__(self, device): def __init__(self, device, hold_temp):
self.device = device self.device = device
self.set_time() self.set_time()
self._target_temperature = None self._target_temperature = None
self._current_temperature = None self._current_temperature = None
self._operation = STATE_IDLE self._operation = STATE_IDLE
self._name = None self._name = None
self.hold_temp = hold_temp
self.update() self.update()
@property @property
@ -119,7 +131,10 @@ class RadioThermostat(ThermostatDevice):
self.device.t_cool = temperature self.device.t_cool = temperature
elif self._operation == STATE_HEAT: elif self._operation == STATE_HEAT:
self.device.t_heat = temperature 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): def set_time(self):
""" Set device time """ """ Set device time """