{"record":{"id":"869fd00d15fb2a59","repo":"home-assistant/core","slug":"could-not-connect-to-autoskope-api","errorCode":null,"errorMessage":"Could not connect to Autoskope API","messagePattern":"Could not connect to Autoskope API","errorType":"exception","errorClass":"ConfigEntryNotReady","httpStatus":null,"severity":"error","filePath":"homeassistant/components/autoskope/__init__.py","lineNumber":36,"sourceCode":"async def async_setup_entry(hass: HomeAssistant, entry: AutoskopeConfigEntry) -> bool:\n    \"\"\"Set up Autoskope from a config entry.\"\"\"\n    session = async_create_clientsession(hass, cookie_jar=aiohttp.CookieJar())\n\n    api = AutoskopeApi(\n        host=entry.data.get(CONF_HOST, DEFAULT_HOST),\n        username=entry.data[CONF_USERNAME],\n        password=entry.data[CONF_PASSWORD],\n        session=session,\n    )\n\n    try:\n        await api.connect()\n    except InvalidAuth as err:\n        raise ConfigEntryAuthFailed(\n            \"Authentication failed, please check credentials\"\n        ) from err\n    except CannotConnect as err:\n        raise ConfigEntryNotReady(\"Could not connect to Autoskope API\") from err\n\n    coordinator = AutoskopeDataUpdateCoordinator(hass, api, entry)\n    await coordinator.async_config_entry_first_refresh()\n\n    entry.runtime_data = coordinator\n\n    await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)\n\n    return True\n\n\nasync def async_unload_entry(hass: HomeAssistant, entry: AutoskopeConfigEntry) -> bool:\n    \"\"\"Unload a config entry.\"\"\"\n    return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)\n","sourceCodeStart":18,"sourceCodeEnd":51,"githubUrl":"https://github.com/home-assistant/core/blob/58a3fdb3ea0538617f0a07efcfba6294de64fd59/homeassistant/components/autoskope/__init__.py#L18-L51","documentation":"Raised as ConfigEntryNotReady from the Autoskope integration when api.connect() raises CannotConnect, indicating a network-level failure reaching the Autoskope API (timeout, DNS failure, connection refused). Home Assistant will retry setup with exponential backoff rather than treating it as a permanent failure.","triggerScenarios":"AutoskopeApi.connect() cannot open its HTTP session: the Autoskope cloud endpoint is unreachable, DNS fails, TLS handshake times out, or a proxy/firewall blocks the outbound request.","commonSituations":"Internet outage; local DNS problems; Autoskope service downtime; firewall or ad-blocker blocking the API host; slow network causing the connect call to exceed its timeout.","solutions":["Check general internet connectivity and DNS from the Home Assistant host (e.g. curl the Autoskope API host).","Verify the Autoskope service status / try the mobile app from the same network.","If a firewall or proxy filters outbound traffic, allow the Autoskope API host.","Wait — ConfigEntryNotReady retries automatically; if it recovers, no action is needed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\n\ndef endpoint_reachable(host: str, port: int = 443, timeout: float = 3.0) -> bool:\n    try:\n        socket.create_connection((host, port), timeout=timeout).close()\n        return True\n    except OSError:\n        return False\n","typeGuard":null,"tryCatchPattern":"from homeassistant.exceptions import ConfigEntryNotReady\n\ntry:\n    await api.connect()\nexcept ConfigEntryNotReady:\n    # HA retries setup with backoff; safe to propagate\n    raise","preventionTips":["Ensure the HA host has reliable outbound internet before installing cloud integrations.","Let ConfigEntryNotReady handle retries — never loop manually in setup.","Monitor for repeated NotReady to distinguish outage from misconfiguration."],"tags":["home-assistant","network","config-entry","retry","autoskope"],"backgroundTag":null,"analyzedSha":"58a3fdb3ea0538617f0a07efcfba6294de64fd59","analyzedAt":"2026-08-14T20:54:38.818Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}