From 16a90f8f1946562ab645204d2087eccd7874a985 Mon Sep 17 00:00:00 2001 From: Yuxin Wang Date: Sat, 27 Jan 2024 02:34:29 -0500 Subject: [PATCH] Fix stalls in config flow of APCUPSD (#108931) Fix deadlock in config flow of APCUPSD --- homeassistant/components/apcupsd/config_flow.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/homeassistant/components/apcupsd/config_flow.py b/homeassistant/components/apcupsd/config_flow.py index 57002d7a2b215f..99c78fd5d337cf 100644 --- a/homeassistant/components/apcupsd/config_flow.py +++ b/homeassistant/components/apcupsd/config_flow.py @@ -52,9 +52,8 @@ async def async_step_user( # Test the connection to the host and get the current status for serial number. coordinator = APCUPSdCoordinator(self.hass, host, port) - await coordinator.async_request_refresh() - await self.hass.async_block_till_done() + if isinstance(coordinator.last_exception, (UpdateFailed, asyncio.TimeoutError)): errors = {"base": "cannot_connect"} return self.async_show_form(