home-assistant / connectzbt1.home-assistant.io

https://connectzbt1.home-assistant.io
Apache License 2.0
22 stars 10 forks source link

SkyConnect locks up sometimes after adding new devices via ZHA #46

Closed kylepyke closed 1 year ago

kylepyke commented 1 year ago

SkyConnect requires a hard reset (unplugging the dongle, and replugging) after adding some devices. This has happened with devices from various manufactureres including Sonoff, Sengled and Innr. This is an intermittent issue, so it doesn't occur everytime a new device is added.

Reloading the ZHA integration fails, and the logs show the following error:

Logger: homeassistant.config_entries
Source: components/zha/core/gateway.py:205
First occurred: 6:00:20 PM (1 occurrences)
Last logged: 6:00:20 PM

Error setting up entry SkyConnect v1.0 for zha
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, 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.10/site-packages/zigpy/application.py", line 191, in new
    await app.startup(auto_form=auto_form)
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 165, in startup
    await self.connect()
  File "/usr/local/lib/python3.10/site-packages/bellows/zigbee/application.py", line 125, in connect
    self._ezsp = await bellows.ezsp.EZSP.initialize(self.config)
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 106, in initialize
    await ezsp._startup_reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 97, in _startup_reset
    await self.reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 126, in reset
    await self._gw.reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/uart.py", line 260, in reset
    return await asyncio.wait_for(self._reset_future, timeout=RESET_TIMEOUT)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
puddly commented 1 year ago

Please upload the diagnostics information for the ZHA integration and include how you are running Home Assistant OS (hardware, etc.).

kylepyke commented 1 year ago

Home Assistant is running the latest version of HAos (2023.4.2) on a generic Intel install. The error posted above appears to be the last in a series of warnings and errors posted from earliest to latest here:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:836
Integration: Sensor (documentation, issues)
First occurred: 5:50:59 PM (1 occurrences)
Last logged: 5:50:59 PM

Updating zha sensor took longer than the scheduled update interval 0:00:30

Then:

Logger: homeassistant
Source: components/zha/core/channels/base.py:464
First occurred: 5:51:25 PM (1 occurrences)
Last logged: 5:51:25 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/light.py", line 960, in _refresh
    await self.async_get_state()
  File "/usr/src/homeassistant/homeassistant/components/zha/light.py", line 895, in async_get_state
    results = await self._color_channel.get_attributes(
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/base.py", line 464, in _get_attributes
    read, _ = await self.cluster.read_attributes(
  File "/usr/local/lib/python3.10/site-packages/zigpy/zcl/__init__.py", line 473, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
  File "/usr/local/lib/python3.10/site-packages/zigpy/zcl/__init__.py", line 326, in request
    return await self._endpoint.request(
  File "/usr/local/lib/python3.10/site-packages/zigpy/endpoint.py", line 237, in request
    return await self.device.request(
  File "/usr/local/lib/python3.10/site-packages/zigpy/device.py", line 294, in request
    await self._application.request(
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 734, in request
    await self.send_packet(
  File "/usr/local/lib/python3.10/site-packages/bellows/zigbee/application.py", line 746, in send_packet
    await self._ezsp.setExtendedTimeout(device.ieee, True)
AttributeError: 'NoneType' object has no attribute 'setExtendedTimeout'

Then:

Logger: homeassistant.components.zha.core.channels.base
Source: components/zha/core/channels/base.py:490
Integration: Zigbee Home Automation (documentation, issues)
First occurred: April 10, 2023 at 2:32:50 PM (59 occurrences)
Last logged: 5:51:25 PM

[0x4D62:1:0x0008]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'setExtendedTimeout'
[0x4D62:1:0x0300]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'setExtendedTimeout'
[0x4D62:1:0x0702]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'setExtendedTimeout'
[0x5C6A:1:0x0006]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
[0x5C6A:1:0x0300]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'

Then:

Logger: homeassistant.components.zha.core.gateway
Source: components/zha/core/gateway.py:205
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 6:00:04 PM (3 occurrences)
Last logged: 6:00:20 PM

Couldn't start EZSP = Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis coordinator (attempt 1 of 3)
Couldn't start EZSP = Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis coordinator (attempt 2 of 3)
Couldn't start EZSP = Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis coordinator (attempt 3 of 3)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  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.10/site-packages/zigpy/application.py", line 191, in new
    await app.startup(auto_form=auto_form)
  File "/usr/local/lib/python3.10/site-packages/zigpy/application.py", line 165, in startup
    await self.connect()
  File "/usr/local/lib/python3.10/site-packages/bellows/zigbee/application.py", line 125, in connect
    self._ezsp = await bellows.ezsp.EZSP.initialize(self.config)
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 106, in initialize
    await ezsp._startup_reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 97, in _startup_reset
    await self.reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/ezsp/__init__.py", line 126, in reset
    await self._gw.reset()
  File "/usr/local/lib/python3.10/site-packages/bellows/uart.py", line 260, in reset
    return await asyncio.wait_for(self._reset_future, timeout=RESET_TIMEOUT)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

Followed by the error above, in the original post. How would I go about finding the diagnostics info for the ZHA integration?

puddly commented 1 year ago

Is a VM running in a hypervisor, or bare metal? If in a hypervisor, which one? The more info, the better.

You can find diagnostics information here:

image
kylepyke commented 1 year ago

Bare metal. Intel i7, 16gb ram. SkyConnenct connected via USB3 with 6ft extension. Nothing else connected.

I don't have the diagnostics option above, because the integration failed to reload. If this happens again, I can grab the diagnostics then.

Screen Shot 2023-04-11 at 6 17 15 PM

In the meantime, here are the full ZHA logs:

https://www.dropbox.com/s/wu0o6zpucuv44e8/ZHA%20LOGS%20home-assistant_2023-04-11T23-17-55.749Z.log?dl=0

agners commented 1 year ago

@kylepyke have you been able to resolve your issue? Did you maybe use Multiprotocol when that happened?

kylepyke commented 1 year ago

Nope! It hasn't happened again since I posted this, and I wasn't using multi-protocol.

It happened several times while I was adding a bunch of Sonoff Zigbee relays, so I think it might be device related? I've since removed those devices since they're not UL/ETL listed.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.