Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z-Stack 1.2 Backup & Restore #395

Merged
merged 4 commits into from
Jul 29, 2021
Merged

Conversation

castorw
Copy link
Contributor

@castorw castorw commented Jul 28, 2021

Tis PR adds ability to backup Z-Stack 1.2 adapters and restore them on newer Z-Stack versions:

  • Z-Stack 1.2 adapter can be backed up,
  • Z-Stack 1.2 backup can be (fake) restored onto Z-Stack 1.2 adapter by performing commissioning,
  • Z-Stack 1.2 backup can be restored onto Z-Stack 3.0.x and newer adapter,
  • Z-Stack 3.0.x or newer backup cannot be restored onto Z-Stack 1.2 adapter (an error is thrown).

Addressing Koenkk/zigbee2mqtt#6714.

@Koenkk Koenkk merged commit 779335f into Koenkk:master Jul 29, 2021
Koenkk added a commit to Koenkk/zigbee2mqtt.io that referenced this pull request Jul 29, 2021
@friebi
Copy link

friebi commented Aug 2, 2021

Awesome work! Is there somewhere a howto convert from an existing CC2531 coordinator to e.g. slea.sh's CC2652RB?

@friebi
Copy link

friebi commented Aug 3, 2021

Found it myself thanks to the Discord channel and it worked!! 🥇 🥳 😎 🏆
You need a Python installation with this: zigpy-znp
and then check here for steps: backup-and-restore (don't get confused by the NVM backup & restore in the next section - this only works for adapters which are physically the same!)

@castorw
Copy link
Contributor Author

castorw commented Aug 3, 2021

@friebi You basically don't need to do anything. Properly shutdown z2m, remove the stick, put in the new stick (freshly erased and flashed) and start z2m. The backup should be restored onto new stick.

@friebi
Copy link

friebi commented Aug 3, 2021

@castorw Thanks for the answer! So that means the above process is already part of z2m startup if it detects a new coordinator (change the serial port in configuration.yaml of course)? Awesome!

@castorw
Copy link
Contributor Author

castorw commented Aug 3, 2021

@Koenkk Is this PR already in latest z2m? Could you please instruct @friebi ? Thanks.

@friebi
Copy link

friebi commented Aug 3, 2021

@castorw sorry if I was confusing. Yes, it is part of the latest z2m releases and that's why it got my attention.
Everything is fine and I got it working as described here. Now I'm just amazed that you seem to have it integrated into the startup process of z2m without any manual steps necessary.
Nvm it works perfect and I'm very happy! Thank you so much

@Koenkk
Copy link
Owner

Koenkk commented Aug 3, 2021

I can confirm this is in 1.21.0 indeed (see changelog: https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.21.0)

@ykcheow
Copy link

ykcheow commented Aug 7, 2021

Hi, I'm upgrading the my cc2531 to cc2652p stick. My zigbee2mqtt is the latest version. I follow the instructions from @castorw, but my zigbee devices doesn't seem to join back. The zigbee2mqtt is able to start and I did change the USB path in the configuration but I didn't change the pan_id. The pan_id was 6754.
So, do I have to change the pan_id actually when upgrading the stick?

@friebi
Copy link

friebi commented Aug 7, 2021

@ykcheow I did not change the pan_id and as far as I understood you'll definitely have to repair all your devices if you do.
Maybe try backing up your network from the old stick and restore it to the new one manually as described above?

@ykcheow
Copy link

ykcheow commented Aug 7, 2021

@friebi As I understand from the latest zigbee2mqtt release of v1.21.0, we don't have to re-pair all the devices if we are changing the cc2531(firmware not the latest) to cc2652p (with latest firmware).

I'm confused with pan_id changes.

@friebi
Copy link

friebi commented Aug 7, 2021

I didn't have to repair all devices and I didn't change the pan_id. All I did was a manual backup and restore of the network, changing the serial port in the configuration and it worked.

@ykcheow
Copy link

ykcheow commented Aug 8, 2021

I have tested the new CC2652p stick at another HA which is dev. environment and it appears the stick is working good. I can pair motion sensor and the sensor is reporting the state correctly. So the new hardware is not a problem.
@castorw May I know how long do we need to wait for the devices to rejoin back to the new stick after swapping? Also, can you confirm we don't need to change pan_id when changing CC2531 to CC2652p? When I putting back the old stick, all the devices joined instantly.
@Koenkk Can you please shred some light also?

Here are some additional info,

  • CC2531 running firmware 20190608.
  • CC2652p running latest firmware, 20210708
  • Running with USB extension cable connected to USB2.0
  • Current pan_id is 6754 and didn't change it when swapping to CC2652p.
  • Mosquitto broker addon is running 5.1 version. Not the latest version though, wasn't sure if the version is matter in this case.

Thanks in advance.

@Koenkk
Copy link
Owner

Koenkk commented Aug 9, 2021

What do you see in the log when controlling devices after migrating to the CC2652p ? If you see errors like No network route (205) when try removing some routers from power and controlling them aftewards.

@ykcheow
Copy link

ykcheow commented Aug 13, 2021

I can confirm the zigbee2mqtt v1.21.0 can migrate from cc2531 to cc2652p with the need of re-pairing all the devices.

My problem is on the my HA RPi that's running with SSD. I suspect the USB does not have enough power for the cc2652p stick and causing the issue. And I still have no solution yet.

I've verified the stick is actually working at another dev HA RPi which is running with SD card.

@Koenkk
Copy link
Owner

Koenkk commented Aug 13, 2021

My problem is on the my HA RPi that's running with SSD. I suspect the USB does not have enough power for the cc2652p stick and causing the issue. And I still have no solution yet.

Common problem, try connecting the SSD or stick through a powered usb hub

@marcgarciamarti
Copy link

marcgarciamarti commented Sep 23, 2021

Hi there @castorw Could you or anybody confirm whether zigbee 3.0 will be supported when running 1.21 on a CC2531 without the need of repairing thanks to this PR? Does one need to do any manual step? Any place I can read up what the instructions are? Thanks!

@maiflaii
Copy link

maiflaii commented Nov 8, 2021

Hi,I only change the port and all devices are working but when try parking news devices,the log dont show nothing and no paring

@maxime1992
Copy link

Hey guys, I just tried to flash my sonoff coordinator to latest version as I was one behind. I had understood that everything was supposed to be automatic now so I just flashed the new version. Except that when I start z2m I don't have any device now 😅 ... I'm sweating a bit with 80 devices I've got, including some in my walls (for controlling the lights). It'd be massively painful to repair everything...

I guess I should've gone with the safe way of doing a backup first, rookie mistake 🤦‍♂️ Any hope I can get it to work fine as before knowing that I do have my file configuration.yaml, coordinator_backup.json, database.db and state.json or should I just start repairing all of them 😕 ?

@reneklootwijk
Copy link

I experienced multiple times, after a power failure, the database was empty. By restoring a backup of the database I almost always were able to recovery all devices.

@maxime1992
Copy link

Hey thanks for the answer @reneklootwijk. I've got it working by doing just that but I had an unfortunate queue of events that nearly put me down with no working backups 😓 ... Anyway I've opened an issue here: Koenkk/zigbee2mqtt#15868 (comment) if you want to follow along as I think even though having backups is important, having the DB being dropped is a real issue

@reneklootwijk
Copy link

reneklootwijk commented Jan 1, 2023

Koenkk/zigbee2mqtt#11759 is related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants