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
|
homeassistant.components.thermostat.radiotherm
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Adds support for Radio Thermostat wifi-enabled home thermostats
|
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 logging
|
||||||
import datetime
|
import datetime
|
||||||
@ -13,6 +34,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. """
|
||||||
@ -22,7 +45,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
|
|
||||||
hosts = []
|
hosts = []
|
||||||
if CONF_HOST in config:
|
if CONF_HOST in config:
|
||||||
hosts = [config[CONF_HOST]]
|
hosts = config[CONF_HOST]
|
||||||
else:
|
else:
|
||||||
hosts.append(radiotherm.discover.discover_address())
|
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")
|
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)
|
||||||
@ -46,13 +70,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
|
||||||
@ -107,7 +132,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 """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user