Zigbee suddenly stopped working: Failed setup. Will retry

Running 24.4.4 on Ubuntu (as a snap).

Everything has been working for several months. Suddenly, and without any manual update or configuration change, HA is not connecting to the Sonoff zigbee dongle.

The dongle is connected and visible with lsusb:

Bus 003 Device 008: ID 1a86:55d4 QinHeng Electronics SONOFF Zigbee 3.0 USB Dongle Plus V2

I’ve done the usual reset/restart, rebooted the Ubuntu PC, checked the connections etc.

The mouse-over error was initially saying something about the Sonoff device but there was no way to copy that message and I couldn’t see it in the log. It now just says ‘Failed setup. Will retry.’

Log entry:

> Logger: homeassistant
> Source: /snap/home-assistant-snap/600/lib/python3.12/site-packages/homeassistant/runner.py:146
> First occurred: 11:29:20 (105 occurrences)
> Last logged: 12:53:30
> Error doing job: Exception in callback SerialTransport._read_ready()
> 
> ValueError: (11, None) is not a valid NcpResetCode
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/lib/python3.12/asyncio/events.py", line 88, in _run
>     self._context.run(self._callback, *self._args)
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/serial_asyncio_fast/__init__.py", line 137, in _read_ready
>     self._protocol.data_received(data)
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/uart.py", line 84, in data_received
>     self.frame_received(frame)
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/uart.py", line 119, in frame_received
>     self.rstack_frame_received(data)
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/uart.py", line 160, in rstack_frame_received
>     code, version = self._get_error_code(data)
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/uart.py", line 193, in _get_error_code
>     return t.NcpResetCode(data[2]), data[1]
>            ^^^^^^^^^^^^^^^^^^^^^^^
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/types/basic.py", line 216, in __call__
>     return super().__call__(value, names, *args, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3.12/enum.py", line 757, in __call__
>     return cls.__new__(cls, value)
>            ^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3.12/enum.py", line 1179, in __new__
>     raise exc
>   File "/usr/lib/python3.12/enum.py", line 1156, in __new__
>     result = cls._missing_(value)
>              ^^^^^^^^^^^^^^^^^^^^
>   File "/snap/home-assistant-snap/600/lib/python3.12/site-packages/bellows/types/basic.py", line 225, in _missing_
>     new = int_type.__new__(cls, value)
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> TypeError: int() argument must be a string, a bytes-like object or a real number, not 'tuple'

I know snap isn’t officially supported but when I first installed HA on Ubuntu that’s the only method I could find that didn’t involve a lot of extra work, so I’m sticking with that for now. At some point I’ll move to a RPi.

1 Like

How is your dongle configured ? /dev/serial/by-id/… ?

I’m trying to figure that out. The configuration is only showing me ‘Shortcuts’ and ‘Network Settings’. Previously it gave me the option to select the USB device but it’s not doing that anymore.

When it did show the USB options, everything was listed as /dev/tty*.

Looks like some of the errors in the log might be due to an issue with the latest python release. E.g. Python 3.12.3 breaks ZHA dependency · Issue #115459 · home-assistant/core · GitHub

But there’s also a mention of HA trying to connect to the wrong USB device. Problem is, I can’t work out how to get to the USB config page.

Update: OK, seems the only way to check the configuration is to use ‘Migrate Radio’. After a couple of attempts, it gives you the option to specify the path to the USB device. It has /dev/ttyACM0 as the default but that doesn’t exist so I replaced it with the path I found from lsusb. I’m guessing it’s a TI device. I left the baud rate and handshake method at the defaults. It just says ‘failed to connect’.

Lots more python errors in the log.

Any ideas what to do now? I’m assuming I should use an older version of python.

A simple downgrade fixed the problem. All I needed to do was:

sudo snap switch home-assistant-snap --channel=2024.1/stable
sudo snap refresh home-assistant-snap

Now Zigbee is working again.