mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Merge pull request #535 from toddeye/radiotherm-dev
radiotherm platform bug fix and configuration parameter
This commit is contained in:
commit
73cb23f599
@ -2,6 +2,27 @@
|
||||
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. 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 datetime
|
||||
@ -13,6 +34,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. """
|
||||
@ -22,7 +45,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())
|
||||
|
||||
@ -30,12 +53,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)
|
||||
@ -46,13 +70,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
|
||||
@ -107,7 +132,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 """
|
||||
|
Loading…
x
Reference in New Issue
Block a user