add hvac mode support to radiotherm (#2442)
* add hvac mode support to radiotherm off/cool/heat/auto modes are supported * Moved STATE_AUTO to thermostat component, fix lint Moved STATE_AUTO to thermostat platform. Fixed lint error.pull/2344/merge
parent
beeae17cab
commit
e1db639317
|
@ -33,6 +33,7 @@ SERVICE_SET_HVAC_MODE = "set_hvac_mode"
|
|||
STATE_HEAT = "heat"
|
||||
STATE_COOL = "cool"
|
||||
STATE_IDLE = "idle"
|
||||
STATE_AUTO = 'auto'
|
||||
|
||||
ATTR_CURRENT_TEMPERATURE = "current_temperature"
|
||||
ATTR_AWAY_MODE = "away_mode"
|
||||
|
|
|
@ -9,7 +9,8 @@ import logging
|
|||
from urllib.error import URLError
|
||||
|
||||
from homeassistant.components.thermostat import (
|
||||
STATE_COOL, STATE_HEAT, STATE_IDLE, ThermostatDevice)
|
||||
STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_IDLE, STATE_OFF,
|
||||
ThermostatDevice)
|
||||
from homeassistant.const import CONF_HOST, TEMP_FAHRENHEIT
|
||||
|
||||
REQUIREMENTS = ['radiotherm==1.2']
|
||||
|
@ -122,3 +123,14 @@ class RadioThermostat(ThermostatDevice):
|
|||
now = datetime.datetime.now()
|
||||
self.device.time = {'day': now.weekday(),
|
||||
'hour': now.hour, 'minute': now.minute}
|
||||
|
||||
def set_hvac_mode(self, mode):
|
||||
"""Set HVAC mode (auto, cool, heat, off)."""
|
||||
if mode == STATE_OFF:
|
||||
self.device.tmode = 0
|
||||
elif mode == STATE_AUTO:
|
||||
self.device.tmode = 3
|
||||
elif mode == STATE_COOL:
|
||||
self.device.t_cool = self._target_temperature
|
||||
elif mode == STATE_HEAT:
|
||||
self.device.t_heat = self._target_temperature
|
||||
|
|
Loading…
Reference in New Issue