ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.03k stars 149 forks source link

HA 2024.6 adds a check for this type of file I/O happening in the event loop. - Detected blocking call to open inside the event loop by custom integration 'smartthinq_sensors' at #757

Closed asucrews closed 3 weeks ago

asucrews commented 3 weeks ago

Describe the bug

HA 2024.6 adds a check for this type of file I/O happening in the event loop.

Detected blocking call to open inside the event loop by custom integration 'smartthinq_sensors' at custom_components/smartthinq_sensors/wideq/core_async.py, line 1704: with open(data_file, "r", encoding="utf-8") as lang_file: (offender: /config/custom_components/smartthinq_sensors/wideq/core_async.py, line 1704: with open(data_file, "r", encoding="utf-8") as lang_file:), please create a bug report at https://github.com/ollo69/ha-smartthinq-sensors/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 188, 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/smartthinq_sensors/init.py", line 316, in async_setup_entry lge_devices, unsupported_devices, discovered_devices = await lge_devices_setup( File "/config/custom_components/smartthinq_sensors/init.py", line 644, in lge_devices_setup if not await init_device(lge_dev, device_info, root_dev): File "/config/custom_components/smartthinq_sensors/init.py", line 600, in init_device if not await dev.init_device(): File "/config/custom_components/smartthinq_sensors/init.py", line 469, in init_device if not await self._device.init_device_info(): File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 509, in init_device_info self._local_lang_pack = self._client.local_lang_pack() File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1704, in local_lang_pack with open(data_file, "r", encoding="utf-8") as lang_file:

Expected behavior If applicable, a clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment details:

Output of HA logs Detected blocking call to open inside the event loop by custom integration 'smartthinq_sensors' at custom_components/smartthinq_sensors/wideq/core_async.py, line 1704: with open(data_file, "r", encoding="utf-8") as lang_file: (offender: /config/custom_components/smartthinq_sensors/wideq/core_async.py, line 1704: with open(data_file, "r", encoding="utf-8") as lang_file:), please create a bug report at https://github.com/ollo69/ha-smartthinq-sensors/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 188, 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/smartthinq_sensors/init.py", line 316, in async_setup_entry lge_devices, unsupported_devices, discovered_devices = await lge_devices_setup( File "/config/custom_components/smartthinq_sensors/init.py", line 644, in lge_devices_setup if not await init_device(lge_dev, device_info, root_dev): File "/config/custom_components/smartthinq_sensors/init.py", line 600, in init_device if not await dev.init_device(): File "/config/custom_components/smartthinq_sensors/init.py", line 469, in init_device if not await self._device.init_device_info(): File "/config/custom_components/smartthinq_sensors/wideq/device.py", line 509, in init_device_info self._local_lang_pack = self._client.local_lang_pack() File "/config/custom_components/smartthinq_sensors/wideq/core_async.py", line 1704, in local_lang_pack with open(data_file, "r", encoding="utf-8") as lang_file:

Additional context Add any other context about the problem here.

ollo69 commented 3 weeks ago

Closed as duplicated of #754