From c52f535eb3b0a48d5da203ed6d032f28c6ad2ebb Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Wed, 18 May 2022 10:00:46 +0300 Subject: [PATCH] Fix filesize doing IO in event loop (#72038) --- homeassistant/components/filesize/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/filesize/sensor.py b/homeassistant/components/filesize/sensor.py index 6c52fcbdd5a..5f66aefaab5 100644 --- a/homeassistant/components/filesize/sensor.py +++ b/homeassistant/components/filesize/sensor.py @@ -96,7 +96,7 @@ class FileSizeCoordinator(DataUpdateCoordinator): async def _async_update_data(self) -> dict[str, float | int | datetime]: """Fetch file information.""" try: - statinfo = os.stat(self._path) + statinfo = await self.hass.async_add_executor_job(os.stat, self._path) except OSError as error: raise UpdateFailed(f"Can not retrieve file statistics {error}") from error