Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion homeassistant/components/plugwise/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import asyncio
from typing import Any

from aiohttp import ClientConnectionError
from plugwise.exceptions import InvalidAuthentication, PlugwiseException
from plugwise.smile import Smile

Expand Down Expand Up @@ -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:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Longterm this should probably be caught by the library and raised as a library exception.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agree.

CC @CoMPaTech @bouwew

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've fixed this in plugwise-beta some time ago, in almost the same way.

We need to think about how to do this in the library...

raise ConfigEntryNotReady(
f"Error while communicating to device {api.smile_name}"
) from err
Expand Down
2 changes: 2 additions & 0 deletions tests/components/plugwise/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import asyncio
from unittest.mock import MagicMock

import aiohttp
from plugwise.exceptions import (
ConnectionFailedError,
PlugwiseException,
Expand Down Expand Up @@ -49,6 +50,7 @@ async def test_load_unload_config_entry(
(PlugwiseException),
(XMLDataMissingError),
(asyncio.TimeoutError),
(aiohttp.ClientConnectionError),
],
)
async def test_config_entry_not_ready(
Expand Down