home-assistant/core · error · ConfigEntryNotReady
{err}
Error message
{err} What it means
ConfigEntryNotReady raised during aemet async_setup_entry when aemet.select_coordinates(latitude, longitude) fails with AemetError — meaning the AEMET Open Data library could not resolve the configured coordinates to a station or fetch station data. ConfigEntryNotReady makes Home Assistant retry setup with a backoff instead of failing permanently. (TownNotFound is handled separately: it logs and returns False, failing setup outright.)
Source
Thrown at homeassistant/components/aemet/__init__.py:44
latitude = entry.data[CONF_LATITUDE]
longitude = entry.data[CONF_LONGITUDE]
update_features: int = UpdateFeature.FORECAST
if entry.options.get(CONF_RADAR_UPDATES, False):
update_features |= UpdateFeature.RADAR
if entry.options.get(CONF_STATION_UPDATES, True):
update_features |= UpdateFeature.STATION
options = ConnectionOptions(api_key, update_features)
aemet = AEMET(aiohttp_client.async_get_clientsession(hass), options)
aemet.set_api_data_dir(hass.config.path(STORAGE_DIR, f"{DOMAIN}-{entry.unique_id}"))
try:
await aemet.select_coordinates(latitude, longitude)
except TownNotFound as err:
_LOGGER.error(err)
return False
except AemetError as err:
raise ConfigEntryNotReady(err) from err
weather_coordinator = WeatherUpdateCoordinator(hass, entry, aemet)
await weather_coordinator.async_config_entry_first_refresh()
entry.runtime_data = AemetData(name=name, coordinator=weather_coordinator)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
entry.async_on_unload(entry.add_update_listener(async_update_options))
return True
async def async_update_options(hass: HomeAssistant, entry: ConfigEntry) -> None:
"""Update options."""
await hass.config_entries.async_reload(entry.entry_id)
View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Wait — ConfigEntryNotReady retries automatically; if the AEMET outage is transient, the entry will come up on its own.
- Validate the AEMET API key by calling the AEMET Open Data endpoint directly with it (401/403 means the key expired — request a new one from opendata.aemet.es).
- Check Home Assistant's outbound access to opendata.aemet.es (proxy, DNS, firewall).
- If TownNotFound was logged instead, re-run the config flow and pick valid coordinates/municipality within Spain (AEMET only covers Spain).
- Reload the integration entry once the underlying cause is fixed.
Defensive patterns
Strategy: retry
Validate before calling
async def aemet_api_key_valid(session, api_key: str) -> bool:
"""Probe the AEMET Open Data API with the configured key."""
async with session.get(
"https://opendata.aemet.es/opendata/api/maestro/estaciones",
headers={"api_key": api_key},
) as resp:
return resp.status == 200 Try / catch
from homeassistant.exceptions import ConfigEntryNotReady
try:
await async_setup_entry(hass, entry)
except ConfigEntryNotReady as err:
# HA retries setup with backoff; investigate AemetError cause in logs
_LOGGER.warning("AEMET setup deferred: %s", err) Prevention
- Renew AEMET Open Data API keys proactively — they expire.
- Verify coordinates are within Spain; TownNotFound fails setup without retry.
- Do not hammer the API from multiple clients with one key during initial setup.
When it happens
Trigger: Setting up or reloading the AEMET integration entry when the AEMET Open Data API is unreachable, returns errors, rate-limits the API key, or the library cannot complete station selection for the given lat/long.
Common situations: AEMET Open Data outage or maintenance window, expired/invalid API key (API keys must be requested from AEMET and renew periodically), network egress restrictions, or transient HTTP failures during first setup.
Related errors
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/472e2b075636e10a.
Report an issue: GitHub.