From b47c53d699e08d6856fb63f85bc31e47406e1e79 Mon Sep 17 00:00:00 2001 From: Stefan Slivinski Date: Wed, 29 Apr 2026 20:32:49 -0700 Subject: [PATCH] fix: use async_reload for reload_entry to avoid LOADED-state error Calling async_setup_entry directly from async_reload_entry hit: ConfigEntryError: async_config_entry_first_refresh called when state is ConfigEntryState.LOADED, but should only be called in state ConfigEntryState.SETUP_IN_PROGRESS Using hass.config_entries.async_reload(entry.entry_id) lets HA manage the unload/setup cycle and state transitions correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- custom_components/generac/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/custom_components/generac/__init__.py b/custom_components/generac/__init__.py index f506fe1..5ab1b4e 100644 --- a/custom_components/generac/__init__.py +++ b/custom_components/generac/__init__.py @@ -63,5 +63,4 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: """Reload config entry.""" - await async_unload_entry(hass, entry) - await async_setup_entry(hass, entry) + await hass.config_entries.async_reload(entry.entry_id)