core icon indicating copy to clipboard operation
core copied to clipboard

ZHA: Error setting up entry /dev/ZBDongle-E for zha asyncio.exceptions.CancelledError

Open Rihan9 opened this issue 1 year ago • 1 comments

The problem

Hi, I'm trying to migrate from Z2M to ZHA. I'll love to do it in order to reduce the number of containers in my server and in hope to resolve an instability problem in my network.

But I can't. The setup of ZHA always fail with the error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 126, in async_setup_entry
    zha_gateway = await Gateway.async_from_config(zha_lib_data)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zha/application/gateway.py", line 233, in async_from_config
    await instance.async_add_executor_job(
asyncio.exceptions.CancelledError

I don't even have the ability to enable the debug logging in the integration. The setup works until I choose to maintain my network. Here the setup took a while and then throw that error. I choose the EZP driver, with 115200 as baundrate and software flow control. Reboot HA doesn't help. Phisical remove the dongle and reinserted it neither.

Can someone explain why this behavior? It seem like a timeout error but I don't know why..

What version of Home Assistant Core has the issue?

core-2024.9.2

What was the last working version of Home Assistant Core?

What type of installation are you running?

Home Assistant Container

Integration causing the issue

ZHA

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?

No response

Additional information

Coordinator type: EmberZNet Coordinator Name: SOnOff ZBDongle-E Coordinator Version: 7.4.3 [GA]

Works "fine" on Z2M (Various instability issues and lagging. I'm hoping is not a coordinator problem, but I still don't know. Still, the coordinator is recognized and the network is able to works)

Rihan9 avatar Sep 22 '24 20:09 Rihan9

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)

home-assistant[bot] avatar Sep 23 '24 19:09 home-assistant[bot]

From the path, it looks like you're using Docker. Make sure that the Home Assistant container has permission to access the serial port. It seems like the dongle just isn't responding to serial traffic.

puddly avatar Sep 23 '24 19:09 puddly

Hi @puddly , that was my first assumption. But even zigbee2mqtt is in a docker container in the same machine, with the same settings (same capabilities, same device configurated). I stopped the zigbee2mqtt container when I was doing my tests so it isn't a conflict between containers neither.

I tried this morning to open a console in the home assistant container and launch a couple of command:

e4aeb9b510a7:/config# zigpy radio ezsp /dev/ZBDongle info
PAN ID:                0x1A62
Extended PAN ID:       dd:dd:dd:dd:dd:dd:dd:dd
Channel:               11
Channel mask:          [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]
NWK update ID:         0
Device IEEE:           e0:79:8d:ff:fe:f4:3c:7c
Device NWK:            0x0000
Network key:           FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF
Network key sequence:  0
Network key counter:   22220801

e4aeb9b510a7:/config# zigpy radio ezsp /dev/ZBDongle energy-scan
Channel energy (mean of 1 / 5):
------------------------------------------------
 ! Different radios compute channel energy differently

 + Lower energy is better
 + Active Zigbee networks on a channel may still cause congestion
 + TX on 26 in North America may be with lower power due to regulations
 + Zigbee channels 15, 20, 25 fall between WiFi channels 1, 6, 11
 + Some Zigbee devices only join networks on channels 15, 20, and 25
 + Current channel is enclosed in [square brackets]
------------------------------------------------
 - [11 ]    89.94%  #########################################################################################
 -  12      93.76%  #############################################################################################
 -  13      94.48%  ##############################################################################################
 -  14      91.06%  ###########################################################################################
 -  15      92.06%  ############################################################################################
 -  16      94.48%  ##############################################################################################
 -  17      93.76%  #############################################################################################
 -  18      92.06%  ############################################################################################
 -  19      92.06%  ############################################################################################
 -  20      89.94%  #########################################################################################
 -  21      93.76%  #############################################################################################
 -  22      93.76%  #############################################################################################
 -  23      92.96%  ############################################################################################
 -  24      89.94%  #########################################################################################
 -  25      91.06%  ###########################################################################################
 -  26*     91.06%  ###########################################################################################

some notes:

  • I masked the network key
  • the device is in a different path because I checked if the '-' was the problem.

For what I can understand the serial comunication seems working fine.

Rihan9 avatar Sep 24 '24 07:09 Rihan9

Maybe my network dimension is the problem? I have multiple devices, but is not "gigantic" Total: 33 devices Routers: 19 Battery powered: 14

Rihan9 avatar Sep 24 '24 07:09 Rihan9

Maybe my network dimension is the problem? I have multiple devices, but is not "gigantic" Total: 33 devices Routers: 19 Battery powered: 14

Nope. I am at 200 devices and we have users well above that as well.

dmulcahey avatar Sep 24 '24 10:09 dmulcahey

Forget it, is not an home assistant zha problem.

For reference in the future to all user with similar problem: use a software to check your home assistant current cpu usage. My problem was a custom integration that use all the available cpu, preventing home assistant to run stable. This issues caused not only this issue but also automation to be cut in half during their execution, and more.

I'm closing this issue. Thanks @dmulcahey and @puddly for your patience.

Rihan9 avatar Sep 26 '24 07:09 Rihan9