Zigbee coordinator backup and restore between different Ember sticks?

Please note:
I got several things wrong here and this first post is edited for more clarity.
Sorry for my initial confusion
In addition there my be a bug that do not show the correct settings in the UI.
The Network Key and PANID do apear as corrupted in some way.
I did manage to move my little test network from the Bitron to the Itead stick. Once…

Problem you are likely to run into is restoring backup from old firmware to adapter with newer firmware.

After you done a backup you might want to try if you can upgrade application firmware on old Ember:

https://github.com/walthowd/husbzb-firmware

https://github.com/walthowd/husbzb-firmware/issues/12

Restore might be be possible with bellows (used as a stand-alone tool) if got similar firmware version:

https://github.com/zigpy/bellows

FYI, Zigpy/ZHA (Home Assistant) + Zigbee2MQTT devs also started work on a standard backup format:

https://github.com/zigpy/open-coordinator-backup

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

https://github.com/Koenkk/zigbee-herdsman/pull/303

Firmware version should not matter. The backup/restore only stores a small amount of data, and it’s exported to a simple text string.

@chris What do you think about using this " Open ZigBee Coordinator Backup Format" for openHAB?

https://github.com/zigpy/open-coordinator-backup

Both Zigpy/ZHA (Home Assistant) and Zigbee2MQTT devs are collaborating on this unified format:

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

https://github.com/Koenkk/zigbee-herdsman/pull/303

The idea is that this should allow backup and restore between different brands of Zigbee adapters.

Hi, @chris , can you take a look at this:

openhab> zigbee ncpsecuritystate
Current Network State      : EMBER_JOINED_NETWORK
Trust Centre Address       : 000D6F000D3AF64C
Security level             : 5
Rejoin timeout             : null
Key table size             : 4
Trust Centre cache size    : 2
Transient key timeout      : 300
Application Key Policy     : EZSP_DENY_APP_KEY_REQUESTS
Trust Centre Policy        : 01
Trust Centre Key Policy    : EZSP_ALLOW_TC_KEY_REQUESTS_AND_SEND_CURRENT_KEY
Trust Centre Rejoin Policy : UNKNOWN
Installation Code          : 
ECC Library Support        : false
CBKE Library Support       : false
CBKE 163k1 Library Support : false
CBKE 163k1 Certificate     : No Certificate
CBKE 283k1 Library Support : false
CBKE 283k1 Certificate     : No Certificate
Security state flags       : EMBER_HAVE_TRUST_CENTER_LINK_KEY
                           : EMBER_TRUST_CENTER_USES_HASHED_LINK_KEY
                           : EMBER_GLOBAL_LINK_KEY

Key Type                        IEEE Address      Key Data                          In Cnt    Out Cnt   Seq  Auth  Sleep  Timer
EMBER_TRUST_CENTER_LINK_KEY     000D6F000D3AF64C  5A6967426565416C6C69616E63653039            00001000       Yes   No  
EMBER_CURRENT_NETWORK_KEY                         28D5D51F3B35157EDDA8A5ACB6FC9FC8            0000A06E    0  No    No  

openhab> zigbee netbackup
2021-04-13T11:36:27Z>COORDINATOR>BFBF>0175888CF74C9A90>CHANNEL_11>28D5D51F3B35157EDDA8A5ACB6FC9FC8>00>>0000A072>5A6967426565416C6C69616E63653039>>>00001000

openhab> zigbee netbackup "2021-04-13T11:36:27Z>COORDINATOR>BFBF>0175888CF74C9A90>CHANNEL_11>28D5D51F3B35157EDDA8A5ACB6FC9FC8>00>>0000A072>5A6967426565416C6C69616E63653039>>>00001000"
Restoring network as COORDINATOR after 42 seconds
PAN ID                       :
Extended PAN ID              :
Channel                      :
Network Key                  :28D5D51F3B35157EDDA8A5ACB6FC9FC8
Network Key Sequence         :0
Link Key       :5A6967426565416C6C69616E63653039

openhab>

It looks like PANID, Extended PANID and channel is not included in the backup string?

Also, this is the coordinator settings from /var/lib/openhab/jsondb/org.openhab.core.thing.Thing.json (These settings is what is seen in MainUI)

"configuration": {
        "properties": {
          "zigbee_port": "/dev/ttyUSB0",
          "zigbee_initialise": false,
          "zigbee_channel": 11,
          "zigbee_concentrator": 0,
          "zigbee_trustcentremode": "TC_JOIN_SECURE",
          "zigbee_extendedpanid": "0175888CF74C9A90",
          "zigbee_baud": 57600,
          "zigbee_flowcontrol": 2,
          "zigbee_panid": 49087,
          "zigbee_powermode": 1,
          "zigbee_txpower": 0,
          "zigbee_networksize": 25,
          "zigbee_linkkey": "5A6967426565416C6C69616E63653039",
          "zigbee_childtimeout": 86400,
          "zigbee_networkkey": "FD47618F29CA47619F993C76BBB433A7",
          "zigbee_meshupdateperiod": 86400
        }

Notice the “zigbee_networkkey”: "FD47618F29CA47619F993C76BBB433A7"
This is not the same value as reported from openhab-cli commands above :28D5D51F3B35157EDDA8A5ACB6FC9FC8.

This is my test nettwork on the Bitronvideo USB stick on a snapshot a couple of days old.
The same happens when I start a fresh network on a Itead zigbee 3 USB stick;
The networkkey changes in UI/jsonfile, but stays the same with the openhab-cli commands.

When I try to restore a backup-string from the Bitronvideo into a Itead stick the PANID get all 8 bits set high, 65535.
The way I have found to get the PANID, Extended PANID and channel setting right is to set all parameters manually (and tick off for reset) in MainUI when including a stick/coordinator.
Well, sometimes this works.

The backup string is this -:

And I clearly see this information included.