zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 87 forks source link

Cannot unpack non-iterable NoneType: ezsp.formNetwork #561

Closed LaG1924 closed 1 year ago

LaG1924 commented 1 year ago

According to this instruction, I tried to update the sonoff zigbee bridge coordinator. Unfortunately, even for restore --force -U -B I ran into the following error.

$ sudo bellows -d socket://...:8888 restore -U -B bellows_backup.txt --force
Restoring NCP
Traceback (most recent call last):
  File "/usr/local/bin/bellows", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bellows/cli/util.py", line 40, in inner
    loop.run_until_complete(f(*args, **kwargs))
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/dist-packages/bellows/cli/backup.py", line 186, in restore
    await _restore(
  File "/usr/local/lib/python3.10/dist-packages/bellows/cli/backup.py", line 275, in _restore
    await _form_network(ezsp, backup_data)
  File "/usr/local/lib/python3.10/dist-packages/bellows/cli/backup.py", line 312, in _form_network
    (status,) = await ezsp.formNetwork(network)
TypeError: cannot unpack non-iterable NoneType object

It looks like the backup command code is using a deprecated API that now throws an exception when the status is set incorrectly instead of returning the new status.