Fix Beosound Level not reconnecting properly

This commit is contained in:
mj23000
2023-10-25 15:07:49 +02:00
parent 14703c504b
commit d618ad0b86

View File

@@ -5,6 +5,7 @@ import logging
from multiprocessing.pool import ApplyResult from multiprocessing.pool import ApplyResult
from typing import cast from typing import cast
from mozart_api.exceptions import ServiceException
from mozart_api.models import BatteryState from mozart_api.models import BatteryState
from mozart_api.mozart_client import MozartClient from mozart_api.mozart_client import MozartClient
from urllib3.exceptions import MaxRetryError from urllib3.exceptions import MaxRetryError
@@ -62,7 +63,7 @@ async def init_entities(hass: HomeAssistant, entry: ConfigEntry) -> bool:
ApplyResult[BatteryState], ApplyResult[BatteryState],
client.get_battery_state(async_req=True, _request_timeout=3), client.get_battery_state(async_req=True, _request_timeout=3),
).get() ).get()
except MaxRetryError: except (MaxRetryError, ServiceException):
_LOGGER.error("Unable to connect to %s", entry.data[CONF_NAME]) _LOGGER.error("Unable to connect to %s", entry.data[CONF_NAME])
return False return False