Allow on/off on tado climate component. (#22242)

* Allow on/off on tado climate component. Bump python-tado version. Patch from @wmalgadey

* Revert wrongly change in tado device tracker
This commit is contained in:
Michaël Arnauts 2019-03-21 16:24:30 +01:00 committed by Jason Hu
parent 03855c18fc
commit f64a99878f
4 changed files with 28 additions and 6 deletions

View file

@ -3,7 +3,7 @@ import logging
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_ON_OFF)
from homeassistant.const import (
ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS)
from homeassistant.util.temperature import convert as convert_temperature
@ -42,7 +42,8 @@ OPERATION_LIST = {
CONST_MODE_OFF: 'Off',
}
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE |
SUPPORT_ON_OFF)
def setup_platform(hass, config, add_entities, discovery_info=None):
@ -200,6 +201,27 @@ class TadoClimate(ClimateDevice):
"""Return the temperature we try to reach."""
return self._target_temp
@property
def is_on(self):
"""Return true if heater is on."""
return self._device_is_active
def turn_off(self):
"""Turn device off."""
_LOGGER.info("Switching mytado.com to OFF for zone %s",
self.zone_name)
self._current_operation = CONST_MODE_OFF
self._control_heating()
def turn_on(self):
"""Turn device on."""
_LOGGER.info("Switching mytado.com to %s mode for zone %s",
self._overlay_mode, self.zone_name)
self._current_operation = self._overlay_mode
self._control_heating()
def set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)