Skip to content

Commit 0bfdd70

Browse files
async_config_entry_first_refresh in update coordinator requires a config entry (home-assistant#154114)
1 parent 01dee65 commit 0bfdd70

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

homeassistant/helpers/update_coordinator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,11 @@ async def async_config_entry_first_refresh(self) -> None:
300300
to ensure that multiple retries do not cause log spam.
301301
"""
302302
if self.config_entry is None:
303-
report_usage(
304-
"uses `async_config_entry_first_refresh`, which is only supported "
305-
"for coordinators with a config entry",
306-
breaks_in_ha_version="2025.11",
303+
raise ConfigEntryError(
304+
"Detected code that uses `async_config_entry_first_refresh`,"
305+
" which is only supported for coordinators with a config entry"
307306
)
308-
elif (
307+
if (
309308
self.config_entry.state
310309
is not config_entries.ConfigEntryState.SETUP_IN_PROGRESS
311310
):

tests/helpers/test_update_coordinator.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,9 @@ async def test_async_config_entry_first_refresh_no_entry(hass: HomeAssistant) ->
663663
crd = get_crd(hass, DEFAULT_UPDATE_INTERVAL, None)
664664
crd.setup_method = AsyncMock()
665665
with pytest.raises(
666-
RuntimeError,
667-
match="Detected code that uses `async_config_entry_first_refresh`, "
668-
"which is only supported for coordinators with a config entry. "
669-
"Please report this issue",
666+
ConfigEntryError,
667+
match="Detected code that uses `async_config_entry_first_refresh`,"
668+
" which is only supported for coordinators with a config entry",
670669
):
671670
await crd.async_config_entry_first_refresh()
672671

0 commit comments

Comments
 (0)