Is this a hardware issue?

Last night my home assistant OS crashed, and when I restarted it this morning, the ZHA integration says that ZHA failed to setup. I tried rebooting, the device, restarting HA, unplugging and re-plugging the coordinator again, etc. The logs tell me a couple of things, but the most relevant seems to be the below.
I am running an RPi4B with SSD, the coordinator is Sonoff Zigbee 3.0 Dongle plus, running updated firmware from Z2M. It ran fine for about a month until the problems this morning.

Is the dongle a problem? Firmware?

If so, is there a way to save my table of devices and switch back to the HUSBZB-1 that is currently just running Z-wave?

Logger: homeassistant.components.zha.core.gateway
Source: components/zha/core/gateway.py:152
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 10:23:43 AM (12 occurrences)
Last logged: 10:35:13 AM

Couldn't start ZNP = Texas Instruments Z-Stack ZNP protocol: CC253x, CC26x2, CC13x2 coordinator
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 322, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_0eccdc73c793eb11b26c1b4f3d98b6d1-if00-port0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/gateway.py", line 152, in async_initialize
    self.application_controller = await app_controller_cls.new(
  File "/usr/local/lib/python3.9/site-packages/zigpy/application.py", line 69, in new
    await app.startup(auto_form)
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/zigbee/application.py", line 196, in startup
    return await self._startup(
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/zigbee/application.py", line 209, in _startup
    await znp.connect()
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/api.py", line 81, in connect
    self._uart = await uart.connect(self._config[conf.CONF_DEVICE], self)
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/uart.py", line 158, in connect
    transport, protocol = await serial_asyncio.create_serial_connection(
  File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 445, in create_serial_connection
    serial_instance = serial.serial_for_url(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/serial/__init__.py", line 90, in serial_for_url
    instance.open()
  File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_0eccdc73c793eb11b26c1b4f3d98b6d1-if00-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_0eccdc73c793eb11b26c1b4f3d98b6d1-if00-port0'

Did you try to unplug and replug your stick ?

Yeah, in different ways. While HA is running, while it is not running, etc.

does another machine recognize the stick when you plug it in? Do you have other USB devices on you r HA install? (ZWave stick perhaps?) Do they still work?

1 Like

The stick is recognized by this machine, in fact. It also recognizes the z-wave stick, which functions fine.

There is another error in the log that suggests it is a Python problem:

Logger: zigpy.application
Source: /usr/local/lib/python3.9/site-packages/zigpy/application.py:73
First occurred: 1:24:21 PM (4 occurrences)
Last logged: 1:25:43 PM

Couldn't start application
1 Like

It’s almost certainly pointing at this line or something that barfed because of this line in your original post above:

  File "/usr/local/lib/python3.9/site-packages/serial/serialposix.py", line 325, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_0eccdc73c793eb11b26c1b4f3d98b6d1-if00-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_0eccdc73c793eb11b26c1b4f3d98b6d1-if00-port0'

Python can’t reach your usb stick for whatever reason - which is what it would report to zigpy when it tried to open the stick. I also believe the error message would be different if it could open the port but then not read the data… I think you’re at the point of determining busted hardware (with relative assuredness it’s not the stick itself) or a busted ZHA install. Cable? Hub? Interference? Eliminate as many pieces as you can - One last quick check before going to software or backup/restore maybe physically swap ports between the Sonoff with the one for the Zstick to see if one of the ports said YOLO? (We know the entire comm chain between HA and the ZStick works on the other port - by swapping you’re determining if its hardware or config… ESPECIALLY if the ZStick suddenly appears to die…)

Swapped ports and rebooted, but the same problem. Swapped cables for the two devices, and the same problem. The network was working for a month without problems. The only thing I changed yesterday was that I removed a device. Also, I tried uninstalling ZHA and reinstalling it. But it had troubles doing that with the Sonoff stick. When I restored my backup config, it was a couple days old, and still had troubles. So, I doubt that it is the ZHA installation.

I can’t see anything else but the stick. Maybe whatever caused HA to crash during the night, borked the stick? Is it worth trying to reinstall the firmware?

I guess it is time to give up on the sonoff stick and move back to the HUSBZB-1. But this is driving me crazy. The sonoff stick was restored from the HUSBZB stick just a month, ago, so they have nearly the same configuration. But for the life of me cannot figure out how to get the HA to just switch over to the old stick. I edited /config/.storage/core.config_entries to correspond to the old HUSBZB stick (name, address, baudrate). But when I restart HA, it just overwrites this file with the old configuration. What am I missing?