Closed Gunth closed 3 months ago
Duplicate of #39 Please upgrade to version 0.2.15 of the integration to fix this. That version was set as per-release as the fix requires functions introduced in HA 2024.6. It is now set as latest
It should fix all the warnings. If some remain, feel free to comment further here or open a new issue
Describe the bug Since the latest update of HA lot of warnings on startup saying "Detected blocking call to open inside the event loop".
Checklist
To Reproduce Steps to reproduce the behavior:
Expected behavior On startup lot of warning :
Detected blocking call to open inside the event loop by custom integration 'irm_kmi' at custom_components/irm_kmi/rain_graph.py, line 304: with open(bg_image_path, 'rb') as f: (offender: /config/custom_components/irm_kmi/rain_graph.py, line 304: with open(bg_image_path, 'rb') as f:), please create a bug report at https://github.com/jdejaegh/irm-kmi-ha/issues 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/config_entries.py", line 742, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/irm_kmi/__init__.py", line 27, in async_setup_entry await coordinator.async_config_entry_first_refresh() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 277, in async_config_entry_first_refresh await self._async_refresh( File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/irm_kmi/coordinator.py", line 105, in _async_update_data return await self.process_api_data(api_data) File "/config/custom_components/irm_kmi/coordinator.py", line 171, in process_api_data animation=await self._async_animation_data(api_data=api_data), File "/config/custom_components/irm_kmi/coordinator.py", line 136, in _async_animation_data rain_graph = self.create_rain_graph(radar_animation, animation_data, country, images_from_api) File "/config/custom_components/irm_kmi/coordinator.py", line 434, in create_rain_graph return RainGraph(radar_animation, image_path, bg_size, File "/config/custom_components/irm_kmi/rain_graph.py", line 75, in __init__ self.insert_background() File "/config/custom_components/irm_kmi/rain_graph.py", line 304, in insert_background with open(bg_image_path, 'rb') as f:
Detected blocking call to open inside the event loop by custom integration 'irm_kmi' at custom_components/irm_kmi/rain_graph.py, line 96: self._dwg.embed_font(name="Roboto Medium", filename=font_file) (offender: /usr/local/lib/python3.12/site-packages/svgwrite/container.py, line 150: data = open(filename, 'rb').read()), please create a bug report at https://github.com/jdejaegh/irm-kmi-ha/issues 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/update_coordinator.py", line 255, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() File "/config/custom_components/irm_kmi/coordinator.py", line 105, in _async_update_data return await self.process_api_data(api_data) File "/config/custom_components/irm_kmi/coordinator.py", line 171, in process_api_data animation=await self._async_animation_data(api_data=api_data), File "/config/custom_components/irm_kmi/coordinator.py", line 136, in _async_animation_data rain_graph = self.create_rain_graph(radar_animation, animation_data, country, images_from_api) File "/config/custom_components/irm_kmi/coordinator.py", line 434, in create_rain_graph return RainGraph(radar_animation, image_path, bg_size, File "/config/custom_components/irm_kmi/rain_graph.py", line 70, in __init__ self.draw_svg_frame() File "/config/custom_components/irm_kmi/rain_graph.py", line 96, in draw_svg_frame self._dwg.embed_font(name="Roboto Medium", filename=font_file)
.....
Version
Additional context This is not the only custom integration impacted in my list custom one's, here is the same issue for another one and it can be related to this change of ha : https://developers.home-assistant.io/blog/2024/05/19/fix_zoneinfo_blocking_io/
https://github.com/custom-components/nordpool/issues/382
Thanks, G.