Closed JonasL1 closed 2 days ago
You are jumping to a diagnosis of the problem, which is incorrect. HA outputs these stack traces because they are trying to improve performance. It used to be just for slow operations like network connections, but recently they started doing it for local file access as well. But the stack trace does not prevent anything from working.
However, since you have provided the log message that was output at the time and the expected device type, this will be relatively easy to correct,
@make-all, thank you for fixing it. I downloaded the latest code ZIP to import the tuya_local manually and now it works. My apologies for the wrong diagnosis.
Description
Most YAML configs can not be read in because of blocking calls that are being detected. As a result the config for my Eurom Heater device is not found. My exact ID is in the config eurom_sani_bathroom_towel_radiator.yaml. If I only leave this specific YAML file present I also get the blocking errors. Only a very few YAML files seem to be possible to be read since I only get a very short list to chose my device from.
As a result my device is recognized as a nybro_heater:
2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Adding Your Eurom Heater device with product id bc6gdgt0cpq1jmjz 2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches nybro_heater with quality of 60%. DPS: {"updated_at": 1732136714.3920865, "1": false, "2": 24, "3": 21, "4": "r", "12": 0, "101": false, "102": false, "103": false, "105": 21, "106": 70} 2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Include the previous log messages with any new device request to https://github.com/make-all/tuya-local/issues/
Steps to reproduce
Adding my Eurom Sani Bathroom Towel Radiator to Tuya Local.
Expected behaviour
My device being successfully recognized as the right device or being able to chose my device from the list.
Additional context
2024-11-20 22:05:14.405 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to walk with args ('/config/custom_components/tuya_local/devices',) inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/helpers/device_config.py, line 1024: for path, dirs, files in walk(_CONFIG_DIR): (offender: /config/custom_components/tuya_local/helpers/device_config.py, line 1024: for path, dirs, files in walk(_CONFIG_DIR):), please create a bug report at https://github.com/make-all/tuya-local/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#walk 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 189, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, 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/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 567, in _handle
return await handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, request.match_info)
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, *kwargs)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, args, kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
result = await self._async_configure(flow_id, user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
File "/config/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
return await self.async_step_select_type()
File "/config/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
async for type in self.device.async_possible_types():
File "/config/custom_components/tuya_local/device.py", line 383, in async_possible_types
for matched in await self._hass.async_add_executor_job(
File "/config/custom_components/tuya_local/helpers/device_config.py", line 1032, in possible_matches
for cfg in available_configs():
File "/config/custom_components/tuya_local/helpers/device_config.py", line 1024, in available_configs
for path, dirs, files in walk(_CONFIG_DIR):
2024-11-20 22:05:14.414 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to scandir with args ('/config/custom_components/tuya_local/devices',) inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/helpers/device_config.py, line 1024: for path, dirs, files in walk(_CONFIG_DIR): (offender: , line 366: ?), please create a bug report at https://github.com/make-all/tuya-local/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#scandir
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 189, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, 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/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 567, in _handle
return await handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, request.match_info)
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, *kwargs)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, args, kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
result = await self._async_configure(flow_id, user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
File "/config/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
return await self.async_step_select_type()
File "/config/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
async for type in self.device.async_possible_types():
File "/config/custom_components/tuya_local/device.py", line 383, in async_possible_types
for matched in await self._hass.async_add_executor_job(
File "/config/custom_components/tuya_local/helpers/device_config.py", line 1032, in possible_matches
for cfg in available_configs():
File "/config/custom_components/tuya_local/helpers/device_config.py", line 1024, in available_configs
for path, dirs, files in walk(_CONFIG_DIR):
2024-11-20 22:05:14.425 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/config/custom_components/tuya_local/devices/9in1_airquality_monitor.yaml',) inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/helpers/device_config.py, line 101: self._config = load_yaml(filename) (offender: /usr/src/homeassistant/homeassistant/util/yaml/loader.py, line 230: with open(fname, encoding="utf-8") as conf_file:), please create a bug report at https://github.com/make-all/tuya-local/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
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 189, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, 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/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 567, in _handle
return await handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, request.match_info)
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, *kwargs)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, args, kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in async_configure
result = await self._async_configure(flow_id, user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 414, in _async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
File "/config/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
return await self.async_step_select_type()
File "/config/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
async for type in self.device.async_possible_types():
File "/config/custom_components/tuya_local/device.py", line 383, in async_possible_types
for matched in await self._hass.async_add_executor_job(
File "/config/custom_components/tuya_local/helpers/device_config.py", line 1033, in possible_matches
parsed = TuyaDeviceConfig(cfg)
File "/config/custom_components/tuya_local/helpers/device_config.py", line 101, in init
self._config = load_yaml(filename)
2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Adding Your Eurom Heater device with product id bc6gdgt0cpq1jmjz
2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches nybro_heater with quality of 60%. DPS: {"updated_at": 1732136714.3920865, "1": false, "2": 24, "3": 21, "4": "r", "12": 0, "101": false, "102": false, "103": false, "105": 21, "106": 70}
2024-11-20 22:05:25.338 WARNING (MainThread) [custom_components.tuya_local.config_flow] Include the previous log messages with any new device request to https://github.com/make-all/tuya-local/issues/
Confirmation
[X] I am sure this is a bug or improvement, that is well enough described that it can be implemented.
[ ] If this is for a specific device, the device config is mentioned above, or diagnostics are included.
[X] Log messages or diagnostics relevant to the issue are included.
[X] This is not requesting addition of a new device.