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.28k stars 30.6k forks source link

Zigbee Home Automation integration not working (Sonoff Zigbee 3.0 USB Dongle Plus) #94503

Closed shivamdixit closed 1 year ago

shivamdixit commented 1 year ago

The problem

When setting up Sonoff Zigbee 3.0 USB Dongle Plus through HA, I see following exception message:

2023-06-12 23:43:03.572 ERROR (MainThread) [zigpy_znp.zigbee.application] Watchdog check failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 1017, in request
    response = await response_future
               ^^^^^^^^^^^^^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 671, in _watchdog_loop
    await self._znp.request(c.SYS.Ping.Req())
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 1013, in request
    async with async_timeout.timeout(
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
TimeoutError
2023-06-12 23:43:04.601 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/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 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 267, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/config_flow.py", line 376, in async_step_form_new_network
    await self._radio_mgr.async_form_network()
  File "/usr/src/homeassistant/homeassistant/components/zha/radio_manager.py", line 224, in async_form_network
    await app.form_network()
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 386, in form_network
    await self.backups.restore_backup(
  File "/usr/local/lib/python3.11/site-packages/zigpy/backups.py", line 157, in restore_backup
    await self.create_backup()
  File "/usr/local/lib/python3.11/site-packages/zigpy/backups.py", line 123, in create_backup
    await self.app.load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 160, in load_network_info
    await self._znp.load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 228, in load_network_info
    await self._load_network_info(load_devices=load_devices)
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 104, in _load_network_info
    nib = await self.nvram.osal_read(OsalNvIds.NIB, item_type=t.NIB)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/nvram.py", line 168, in osal_read
    length = (await self.znp.request(c.SYS.OSALNVLength.Req(Id=nv_id))).ItemLen
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 1010, in request
    self._uart.send(frame)
    ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'send'

I tried restarting my raspberry pi and Home Assistant container, but that didn't help. I also tried disconnecting and re-connecting the dongle, but that didn't help either. The dongle is correctly identified by HA and only when I click configure, then it fails.

What version of Home Assistant Core has the issue?

core-2023.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

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?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @dmulcahey, @adminiuga, @puddly, 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.

(message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

puddly commented 1 year ago

According to the log, your stick is unresponsive. Please enable ZHA debug logging (https://www.home-assistant.io/integrations/zha/#debug-logging) and post a log.

lexcao1729 commented 1 year ago

Seems we have the same problem.

yaz65 commented 1 year ago

Hello, same issue for me I think: when trying to add the Sonoff zigbee dongle plus, it is detected but configuration fails. I tried to restart HA, restart the Raspberry, flash the dongle... Nothing worked.

melibokus-h2 commented 1 year ago

Probably related issue with my intallation. The dongle worked flawlesely til roughly one week ago. It now does not start anymore. Also reloading a nackup configuration does not work.

Logger: homeassistant.config_entries Source: components/zha/core/gateway.py:205 First occurred: 20:13:02 (7 occurrences) Last logged: 21:02:53

Error setting up entry Sonoff Zigbee 3.0 USB Dongle Plus - Sonoff Zigbee 3.0 USB Dongle Plus for zha Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 228, in load_network_info await self._load_network_info(load_devices=load_devices) File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 112, in _load_network_info and await self.nvram.osal_read( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy_znp/nvram.py", line 171, in osal_read raise KeyError(f"NV item does not exist: {nv_id!r}") KeyError: 'NV item does not exist: <OsalNvIds.BDBNODEISONANETWORK: 85>'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 116, in initialize await self.load_network_info(load_devices=False) File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 168, in load_network_info await self._znp.load_network_info(load_devices=load_devices) File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 230, in load_network_info raise NetworkNotFormed() from e zigpy.exceptions.NetworkNotFormed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 390, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 122, in async_setup_entry await zha_gateway.async_initialize() File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 220, in async_initialize raise exc File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 205, in async_initialize self.application_controller = await app_controller_cls.new( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 219, in new await app.startup(auto_form=auto_form) File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 194, in startup await self.initialize(auto_form=auto_form) File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 129, in initialize await self.backups.restore_backup(last_backup) File "/usr/local/lib/python3.11/site-packages/zigpy/backups.py", line 151, in restore_backup await self.app.write_network_info( File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 195, in write_network_info await self._znp.write_network_info( File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 348, in write_network_info await self.reset_network_info() File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 329, in reset_network_info await self.nvram.osal_write( File "/usr/local/lib/python3.11/site-packages/zigpy_znp/nvram.py", line 139, in osal_write await self.znp.request( File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 1026, in request raise InvalidCommandResponse( zigpy_znp.exceptions.InvalidCommandResponse: Expected SRSP response SYS.OSALNVWriteExt.Rsp(Status=<Status.SUCCESS: 0>), got SYS.OSALNVWriteExt.Rsp(Status=<Status.NV_OPER_FAILED: 10>)

#

87Vortex87 commented 1 year ago

Hi everbody,

I seem to have the same problem: Dongle: TI CC2531 USB CDC

Message:

`Logger: homeassistant.config_entries Source: components/zha/core/gateway.py:205 First occurred: 15:33:54 (1 occurrences) Last logged: 15:33:54

Error setting up entry TI CC2531 USB CDC, s/n: __0X00124B001CD4A271 - Texas Instruments for zha Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 684, in _skip_bootloader result = await responses.get() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/queues.py", line 158, in get await getter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 388, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 138, in async_setup_entry await zha_gateway.async_initialize() File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 220, in async_initialize raise exc File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 205, in async_initialize self.application_controller = await app_controller_cls.new( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 219, in new await app.startup(auto_form=auto_form) File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 193, in startup await self.connect() File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 115, in connect await znp.connect() File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 726, in connect self.capabilities = (await self._skip_bootloader()).Capabilities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 683, in _skip_bootloader async with async_timeout.timeout(CONNECT_PROBE_TIMEOUT): File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 129, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 212, in _do_exit raise asyncio.TimeoutError TimeoutError ` Could it be related to this error message:

`Logger: zigpy.application Source: /usr/local/lib/python3.11/site-packages/zigpy/application.py:196 First occurred: 15:32:56 (3 occurrences) Last logged: 15:33:49

Couldn't start application Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 684, in _skip_bootloader result = await responses.get() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/queues.py", line 158, in get await getter asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 193, in startup await self.connect() File "/usr/local/lib/python3.11/site-packages/zigpy_znp/zigbee/application.py", line 115, in connect await znp.connect() File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 726, in connect self.capabilities = (await self._skip_bootloader()).Capabilities ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/zigpy_znp/api.py", line 683, in _skip_bootloader async with async_timeout.timeout(CONNECT_PROBE_TIMEOUT): File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 129, in aexit self._do_exit(exc_type) File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 212, in _do_exit raise asyncio.TimeoutError TimeoutError `

puddly commented 1 year ago

Closing because the original author has not responded in two months, this issue is stale.

@87Vortex87 the CC2531 is known to lock up. Unplug it and plug it back in, it should start working after that. I would suggest migrating to a more stable coordinator in the near future if you want to avoid issues like this, as the CC2531's firmware is no longer being developed and will not receive future bugfixes.

acidpizza commented 1 year ago

i had this exact problem as well. However, after clicking "Configure" again on ZHA and setting it to use the existing network settings, everything was okay.

brandons209 commented 1 year ago

i had this exact problem as well. However, after clicking "Configure" again on ZHA and setting it to use the existing network settings, everything was okay.

Same here, had to keep doing that and I got it configured.