hacs-govee icon indicating copy to clipboard operation
hacs-govee copied to clipboard

Blocking call to open inside the event loop

Open Taraman17 opened this issue 8 months ago • 6 comments

Version of the custom_component

2023.11.1

Configuration

Standard configuration via UI

Describe the bug

HA Logs show the above warning. This is issued since 2024.6.0 and will most likely lead to an error in the future.

Full log entry below.

Error (Warning) log

2024-06-13 16:42:58.723 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'govee' at custom_components/govee/learning_storage.py, line 28: learned_dict = load_yaml(self._config_dir + LEARNING_STORAGE_YAML) (offender: /usr/src/homeassistant/homeassistant/util/yaml/loader.py, line 226: with open(fname, encoding="utf-8") as conf_file:), please create a bug report at https://github.com/LaggAt/hacs-govee/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/govee/__init__.py", line 64, in async_setup_entry
_, err = await hub.get_devices()
File "/usr/local/lib/python3.12/site-packages/govee_api_laggat/govee_api_laggat.py", line 312, in get_devices
_, err_api = await self._api.get_devices()
File "/usr/local/lib/python3.12/site-packages/govee_api_laggat/api.py", line 244, in get_devices
learning_infos = await self._govee._learning_storage._read_cached()
File "/usr/local/lib/python3.12/site-packages/govee_api_laggat/learning_storage.py", line 30, in _read_cached
self._learned_info = await self.read()
File "/config/custom_components/govee/learning_storage.py", line 28, in read
learned_dict = load_yaml(self._config_dir + LEARNING_STORAGE_YAML)

Taraman17 avatar Jun 13 '24 18:06 Taraman17