Fix opower to work with aiohttp>=3.12.7 by disabling cookie quoting (#146697)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
tronikos
2025-06-13 06:58:27 -07:00
committed by GitHub
parent a349653282
commit a8201009f3
5 changed files with 9 additions and 6 deletions

View File

@ -10,6 +10,7 @@ from opower import (
CannotConnect,
InvalidAuth,
Opower,
create_cookie_jar,
get_supported_utility_names,
select_utility,
)
@ -39,7 +40,7 @@ async def _validate_login(
) -> dict[str, str]:
"""Validate login data and return any errors."""
api = Opower(
async_create_clientsession(hass),
async_create_clientsession(hass, cookie_jar=create_cookie_jar()),
login_data[CONF_UTILITY],
login_data[CONF_USERNAME],
login_data[CONF_PASSWORD],

View File

@ -12,6 +12,7 @@ from opower import (
MeterType,
Opower,
ReadResolution,
create_cookie_jar,
)
from opower.exceptions import ApiException, CannotConnect, InvalidAuth
@ -30,7 +31,8 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, UnitOfEnergy, UnitOfVolume
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers import aiohttp_client, issue_registry as ir
from homeassistant.helpers import issue_registry as ir
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util import dt as dt_util
@ -62,7 +64,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
update_interval=timedelta(hours=12),
)
self.api = Opower(
aiohttp_client.async_get_clientsession(hass),
async_create_clientsession(hass, cookie_jar=create_cookie_jar()),
config_entry.data[CONF_UTILITY],
config_entry.data[CONF_USERNAME],
config_entry.data[CONF_PASSWORD],

View File

@ -7,5 +7,5 @@
"documentation": "https://www.home-assistant.io/integrations/opower",
"iot_class": "cloud_polling",
"loggers": ["opower"],
"requirements": ["opower==0.12.3"]
"requirements": ["opower==0.12.4"]
}

2
requirements_all.txt generated
View File

@ -1617,7 +1617,7 @@ openwrt-luci-rpc==1.1.17
openwrt-ubus-rpc==0.0.2
# homeassistant.components.opower
opower==0.12.3
opower==0.12.4
# homeassistant.components.oralb
oralb-ble==0.17.6

View File

@ -1370,7 +1370,7 @@ openhomedevice==2.2.0
openwebifpy==4.3.1
# homeassistant.components.opower
opower==0.12.3
opower==0.12.4
# homeassistant.components.oralb
oralb-ble==0.17.6