ZHA Integration suddenly lost connection to all zigbee devices

I Recently did a system restore to an earlier backup, and after that my zha integration has been unavailable. And I don’t want to setup all my devices again. Anyone experienced this?

image

posting this error in the log:

Logger: homeassistant.config_entries
Source: components/zha/core/gateway.py:152
First occurred: 8:30:57 AM (1 occurrences)
Last logged: 8:30:57 AM

Error setting up entry Sonoff Zigbee 3.0 USB Dongle Plus, s/n: 2ac21323251aec1197dc74e5f01c6278 - ITead for zha
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 313, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/zha/__init__.py", line 102, in async_setup_entry
    await zha_gateway.async_initialize()
  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 175, in startup
    return await self._startup(
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/zigbee/application.py", line 188, in _startup
    await znp.connect()
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/api.py", line 554, in connect
    await self.nvram.determine_alignment()
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/nvram.py", line 35, in determine_alignment
    value = await self.osal_read(nvids.OsalNvIds.NWKKEY, item_type=t.Bytes)
  File "/usr/local/lib/python3.9/site-packages/zigpy_znp/nvram.py", line 173, in osal_read
    raise KeyError(f"NV item does not exist: {nv_id!r}")
KeyError: 'NV item does not exist: <OsalNvIds.NWKKEY: 130>'

I’ve tried restarting home assistant to no avail.
Also the discovery function in home assistant strangely enough finds the usb dongle, although i already have an integration using it…

image

Any help would be much appreciated!

Maybe the dongle got new serial port device path so check that ZHA config points to to the correct port.

At least error message seems to indicate that the ZHA is failing to find the actual Zigbee Coordinator.

PS: If you are using serial port instead of unique ID then it can happen that it gets a other port assigned.

I ran into the same problem since last week. Before going into complete reinstall, nvram clear, firmware flashing, I would like to check this option as it seems simple.
@Hedda, can you point a direction where to set the serial port and maybe better where and how to change to using unique ID instead?

From the log I get this:
Connected to /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_02a111111cc9eb11a32e8f4f1d69213e-if00-port0 at 115200 baud

`File “/usr/local/lib/python3.12/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.NIB: 33>’

That’s the ID.

Ok, thanks. So that means I’m already using the ID instead of a serial port?

Correct. /serial/by-id/ is the preferred way, which you are already using. Seems your system sees your device too, so I don’t think that the error lies there.

When clicking on Configure from the device discovery popup. It is asking me which serial port to use. So I have to choose a serial port.

Select a Serial Port

Select the serial port for your Zigbee radio

Serial Device Path

  • /dev/ttyUSB1 - Sonoff Zigbee 3.0 USB Dongle Plus, s/n: 02a111111cc9eb11a32e8f4f1d69213e - ITead

  • /dev/ttyUSB0 - FT232R USB UART - FT232R USB UART, s/n: AB8FZI9Q - FTDI

  • Enter Manually

after choosing the first:
It does not matter choosing for restore or create a Network…
Just getting this:
Restore:
image

Create Network:
image

Only solution is to flash the firmware in order clean the ‘faulty’ nvram.
I used the python method. A very clear video with step by step path is this one.(worked for me);

1 Like