Skip to content

Commit

Permalink
Revert "stop reading historical data on start"
Browse files Browse the repository at this point in the history
This reverts commit e60c598.
  • Loading branch information
kdeyev committed Jun 25, 2024
1 parent e60c598 commit f249da4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/eyeonwater/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

async def async_update_data():
_LOGGER.debug("Fetching latest data")
await eye_on_water_data.read_meters()
await eye_on_water_data.read_meters(days_to_load=3)
return eye_on_water_data

coordinator = DataUpdateCoordinator(
Expand Down
6 changes: 5 additions & 1 deletion custom_components/eyeonwater/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ async def setup(self):
self.meters = await self.account.fetch_meters(self.client)
_LOGGER.debug("Discovered %i meter(s)", len(self.meters))

async def read_meters(self):
async def read_meters(self, days_to_load=3):
"""Read each meter."""
for meter in self.meters:
try:
await meter.read_meter_info(client=self.client)
await meter.read_historical_data(
client=self.client,
days_to_load=days_to_load,
)
except (EyeOnWaterAPIError, EyeOnWaterAuthError) as error:
raise UpdateFailed(error) from error
return self.meters
Expand Down

0 comments on commit f249da4

Please sign in to comment.