diff --git a/homeassistant/components/plugwise/gateway.py b/homeassistant/components/plugwise/gateway.py index f540c6d0b9c..648765155e4 100644 --- a/homeassistant/components/plugwise/gateway.py +++ b/homeassistant/components/plugwise/gateway.py @@ -4,6 +4,7 @@ from __future__ import annotations import asyncio from typing import Any +from aiohttp import ClientConnectionError from plugwise.exceptions import InvalidAuthentication, PlugwiseException from plugwise.smile import Smile @@ -44,7 +45,7 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: except InvalidAuthentication: LOGGER.error("Invalid username or Smile ID") return False - except PlugwiseException as err: + except (ClientConnectionError, PlugwiseException) as err: raise ConfigEntryNotReady( f"Error while communicating to device {api.smile_name}" ) from err diff --git a/tests/components/plugwise/test_init.py b/tests/components/plugwise/test_init.py index 811018db7e2..557680cb060 100644 --- a/tests/components/plugwise/test_init.py +++ b/tests/components/plugwise/test_init.py @@ -2,6 +2,7 @@ import asyncio from unittest.mock import MagicMock +import aiohttp from plugwise.exceptions import ( ConnectionFailedError, PlugwiseException, @@ -49,6 +50,7 @@ async def test_load_unload_config_entry( (PlugwiseException), (XMLDataMissingError), (asyncio.TimeoutError), + (aiohttp.ClientConnectionError), ], ) async def test_config_entry_not_ready(