Fix Plugwise recovering from aiohttp client error (#71642)

This commit is contained in:
Franck Nijhof 2022-05-10 15:28:44 +02:00 committed by GitHub
parent 26177bd080
commit ef16e6c129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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

View File

@ -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(