-
Notifications
You must be signed in to change notification settings - Fork 184
Coordinator Backup and Migration
You can backup your Zigbee network information that is stored on your Zigbee coordinator radio for supported radio types. (Currently EZSP and ZNP radios)
This backup allows you to restore your Zigbee network in the event your Zigbee coordinator radio is damaged or even to migrate to a new supported radio.
Recent Home Assistant Core versions have a UI for migrating between Zigbee sticks and downloading backups. You probably want to use that.
(Nortek GoControl HUSBZB-1, Elelabs, Sonoff ZBBridge, Telegesis)
Requirements:
- Direct and exclusive access to the USB stick/radio with Home Assistant stopped - Home Assistant OS (Hass.io) users will need to pull their stick and run this procedure on another system
- Home Assistant 0.115 or higher
- Python 3.8
- For seamless migration, you need to overwrite the EUI64 on your target stick/bridge. This is a one time operation and can not be undone or changed in future (without a SWD flasher) so this should only be done if you are sure of the change. If you do not overwrite the EUI64 the binding tables on your devices will be incorrect and they will need to be reset and rejoined. That said, there is very little downside to overwriting the EUI64 -- You can have two sticks/hubs with the same EUI64 online at the same time with out any conflicts if you create a new network on one of the two sticks. (
bellows leave && bellows form
) - The backup only stores the network level information for your Zigbee stick. You still need your Home Assistant backups that contain all the device/entity information for all your ZHA devices.
- For HUSBZB-1 users, the Z-Wave side of the stick is not backed up or affected or changed in anyway.
- If you migrate to a new stick and then want to go back to your original stick, you may need to restore the backup on it as well as the nwkUpdateID may be behind the current network setting.
Backup Procedure
- Find the /dev/ttyUSBx of your stick - Re-plug stick in and run
dmesg
- Or for Sonoff ZBBridge, make sure you have the current IP - Make sure bellows is installed and up to date. Run
sudo pip3 install bellows
- Run
sudo bellows -d /dev/ttyUSBX info
to make sure bellows can talk to your stick.
- Replace
/dev/ttyUSBX
with the correct path for your device. - For Sonoff ZBBridge use
socket://<ip>:8888
for the device. - For Elelabs and/or Sonoff you may need/want to run
sudo bellows -d /dev/ttyUSBX -b 115200 info
(If that is the case, add-b 115200
for all futurebellows
commands)
- Make a note of the EUI64 (first line of output), the extendedPanId, the nwkUpdateId and the trustCenterLongAddress.
- Backup your stick to a file
sudo bellows -d /dev/ttyUSBX backup > backup.txt
Restore Procedure
- Restore the backup you took. Run
sudo bellows -d /dev/ttyUSBX restore --i-understand-i-can-update-eui64-only-once-and-i-still-want-to-do-it -B backup.txt
- Verify backup was restored correctly. Run
sudo bellows -d /dev/ttyUSB1 info
and check that EUI64 (first line outputed), and extendedPanId, nwkUpdateId and trustCenterLongAddress match what your noted in step five of the backup procedure. - If the values do not match, run the restore again like this
sudo bellows -d /dev/ttyUSBX -f -B backup.txt
- This is ommiting the
--i-understand-i-can-update-eui64-only-once-and-i-still-want-to-do-it
and adding-f
flag bellows info`
That's it! Now move the stick back to your Home Assistant host, or restart Home Assistant.
If your new stick changed /dev paths (or baud rates) you will need to update Home Assistant with the new information by either removing ZHA integration and adding it back or by editing the .storage/core.config_entries
file.
You can not force factory reset your EZSP radio with a command to erase the NVRAM, as the NVRAM is stored in soft / hardware protected storage in the chip.
It's possible to erase the NVRAM with an SWD flashing tool, but it's normally not needed and not recommended for normal users.
But you can delete the NCPs key table which will make it "clean" and erases all link keys for earlier joined devices.
Install zha_custom and call HA service zha_custom.execute
with command: ezsp_clear_keys
(CC2531, CC2652P/CC2652R/CC2652RB, CC1352P/CC1352R)
- Direct and exclusive access to the USB stick/radio with Home Assistant stopped - Home Assistant OS (Hass.io) users will need to pull their stick and run this procedure on another system
- Python 3.8
- CC2531 backups can only be restored to CC2531 devices running similar firmware versions.
- Firmware upgrades usually erase all settings, including your network information. Perform a backup before upgrading and restore it after to preserve your settings.
- When restarting Home Assistant after a restore, you will experience some routing issues while the coordinator rebuilds its routing table.
A complete NVRAM backup and restore can be performed between similar devices and Z-Stack versions to copy your network between similar devices:
python3 -m zigpy_znp.tools.nvram_read /dev/serial/by-id/old_radio -o backup.json
python3 -m zigpy_znp.tools.nvram_write /dev/serial/by-id/new_radio -i backup.json
You can factory reset your ZNP radio by erasing the NVRAM entries in it by running one of the following commands:
# Erases the NVRAM items that indicate that a network has been formed
(venv) $ python -m zigpy_znp.tools.nvram_reset /dev/serial/by-id/your-radio
# Erases every single NVRAM item, resetting your stick as much as possible
# Unplug and re-plug the adapter after doing this
(venv) $ python -m zigpy_znp.tools.nvram_reset -c /dev/serial/by-id/your-radio