Bump opower to 0.8.9 (#136911)

* Bump opower to 0.8.9

* mypy
pull/136844/head^2
tronikos 2025-01-30 23:33:58 -08:00 committed by GitHub
parent 4d4e11a0eb
commit 99e307fe5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 15 deletions

View File

@ -5,18 +5,16 @@ import logging
from types import MappingProxyType
from typing import Any, cast
import aiohttp
from opower import (
Account,
AggregateType,
CannotConnect,
CostRead,
Forecast,
InvalidAuth,
MeterType,
Opower,
ReadResolution,
)
from opower.exceptions import ApiException, CannotConnect, InvalidAuth
from homeassistant.components.recorder import get_instance
from homeassistant.components.recorder.models import StatisticData, StatisticMetaData
@ -89,7 +87,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
raise UpdateFailed(f"Error during login: {err}") from err
try:
forecasts: list[Forecast] = await self.api.async_get_forecast()
except aiohttp.ClientError as err:
except ApiException as err:
_LOGGER.error("Error getting forecasts: %s", err)
raise
_LOGGER.debug("Updating sensor data with: %s", forecasts)
@ -102,7 +100,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
"""Insert Opower statistics."""
try:
accounts = await self.api.async_get_accounts()
except aiohttp.ClientError as err:
except ApiException as err:
_LOGGER.error("Error getting accounts: %s", err)
raise
for account in accounts:
@ -271,7 +269,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
cost_reads = await self.api.async_get_cost_reads(
account, AggregateType.BILL, start, end
)
except aiohttp.ClientError as err:
except ApiException as err:
_LOGGER.error("Error getting monthly cost reads: %s", err)
raise
_LOGGER.debug("Got %s monthly cost reads", len(cost_reads))
@ -290,7 +288,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
daily_cost_reads = await self.api.async_get_cost_reads(
account, AggregateType.DAY, start, end
)
except aiohttp.ClientError as err:
except ApiException as err:
_LOGGER.error("Error getting daily cost reads: %s", err)
raise
_LOGGER.debug("Got %s daily cost reads", len(daily_cost_reads))
@ -308,7 +306,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
hourly_cost_reads = await self.api.async_get_cost_reads(
account, AggregateType.HOUR, start, end
)
except aiohttp.ClientError as err:
except ApiException as err:
_LOGGER.error("Error getting hourly cost reads: %s", err)
raise
_LOGGER.debug("Got %s hourly cost reads", len(hourly_cost_reads))

View File

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

View File

@ -97,7 +97,7 @@ ELEC_SENSORS: tuple[OpowerEntityDescription, ...] = (
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
value_fn=lambda data: data.start_date,
value_fn=lambda data: str(data.start_date),
),
OpowerEntityDescription(
key="elec_end_date",
@ -105,7 +105,7 @@ ELEC_SENSORS: tuple[OpowerEntityDescription, ...] = (
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
value_fn=lambda data: data.end_date,
value_fn=lambda data: str(data.end_date),
),
)
GAS_SENSORS: tuple[OpowerEntityDescription, ...] = (
@ -169,7 +169,7 @@ GAS_SENSORS: tuple[OpowerEntityDescription, ...] = (
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
value_fn=lambda data: data.start_date,
value_fn=lambda data: str(data.start_date),
),
OpowerEntityDescription(
key="gas_end_date",
@ -177,7 +177,7 @@ GAS_SENSORS: tuple[OpowerEntityDescription, ...] = (
device_class=SensorDeviceClass.DATE,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
value_fn=lambda data: data.end_date,
value_fn=lambda data: str(data.end_date),
),
)

2
requirements_all.txt generated
View File

@ -1592,7 +1592,7 @@ openwrt-luci-rpc==1.1.17
openwrt-ubus-rpc==0.0.2
# homeassistant.components.opower
opower==0.8.8
opower==0.8.9
# homeassistant.components.oralb
oralb-ble==0.17.6

View File

@ -1328,7 +1328,7 @@ openhomedevice==2.2.0
openwebifpy==4.3.1
# homeassistant.components.opower
opower==0.8.8
opower==0.8.9
# homeassistant.components.oralb
oralb-ble==0.17.6