Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump opower to 0.8.9 #136911

Merged
merged 2 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions homeassistant/components/opower/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
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
Expand Down Expand Up @@ -89,7 +87,7 @@ async def _async_update_data(
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)
Expand All @@ -102,7 +100,7 @@ async def _insert_statistics(self) -> None:
"""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:
Expand Down Expand Up @@ -271,7 +269,7 @@ def _update_with_finer_cost_reads(
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))
Expand All @@ -290,7 +288,7 @@ def _update_with_finer_cost_reads(
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))
Expand All @@ -308,7 +306,7 @@ def _update_with_finer_cost_reads(
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))
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/opower/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
8 changes: 4 additions & 4 deletions homeassistant/components/opower/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ class OpowerEntityDescription(SensorEntityDescription):
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",
name="Current bill electric end date",
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, ...] = (
Expand Down Expand Up @@ -169,15 +169,15 @@ class OpowerEntityDescription(SensorEntityDescription):
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",
name="Current bill gas end date",
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),
),
)

Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading