From cc174022e4403a68f930d861c51996581ee25637 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Fri, 29 Apr 2022 22:55:55 +0200 Subject: [PATCH] Pydeconz raise ResponseError when deCONZ Rest API Plugin is not yet ready (#71078) --- homeassistant/components/deconz/gateway.py | 2 +- tests/components/deconz/test_gateway.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/deconz/gateway.py b/homeassistant/components/deconz/gateway.py index ef07a97ad8f..f54cd4076d3 100644 --- a/homeassistant/components/deconz/gateway.py +++ b/homeassistant/components/deconz/gateway.py @@ -289,6 +289,6 @@ async def get_deconz_session( LOGGER.warning("Invalid key for deCONZ at %s", config[CONF_HOST]) raise AuthenticationRequired from err - except (asyncio.TimeoutError, errors.RequestError) as err: + except (asyncio.TimeoutError, errors.RequestError, errors.ResponseError) as err: LOGGER.error("Error connecting to deCONZ gateway at %s", config[CONF_HOST]) raise CannotConnect from err diff --git a/tests/components/deconz/test_gateway.py b/tests/components/deconz/test_gateway.py index 3a4f6b907af..e6ded3981c4 100644 --- a/tests/components/deconz/test_gateway.py +++ b/tests/components/deconz/test_gateway.py @@ -286,6 +286,7 @@ async def test_get_deconz_session(hass): [ (asyncio.TimeoutError, CannotConnect), (pydeconz.RequestError, CannotConnect), + (pydeconz.ResponseError, CannotConnect), (pydeconz.Unauthorized, AuthenticationRequired), ], )