mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Avoid delaying HA startup in Rehlko (#144202)
This commit is contained in:
parent
1d0c520f64
commit
34bec1c50f
@ -40,7 +40,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
|
|||||||
)
|
)
|
||||||
|
|
||||||
rehlko.set_refresh_token_callback(async_refresh_token_update)
|
rehlko.set_refresh_token_callback(async_refresh_token_update)
|
||||||
rehlko.set_retry_policy(retry_count=3, retry_delays=[5, 10, 20])
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await rehlko.authenticate(
|
await rehlko.authenticate(
|
||||||
@ -48,6 +47,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
|
|||||||
entry.data[CONF_PASSWORD],
|
entry.data[CONF_PASSWORD],
|
||||||
entry.data.get(CONF_REFRESH_TOKEN),
|
entry.data.get(CONF_REFRESH_TOKEN),
|
||||||
)
|
)
|
||||||
|
homes = await rehlko.get_homes()
|
||||||
except AuthenticationError as ex:
|
except AuthenticationError as ex:
|
||||||
raise ConfigEntryAuthFailed(
|
raise ConfigEntryAuthFailed(
|
||||||
translation_domain=DOMAIN,
|
translation_domain=DOMAIN,
|
||||||
@ -60,7 +60,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
|
|||||||
translation_key="cannot_connect",
|
translation_key="cannot_connect",
|
||||||
) from ex
|
) from ex
|
||||||
coordinators: dict[int, RehlkoUpdateCoordinator] = {}
|
coordinators: dict[int, RehlkoUpdateCoordinator] = {}
|
||||||
homes = await rehlko.get_homes()
|
|
||||||
|
|
||||||
entry.runtime_data = RehlkoRuntimeData(
|
entry.runtime_data = RehlkoRuntimeData(
|
||||||
coordinators=coordinators,
|
coordinators=coordinators,
|
||||||
@ -86,6 +85,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: RehlkoConfigEntry) -> bo
|
|||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
coordinators[device_id] = coordinator
|
coordinators[device_id] = coordinator
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
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])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user