From 44b577cadba104952404505dc08668ccef596aa4 Mon Sep 17 00:00:00 2001 From: jesperraemaekers <146726232+jesperraemaekers@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:43:15 +0100 Subject: [PATCH] Bump Weheat to 2025.1.15 (#135626) --- homeassistant/components/weheat/__init__.py | 3 ++- homeassistant/components/weheat/config_flow.py | 5 ++++- homeassistant/components/weheat/coordinator.py | 5 ++++- homeassistant/components/weheat/manifest.json | 2 +- homeassistant/components/weheat/quality_scale.yaml | 7 ++----- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/weheat/__init__.py b/homeassistant/components/weheat/__init__.py index c14bbbcb028..d8d8616c867 100644 --- a/homeassistant/components/weheat/__init__.py +++ b/homeassistant/components/weheat/__init__.py @@ -12,6 +12,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_ACCESS_TOKEN, Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady +from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.config_entry_oauth2_flow import ( OAuth2Session, async_get_config_entry_implementation, @@ -49,7 +50,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: WeheatConfigEntry) -> bo # fetch a list of the heat pumps the entry can access try: discovered_heat_pumps = await HeatPumpDiscovery.async_discover_active( - API_URL, token + API_URL, token, async_get_clientsession(hass) ) except UnauthorizedException as error: raise ConfigEntryAuthFailed from error diff --git a/homeassistant/components/weheat/config_flow.py b/homeassistant/components/weheat/config_flow.py index 318a02ee47f..2911ebdd49b 100644 --- a/homeassistant/components/weheat/config_flow.py +++ b/homeassistant/components/weheat/config_flow.py @@ -8,6 +8,7 @@ from weheat.abstractions.user import async_get_user_id_from_token from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlowResult from homeassistant.const import CONF_ACCESS_TOKEN, CONF_TOKEN +from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.config_entry_oauth2_flow import AbstractOAuth2FlowHandler from .const import API_URL, DOMAIN, ENTRY_TITLE, OAUTH2_SCOPES @@ -34,7 +35,9 @@ class OAuth2FlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN): """Override the create entry method to change to the step to find the heat pumps.""" # get the user id and use that as unique id for this entry user_id = await async_get_user_id_from_token( - API_URL, data[CONF_TOKEN][CONF_ACCESS_TOKEN] + API_URL, + data[CONF_TOKEN][CONF_ACCESS_TOKEN], + async_get_clientsession(self.hass), ) await self.async_set_unique_id(user_id) if self.source != SOURCE_REAUTH: diff --git a/homeassistant/components/weheat/coordinator.py b/homeassistant/components/weheat/coordinator.py index 94d897351eb..4a85380e4a3 100644 --- a/homeassistant/components/weheat/coordinator.py +++ b/homeassistant/components/weheat/coordinator.py @@ -16,6 +16,7 @@ from weheat.exceptions import ( from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryAuthFailed +from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.config_entry_oauth2_flow import OAuth2Session from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -47,7 +48,9 @@ class WeheatDataUpdateCoordinator(DataUpdateCoordinator[HeatPump]): update_interval=timedelta(seconds=UPDATE_INTERVAL), ) self.heat_pump_info = heat_pump - self._heat_pump_data = HeatPump(API_URL, heat_pump.uuid) + self._heat_pump_data = HeatPump( + API_URL, heat_pump.uuid, async_get_clientsession(hass) + ) self.session = session diff --git a/homeassistant/components/weheat/manifest.json b/homeassistant/components/weheat/manifest.json index c81fe570691..1d60f66afba 100644 --- a/homeassistant/components/weheat/manifest.json +++ b/homeassistant/components/weheat/manifest.json @@ -6,5 +6,5 @@ "dependencies": ["application_credentials"], "documentation": "https://www.home-assistant.io/integrations/weheat", "iot_class": "cloud_polling", - "requirements": ["weheat==2025.1.14"] + "requirements": ["weheat==2025.1.15"] } diff --git a/homeassistant/components/weheat/quality_scale.yaml b/homeassistant/components/weheat/quality_scale.yaml index aa5606ffe2a..705efce4421 100644 --- a/homeassistant/components/weheat/quality_scale.yaml +++ b/homeassistant/components/weheat/quality_scale.yaml @@ -88,9 +88,6 @@ rules: While unlikely to happen. Check if it is easily integrated. # Platinum - async-dependency: - status: todo - comment: | - Dependency uses asyncio.to_thread, but this is not real async. - inject-websession: todo + async-dependency: done + inject-websession: done strict-typing: todo diff --git a/requirements_all.txt b/requirements_all.txt index 56d6c64ca53..231cea8aba6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -3033,7 +3033,7 @@ webio-api==0.1.11 webmin-xmlrpc==0.0.2 # homeassistant.components.weheat -weheat==2025.1.14 +weheat==2025.1.15 # homeassistant.components.whirlpool whirlpool-sixth-sense==0.18.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 436238fa296..8a669423170 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2437,7 +2437,7 @@ webio-api==0.1.11 webmin-xmlrpc==0.0.2 # homeassistant.components.weheat -weheat==2025.1.14 +weheat==2025.1.15 # homeassistant.components.whirlpool whirlpool-sixth-sense==0.18.11