Sonoff Dongle P with Zigbee2mqtt can't be replaced

My Goal is to have a Second spare Zigbee Dongle, ready to take over with a second spare RPi with HAOS, in Case of a Failure.
I used to do this with my old Conbee II Stick running Deconz without Problems, but i can’t get it to work with Sonoff Zigbee Dongle Plus (P) and Zigbee2MQTT.

I found out i even can’t just swap the Stick in my productive System and control my Network.
After waiting a couple of Minutes before im plugging in the new Stick, but none of my Devices is controllable with it.
I think the relevant Part in the Z2M Logs is:
(Data request failed with error: ‘No network route’ (205)))
As soon as i plug the old one in, everything is (almost instantly) back to normal.

  • The Coordinators IEEE-Adress of the new Stick is set to the one of the first Stick
  • Both are on the same Firmware as well

On my old Conbee II/Deconz System, i just had to make sure they are not running at the same Time, and sometimes had to wait a couple of Minutes til all Devices were controllable again with the new Stick.

What could i be looking after, did i miss an important Step?

So do you have two identical Sonoff sticks or one Sonoff and one Conbee 2?

Ah sorry, the most important not clearly said :crazy_face:
Yes, two Sonoff Zigbee Dongle Plus (P) with the same Firmware and IEEE Adress (Checked via Z2M → About)

Sorry, then I don’t know. When I migrated from one stick to another I did not have to change the IEEE address.

Zigbee2MQTT is supposed to perform automatic backups if using a zstack adapter (Texas Instruments based adapters), so probably better to just to rely on the native Zigbee2MQTT Zigbee network backup and restore feature built-into Z2M, and then only backup the data stored in the data directly if also want offline backups-> https://www.zigbee2mqtt.io/guide/faq/#how-do-i-move-my-zigbee2mqtt-instance-to-a-different-environment

Regardless, best post Zigbee2MQTT querstions to → Koenkk/zigbee2mqtt · Discussions · GitHub but FYI, copying IEEE address in in Z2M FAQ:

https://www.zigbee2mqtt.io/guide/faq/#how-do-i-migrate-from-one-adapter-to-another

https://www.zigbee2mqtt.io/guide/adapters/flashing/copy_ieeaddr.html

Another unofficial alternative would be to use zigpy-cli to backup one and restore to the other as that automatically copies the whole network and the IEEE address, read this discussion:

FYI, zigpy-cli and Zigbee2MQTT gateway backups are not compatible even though both use “Open ZigBee Coordinator Backup Format”, that is because the Zigbee network backup is only a high-level and stack-agnostic backup of your device’s network data (written in the Open Coordinator Backup Format) but it at least allows you to snapshot the device state and move your network between any hardware and firmware versions supported by zigpy-cli. This backup format is human-readable and fully documented so users have to option to manually fill out or change the appropriate information by hand to form a network if they are migrating from a Zigbee Coordinator that is not currently supported.

1 Like

Thank you so much for Answer and takin your Time, appreciate it!

Since, when i used Conbee II this was effortless possible (basically just boot the Backup-Device up and wait a Minute), i was (and am still) hoping there is a Way without restoring Z2M Backups etc…

I read the linked z2m Documentation (this is where i e.g. followed the guide for copying IEEE Adress), but they are mainly about Migration which is not really my Case.

Wondering if i am the only overcautious? :smiley: Whenever the Main HA was down, i was so glad i could just restore Functionality without any Hassle, and then take my Time to get the Main back up.

Anyway, thanks again for your Input!

Just do regular backups to the data folder to offline media, NAS, and/or a cloud drive and that should be good enough IMHO. Again, the data folder should contain a backup file which has all the Zigbee network information needed to fully restore to any new adapter.

Note! Zigbee2MQTT currently only support backing up Texas Instruments based adapters, not Silicon Labs or ConBee/RaspBee based adapters.

Maybe you can help with some confusion I have…
In the use case here, having a “replacement” Sonoff -P stick to use in case the “operational” -P stick dies,
there is a statement in the migration docs: “Migration from one adapter to another requires backup and restore support which is so far only implemented for the Zstack adapter (Texas Instruments adapters).”
(I also read the thread you referenced on using zigpy-cli so thanks for that)

There seems to be two types of backup/restore:

  1. Backup/Restore of the “data folder” which also contains a coordinator_backup.json file
  2. Backup/Restore of the data residing in the coordinator.

For #1, I understand what you’re saying about regular backups of the data folder.

For #2, I can not find anything on how this type of backup/restore is suppose to happen using Z2M. The rest of the directions in the doc for migrating a TI to TI Adapter do not have any steps for backup/restore.

I see in my directory that there is already a coordinator_backup.json file available. Its date-time stamp doesn’t seem to correlate to when Z2M started up, so I presume Z2M automatically creates/refreshes this from time to time. Also, playing around with UI->Settings->Tools->Request z2m backup I see that the coordinator_json.backup gets refreshed when that button is clicked. This seems to take care of the “backup” of the coordinator_json.backup file.

So I’m left scratching my head as to how the “replacement” -P zstick gets restored when it is plugged in for the first time. I guess the restore gets done automatically by z2m on startup?

You guess is correct, Zigbee2MQTT does an automatic restore if it detects that there is an compatible unconfigured Zigbee Coordinator (i.e. an adapter that does not have a Zigbee network on it). Again, only for Texas Instruments based adapters.

You of course also need to change the serial port device address in Zigbee2MQTT configuration file. Example from:

serial:
  port: /dev/ttyUSB0
  adapter: zstack
  baudrate: 115200

to

serial:
  port: /dev/ttyUSB1
  adapter: zstack
  baudrate: 115200

PS: The code for adapter backup and restore is in the zigbee-herdsman library that Z2M depends on:

FYI, it should now also be easy to migrate (using backup and restore process/metod) as well as reset adapters via TubeZB’s zigpy-cli tools add-on if using Z2M with Home Assistant:

Note! If plan on migrating to a new adapter then best practice is to upgrade firmware on new adapter before migrating.

You of course also need to chang the serial port (as well as the baud rate speed and adapter type if needed) in Zigbee2MQTT configuration file so that it matches the new adapter.

PS: Off-topic; Tip is to use respective CC2652 Flasher or Silabs Flasher from TubesZB add-ons or ZigStar add-ons for upgrading adapter firmware if migrating to a Texas Instruments or Silicon Labs adapter.

But there must be something else missing, hence are all my Devices getting marked as ‘offline’, if i

  • Stop Z2M
  • Unplug Old Stick
  • Plug In New Stick
  • Change (Confirm) Port
  • Start Z2M

That should be all you need to do, though must also wait a while since it can take several hours for some devices to re-join (if each device is not forced to restart by you manually power-cycling them).

If that does not work then best have to open a new discussion or issue in the official Zigbee2MQTT repository on GitHub (with debug logs) as the Z2M gateway application is a third-party project that is not part of Home Assistant → https://github.com/Koenkk/zigbee2mqtt

PS: By the way, did not mention it but this Zigbee section in Home Assistant forum is really just meant the native ZHA integration that is built-in as well as Zigbee products that can be used with the ZHA integration, as such it is ok to dicuss generic Zigbee things but other stuff that are only specific to Zigbee2MQTT or other Zigbee gateways/hubs/bridges/controllers, etc. needs to be addressed via their own respective support channels/communities.

1 Like

OK…maybe one final question… I have read where other users have migrated their adapters successfully without changing the “replacement” adapter’s IEEE Address to that of the original adapter’s IEEE Address. Do you know if the “restore” process takes the IEEE coordinator address from the coordinator_backup.json and updates the “replacement” adapter’s IEEE Address anyway and this is why those users did not have to change the address?

Yes that is indirectly covered in the FAQ for Zigbee2MQTT if you read them. In summery; if you change IEEE to same address then you do not need to re-pair all devices, but if you do not change the IEEE to the same address then you need to re-pair all your devices, see → https://www.zigbee2mqtt.io/guide/faq/

Again, please understand and respect that all that is Zigbee2MQTT specific and does not have anything directly to do Home Assistant or ZHA. So suggest post any further questions only related to Zigbee2MQTT to their community discussion section at https://github.com/zigpy/zigpy/discussions/ (while Z2M bug reports should be posted as issues to https://github.com/Koenkk/zigbee2mqtt/issues)

1 Like

I was able to get this working…I did a write up here.

2 Likes

Your Documentation is awesome, thank you so much @wmaker ! :sunglasses: :100: :+1:
I will check it out as soon as possible :slight_smile:

@Hedda : Thankin you as well for detailled sharing your knowledge!
And Thanks for letting me know about the Zigbee Category beeing ZHA only, i really didn’t know/read it. Third party integrations - Home Assistant Community is most probably the better fitting Category… Or, of course, the dedicated Github Page :slight_smile:
Thanks for kindly letting me know, helping and sharing your knowledge anyway!

1 Like