Fix Opower accounts that report cost less regularly than usage (#114034)
* Update coordinator.py * Update coordinator.pypull/89350/head^2
parent
72fed878b4
commit
a6fabdc115
|
@ -109,7 +109,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
|||
)
|
||||
|
||||
last_stat = await get_instance(self.hass).async_add_executor_job(
|
||||
get_last_statistics, self.hass, 1, consumption_statistic_id, True, set()
|
||||
get_last_statistics, self.hass, 1, cost_statistic_id, True, set()
|
||||
)
|
||||
if not last_stat:
|
||||
_LOGGER.debug("Updating statistic for the first time")
|
||||
|
@ -119,7 +119,7 @@ class OpowerCoordinator(DataUpdateCoordinator[dict[str, Forecast]]):
|
|||
last_stats_time = None
|
||||
else:
|
||||
cost_reads = await self._async_get_recent_cost_reads(
|
||||
account, last_stat[consumption_statistic_id][0]["start"]
|
||||
account, last_stat[cost_statistic_id][0]["start"]
|
||||
)
|
||||
if not cost_reads:
|
||||
_LOGGER.debug("No recent usage/cost data. Skipping update")
|
||||
|
|
Loading…
Reference in New Issue