{"record":{"id":"7cdcf9b921303ea7","repo":"home-assistant/core","slug":"exc","errorCode":null,"errorMessage":"{exc}","messagePattern":"\\{exc\\}","errorType":"exception","errorClass":"ConfigEntryNotReady","httpStatus":null,"severity":"error","filePath":"homeassistant/components/androidtv/__init__.py","lineNumber":215,"sourceCode":"    async_setup_services(hass)\n    return True\n\n\nasync def async_setup_entry(hass: HomeAssistant, entry: AndroidTVConfigEntry) -> bool:\n    \"\"\"Set up Android Debug Bridge platform.\"\"\"\n\n    state_det_rules = entry.options.get(CONF_STATE_DETECTION_RULES)\n    if CONF_ADB_SERVER_IP not in entry.data:\n        exceptions = ADB_PYTHON_EXCEPTIONS\n    else:\n        exceptions = ADB_TCP_EXCEPTIONS\n\n    try:\n        aftv, error_message = await async_connect_androidtv(\n            hass, entry.data, state_detection_rules=state_det_rules\n        )\n    except exceptions as exc:\n        raise ConfigEntryNotReady(exc) from exc\n\n    if not aftv:\n        raise ConfigEntryNotReady(error_message)\n\n    async def async_close_connection(event: Event) -> None:\n        \"\"\"Close Android Debug Bridge connection on HA Stop.\"\"\"\n        await aftv.adb_close()\n\n    entry.async_on_unload(\n        hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, async_close_connection)\n    )\n    entry.async_on_unload(entry.add_update_listener(update_listener))\n\n    entry.runtime_data = AndroidTVRuntimeData(aftv, entry.options.copy())\n\n    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)\n\n    return True","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/androidtv/__init__.py#L197-L233","documentation":"Raised as ConfigEntryNotReady(exc) when async_connect_androidtv raises one of the configured ADB exception tuples: ADB_PYTHON_EXCEPTIONS (adb-shell/adb-home-python errors) when no ADB server IP is configured, or ADB_TCP_EXCEPTIONS (pure-python-adb / AndroidTV TCP errors) when CONF_ADB_SERVER_IP is set. The message is the raw exception text; setup retries with backoff.","triggerScenarios":"async_connect_androidtv tries to open the ADB connection to the Android TV: direct TCP to device port 5555 (python impl) or to the configured adb server. Failures: device off/unreachable, ADB debugging disabled, wrong IP, adb server not running, or authentication not accepted.","commonSituations":"TV powered off or in deep standby (very common), 'USB debugging / Network debugging' toggled off on the device, adb-over-TCP not enabled (adb tcpip 5555), a stale IP after DHCP renewal, or a missing/unstarted external ADB server.","solutions":["Confirm the TV is on, reachable (ping), and Developer Options > USB/Network debugging is enabled.","Verify the device IP in the config entry; set a DHCP reservation for the TV.","If using an ADB server (adb_server_ip set), ensure adb is installed and the server is running.","For direct connections, run 'adb tcpip 5555' once from a computer to enable network ADB."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\n# before connecting, probe the ADB endpoint\nwith socket.socket() as s:\n    s.settimeout(3)\n    adb_reachable = s.connect_ex((entry.data['host'], 5555)) == 0","typeGuard":null,"tryCatchPattern":"except ConfigEntryNotReady: retry is automatic; distinguish auth vs unreachable via the chained exception text before touching config.","preventionTips":["Enable network ADB (adb tcpip 5555 / Developer Options) before setup.","Reserve the TV's DHCP address.","Keep an ADB server running and its IP configured if devices rotate."],"tags":["adb","network","androidtv","retry","config-entry-not-ready"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}