Skip to content

Commit

Permalink
Merge pull request #583 from MTrab:Fix-blocking-when-tariff-endpoint-…
Browse files Browse the repository at this point in the history
…returns-non-200-response

Retry update when tariff endpoint returns a non 200 response
  • Loading branch information
MTrab authored Sep 10, 2024
2 parents f1277a4 + a1deb74 commit 3a51660
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/energidataservice/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ async def update_carnot(self, dt=None) -> None: # type: ignore pylint: disable=

async def async_get_tariffs(self) -> None:
"""Get tariff data."""

if self.api.status != 200:
retry_update(self, self.async_get_tariffs)

if self.tariff:
tariff_endpoint = await self.tariffs.get_endpoint(self._region.region)
tariff_module = await self.hass.async_add_executor_job(
Expand Down

0 comments on commit 3a51660

Please sign in to comment.