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
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
if self.hold_temp:
self.device.hold = 1
else:
self.device.hold = 0
def set_time(self):
""" Set device time """