Skip to content

Commit

Permalink
fix: async blocking call
Browse files Browse the repository at this point in the history
  • Loading branch information
topsworld committed Dec 20, 2024
1 parent 1c95ff7 commit 38a5174
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/xiaomi_home/miot/miot_lan.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,9 @@ async def init_async(self) -> None:
_LOGGER.info('no valid net_ifs')
return
try:
self._profile_models = load_yaml_file(
yaml_file=gen_absolute_path(self.PROFILE_MODELS_FILE))
self._profile_models = await self._main_loop.run_in_executor(
None, load_yaml_file,
gen_absolute_path(self.PROFILE_MODELS_FILE))
except Exception as err: # pylint: disable=broad-exception-caught
_LOGGER.error('load profile models error, %s', err)
self._profile_models = {}
Expand Down

0 comments on commit 38a5174

Please sign in to comment.