ZHA integration to do nightly backup of both Zigbee Coordinator adapter/dongle/stick and Zigbee network/database?

FYI, many testers testing has confirmed that patches for the mentioned pull request work with ConBee:

https://github.com/zigpy/zigpy-cli/pull/2

Again, idea is backup and restore will work via “zigpy-cli” regardless of Zigbee Coordinator make/model.

Has there been any progress with zha coordinator backups?

I’m relatively new to ZIgbee and this would be a great feature to have.

Yes, there has at least been a lot of progress on the underlying zigpy libraries that ZHA uses as a dependency and all zigpy libraries are currently in the process of being updated to a new radio API for zigpy which will once fully merged among other things introduce a new network backup/restore utility in " zigpy-cli" for any zigpy radio library for Zigbee Coordinator adapters/dongles that implementing that for the new radio API.

The initial support will include a unified radio command line interface and using standard network backup format for the zigpy radio libraries that support Zigbee Coordinator adapters/dongles based on Silicon Labs, Texas Instruments, and deconz (ConBee/RaspBee) serial protocols, (leaving someone else having to volunteer to add backup/restore code for XBee and ZiGate radio libraries when the new zigpy radio API is in place).

I also believe that once patches are merged on the zigpy side some other volunteering developer(s) would still have to step-up and implement the use of that new network backup/restore utility in “zigpy-cli” in the ZHA integration (which is component part of Home Assistant core) and the Home Assistant frontend for the UI interface, (and the developers working on the zigpy part for this have in the past mostly worked on the core/backend parts and not the frontend UI/GUI parts).

To follow the status of the underlying zigpy development see patches and pull requests linked here:

https://github.com/zigpy/zigpy-cli/pull/2

and zigpy developers have discussed the concepts and ideas about unified backup CLI + format here:

https://github.com/zigpy/zigpy/issues/557

FYI, ZHA’s zigpy dependencies have now been updated with the mentioned new zigpy radio API that introduces a network backup/restore utility via “zigpy-cli ” (initially for zigpy-znp, bellows, and zigpy-deconz radio libraries) and those libraries has been bumped in Home Assistant core and thus the backend side needed to make this happen will be available is the upcoming Home Assistant 2022.7 release.

https://github.com/home-assistant/core/pull/73964 has the comment “This incorporates the new radio API for zigpy, which will allow for network parameter changes and backup/restore in a future patchset.

Again, I still think that some other volunteering developer(s) might have to step up and implement the use of that new network backup/restore utility in “zigpy-cli ” in the ZHA integration (which is component part of Home Assistant core) and the Home Assistant frontend for the UI interface, (as as again gooing on historical UI features the developers working on the zigpy parts for this have in the past mostly worked on the core/backend parts and not the frontend UI/GUI parts). Read → https://github.com/zigpy/zigpy-cli/pull/2

1 Like

Is it possible now to move from CC2531 to ConBee II or RaspBee ? I cant find informations about that.

Yes I believe that should be possible now, however not yet from Home Assistant, but using zigpy-cli command-line tool for backup and restore, again see discussions in ZHA libraries will soon support ConBee/RaspBee backup and restore that can be used for Zigbee network migrations and https://github.com/zigpy/zigpy-cli/pull/2 (as well as https://github.com/zigpy/open-coordinator-backup) so maybe post to zigpy-cli discussions if run into problems Discussions · zigpy/zigpy-cli · GitHub

Tip! If you have not yet purchased a replacement for that CC2530/CC2531 based adapter then keep in mind that TI CC2652 (CC2652P) or Silabs EFR32 (EFR32MG21) based adapters are generally recommended before ConBee/Raspbee for better performance when not using Dresden Elektronik’s official deCONZ/Phoscon Zigbee Gateway software for them. For CC2652 hardware links see → Supported Adapters | Zigbee2MQTT

It’s possible but annoying to make the backup from HA. In my config I have this:

shell_command:
  zigbee_backup: python -m zigpy_znp.tools.network_backup /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_9493876151c9eb11b7dxxxxxxxx-if00-port0 -o network_backup-"`date +"%Y-%m-%d"`".json ; cp zigbee.db zigbee-"`date +"%Y-%m-%d"`".db

Then you’ll need to:

  • disable the ZHA integration
  • run the zigbee_backup from developer tools
  • enable the ZHA integration
  • reboot to get your zigbee up and running.

I haven’t found a way to disable or enable the integration using a HA service.

You can backup znp using zha-toolkit - there is a blueprint for it - you have to install zha-toolkit of course which is easiest to do using HACS.

There are two blueprints for backups:

.
  name: Daily Coordinator Backup - Monthly rotation
  description: >-
    Backup Zigbee Coordinator Configuration (ZNP/ezsp(bellows)),
    monthly rotation
.
.
action:
  - service: zha_toolkit.execute
    data:
      command: backup

and the other:

.
  name: Daily ZNP Backup - Monthly rotation
  description: Backup ZNP Zigbee configuration, monthly rotation
.
.
action:
  - service: zha_toolkit.execute
    data:
      command: znp_backup

but in the docs the two commands are specified as either:

service: zha_toolkit.execute
data:
  command: ezsp_backup
  # Optional command_data, string added to the basename.
  # With this example the backup is written to `nwk_backup_20220105.json`
  command_data: _20220105

or:

service: zha_toolkit.znp_backup
data:
  # Optional command_data, string added to the basename.
  # With this example the backup is written to `nwk_backup_20220105.json`
  command_data: _20220105

Which of the four should it be?

FYI, zigpy and ZHA developer @puddly have now submitted initial patches for ZHA in Home Assistant core (backend) and frontend (GUI) for both automatic and manual Zigbee network backup + restore features/settings; “Implements the websocket API for listing, creating, and restoring ZHA network backups. This also adds a ZHA backup platform, which initiates network backup whenever a HA backup is created.” + “Add a new tab to the ZHA interface to show the current network settings to allow them to be backed up/restored.” See these pull requests for reference:

4 Likes

Good news at last, soon I will be able to move to my Sonoff dongle plus

no one has any answers?

Suggest asking in the dedicated thread for that Blueprint or its GitHub reposiroty instead as kind of off-topic from the original post here which really just a feature request for ZHA devs to add this and not a support thread for workarounds.

FYI, https://github.com/home-assistant/frontend/pull/13415 supersedes https://github.com/home-assistant/frontend/pull/13295 as the initial frontend UI part, and https://github.com/home-assistant/core/pull/77044 will adds network formation options to ZHA’s config flow, (that will give you several different options to let you “decide how to handle network information when setting up ZHA”):

https://www.home-assistant.io/blog/2022/09/07/release-20229/#zigbee-backup-and-restore–migration

Nice! :smiley:

2 Likes

Unfortunately that doesn’t keep your custom device and entity id naming and area relations:

Not if restoring/migrating from third-party Zigbee solutions like Zigbee2MQTT (or IoBroker) to the ZHA integration, however it should keep it if the backup is made from the ZHA integration and migration is only from one supported Zigbee Coordinator adapter to a different supported Zigbee Coordinator adapter.

As in the current valid use-case is for a scenario when you are restoring/migrating from a backup made inside the ZHA integration from using for example an older CC2530/CC231 based Zigbee Coordinator adapter to a newer Zigbee Coordinator adapter like for example Home Assistant SkyConnect USB Stick or ITead’s “Sonoff Zigbee 3.0 USB Dongle Plus” (model “ZBDongle-P”). See → https://www.home-assistant.io/integrations/zha#zigbee-backup-and-restore-in-zha

If that do not work then report ZHA integration issue to https://github.com/home-assistant/core/issues

I backed up ZHA with ConBee II and restored to ZHA on internal chip in the Yellow. It didn’t keep custom naming as others report in this thread:

1 Like

Ah, that must be a bug that you need to report to → https://github.com/home-assistant/core/issues

Ok! Thanks! I will do that!