Skip to content

Commit

Permalink
Skip empty forecasts
Browse files Browse the repository at this point in the history
  • Loading branch information
tronikos committed Aug 26, 2023
1 parent a580b15 commit 57a62f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/opower/opower.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ async def async_get_forecast(self) -> list[Forecast]:
# For some customers utilities don't provide forecast
_LOGGER.debug("Ignoring combined-forecast error: %s", err.status)
continue
if all(
x in result["totalMetadata"]
for x in ["NO_FORECASTED_COST", "NO_FORECASTED_USAGE"]
):
_LOGGER.debug(
"Ignoring combined-forecast since there is no usage or cost. metadata: %s",
result["totalMetadata"],
)
continue
for forecast in result["accountForecasts"]:
forecasts.append(
Forecast(
Expand Down

0 comments on commit 57a62f2

Please sign in to comment.