Skip to content

Commit 926944e

Browse files
authored
Add sleep if update fails (#120)
1 parent 88cffb4 commit 926944e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

custom_components/ta_cmi/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,10 @@ async def _async_update_data(self) -> dict[str, Any]:
145145

146146
return return_data
147147
except (InvalidCredentialsError, RateLimitError, ApiError) as err:
148+
_LOGGER.warning("Update failed with error: %s", str(err))
149+
_LOGGER.debug(
150+
"Waiting %s seconds to prevent retrying with an rate limit error",
151+
DEVICE_DELAY,
152+
)
153+
await custom_sleep(DEVICE_DELAY)
148154
raise UpdateFailed(err) from err

0 commit comments

Comments
 (0)