Skip to content

Commit

Permalink
Add Tado set presence (home-assistant#32765)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jasperro authored Mar 23, 2020
1 parent df67ab9 commit c8d4cf0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions homeassistant/components/tado/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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
Expand Down Expand Up @@ -162,6 +163,15 @@ def reset_zone_overlay(self, zone_id):
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,
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tado/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def preset_modes(self):

def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
pass
self._tado.set_presence(preset_mode)

@property
def temperature_unit(self):
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/tado/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c8d4cf0

Please sign in to comment.