diff --git a/homeassistant/components/yalexs_ble/__init__.py b/homeassistant/components/yalexs_ble/__init__.py index 9d2679d79d3..5082029af29 100644 --- a/homeassistant/components/yalexs_ble/__init__.py +++ b/homeassistant/components/yalexs_ble/__init__.py @@ -15,7 +15,7 @@ from yalexs_ble import ( from homeassistant.components import bluetooth from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_ADDRESS, EVENT_HOMEASSISTANT_STOP, Platform -from homeassistant.core import CALLBACK_TYPE, Event, HomeAssistant, callback +from homeassistant.core import CALLBACK_TYPE, CoreState, Event, HomeAssistant, callback from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady from .const import ( @@ -73,6 +73,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # We may already have the advertisement, so check for it. if service_info := async_find_existing_service_info(hass, local_name, address): push_lock.update_advertisement(service_info.device, service_info.advertisement) + elif hass.state is CoreState.starting: + # If we are starting and the advertisement is not found, do not delay + # the setup. We will wait for the advertisement to be found and then + # discovery will trigger setup retry. + raise ConfigEntryNotReady("{local_name} ({address}) not advertising yet") entry.async_on_unload( bluetooth.async_register_callback(