Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions homeassistant/components/radiotherm/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
FAN_ON,
FAN_OFF,
CURRENT_HVAC_IDLE,
CURRENT_HVAC_HEAT,
CURRENT_HVAC_COOL,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_FAN_MODE,
)
Expand All @@ -25,8 +30,7 @@

_LOGGER = logging.getLogger(__name__)

ATTR_FAN = "fan"
ATTR_MODE = "mode"
ATTR_FAN_ACTION = "fan_action"

CONF_HOLD_TEMP = "hold_temp"

Expand Down Expand Up @@ -55,11 +59,11 @@

# Active thermostat state (is it heating or cooling?). In the future
# this should probably made into heat and cool binary sensors.
CODE_TO_TEMP_STATE = {0: HVAC_MODE_OFF, 1: HVAC_MODE_HEAT, 2: HVAC_MODE_COOL}
CODE_TO_TEMP_STATE = {0: CURRENT_HVAC_IDLE, 1: CURRENT_HVAC_HEAT, 2: CURRENT_HVAC_COOL}

# Active fan state. This is if the fan is actually on or not. In the
# future this should probably made into a binary sensor for the fan.
CODE_TO_FAN_STATE = {0: HVAC_MODE_OFF, 1: STATE_ON}
CODE_TO_FAN_STATE = {0: FAN_OFF, 1: FAN_ON}


def round_temp(temperature):
Expand Down Expand Up @@ -160,7 +164,7 @@ def precision(self):
@property
def device_state_attributes(self):
"""Return the device specific state attributes."""
return {ATTR_FAN: self._fstate, ATTR_MODE: self._tstate}
return {ATTR_FAN_ACTION: self._fstate}

@property
def fan_modes(self):
Expand Down Expand Up @@ -200,6 +204,13 @@ def hvac_modes(self):
"""Return the operation modes list."""
return OPERATION_LIST

@property
def hvac_action(self):
"""Return the current running hvac operation if supported."""
if self.hvac_mode == HVAC_MODE_OFF:
return None
return self._tstate

@property
def target_temperature(self):
"""Return the temperature we try to reach."""
Expand Down Expand Up @@ -261,9 +272,9 @@ def update(self):
# This doesn't really work - tstate is only set if the HVAC is
# active. If it's idle, we don't know what to do with the target
# temperature.
if self._tstate == HVAC_MODE_COOL:
if self._tstate == CURRENT_HVAC_COOL:
self._target_temperature = data["t_cool"]
elif self._tstate == HVAC_MODE_HEAT:
elif self._tstate == CURRENT_HVAC_HEAT:
self._target_temperature = data["t_heat"]
else:
self._current_operation = HVAC_MODE_OFF
Expand All @@ -281,9 +292,9 @@ def set_temperature(self, **kwargs):
elif self._current_operation == HVAC_MODE_HEAT:
self.device.t_heat = temperature
elif self._current_operation == HVAC_MODE_AUTO:
if self._tstate == HVAC_MODE_COOL:
if self._tstate == CURRENT_HVAC_COOL:
self.device.t_cool = temperature
elif self._tstate == HVAC_MODE_HEAT:
elif self._tstate == CURRENT_HVAC_HEAT:
self.device.t_heat = temperature

# Only change the hold if requested or if hold mode was turned
Expand Down