diff --git a/custom_components/multimatic/config_flow.py b/custom_components/multimatic/config_flow.py index 65057d9..4d5b84d 100644 --- a/custom_components/multimatic/config_flow.py +++ b/custom_components/multimatic/config_flow.py @@ -8,7 +8,7 @@ from homeassistant import config_entries, core, exceptions from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from homeassistant.core import callback -from homeassistant.helpers.aiohttp_client import async_get_clientsession +from homeassistant.helpers.aiohttp_client import async_create_clientsession import homeassistant.helpers.config_validation as cv from .const import CONF_SERIAL_NUMBER, DEFAULT_SCAN_INTERVAL, DOMAIN @@ -39,7 +39,7 @@ async def validate_authentication(hass, username, password): """Ensure provided credentials are working.""" try: if not await SystemManager( - username, password, async_get_clientsession(hass) + username, password, async_create_clientsession(hass) ).login(True): raise InvalidAuth except ApiError as err: diff --git a/custom_components/multimatic/coordinator.py b/custom_components/multimatic/coordinator.py index e4c146d..2a54502 100644 --- a/custom_components/multimatic/coordinator.py +++ b/custom_components/multimatic/coordinator.py @@ -26,7 +26,7 @@ from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_PASSWORD, CONF_USERNAME -from homeassistant.helpers.aiohttp_client import async_get_clientsession +from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import ( @@ -61,7 +61,7 @@ def __init__(self, hass, entry: ConfigEntry): self._manager = pymultimatic.systemmanager.SystemManager( user=username, password=password, - session=async_get_clientsession(hass), + session=async_create_clientsession(hass), serial=self.serial, ) @@ -528,8 +528,9 @@ async def _fetch_data(self): try: self.logger.debug("calling %s", self._method) return await getattr(self.api, self._method)() - except ApiError: - await self._safe_logout() + except ApiError as err: + if err.status == 401: + await self._safe_logout() raise async def _fetch_data_if_needed(self): diff --git a/custom_components/multimatic/manifest.json b/custom_components/multimatic/manifest.json index dab8116..fca2516 100644 --- a/custom_components/multimatic/manifest.json +++ b/custom_components/multimatic/manifest.json @@ -12,6 +12,6 @@ "homekit": {}, "dependencies": [], "codeowners": ["@thomasgermain"], - "version": "1.12.10", + "version": "1.12.11", "iot_class": "cloud_polling" } diff --git a/custom_components/multimatic/strings.json b/custom_components/multimatic/strings.json index 8ded63e..85261ef 100644 --- a/custom_components/multimatic/strings.json +++ b/custom_components/multimatic/strings.json @@ -20,7 +20,7 @@ "already_configured": "Only one configuration is allowed" } }, - "options": { + "options": { "step": { "init": { "data": { @@ -29,4 +29,4 @@ } } } -} \ No newline at end of file +} diff --git a/custom_components/multimatic/translations/de.json b/custom_components/multimatic/translations/de.json index dec5c48..e15ad95 100644 --- a/custom_components/multimatic/translations/de.json +++ b/custom_components/multimatic/translations/de.json @@ -8,7 +8,7 @@ "application": "Applikation", "serial_number": "Seriennummer" }, - "title": "Verbindungsinformationen (wie in der mutliMATIC / sensoAPP" + "title": "Verbindungsinformationen (wie in der mutliMATIC / sensoAPP)" } }, "error": {