JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
947 stars 80 forks source link

Warning: Detected blocking call to listdir with args inside the event loop #615

Open tjorim opened 4 days ago

tjorim commented 4 days ago

Description

Getting warning since HA 2024.7 (different from #612).

Reproduction Steps

Update HA and check logs

Expected behavior

No blocking calls

If applicable, add error logs.

Logger: homeassistant.util.loop
Source: util/loop.py:86
First occurred: 00:28:27 (590 occurrences)
Last logged: 16:42:19

Detected blocking call to listdir with args ('/config/www/tapo_control/e5ca38dd4c59907de1b1e993dce8c967//thumbs/',) inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 397: for f in os.listdir(dirPath): (offender: /config/custom_components/tapo_control/utils.py, line 397: for f in os.listdir(dirPath):), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 288, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/__init__.py", line 505, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 353, in mediaCleanup deleteFilesNotIncluding(hotDirPath + "/thumbs/", UUID) File "/config/custom_components/tapo_control/utils.py", line 397, in deleteFilesNotIncluding for f in os.listdir(dirPath):
Detected blocking call to listdir with args ('/config/.storage/tapo_control/e5ca38dd4c59907de1b1e993dce8c967//videos/',) inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 275: for f in os.listdir(coldDirPath + "/" + folder + "/"): (offender: /config/custom_components/tapo_control/utils.py, line 275: for f in os.listdir(coldDirPath + "/" + folder + "/"):), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 288, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/__init__.py", line 505, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 355, in mediaCleanup deleteFilesNoLongerPresentInCamera(hass, entry_id, ".mp4", "videos") File "/config/custom_components/tapo_control/utils.py", line 275, in deleteFilesNoLongerPresentInCamera for f in os.listdir(coldDirPath + "/" + folder + "/"):
Detected blocking call to listdir with args ('/config/.storage/tapo_control/e5ca38dd4c59907de1b1e993dce8c967//thumbs/',) inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 275: for f in os.listdir(coldDirPath + "/" + folder + "/"): (offender: /config/custom_components/tapo_control/utils.py, line 275: for f in os.listdir(coldDirPath + "/" + folder + "/"):), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 288, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/__init__.py", line 505, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 356, in mediaCleanup deleteFilesNoLongerPresentInCamera(hass, entry_id, ".jpg", "thumbs") File "/config/custom_components/tapo_control/utils.py", line 275, in deleteFilesNoLongerPresentInCamera for f in os.listdir(coldDirPath + "/" + folder + "/"):
Detected blocking call to listdir with args ('/config/www/tapo_control/e5ca38dd4c59907de1b1e993dce8c967//videos/',) inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 387: for f in os.listdir(dirPath): (offender: /config/custom_components/tapo_control/utils.py, line 387: for f in os.listdir(dirPath):), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 288, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/__init__.py", line 505, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 369, in mediaCleanup deleteFilesOlderThan(hotDirPath + "/videos/", HOT_DIR_DELETE_TIME) File "/config/custom_components/tapo_control/utils.py", line 387, in deleteFilesOlderThan for f in os.listdir(dirPath):
Detected blocking call to listdir with args ('/config/www/tapo_control/e5ca38dd4c59907de1b1e993dce8c967//thumbs/',) inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 387: for f in os.listdir(dirPath): (offender: /config/custom_components/tapo_control/utils.py, line 387: for f in os.listdir(dirPath):), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#listdir Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 288, in async_refresh await self._async_refresh(log_failures=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_update_data return await self.update_method() File "/config/custom_components/tapo_control/__init__.py", line 505, in async_update_data await mediaCleanup(hass, entry) File "/config/custom_components/tapo_control/utils.py", line 370, in mediaCleanup deleteFilesOlderThan(hotDirPath + "/thumbs/", HOT_DIR_DELETE_TIME) File "/config/custom_components/tapo_control/utils.py", line 387, in deleteFilesOlderThan for f in os.listdir(dirPath):

Device Firmware

n/a

Integration Version

5.4.18

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Home Assistant OS

Search for similar issues

Yes

Additional information

No response