home-assistant/core · error · ConfigEntryNotReady

cannot_connect

cannot_connect

Error message

cannot_connect

What it means

Raised during bosch_alarm setup when panel.connect() fails with TimeoutError, OSError, ConnectionRefusedError, or SSLError. The integration calls panel.disconnect() to clean up and raises ConfigEntryNotReady with translation_key 'cannot_connect', so Home Assistant retries setup with backoff instead of failing permanently.

Source

Thrown at homeassistant/components/bosch_alarm/__init__.py:54

    panel = Panel(
        host=entry.data[CONF_HOST],
        port=entry.data[CONF_PORT],
        automation_code=entry.data.get(CONF_PASSWORD),
        installer_or_user_code=entry.data.get(
            CONF_INSTALLER_CODE, entry.data.get(CONF_USER_CODE)
        ),
    )
    try:
        await panel.connect()
    except (PermissionError, ValueError) as err:
        await panel.disconnect()
        raise ConfigEntryAuthFailed(
            translation_domain=DOMAIN, translation_key="authentication_failed"
        ) from err
    except (TimeoutError, OSError, ConnectionRefusedError, SSLError) as err:
        await panel.disconnect()
        raise ConfigEntryNotReady(
            translation_domain=DOMAIN,
            translation_key="cannot_connect",
        ) from err

    entry.runtime_data = panel

    device_registry = dr.async_get(hass)

    mac = entry.data.get(CONF_MAC)

    device_registry.async_get_or_create(
        config_entry_id=entry.entry_id,
        connections={(CONNECTION_NETWORK_MAC, mac)} if mac else set(),
        identifiers={(DOMAIN, entry.unique_id or entry.entry_id)},
        name=f"Bosch {panel.model.name}",
        manufacturer="Bosch Security Systems",
        model=panel.model.name,
        sw_version=panel.firmware_version,

View on GitHub (pinned to 58a3fdb3ea)

Solutions

  1. Verify reachability: ping the panel and confirm the configured port (test with a raw TCP connect, e.g. nc <host> <port>).
  2. Fix CONF_HOST/CONF_PORT in the integration entry if the panel moved or the port is wrong.
  3. Check firewall/VLAN rules between Home Assistant and the panel.
  4. Let ConfigEntryNotReady retry with backoff — if the panel was rebooting it will recover on its own.
Defensive patterns

Strategy: retry

Validate before calling

async def panel_reachable(host: str, port: int, timeout: float = 3.0) -> bool:
    try:
        _, w = await asyncio.wait_for(asyncio.open_connection(host, port), timeout)
        w.close()
        return True
    except (OSError, asyncio.TimeoutError):
        return False

Try / catch

try:
    await panel.connect()
except (TimeoutError, OSError, ConnectionRefusedError, SSLError) as err:
    await panel.disconnect()
    raise ConfigEntryNotReady(...) from err  # HA retries with backoff automatically

Prevention

When it happens

Trigger: Wrong host/port in entry data, panel unreachable on the LAN, port not the panel's API port (default 7700 series depend on model), TLS mismatch triggering SSLError, connection refused because the panel's network interface is down.

Common situations: Panel IP changed via DHCP, port-forward/NAT rule misconfigured, panel rebooting, VLAN blocking the panel, APNIC/IT-settings disabling network access.

Related errors


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