diff --git a/custom_components/bwt_perla/__init__.py b/custom_components/bwt_perla/__init__.py index 6c5c55d..a642eec 100644 --- a/custom_components/bwt_perla/__init__.py +++ b/custom_components/bwt_perla/__init__.py @@ -1,5 +1,7 @@ """The BWT Perla integration.""" +import logging + from bwt_api.api import BwtApi from bwt_api.exception import BwtException @@ -10,6 +12,7 @@ from .const import DOMAIN +_LOGGER = logging.getLogger(__name__) PLATFORMS: list[Platform] = [Platform.SENSOR] @@ -21,6 +24,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: try: await api.get_current_data() except BwtException as e: + _LOGGER.exception("Error setting up Bwt API") await api.close() raise ConfigEntryNotReady from e diff --git a/custom_components/bwt_perla/config_flow.py b/custom_components/bwt_perla/config_flow.py index 0780a3b..57244e3 100644 --- a/custom_components/bwt_perla/config_flow.py +++ b/custom_components/bwt_perla/config_flow.py @@ -50,8 +50,10 @@ async def async_step_user( info = await validate_input(self.hass, user_input) return self.async_create_entry(title=info["title"], data=user_input) except ConnectException: + _LOGGER.exception("Connection error setting up the Bwt Api") errors["base"] = "cannot_connect" except WrongCodeException: + _LOGGER.exception("Wrong user code passed to bwt api") errors["base"] = "invalid_auth" except Exception: # pylint: disable=broad-except _LOGGER.exception("Unexpected exception")