zigpy / zigpy

Library implementing a ZigBee stack
GNU General Public License v3.0
799 stars 156 forks source link

"zigpy radio ... info" works but "zigpy radio ... backup" doesn't #1403

Closed IgnacioHR closed 1 month ago

IgnacioHR commented 1 month ago

Hello,

I'm trying to migrate from ezsp to ember as indicated here: https://smarthomescene.com/guides/how-to-use-ember-driver-with-efr32mg21-zigbee-adapters/

First step is to take a backup of current radio so I installed this repository in my computer running zigbee2mqtt. I'm having issues trying to obtain a backup. Here is what I'm doing and the configuration I've.

  1. I stop zigbee2mqtt using systemctl stop zigbee2mqtt
  2. I test access to the radio using zigpy radio --baudrate 115200 ezsp /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20240101000000-if00 info and it works. I receive the PAN ID, channel, Channel mask, etc...
  3. I try to backp using zigpy radio --baudrate 115200 ezsp /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20240101000000-if00 backup and this is what I obtain:
    
    2024-05-23 19:08:43.679 z2mqtt bellows.uart ERROR CRC error in frame b'2a15b658944a24ab5593499cc99f61cb109874f2ce0283fd7e4714b1a9112a15b658954a24ab5593499cde876f97149874face7e83dd7e1f13ed1f9f7e' (b'1f9f' != b'fc09')
    2024-05-23 19:08:45.036 z2mqtt bellows.ezsp.protocol WARNING Failed to parse frame getKeyTableEntry: b'03db9f03010000004369002051760000f80000009116002032'
    2024-05-23 19:08:45.036 z2mqtt bellows.ezsp WARNING Failed to parse frame, ignoring
    2024-05-23 19:08:45.093 z2mqtt bellows.ezsp WARNING Failed to parse frame, ignoring
    Traceback (most recent call last):
    File "/root/zigbee-backup/venv/lib/python3.9/site-packages/bellows/ezsp/protocol.py", line 74, in command
    return await future
    asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/zigbee-backup/venv/bin/zigpy", line 8, in sys.exit(cli()) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(args, kwargs) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/click/decorators.py", line 45, in new_func return f(get_current_context().obj, *args, *kwargs) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/zigpy_cli/cli.py", line 20, in inner return loop.run_until_complete(cmd(args, kwargs)) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/root/zigbee-backup/venv/lib/python3.9/site-packages/zigpy_cli/radio.py", line 119, in backup backup = await app.backups.create_backup(load_devices=True) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/zigpy/backups.py", line 143, in create_backup await self.app.load_network_info(load_devices=load_devices) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/bellows/zigbee/application.py", line 376, in load_network_info (status, key) = await ezsp.getKeyTableEntry(index) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/bellows/ezsp/init.py", line 215, in _command return await self._protocol.command(name, *args) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/bellows/ezsp/protocol.py", line 74, in command return await future File "/root/zigbee-backup/venv/lib/python3.9/site-packages/async_timeout/init.py", line 141, in aexit self._do_exit(exc_type) File "/root/zigbee-backup/venv/lib/python3.9/site-packages/async_timeout/init.py", line 228, in _do_exit raise asyncio.TimeoutError asyncio.exceptions.TimeoutError


so, how can `info` command work and `backup` command fail?
puddly commented 1 month ago

This will be fixed by https://github.com/zigpy/bellows/pull/625

info performs a "quick" backup just to get basic information. backup loads everything possible and there is currently a parsing issue with one command. Feel free to try the PR, it should fix the problem.

IgnacioHR commented 1 month ago

Thank you! I'll move from this point on