ZHA or CC2531 crashing HA - how to upgrade/migrate Zigbee coordinator?

With the addition of a couple of zigbee lights, ZHA has started to crash on boot, and prevents HA from starting properly - a few minutes after it reaches the message that it is waiting for zha to start, the web interface become unresponsive. If I reload the page, it shows loading data and repeatedly fails to connect. At this point I have to SSH in and use ha host reboot to get HA starting again, but then the issue happens again. In the period before the crash, I managed to disable the ZHA integration and shutdown. I disconnected the CC2531, and started HA again and this enabled me to use the other functions aside from Zigbee.

I expect that the issue is the old TI CC2531 Zigbee USB dongle I am using. I am waiting a new CC2652 to arrive in the next week. When I get that I want to migrate from the CC2531 - however, I am not sure I can do this if ZHA crashes HA with the CC2531 plugged in.

Luckily I do have a backup file I took from ZHA a couple of days ago. Can I use this to do the migration without the CC2531 attached, or without ZHA integration running?

In case anyone is interested in the tail -f home-assistant.log up till when HA becomes unresponsive, you can see it on Pastebin. This is the last message in the logfile, and nothing else is logged after this, although SSH is responsive.

This looks promising: zigpy-znp/TOOLS.md at e6e2c42981c8a04303db6d28ef503a6b0778d667 · zigpy/zigpy-znp · GitHub

Here is what I have done so far:

  1. Connected CC2531 to my Mac
  2. Identified the device in /dev/ - in my case it is called /dev/tty.usbmodemXX where the XX changes each time I connect the CC2531
  3. Installed zigpy_znp (pip3 install zigpy_znp)

I could then use the zigpy_znp commands to get a network backup from the CC2531. According to the doc linked to above, I can then restore this to the CC2652 as it is in Open Coordinator Backup Format.

Backup and restore feature is now built into ZHA in latest Home Assistant, see https://www.home-assistant.io/integrations/zha/#zigbee-backup-and-restore-in-zha

Yes - my problem was that ZHA would crash when I had the CC2351 attached, so I couldn’t see a pathway to use ZHA to do the migration. Manually backing up and restoring was the solution for me in the end.

The backup/restore process linked to in the post above worked great!

After restoring the network backup to the new stick, I then deleted the existing ZHA integration in HA, connected the new zzh stick to HA, and added ZHA integration again. All my Zigbee devices were there, although I did need to rename them again, and update my dashboards, scenes and automations. All done now, and seeing a much smoother zigbee experience, and HA booting much faster!