Add Tado set presence (#32765)

* Updated tado integration climate.py to allow for presence change

* Updated tado integration __init__.py to allow for presence change

* Black formatting

* Added missing docstring

* Added missing period to docstring

* Using constants from climate component

* Filter out other preset_modes

* Linting error fix

* Isort error fix

* Filtering of unwanted presence mode in init

* Bumped python-tado version to 0.5.0

Removed unnecessary preset mode check

* Update requirements_all.txt
This commit is contained in:
jasperro 2020-03-23 16:40:15 +01:00 committed by GitHub
parent df67ab995f
commit c8d4cf08d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import urllib
from PyTado.interface import Tado
import voluptuous as vol
from homeassistant.components.climate.const import PRESET_AWAY, PRESET_HOME
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.discovery import load_platform
@ -162,6 +163,15 @@ class TadoConnector:
self.tado.resetZoneOverlay(zone_id)
self.update_sensor("zone", zone_id)
def set_presence(
self, presence=PRESET_HOME,
):
"""Set the presence to home or away."""
if presence == PRESET_AWAY:
self.tado.setAway()
elif presence == PRESET_HOME:
self.tado.setHome()
def set_zone_overlay(
self,
zone_id,

View File

@ -289,7 +289,7 @@ class TadoClimate(ClimateDevice):
def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
pass
self._tado.set_presence(preset_mode)
@property
def temperature_unit(self):

View File

@ -3,7 +3,7 @@
"name": "Tado",
"documentation": "https://www.home-assistant.io/integrations/tado",
"requirements": [
"python-tado==0.3.0"
"python-tado==0.5.0"
],
"dependencies": [],
"codeowners": [

View File

@ -1658,7 +1658,7 @@ python-songpal==0.11.2
python-synology==0.4.0
# homeassistant.components.tado
python-tado==0.3.0
python-tado==0.5.0
# homeassistant.components.telegram_bot
python-telegram-bot==11.1.0