Skip to content

Commit

Permalink
Merge pull request #376 from MTrab:Better-handling-of-tariff-errors
Browse files Browse the repository at this point in the history
Better handling of tariff errors
  • Loading branch information
MTrab committed Sep 29, 2023
2 parents c322b5e + 1f47c80 commit e93d21b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/energidataservice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ async def new_day(n): # type: ignore pylint: disable=unused-argument, invalid-n
"""Handle data on new day."""
_LOGGER.debug("New day function called")

await api.async_get_tariffs()

api.today = api.api_tomorrow
api.today_calculated = False
api.api_today = api.api_tomorrow
Expand All @@ -112,6 +110,8 @@ async def get_new_data(n): # type: ignore pylint: disable=unused-argument, inva
_LOGGER.debug("Getting latest dataset")
await api.update()
await api.update_carnot()
await api.async_get_tariffs()

async_dispatcher_send(hass, UPDATE_EDS.format(entry.entry_id))

async def update_carnot(n): # type: ignore pylint: disable=unused-argument, invalid-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async def async_get_system_tariffs(self) -> dict:
except RetryError:
_LOGGER.error("Retry attempts exceeded for retrieving system tariffs.")

@retry(attempts=5, delay=10, max_delay=3600, backoff=1.5)
@retry(attempts=10, delay=10, max_delay=3600, backoff=1.5)
async def async_call_api(self, query: str) -> dict:
"""Make the API calls."""
try:
Expand Down

0 comments on commit e93d21b

Please sign in to comment.