diff --git a/pyproject.toml b/pyproject.toml index 30290f8..e1bf44a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "opower" -version = "0.0.5" +version = "0.0.6" license = {text = "Apache-2.0"} authors = [ { name="tronikos", email="tronikos@gmail.com" }, diff --git a/src/opower/opower.py b/src/opower/opower.py index 7e38efa..73a05b3 100644 --- a/src/opower/opower.py +++ b/src/opower/opower.py @@ -219,8 +219,8 @@ async def async_get_forecast(self) -> list[Forecast]: end_date=date.fromisoformat(forecast["endDate"]), current_date=date.fromisoformat(forecast["currentDate"]), unit_of_measure=UnitOfMeasure(forecast["unitOfMeasure"]), - usage_to_date=float(forecast["usageToDate"]), - cost_to_date=float(forecast["costToDate"]), + usage_to_date=float(forecast.get("usageToDate", 0)), + cost_to_date=float(forecast.get("costToDate", 0)), forecasted_usage=float(forecast.get("forecastedUsage", 0)), forecasted_cost=float(forecast.get("forecastedCost", 0)), typical_usage=float(forecast.get("typicalUsage", 0)),