mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Bump Weheat to 2025.1.14 (#135578)
This commit is contained in:
parent
6359a75977
commit
f4e7c9d6c3
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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"]
|
||||
}
|
||||
|
@ -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
2
requirements_all.txt
generated
@ -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
|
||||
|
2
requirements_test_all.txt
generated
2
requirements_test_all.txt
generated
@ -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
|
||||
|
@ -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,
|
||||
):
|
||||
|
@ -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,
|
||||
),
|
||||
):
|
||||
|
Loading…
x
Reference in New Issue
Block a user