Disaster Recovery, ZHA and backups

Imagine the scenario: my Conbee II stick goes bad. I plug in a Sonoff Zigbee 3 stick and want to migrate to this. But, where is my backup?

The ZHA documentation says, ‘Backups are taken automatically,’ but where are they stored?

I know I can make a backup and download it but this requires me to remember to do this on a regular basis. I don’t trust me to do this.

I’m not sure that ZHA supports automatic migration between different coordinator types.

The ZHA integration has a migrate radio button on its interface. It was introduced a few releases ago.

And that’s not automatic migration :wink:

ZHA’s backups are included in the complete HA backup.

And automatic migration isn’t automatic backup.

Anyway, I’ll see if I can find out in the HA backup

I saw this, too, and thought: Where? When? How Often? How do I find it to restore?

following @Tinkerer 's suggestion I’ve had a look through a full backup and can’t see anything that appears to be a backup for my Zigbee controller.

I downloaded a backup from the ZHA integration and got a .json file. I can see nothing like this in the backup.

I’m puzzled.

The backup is configured inside zigpy module. Namely application.py:

        if self.config[conf.CONF_NWK_BACKUP_ENABLED]:                                
            self.backups.start_periodic_backups(                                     
                # Config specifies the period in minutes, not seconds                
                period=(60 * self.config[conf.CONF_NWK_BACKUP_PERIOD])               
            )        

The backup period seems to be hardcoded and scheduled to run every 24 hours (zigpy/zigpy/config/defaults.py at 377c3031cf1a9b2c6a377e034f24b09ed39ccf6d · zigpy/zigpy · GitHub). I believe it’s stored inside an SQLite database zigbee.db within HA config directory.

For restore… you may be able to extract the json data out of the database and then use GitHub - zigpy/zigpy-cli: Command line interface for zigpy to restore network data. But I haven’t tested yet so not sure if it would work.

1 Like