fix: catch error for refreshing devices

This commit is contained in:
LiShuzhen 2025-12-12 11:12:07 +08:00
parent 30ce1b4970
commit 0954b003b0
2 changed files with 7 additions and 3 deletions

View File

@ -1434,8 +1434,12 @@ class MIoTClient:
_LOGGER.debug(
'refresh cloud devices, %s, %s', self._uid, self._cloud_server)
self._refresh_cloud_devices_timer = None
result = await self._http.get_devices_async(
home_ids=list(self._entry_data.get('home_selected', {}).keys()))
try:
result = await self._http.get_devices_async(
home_ids=list(self._entry_data.get('home_selected', {}).keys()))
except Exception as err: # pylint: disable=broad-exception-caught
_LOGGER.error('refresh cloud devices failed, %s', err)
return
if not result and 'devices' not in result:
self.__show_client_error_notify(
message=self._i18n.translate(

View File

@ -291,7 +291,7 @@ class MIoTNetwork:
return self._main_loop.time() - start_ts
return self._DETECT_TIMEOUT
except Exception as err: # pylint: disable=broad-exception-caught
print(err)
_LOGGER.debug('ping error, %s',err)
return self._DETECT_TIMEOUT
async def __http_async(self, url: str) -> float: