mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Fix async_config_entry_first_refresh used after config entry is loaded in speedtestdotcom (#129527)
* Fix async_config_entry_first_refresh used after config entry is loaded in speedtestdotcom * is
This commit is contained in:
parent
208b15637a
commit
3e32c50936
@ -6,7 +6,7 @@ from functools import partial
|
|||||||
|
|
||||||
import speedtest
|
import speedtest
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
@ -35,7 +35,10 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
async def _async_finish_startup(hass: HomeAssistant) -> None:
|
async def _async_finish_startup(hass: HomeAssistant) -> None:
|
||||||
"""Run this only when HA has finished its startup."""
|
"""Run this only when HA has finished its startup."""
|
||||||
await coordinator.async_config_entry_first_refresh()
|
if config_entry.state is ConfigEntryState.LOADED:
|
||||||
|
await coordinator.async_refresh()
|
||||||
|
else:
|
||||||
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
# Don't start a speedtest during startup
|
# Don't start a speedtest during startup
|
||||||
async_at_started(hass, _async_finish_startup)
|
async_at_started(hass, _async_finish_startup)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user