Skip to content

Commit

Permalink
get_system_info exception workaround, fixes #126
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneNulschDE committed Apr 7, 2023
1 parent 85a03a8 commit b417fb8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/mbapi2020/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,16 @@ def _get_car(self, vin: str):
return car

async def set_rlock_mode(self):
info = await system_info.async_get_system_info(self._hass)

if not "WSL" in info.get("os_version"):
# In rare cases the ha-core system_info component runs in error when detecting the supervisor
# See https://github.com/ReneNulschDE/mbapi2020/issues/126
info = None
try:
info = await system_info.async_get_system_info(self._hass)
except Exception as e:
LOGGER.debug("WSL detection not possible. Error in HA-Core get_system_info. Force rlock mode.")

if not info is None and not "WSL" in info.get("os_version"):
self._disable_rlock = False
self.__lock = threading.RLock()
LOGGER.debug("WSL not detected - running in rlock mode")
Expand Down

0 comments on commit b417fb8

Please sign in to comment.