mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix Plugwise recovering from aiohttp client error (#71642)
This commit is contained in:
parent
26177bd080
commit
ef16e6c129
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||||||
import asyncio
|
import asyncio
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from aiohttp import ClientConnectionError
|
||||||
from plugwise.exceptions import InvalidAuthentication, PlugwiseException
|
from plugwise.exceptions import InvalidAuthentication, PlugwiseException
|
||||||
from plugwise.smile import Smile
|
from plugwise.smile import Smile
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
except InvalidAuthentication:
|
except InvalidAuthentication:
|
||||||
LOGGER.error("Invalid username or Smile ID")
|
LOGGER.error("Invalid username or Smile ID")
|
||||||
return False
|
return False
|
||||||
except PlugwiseException as err:
|
except (ClientConnectionError, PlugwiseException) as err:
|
||||||
raise ConfigEntryNotReady(
|
raise ConfigEntryNotReady(
|
||||||
f"Error while communicating to device {api.smile_name}"
|
f"Error while communicating to device {api.smile_name}"
|
||||||
) from err
|
) from err
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
import aiohttp
|
||||||
from plugwise.exceptions import (
|
from plugwise.exceptions import (
|
||||||
ConnectionFailedError,
|
ConnectionFailedError,
|
||||||
PlugwiseException,
|
PlugwiseException,
|
||||||
@ -49,6 +50,7 @@ async def test_load_unload_config_entry(
|
|||||||
(PlugwiseException),
|
(PlugwiseException),
|
||||||
(XMLDataMissingError),
|
(XMLDataMissingError),
|
||||||
(asyncio.TimeoutError),
|
(asyncio.TimeoutError),
|
||||||
|
(aiohttp.ClientConnectionError),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_config_entry_not_ready(
|
async def test_config_entry_not_ready(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user