From 3493a7f7e5ca4bd4f11bd4c77c5b09a8ed088665 Mon Sep 17 00:00:00 2001 From: Alex X Date: Fri, 22 Nov 2024 16:37:25 +0300 Subject: [PATCH] Fix detected blocking call to scandir with args #1491 --- custom_components/xiaomi_gateway3/diagnostics.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/xiaomi_gateway3/diagnostics.py b/custom_components/xiaomi_gateway3/diagnostics.py index d6ff7a25..5de9169f 100644 --- a/custom_components/xiaomi_gateway3/diagnostics.py +++ b/custom_components/xiaomi_gateway3/diagnostics.py @@ -14,7 +14,7 @@ async def async_get_config_entry_diagnostics( except Exception as e: devices = repr(e) - info = get_info(hass, config_entry) + info = await get_info(hass, config_entry) info["devices"] = devices return info @@ -29,12 +29,12 @@ async def async_get_device_diagnostics( except Exception as e: device = repr(e) - info = get_info(hass, config_entry) + info = await get_info(hass, config_entry) info["device"] = device return info -def get_info(hass: HomeAssistant, config_entry: ConfigEntry) -> dict: +async def get_info(hass: HomeAssistant, config_entry: ConfigEntry) -> dict: try: errors = [ entry.to_dict() @@ -45,7 +45,7 @@ def get_info(hass: HomeAssistant, config_entry: ConfigEntry) -> dict: errors = repr(e) return { - "version": source_hash(), + "version": await hass.async_add_executor_job(source_hash), "options": config_entry.options.copy(), "errors": errors, }