home-assistant/core · warning · PlatformNotReady

Could not discover Avea bulbs for YAML import

Error message

Could not discover Avea bulbs for YAML import

What it means

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.

Source

Thrown at homeassistant/components/avea/light.py:163

                or _normalize_name(bulb.name)
                or address,
            }
        )

    return discovered_bulbs


async def async_setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    async_add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Import the Avea YAML platform into config entries."""
    try:
        bulbs = await hass.async_add_executor_job(_discover_bulbs_for_import)
    except UPDATE_EXCEPTIONS as err:
        raise PlatformNotReady("Could not discover Avea bulbs for YAML import") from err

    if not bulbs:
        _create_yaml_import_failed_issue(hass)

    for bulb in bulbs:
        result = await hass.config_entries.flow.async_init(
            DOMAIN,
            context={"source": SOURCE_IMPORT},
            data=bulb,
        )

        if (
            result.get("type") is FlowResultType.ABORT
            and result.get("reason") != "already_configured"
        ):
            _LOGGER.warning(
                "Skipping Avea YAML import for bulb %s: %s",
                bulb[CONF_ADDRESS],

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Confirm the host has a working Bluetooth adapter visible to Home Assistant (Settings > Devices > Bluetooth).
  2. For containers/VMs, ensure D-Bus and bluez are correctly passed through and the container has BT capabilities.
  3. Prefer the config-flow (discovery) based setup over the deprecated YAML platform — YAML import is a legacy path.
  4. Restart Bluetooth (systemctl restart bluetooth) or reboot HA so PlatformNotReady retry succeeds.
Defensive patterns

Strategy: retry

Validate before calling

from homeassistant.components.bluetooth import async_scanner_count

def bluetooth_ready(hass) -> bool:
    return async_scanner_count(hass, connectable=False) > 0

Try / catch

from homeassistant.exceptions import PlatformNotReady

try:
    await async_setup_platform(hass, config, async_add_entities)
except PlatformNotReady:
    # HA will retry the platform setup; fix the host Bluetooth stack meanwhile
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14). Data as JSON: /api/errors/a81986d83ebbcc1f. Report an issue: GitHub.