From fdaa807ca83ca17ecaa2549972fba5cbda42fa2c Mon Sep 17 00:00:00 2001 From: chiro79 Date: Thu, 21 May 2026 14:54:23 +0200 Subject: [PATCH] Switch to aiopvpc-ng (#171025) --- CODEOWNERS | 4 ++-- .../components/pvpc_hourly_pricing/config_flow.py | 9 +++++---- homeassistant/components/pvpc_hourly_pricing/const.py | 2 +- .../components/pvpc_hourly_pricing/coordinator.py | 2 +- homeassistant/components/pvpc_hourly_pricing/helpers.py | 2 +- .../components/pvpc_hourly_pricing/manifest.json | 6 +++--- homeassistant/components/pvpc_hourly_pricing/sensor.py | 2 +- requirements_all.txt | 6 +++--- requirements_test_all.txt | 0 script/hassfest/requirements.py | 1 - 10 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 requirements_test_all.txt diff --git a/CODEOWNERS b/CODEOWNERS index d6e36c70e09..e8df625134e 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1413,8 +1413,8 @@ CLAUDE.md @home-assistant/core /tests/components/pushover/ @engrbm87 /homeassistant/components/pvoutput/ @frenck /tests/components/pvoutput/ @frenck -/homeassistant/components/pvpc_hourly_pricing/ @azogue -/tests/components/pvpc_hourly_pricing/ @azogue +/homeassistant/components/pvpc_hourly_pricing/ @azogue @chiro79 +/tests/components/pvpc_hourly_pricing/ @azogue @chiro79 /homeassistant/components/pyload/ @tr4nt0r /tests/components/pyload/ @tr4nt0r /homeassistant/components/qbittorrent/ @geoffreylagaisse @finder39 diff --git a/homeassistant/components/pvpc_hourly_pricing/config_flow.py b/homeassistant/components/pvpc_hourly_pricing/config_flow.py index 17082fe98fd..a09c50abdd7 100644 --- a/homeassistant/components/pvpc_hourly_pricing/config_flow.py +++ b/homeassistant/components/pvpc_hourly_pricing/config_flow.py @@ -3,7 +3,7 @@ from collections.abc import Mapping from typing import Any -from aiopvpc import DEFAULT_POWER_KW, PVPCData +from esios_api import DEFAULT_POWER_KW, PVPCData import voluptuous as vol from homeassistant.config_entries import ( @@ -63,9 +63,10 @@ class TariffSelectorConfigFlow(ConfigFlow, domain=DOMAIN): if user_input is not None: await self.async_set_unique_id(user_input[ATTR_TARIFF]) self._abort_if_unique_id_configured() + calc_name = f"{DEFAULT_NAME} - {user_input[ATTR_TARIFF]}" if not user_input[CONF_USE_API_TOKEN]: return self.async_create_entry( - title=DEFAULT_NAME, + title=calc_name, data={ ATTR_TARIFF: user_input[ATTR_TARIFF], ATTR_POWER: user_input[ATTR_POWER], @@ -74,7 +75,7 @@ class TariffSelectorConfigFlow(ConfigFlow, domain=DOMAIN): }, ) - self._name = DEFAULT_NAME + self._name = calc_name self._tariff = user_input[ATTR_TARIFF] self._power = user_input[ATTR_POWER] self._power_p3 = user_input[ATTR_POWER_P3] @@ -150,7 +151,7 @@ class TariffSelectorConfigFlow(ConfigFlow, domain=DOMAIN): """Handle re-authentication with ESIOS Token.""" self._api_token = entry_data.get(CONF_API_TOKEN) self._use_api_token = self._api_token is not None - self._name = DEFAULT_NAME + self._name = f"{DEFAULT_NAME} - {entry_data[ATTR_TARIFF]}" self._tariff = entry_data[ATTR_TARIFF] self._power = entry_data[ATTR_POWER] self._power_p3 = entry_data[ATTR_POWER_P3] diff --git a/homeassistant/components/pvpc_hourly_pricing/const.py b/homeassistant/components/pvpc_hourly_pricing/const.py index 9aaa46233cb..b4f23c1ac66 100644 --- a/homeassistant/components/pvpc_hourly_pricing/const.py +++ b/homeassistant/components/pvpc_hourly_pricing/const.py @@ -1,6 +1,6 @@ """Constant values for pvpc_hourly_pricing.""" -from aiopvpc.const import TARIFFS +from esios_api.const import TARIFFS import voluptuous as vol DOMAIN = "pvpc_hourly_pricing" diff --git a/homeassistant/components/pvpc_hourly_pricing/coordinator.py b/homeassistant/components/pvpc_hourly_pricing/coordinator.py index c357551be8f..ce6011bf472 100644 --- a/homeassistant/components/pvpc_hourly_pricing/coordinator.py +++ b/homeassistant/components/pvpc_hourly_pricing/coordinator.py @@ -3,7 +3,7 @@ from datetime import timedelta import logging -from aiopvpc import BadApiTokenAuthError, EsiosApiData, PVPCData +from esios_api import BadApiTokenAuthError, EsiosApiData, PVPCData from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_TOKEN diff --git a/homeassistant/components/pvpc_hourly_pricing/helpers.py b/homeassistant/components/pvpc_hourly_pricing/helpers.py index e0792f76404..5836044c0e2 100644 --- a/homeassistant/components/pvpc_hourly_pricing/helpers.py +++ b/homeassistant/components/pvpc_hourly_pricing/helpers.py @@ -1,6 +1,6 @@ """Helper functions to relate sensors keys and unique ids.""" -from aiopvpc.const import ( +from esios_api.const import ( ALL_SENSORS, KEY_INJECTION, KEY_MAG, diff --git a/homeassistant/components/pvpc_hourly_pricing/manifest.json b/homeassistant/components/pvpc_hourly_pricing/manifest.json index 18287a2d5e9..f6198840ed0 100644 --- a/homeassistant/components/pvpc_hourly_pricing/manifest.json +++ b/homeassistant/components/pvpc_hourly_pricing/manifest.json @@ -1,11 +1,11 @@ { "domain": "pvpc_hourly_pricing", "name": "Spain electricity hourly pricing (PVPC)", - "codeowners": ["@azogue"], + "codeowners": ["@azogue", "@chiro79"], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/pvpc_hourly_pricing", "integration_type": "service", "iot_class": "cloud_polling", - "loggers": ["aiopvpc"], - "requirements": ["aiopvpc==4.3.1"] + "loggers": ["esios_api"], + "requirements": ["esios_api==4.4.0"] } diff --git a/homeassistant/components/pvpc_hourly_pricing/sensor.py b/homeassistant/components/pvpc_hourly_pricing/sensor.py index e6ed7fe81f0..fdfb1167e8c 100644 --- a/homeassistant/components/pvpc_hourly_pricing/sensor.py +++ b/homeassistant/components/pvpc_hourly_pricing/sensor.py @@ -5,7 +5,7 @@ from datetime import datetime import logging from typing import Any -from aiopvpc.const import KEY_INJECTION, KEY_MAG, KEY_OMIE, KEY_PVPC +from esios_api.const import KEY_INJECTION, KEY_MAG, KEY_OMIE, KEY_PVPC from homeassistant.components.sensor import ( SensorEntity, diff --git a/requirements_all.txt b/requirements_all.txt index a9f81c28da9..4d82c06faca 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -374,9 +374,6 @@ aiopurpleair==2025.08.1 # homeassistant.components.hunterdouglas_powerview aiopvapi==3.3.0 -# homeassistant.components.pvpc_hourly_pricing -aiopvpc==4.3.1 - # homeassistant.components.lidarr # homeassistant.components.radarr # homeassistant.components.sonarr @@ -951,6 +948,9 @@ epson-projector==0.6.0 # homeassistant.components.eq3btsmart eq3btsmart==2.3.0 +# homeassistant.components.pvpc_hourly_pricing +esios_api==4.4.0 + # homeassistant.components.esphome esphome-dashboard-api==1.3.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/script/hassfest/requirements.py b/script/hassfest/requirements.py index f7fc9dc61cf..f32cbe0fc33 100644 --- a/script/hassfest/requirements.py +++ b/script/hassfest/requirements.py @@ -203,7 +203,6 @@ FORBIDDEN_PACKAGE_EXCEPTIONS: dict[str, dict[str, set[str]]] = { "opengarage": {"open-garage": {"async-timeout"}}, "overkiz": {"pyoverkiz": {"backoff"}}, "prosegur": {"pyprosegur": {"backoff"}}, - "pvpc_hourly_pricing": {"aiopvpc": {"async-timeout"}}, "radio_browser": {"radios": {"backoff"}}, "remote_rpi_gpio": { # https://github.com/waveform80/colorzero/issues/9