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 Paulus Schoutsen
parent 56cbe8a73f
commit b2bb70b5aa
4 changed files with 30 additions and 7 deletions

View File

@ -10,7 +10,7 @@ from homeassistant.helpers import config_validation as cv
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
from homeassistant.util import Throttle
REQUIREMENTS = ['python-tado==0.2.8']
REQUIREMENTS = ['python-tado==0.2.9']
_LOGGER = logging.getLogger(__name__)

View File

@ -4,9 +4,10 @@ import logging
from homeassistant.const import (PRECISION_TENTHS, TEMP_CELSIUS)
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
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
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.components.tado import DATA_TADO
_LOGGER = logging.getLogger(__name__)
@ -41,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):
@ -199,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)

View File

@ -52,9 +52,9 @@ class TadoDeviceScanner(DeviceScanner):
# If there's a home_id, we need a different API URL
if self.home_id is None:
self.tadoapiurl = 'https://auth.tado.com/api/v2/me'
self.tadoapiurl = 'https://my.tado.com/api/v2/me'
else:
self.tadoapiurl = 'https://auth.tado.com/api/v2' \
self.tadoapiurl = 'https://my.tado.com/api/v2' \
'/homes/{home_id}/mobileDevices'
# The API URL always needs a username and password

View File

@ -1394,7 +1394,7 @@ python-songpal==0.0.9.1
python-synology==0.2.0
# homeassistant.components.tado
python-tado==0.2.8
python-tado==0.2.9
# homeassistant.components.telegram_bot
python-telegram-bot==11.1.0