Do not use async_config_entry_first_refresh in fastdotcom (#128152)

Do not use async_config_entry_first_refresh in fastdocom
pull/128293/head
epenet 2024-10-13 14:17:11 +02:00 committed by GitHub
parent 7e56b595a0
commit de47776ea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -4,7 +4,7 @@ from __future__ import annotations
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers.start import async_at_started
@ -26,7 +26,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def _async_finish_startup(hass: HomeAssistant) -> None:
"""Run this only when HA has finished its startup."""
await coordinator.async_config_entry_first_refresh()
if entry.state == ConfigEntryState.LOADED:
await coordinator.async_refresh()
else:
await coordinator.async_config_entry_first_refresh()
# Don't start a speedtest during startup, this will slow down the overall startup dramatically
async_at_started(hass, _async_finish_startup)