Bump Weheat to 2025.1.14 (#135578)

This commit is contained in:
jesperraemaekers 2025-01-14 11:36:26 +01:00 committed by GitHub
parent 6359a75977
commit f4e7c9d6c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 20 additions and 20 deletions

View File

@ -48,7 +48,9 @@ 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.discover_active(API_URL, token)
discovered_heat_pumps = await HeatPumpDiscovery.async_discover_active(
API_URL, token
)
except UnauthorizedException as error:
raise ConfigEntryAuthFailed from error

View File

@ -4,7 +4,7 @@ from collections.abc import Mapping
import logging
from typing import Any
from weheat.abstractions.user import get_user_id_from_token
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
@ -33,7 +33,7 @@ class OAuth2FlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
async def async_oauth_create_entry(self, data: dict) -> ConfigFlowResult:
"""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 get_user_id_from_token(
user_id = await async_get_user_id_from_token(
API_URL, data[CONF_TOKEN][CONF_ACCESS_TOKEN]
)
await self.async_set_unique_id(user_id)

View File

@ -68,19 +68,17 @@ class WeheatDataUpdateCoordinator(DataUpdateCoordinator[HeatPump]):
"""Return the model of the heat pump."""
return self.heat_pump_info.model
def fetch_data(self) -> HeatPump:
"""Get the data from the API."""
async def _async_update_data(self) -> HeatPump:
"""Fetch data from the API."""
await self.session.async_ensure_token_valid()
try:
self._heat_pump_data.get_status(self.session.token[CONF_ACCESS_TOKEN])
await self._heat_pump_data.async_get_status(
self.session.token[CONF_ACCESS_TOKEN]
)
except UnauthorizedException as error:
raise ConfigEntryAuthFailed from error
except EXCEPTIONS as error:
raise UpdateFailed(error) from error
return self._heat_pump_data
async def _async_update_data(self) -> HeatPump:
"""Fetch data from the API."""
await self.session.async_ensure_token_valid()
return await self.hass.async_add_executor_job(self.fetch_data)

View File

@ -6,5 +6,5 @@
"dependencies": ["application_credentials"],
"documentation": "https://www.home-assistant.io/integrations/weheat",
"iot_class": "cloud_polling",
"requirements": ["weheat==2024.12.22"]
"requirements": ["weheat==2025.1.14"]
}

View File

@ -88,6 +88,6 @@ rules:
While unlikely to happen. Check if it is easily integrated.
# Platinum
async-dependency: todo
async-dependency: done
inject-websession: todo
strict-typing: todo

2
requirements_all.txt generated
View File

@ -3033,7 +3033,7 @@ webio-api==0.1.11
webmin-xmlrpc==0.0.2
# homeassistant.components.weheat
weheat==2024.12.22
weheat==2025.1.14
# homeassistant.components.whirlpool
whirlpool-sixth-sense==0.18.11

View File

@ -2437,7 +2437,7 @@ webio-api==0.1.11
webmin-xmlrpc==0.0.2
# homeassistant.components.weheat
weheat==2024.12.22
weheat==2025.1.14
# homeassistant.components.whirlpool
whirlpool-sixth-sense==0.18.11

View File

@ -81,7 +81,7 @@ def mock_user_id() -> Generator[AsyncMock]:
"""Mock the user API call."""
with (
patch(
"homeassistant.components.weheat.config_flow.get_user_id_from_token",
"homeassistant.components.weheat.config_flow.async_get_user_id_from_token",
return_value=USER_UUID_1,
) as user_mock,
):
@ -93,7 +93,7 @@ def mock_weheat_discover(mock_heat_pump_info) -> Generator[AsyncMock]:
"""Mock an Weheat discovery."""
with (
patch(
"homeassistant.components.weheat.HeatPumpDiscovery.discover_active",
"homeassistant.components.weheat.HeatPumpDiscovery.async_discover_active",
autospec=True,
) as mock_discover,
):

View File

@ -47,7 +47,7 @@ async def test_full_flow(
with (
patch(
"homeassistant.components.weheat.config_flow.get_user_id_from_token",
"homeassistant.components.weheat.config_flow.async_get_user_id_from_token",
return_value=USER_UUID_1,
) as mock_weheat,
):
@ -89,7 +89,7 @@ async def test_duplicate_unique_id(
with (
patch(
"homeassistant.components.weheat.config_flow.get_user_id_from_token",
"homeassistant.components.weheat.config_flow.async_get_user_id_from_token",
return_value=USER_UUID_1,
),
):