make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.41k stars 542 forks source link

Detected blocking call to XXX #2501

Open sshaikh opened 1 week ago

sshaikh commented 1 week ago

Description

I tried adding a device that is currently not supported by TL in order to generate DPs log as per my first attempt at https://github.com/make-all/tuya-local/issues/2498

Initially going through all protocols resulted in the following in the logs for 3.1-3.5 in order:

2024-11-14 18:59:26.386 WARNING (SyncWorker_19) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-11-14 18:59:31.510 WARNING (SyncWorker_28) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-11-14 18:59:36.321 WARNING (SyncWorker_39) [custom_components.tuya_local.device] Test protocol error 904: Unexpected Payload from Device
2024-11-14 19:00:00.982 WARNING (SyncWorker_54) [custom_components.tuya_local.device] Test protocol error 914: Check device key or version
2024-11-14 19:00:15.386 WARNING (SyncWorker_34) [custom_components.tuya_local.device] Test protocol error 914: Check device key or version

So no DPs.

I tried again, in order to capture logs to raise an issue. This time I got a dialog saying "This device is not supported" with the following in the logs:

2024-11-14 18:52:55.828 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to walk with args ('/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/devices',) inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/helpers/device_config.py, line 1017: for path, dirs, files in walk(_CONFIG_DIR): (offender: /home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py, line 1017: for path, dirs, files in walk(_CONFIG_DIR):), please create a bug report at https://github.com/make-all/tuya-local/issues
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/device.py", line 387, in async_possible_types
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 1025, in possible_matches
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 1017, in available_configs
2024-11-14 18:52:55.831 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to scandir with args ('/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/devices',) inside the event loop by custom integration 'tuya_local' at custom_components/tuya_local/helpers/device_config.py, line 1017: for path, dirs, files in walk(_CONFIG_DIR): (offender: <frozen os>, line 362: ?), please create a bug report at https://github.com/make-all/tuya-local/issues
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/device.py", line 387, in async_possible_types
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 1025, in possible_matches
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 1017, in available_configs
2024-11-14 18:52:55.837 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/home/homeassistant/homeassistant-config/homeassistant/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: /home/homeassistant/homeassistant/lib/python3.12/site-packages/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
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 325, in async_step_local
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/config_flow.py", line 363, in async_step_select_type
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/device.py", line 387, in async_possible_types
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 1026, in possible_matches
  File "/home/homeassistant/homeassistant-config/homeassistant/custom_components/tuya_local/helpers/device_config.py", line 101, in __init__
2024-11-14 18:52:59.274 WARNING (MainThread) [custom_components.tuya_local.config_flow] Device matches None with quality of 0%. DPS: {"updated_at": 1731610375.8220537, "20": 2386}
2024-11-14 18:52:59.274 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/

On the positive side, I did get the DPs log.

Steps to reproduce

  1. Try adding the Eightree ET31
  2. Keep trying until you see the errors in the logs.

Expected behaviour

For the device not to be recognised consistently and for DPs to be consistently printed if so.

At the very least no blocking call exceptions?

Additional context

No response

Confirmation