Skip to content

fix: use hass.config_entries.async_reload for reload_entry on HA 2026.x+#269

Open
sslivins wants to merge 1 commit intobinarydev:mainfrom
sslivins:pr2-async-reload
Open

fix: use hass.config_entries.async_reload for reload_entry on HA 2026.x+#269
sslivins wants to merge 1 commit intobinarydev:mainfrom
sslivins:pr2-async-reload

Conversation

@sslivins
Copy link
Copy Markdown

Another small standalone fix in the same vein as #268.

Calling async_setup_entry directly from async_reload_entry triggers an error on HA 2026.x:

ConfigEntryError: async_config_entry_first_refresh called when state is
ConfigEntryState.LOADED, but should only be called in state
ConfigEntryState.SETUP_IN_PROGRESS

Letting HA manage the reload via hass.config_entries.async_reload(entry.entry_id) handles the unload/setup cycle and state transitions correctly. One-line change.

Hit this every time I changed the scan_interval in the options flow.

Take it or leave it.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant