Replacing ZHA gateway device

I have home assistant running with sonoff bridge (tasmoted and everything). It works fairly stable but sometimes some (and always the same) devices seem to drop off my zigbee network. When I restart ZHA and my sonoff zigbee bridge, everything comes back fully online.

Now, I have decided to replace sonoff bridge with sonoff zigbee usb dongle 3.0.

My question is how do I migrate to new gateway. Once ZHA is running I do not see how can I access and replace existing sonoff bridge with sonoff usb dongle. Is there a way to just replace it or do I have to delete ZHA and install it from zero?

I hoped that I can only replace my device and that everything will continue working? (meaning, my current configuration will simply be reloaded to my new gateway and everything will continue working as it is)

In theory it should be possible, whole point of ZHA is that whole ID-ing and connecting to zigbee network is software based, so replacing gateway should be possible?

Unfortunately, I do not see how (or where) do I redefine and replace existing gateway with new one.

1 Like

This is basically exactly what I am trying to do. Unfortunately, seems that because od different versions of underlying sw, it does not work correctly.

I can make backup of my existing bridge, but restore seems to fail (completely).

It worked for me moving from a Nortek stick to Sonoff, but it wouldn’t be the first time a tutorial had a short shelf life.

ah, it appears that the underlying reason is that while installing backup/restore tools, they need to access/use GCC which is not avaliable in home assistant docker environment

apparently, backup part of the tool works ok (or at least I think it works, in my case it creates simple 1800 bytes json file), but restore part does not work at all since it was not compiled in the first place

Hi, I tried the migration route described in the link below but failed and gave up after an hour or two of trying. I therefore decided to bite the bullet and just repair everything manually, I have 28 devices so it did not take that long.

The method I used is sumarised below:

  • Make sure that your new Sonoff Zigbee USB Dongle’s firmware is up to date (I used the method in the link below).
  • Grab a list of your ZHA entity names (e.g. snip the entities list) as you will need this later.
  • Remove the ZHA Integration.
  • Disconnect your old radio and connect the Sonoff Zigbee USB Dongle.
  • If it is not auto-discovered then re-add the ZHA Integration (it should find the new radio straight away).
  • Manually re-pair each Zigbee device.
  • Manually correct the entitiy names to match the originals, this ensures that your dashboards, automations, scripts etc. will work normally.

Hopefully that is useful.

1 Like

After two days of trial and error I have finally managed to “move” my configuration from zbbridge to sonoff zigbee usb stick.

Now, everything appears to be ok (zigbee works), but my light groups are unresponsive (it tells me that my group is disabled by device, but I do not see where can I enable my group again)

so, just to finishi it off, it appears that groups in ZHA do not work anymore (they should, since ZHA groups are on zigbee level and when using them, for example, all of the lights turn off or on exactly at the same time, with ha groups, they do turn on or off in their own and noticable rythm which is not allways the same).

when I replaced by sonoff zbbridge with my new stick, all groups stopped working and I could not find the place where they were disabled, so I moved to HA groups and re-configured everything for using new groups

as for how I did it in the end:

  • I started using instruction from first video in this thread, I have managed to make backup of my zbbridge with original instructions, sadly - restore to my new sonoff 3.0 usb zigbee stick did not work at all (many errors)

  • I had a lot of trouble figuring out why I can not properly install (newer version) of zigbee tools, but it all boiled down to not having GCC in docker install of my HA (which is NUC running debian, running ha in docker environment); in the end I have moved to debian itself (not the docker), created virtualenv there and followed the script, it worked :slight_smile:

  • so, I moved into comments of the following link Zigbee Network Migration · GitHub, now, what happens is that when you replace your zigbee gateway/coordinator it appears that HA/ZHA automatically disables all zigbee devices and you need to manually reconfigure and enable all of the devices. you ned to enable them in core.device_registry (in my case this is a file of about 4000 lines), and then in core.entity_registry which is about 40.000 lines in my case (although in this file I could not find single disabled entity)

  • I am not sure why this apparently automatic disabling happened, or why is it not possible to re-enable this devices from HA UI, but this is what happened

In conclusion: it worked (sort of), I have spent a lot of time on making it happen (about 6-7 hours in total) with, let’s say, power user level of expertise. I expect that this scenarion (changing/upgrading coordinator) will happen more often and that likely someone will make this waaay more automated and easier for end-user than it is now. But the point remains, it is possible to do today.