OpenEPaperLink / Home_Assistant_Integration

Home assistant Integration for the OpenEPaperLink project
https://openepaperlink.de
Apache License 2.0
148 stars 34 forks source link

Detected blocking call to open inside the event loop by custom integration 'open_epaper_link' at custom_components/open_epaper_link/imagegen.py, line 640 #153

Open nohn opened 3 months ago

nohn commented 3 months ago

Describe the bug

Home Assistant log is full of

2024-06-29 09:47:33.841 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'open_epaper_link' at custom_components/open_epaper_link/imagegen.py, line 640: rgb_image.save(os.path.join(os.path.dirname(__ file__), entity_id + '.jpg'), format='JPEG', quality="maximum") (offender: /usr/local/lib/python3.12/site-packages/PIL/Image.py, line 2456: fp = builtins.open(filename, "w+b")), please create a bug report at https://github.com/jonasniesner/open_epaper_link_homeassistant/i ssues 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 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 "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step self._hass.async_create_task_internal( File "/usr/src/homeassistant/homeassistant/core.py", line 828, in async_create_task_internal task = create_eager_task(target, name=name, loop=self.loop) File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 663, in _service_handler response = await self._async_start_run( File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 621, in _async_start_run script_result = await coro File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 652, in _async_run return await self.script.async_run(script_vars, context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1769, in async_run return await asyncio.shield(create_eager_task(run.async_run())) File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step self._hass.async_create_task_internal( File "/usr/src/homeassistant/homeassistant/core.py", line 828, in async_create_task_internal task = create_eager_task(target, name=name, loop=self.loop) File "/usr/src/homeassistant/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/core.py", line 2741, in async_call response_data = await coro File "/usr/src/homeassistant/homeassistant/core.py", line 2784, in _execute_service return await target(service_call) File "/config/custom_components/open_epaper_link/__init__.py", line 79, in lines4service imgbuff = gen4line(entity_id, service, hass) File "/config/custom_components/open_epaper_link/imagegen.py", line 640, in gen4line rgb_image.save(os.path.join(os.path.dirname(__file__), entity_id + '.jpg'), format='JPEG', quality="maximum")

To Reproduce Steps to reproduce the behavior:

  1. Take a look at your logfile

Expected behavior No ERRORs or WARNINGs wrt openepaperlink are in Home Assitant Logfile

Screenshots

Additional context