{"record":{"id":"a81986d83ebbcc1f","repo":"home-assistant/core","slug":"could-not-discover-avea-bulbs-for-yaml-import","errorCode":null,"errorMessage":"Could not discover Avea bulbs for YAML import","messagePattern":"Could not discover Avea bulbs for YAML import","errorType":"exception","errorClass":"PlatformNotReady","httpStatus":null,"severity":"warning","filePath":"homeassistant/components/avea/light.py","lineNumber":163,"sourceCode":"                or _normalize_name(bulb.name)\n                or address,\n            }\n        )\n\n    return discovered_bulbs\n\n\nasync def async_setup_platform(\n    hass: HomeAssistant,\n    config: ConfigType,\n    async_add_entities: AddEntitiesCallback,\n    discovery_info: DiscoveryInfoType | None = None,\n) -> None:\n    \"\"\"Import the Avea YAML platform into config entries.\"\"\"\n    try:\n        bulbs = await hass.async_add_executor_job(_discover_bulbs_for_import)\n    except UPDATE_EXCEPTIONS as err:\n        raise PlatformNotReady(\"Could not discover Avea bulbs for YAML import\") from err\n\n    if not bulbs:\n        _create_yaml_import_failed_issue(hass)\n\n    for bulb in bulbs:\n        result = await hass.config_entries.flow.async_init(\n            DOMAIN,\n            context={\"source\": SOURCE_IMPORT},\n            data=bulb,\n        )\n\n        if (\n            result.get(\"type\") is FlowResultType.ABORT\n            and result.get(\"reason\") != \"already_configured\"\n        ):\n            _LOGGER.warning(\n                \"Skipping Avea YAML import for bulb %s: %s\",\n                bulb[CONF_ADDRESS],","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/avea/light.py#L145-L181","documentation":"Raised as PlatformNotReady by the Avea YAML platform setup (async_setup_platform) when discovering bulbs for YAML import raises UPDATE_EXCEPTIONS (BLE discovery errors from the avea library). It signals Home Assistant to retry the platform setup later instead of silently failing the YAML import.","triggerScenarios":"hass.async_add_executor_job(_discover_bulbs_for_import) throws a BluetoothScanningError/bleak error: no Bluetooth adapter available, adapter busy, insufficient permissions to scan (e.g. D-Bus/BT stack issues in container), or the avea library fails its UDP/Discovery handshake.","commonSituations":"Home Assistant Core/Container without a working Bluetooth stack; host Bluetooth blocked or hci0 down; first boot before bluez is ready; running in a VM without USB passthrough of the BT adapter.","solutions":["Confirm the host has a working Bluetooth adapter visible to Home Assistant (Settings > Devices > Bluetooth).","For containers/VMs, ensure D-Bus and bluez are correctly passed through and the container has BT capabilities.","Prefer the config-flow (discovery) based setup over the deprecated YAML platform — YAML import is a legacy path.","Restart Bluetooth (systemctl restart bluetooth) or reboot HA so PlatformNotReady retry succeeds."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"from homeassistant.components.bluetooth import async_scanner_count\n\ndef bluetooth_ready(hass) -> bool:\n    return async_scanner_count(hass, connectable=False) > 0\n","typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import PlatformNotReady\n\ntry:\n    await async_setup_platform(hass, config, async_add_entities)\nexcept PlatformNotReady:\n    # HA will retry the platform setup; fix the host Bluetooth stack meanwhile\n    raise","preventionTips":["Migrate off the YAML platform — config-flow discovery avoids this legacy path entirely.","In containers, verify D-Bus + bluez passthrough before adding BLE integrations.","PlatformNotReady is expected on early boot; only investigate if it persists."],"tags":["home-assistant","bluetooth","yaml","platform-not-ready","avea"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}