home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.32k stars 30.63k forks source link

"Detected blocking call to open with args" when trying to submit serial port settings, when adding integration with USB #125066

Open hpojak opened 2 months ago

hpojak commented 2 months ago

The problem

Tried to add an integration "Zigbee Home Automation", radio type EZSP, with port speed 115200. It resulted in an error message: "Failed to connect" in the web browser, and logs in the server.

All alternatives (hardware, software and blank) for flow control resulted in the same error message. Please see the included image.

The logs "Detected blocking call to open..." etc are written before I choose radio type.

The USB dongle (Aeotec Zi-Stick) is shown here: $ dmesg | grep tty [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 smsc95xx.macaddr=D8:3A:DD:9C:2A:CE vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=PARTUUID=7d319b0c-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles [ 0.000357] printk: console [tty1] enabled [ 1.617029] fe201000.serial: ttyAMA1 at MMIO 0xfe201000 (irq = 36, base_baud = 0) is a PL011 rev2 [ 1.617273] serial serial0: tty port ttyAMA1 registered [ 6.201656] systemd[1]: Created slice system-getty.slice - Slice /system/getty. [ 9.238940] usb 1-1.4: ch341-uart converter now attached to ttyUSB0

The system is a Raspberry Pi 4 with Raspberry Pi OS 32 bits.

Note

HA couldn't complete its installation: ../../numpy/meson.build:207:4: ERROR: Problem encountered: No BLAS library detected! etc in spite of the system having the BLAS library:

$ ls -ltr /usr/lib/arm-linux-gnueabihf/blas/
total 1028
-rw-r--r-- 1 root root 394500 Nov 27  2022 libblas.so.3.11.0
lrwxrwxrwx 1 root root     17 Nov 27  2022 libblas.so.3 -> libblas.so.3.11.0
lrwxrwxrwx 1 root root     17 Nov 27  2022 libblas.so -> libblas.so.3.11.0
-rw-r--r-- 1 root root 651382 Nov 27  2022 libblas.a

Thus, the following edit was done to homeassistant/lib/python3.12/site-packages/homeassistant/components/stream/core.py: # import numpy as np The dependency of numpy, from camera, was removed with a comment sign. I'm not attaching any camera to HA.

image

What version of Home Assistant Core has the issue?

core-2024.8.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Zigbee Home Automation

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-09-02 10:12:59.943 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/bNumInterfaces',) inside the event loop by integration 'zha' at homeassistant/components/zha/radio_manager.py, line 221: probe_result = await radio.controller.probe(dev_config) (offender: /srv/homeassistant/lib/python3.12/site-packages/serial/tools/list_ports_linux.py, line 84: with open(os.path.join(*args)) as f:), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+zha%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#open
Traceback (most recent call last):
  File "/srv/homeassistant/bin/hass", line 8, in <module>
    sys.exit(main())
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/srv/homeassistant/lib/python3.12/site-packages/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 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 1979, 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 "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
    resp = await request_handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 366, in async_configure
    result = await self._async_configure(flow_id, user_input)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 413, in _async_configure
    result = await self._async_handle_step(
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/zha/config_flow.py", line 199, in async_step_choose_serial_port
    probe_result = await self._radio_mgr.detect_radio_type()
  File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/components/zha/radio_manager.py", line 221, in detect_radio_type
    probe_result = await radio.controller.probe(dev_config)

Additional information

No response

home-assistant[bot] commented 2 months ago

Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zha` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zha` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

jsb5151 commented 1 month ago

Same issue here; am currently rebuilding my Home Assistant instance from scratch using HassOS and ZHA refuses to talk to my ConBee, which was working fine before on a supervised install.