Skip to content

Commit

Permalink
stop reading historical data on start
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeyev committed Jun 25, 2024
1 parent 70982d6 commit e60c598
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 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(days_to_load=3)
await eye_on_water_data.read_meters()
return eye_on_water_data

coordinator = DataUpdateCoordinator(
Expand Down
6 changes: 1 addition & 5 deletions custom_components/eyeonwater/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,11 @@ 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, days_to_load=3):
async def read_meters(self):
"""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 e60c598

Please sign in to comment.