zigpy / zigpy-znp

TI CC2531, CC13x2, CC26x2 radio support for Zigpy and ZHA
GNU General Public License v3.0
145 stars 40 forks source link

Restoring Backup #101

Closed najamshah1 closed 2 years ago

najamshah1 commented 2 years ago

Hi,

I am trying to backup from SONOFF TASMOTISED WIFI Coordinator to SONOFF Zigbee 3.0 USB Dongle plus. Is it even possible ?

I am getting following error while restoring.. Any clues

bash-5.1# python -m zigpy_znp.tools.network_restore /dev/ttyUSB0 -i /config/zigbee-backup1.json Traceback (most recent call last): File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.9/site-packages/zigpy_znp/tools/network_restore.py", line 129, in asyncio.run(main(sys.argv[1:])) # pragma: no cover File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/usr/local/lib/python3.9/site-packages/zigpy_znp/tools/network_restore.py", line 119, in main validate_backup_json(backup) File "/usr/local/lib/python3.9/site-packages/zigpy_znp/tools/common.py", line 111, in validate_backup_json jsonschema.validate(backup, schema=OPEN_COORDINATOR_BACKUP_SCHEMA) File "/usr/local/lib/python3.9/site-packages/jsonschema/validators.py", line 967, in validate raise error jsonschema.exceptions.ValidationError: 'metadata' is a required property

Failed validating 'required' in schema: {'$id': 'https://github.com/zigpy/open-coordinator-backup/schema.json', '$schema': 'http://json-schema.org/draft-07/schema#', 'properties': {'channel': {'maximum': 26, 'minimum': 11, 'type': 'integer'}, 'channel_mask': {'items': {'maximum': 26, 'minimum': 11, 'type': 'integer'}, 'type': 'array'}, 'coordinator_ieee': {'pattern': '[a-fA-F0-9]{16}', 'type': 'string'}, 'devices': {'items': {'properties': {'ieee_address': {'pattern': '[a-fA-F0-9]{16}', 'type': 'string'}, 'link_key': {'properties': {'key': {'pattern': '[a-fA-F0-9]{16}', 'type': 'string'}, 'rx_counter': {'maximum': 4294967295, 'minimum': 0, 'type': 'integer'}, 'tx_counter': {'maximum': 4294967295, 'minimum': 0, 'type': 'integer'}}, 'required': ['key', 'tx_counter', 'rx_counter'], 'type': 'object'}, 'nwk_address': {'pattern': '[a-fA-F0-9]{4}', 'type': 'string'}}, 'required': ['nwk_address', 'ieee_address'], 'type': 'object'}, 'type': 'array'}, 'extended_pan_id': {'pattern': '[a-fA-F0-9]{16}', 'type': 'string'}, 'metadata': {'properties': {'format': {'pattern': '^zigpy/open-coordinator-backup$', 'type': 'string'}, 'internal': {'type': 'object'}, 'source': {'pattern': '^(.?)+@(.?)$', 'type': 'string'}, 'version': {'maximum': 1, 'minimum': 1, 'type': 'integer'}}, 'required': ['version', 'source'], 'type': 'object'}, 'network_key': {'properties': {'frame_counter': {'maximum': 4294967295, 'minimum': 0, 'type': 'integer'}, 'key': {'pattern': '[a-fA-F0-9]{32}', 'type': 'string'}, 'sequence_number': {'maximum': 255, 'minimum': 0, 'type': 'integer'}}, 'required': ['key', 'sequence_number', 'frame_counter'], 'type': 'object'}, 'nwk_update_id': {'maximum': 255, 'minimum': 0, 'type': 'integer'}, 'pan_id': {'pattern': '[a-fA-F0-9]{4}', 'type': 'string'}, 'security_level': {'maximum': 7, 'minimum': 0, 'type': 'integer'}, 'stack_specific': {'properties': {'zstack': {'properties': {'tclk_seed': {'pattern': '[a-fA-F0-9]{32}', 'type': 'string'}}, 'type': 'object'}}, 'type': 'object'}}, 'required': ['metadata', 'coordinator_ieee', 'pan_id', 'extended_pan_id', 'nwk_update_id', 'security_level', 'channel', 'channel_mask', 'network_key', 'devices'], 'type': 'object'}

On instance: {'channels': 134215680, 'extendedPanId': '9d:91:95:20:ab:2e:9f:e8', 'key_table': [], 'network_key': {'bitmask': 3, 'incomingFrameCounter': 0, 'key': [214, 101, 207, 90, 187, 111, 23, 33, 39, 225, 243, 214, 136, 159, 201, 41], 'outgoingFrameCounter': 5488641, 'partnerEUI64': '00:00:00:00:00:00:00:00', 'sequenceNumber': 0, 'type': 3}, 'node_id': 0, 'node_ieee': '80:4b:50:ff:fe:0b:5c:37', 'node_type': 1, 'nwkUpdateId': 0, 'panId': 41051, 'radioChannel': 15, 'radioTxPower': 8, 'tc_link_key': {'bitmask': 26, 'incomingFrameCounter': 0, 'key': [138, 183, 65, 5, 48, 223, 222, 100, 143, 71, 105, 240, 40, 80, 43, 234], 'outgoingFrameCounter': 69632, 'partnerEUI64': '80:4b:50:ff:fe:0b:5c:37', 'sequenceNumber': 0, 'type': 1}}

puddly commented 2 years ago

The bellows backup tool doesn't create JSON compatible with zigpy-znp's backup tool at the moment.

See the following discussion for instructions on how to install a modified version of bellows that does: https://github.com/zigpy/zigpy-znp/discussions/90