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 open inside the event loop by custom integration 'tapo_control' #612

Open catalinbordan opened 2 weeks ago

catalinbordan commented 2 weeks ago

Description

I think it is coming from new version of Home Assistant 2024.6.3 Almost 19k hits from the last 12h. I also have this warning: Recording is currently in progress. I did not see any issues in regarding the use of integration.

Reproduction Steps

I had activated media sync for all my 3 cameras in /media/tapo

Expected behavior

no warning about

If applicable, add error logs.

Logger: homeassistant.util.loop Source: util/loop.py:84 First occurred: 17 June 2024 at 19:35:02 (18096 occurrences) Last logged: 10:40:11

Detected blocking call to open inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 513: downloadedFile = await downloader.downloadFile( (offender: /usr/local/lib/python3.12/site-packages/pytapo/media_stream/convert.py, line 25: file = open(tempVideoFileLocation, "wb")), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 "/config/custom_components/tapo_control/init.py", line 752, in mediaSync await getRecording( File "/config/custom_components/tapo_control/utils.py", line 513, in getRecording downloadedFile = await downloader.downloadFile( Detected blocking call to open inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 513: downloadedFile = await downloader.downloadFile( (offender: /usr/local/lib/python3.12/site-packages/pytapo/media_stream/convert.py, line 29: file = open(tempAudioFileLocation, "wb")), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 "/config/custom_components/tapo_control/init.py", line 752, in mediaSync await getRecording( File "/config/custom_components/tapo_control/utils.py", line 513, in getRecording downloadedFile = await downloader.downloadFile( Detected blocking call to open inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 513: downloadedFile = await downloader.downloadFile( (offender: /usr/local/lib/python3.12/site-packages/pytapo/media_stream/downloader.py, line 45: with open(fileName, "rb") as f:), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 "/config/custom_components/tapo_control/init.py", line 752, in mediaSync await getRecording( File "/config/custom_components/tapo_control/utils.py", line 513, in getRecording downloadedFile = await downloader.downloadFile( Detected blocking call to open inside the event loop by custom integration 'tapo_control' at custom_components/tapo_control/utils.py, line 265: with open(filePathThumb, "wb") as binary_file: (offender: /config/custom_components/tapo_control/utils.py, line 265: with open(filePathThumb, "wb") as binary_file:), please create a bug report at https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in 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 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, 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 "/config/custom_components/tapo_control/init.py", line 752, in mediaSync await getRecording( File "/config/custom_components/tapo_control/utils.py", line 540, in getRecording await processDownload( File "/config/custom_components/tapo_control/utils.py", line 233, in processDownload await generateThumb( File "/config/custom_components/tapo_control/utils.py", line 265, in generateThumb with open(filePathThumb, "wb") as binary_file:

Device Firmware

last fw without issues related to cloud pswd

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 on VM

Search for similar issues

Yes

Additional information

No response