Rehlko adjust timeouts for coordinator polls (#144297)

This commit is contained in:
Pete Sage 2025-05-05 22:37:54 -04:00 committed by GitHub
parent 14f967cdd0
commit 0dd21f4c89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
"""Set up Rehlko from a config entry."""
websession = async_get_clientsession(hass)
rehlko = AioKem(session=websession)
# If requests take more than 20 seconds; timeout and let the setup retry.
rehlko.set_timeout(20)
async def async_refresh_token_update(refresh_token: str) -> None:
"""Handle refresh token update."""
@ -87,6 +89,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
# Retrys enabled after successful connection to prevent blocking startup
rehlko.set_retry_policy(retry_count=3, retry_delays=[5, 10, 20])
# Rehlko service can be slow to respond, increase timeout for polls.
rehlko.set_timeout(100)
return True