diff --git a/homeassistant/components/plex/__init__.py b/homeassistant/components/plex/__init__.py index e0a84ced16f0db..4ca83d982428bd 100644 --- a/homeassistant/components/plex/__init__.py +++ b/homeassistant/components/plex/__init__.py @@ -159,7 +159,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: entry.data[CONF_SERVER], error, ) - return False + # Retry as setups behind a proxy can return transient 404 or 502 errors + raise ConfigEntryNotReady from error _LOGGER.debug( "Connected to: %s (%s)", plex_server.friendly_name, plex_server.url_in_use diff --git a/tests/components/plex/test_init.py b/tests/components/plex/test_init.py index 8e09f7023862e4..bbab50a7bbb49c 100644 --- a/tests/components/plex/test_init.py +++ b/tests/components/plex/test_init.py @@ -63,7 +63,7 @@ async def test_setup_config_entry_with_error(hass, entry): await hass.async_block_till_done() assert len(hass.config_entries.async_entries(const.DOMAIN)) == 1 - assert entry.state is ConfigEntryState.SETUP_ERROR + assert entry.state is ConfigEntryState.SETUP_RETRY async def test_setup_with_insecure_config_entry(hass, entry, setup_plex_server):