From 28e9b9e01df76801b8cf6169f21398e63ab27cf5 Mon Sep 17 00:00:00 2001 From: David Bonnes Date: Wed, 19 May 2021 10:41:20 +0100 Subject: [PATCH] Add evohome water_heater service calls, bump client to 0.3.15 (#50803) --- homeassistant/components/evohome/__init__.py | 12 +++++++----- homeassistant/components/evohome/manifest.json | 2 +- homeassistant/components/evohome/water_heater.py | 8 ++++++++ requirements_all.txt | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index cadeefa3c3a..4084045b1fb 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -180,7 +180,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: async def load_auth_tokens(store) -> tuple[dict, dict | None]: app_storage = await store.async_load() - tokens = dict(app_storage if app_storage else {}) + tokens = dict(app_storage or {}) if tokens.pop(CONF_USERNAME, None) != config[DOMAIN][CONF_USERNAME]: # any tokens won't be valid, and store might be be corrupt @@ -406,10 +406,12 @@ class EvoBroker: # evohomeasync2 uses naive/local datetimes access_token_expires = _dt_local_to_aware(self.client.access_token_expires) - app_storage = {CONF_USERNAME: self.client.username} - app_storage[REFRESH_TOKEN] = self.client.refresh_token - app_storage[ACCESS_TOKEN] = self.client.access_token - app_storage[ACCESS_TOKEN_EXPIRES] = access_token_expires.isoformat() + app_storage = { + CONF_USERNAME: self.client.username, + REFRESH_TOKEN: self.client.refresh_token, + ACCESS_TOKEN: self.client.access_token, + ACCESS_TOKEN_EXPIRES: access_token_expires.isoformat(), + } if self.client_v1 and self.client_v1.user_data: app_storage[USER_DATA] = { diff --git a/homeassistant/components/evohome/manifest.json b/homeassistant/components/evohome/manifest.json index b9f93c295d6..09f9cf81cd1 100644 --- a/homeassistant/components/evohome/manifest.json +++ b/homeassistant/components/evohome/manifest.json @@ -2,7 +2,7 @@ "domain": "evohome", "name": "Honeywell Total Connect Comfort (Europe)", "documentation": "https://www.home-assistant.io/integrations/evohome", - "requirements": ["evohome-async==0.3.8"], + "requirements": ["evohome-async==0.3.15"], "codeowners": ["@zxdavb"], "iot_class": "cloud_polling" } diff --git a/homeassistant/components/evohome/water_heater.py b/homeassistant/components/evohome/water_heater.py index 692c4dbbc49..495df9e697e 100644 --- a/homeassistant/components/evohome/water_heater.py +++ b/homeassistant/components/evohome/water_heater.py @@ -112,6 +112,14 @@ class EvoDHW(EvoChild, WaterHeaterEntity): """Turn away mode off.""" await self._evo_broker.call_client_api(self._evo_device.set_dhw_auto()) + async def async_turn_on(self): + """Turn on.""" + await self._evo_broker.call_client_api(self._evo_device.set_dhw_on()) + + async def async_turn_off(self): + """Turn off.""" + await self._evo_broker.call_client_api(self._evo_device.set_dhw_off()) + async def async_update(self) -> None: """Get the latest state data for a DHW controller.""" await super().async_update() diff --git a/requirements_all.txt b/requirements_all.txt index 7a09974804f..45f42348920 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -581,7 +581,7 @@ eternalegypt==0.0.12 # evdev==1.4.0 # homeassistant.components.evohome -evohome-async==0.3.8 +evohome-async==0.3.15 # homeassistant.components.faa_delays faadelays==0.0.7