Zigbee2mqtt: Instruction - how to migrate from CC2531 to another (better) Zigbee dongle

Created on 21 Aug 2020  路  32Comments  路  Source: Koenkk/zigbee2mqtt

Bug Report

Please, write Instructions/documentation on zigbee2mqtt.io, how to migrate from CC2531 to another (better) dongle

What happened

I am planning make upgrade from CC2531 (source routing) to CC2652RB stick with 23 Zigbeee devices and i am finding the best Solution how to perform without nerve loss

What did you expect to happen

I expect help, what all i need change in section "advanced" - configuration. yaml
Now i have:
advanced: pan_id: 6754 channel: 11 network_key: - 1 - 3 - 5 - 7 - 9 - 11 - 13 - 15 - 0 - 2 - 4 - 6 - 8 - 10 - 12 - 13

How to reproduce it (minimal and precise)

I know, pan_id have to change, but is only possible example from 6754 to 6760? And is better change the network_key (due to a Wifi 2.4Ghz) collision/interference)? Or if is some Solution like Cloning Coordinator from old to new without new Pairing devices?
Thank you

Debug Info

Zigbee2MQTT version: 1.14.13
Adapter hardware: CC2531
Adapter firmware version: last

Most helpful comment

Hi there,

Just received my zzh and it works perfectly well !
It took me around 2 hours to update it and repair my 50 devices... it's quite easy as the device configuration is kept and the pairing with the zzh is incredibly fast and stable.

Here is a step by step procedure to update an existing configuration with CC2531 adapter to zzh (CC26X2R1) adapter if it can helps.

Here is my configuration prior the update :

  • Raspberrypi 3B+ with raspbian stretch
  • zigbee2mqtt already configured with a CC2531 adapter and source routing firmware (Zigbee 1.2)

PART 1. Flash the zzh (CC26X2R1)

_Note_ : your zzh stick might not be on the same port (eg, /dev/ttyACM0 for CC2531 and /dev/USB0 for zzh). use following command to know your configuration

pi@raspberry:/ $ ls -l /dev/serial/by-id

  • Download and unzip the Z-Stack firmware for your coordinator
    wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC26X2R1_20200805.zip && unzip CC26X2R1_20200805.zip

_Note :_ this link is for the current firmware (2020-08-05), check firmware version on following page : https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin

Now, you should have a file named CC26X2R1_20200805.hex

  • Flash your coordinator with this firmware
    ./cc2538-bsl.py -p /dev/ttyUSB0 -evw CC26X2R1_20200805.hex

You should see something like that :
pi@raspberrypi:~/cc2538-bsl-master $ ./cc2538-bsl.py -p /dev/ttyUSB0 -evw CC26X2R1_20200805.hex Opening port /dev/ttyUSB0, baud 500000 Reading data from CC26X2R1_20200805.hex Your firmware looks like an Intel Hex file Connecting to target... CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8 Primary IEEE Address: xxxxx Performing mass erase Erasing all main bank flash sectors Erase done Writing 360448 bytes starting at address 0x00000000 Write 104 bytes at 0x00057F980 Write done Verifying by comparing CRC32 calculations. Verified (match: 0x1aded532)

_Note_ : I had to try many times to have a correct flash. In case of wrong flash, then you might have following error message while launching zigbee2mqtt
Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)

Now your coordinator is ready. The LED should be turned off (seems normal).

PART 2. Update Zigbee2mqtt configuration

  • Ensure that you have the latest version of zigbee2mqtt (for update, see : https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html)

  • Go to the zigbee2mqtt folder
    cd /opt/zigbee2mqtt/

  • Backup your data folder in case of issue
    cp -R data data-backup

  • Remove you data/database.db file
    rm data/database.db

  • Edit your configuration file (eg.
    vi data/configuration.yaml

  • under section serial : If needed, update your Serial (eg. Port : /dev/ttyUSB0)

  • under section advanced: (to create is not present), add or edit pan_id to 0x1a63 (or higher if you already update it)
  • OPTIONAL : As you'll have to repair all devices, if not already done, you can add more security by adding a network key. Always under section advanced, add : network_key: GENERATE
  • Set the permit_join to true
  • Save your configuration file

PART 3. Validation and new pairing

  • Start zigbee2mqtt
    systemctl stop zigbee2mqtt
  • You should see that you have currently 0 devices joined (as we deletes database.db file)
  • For each device you have, follow the pairing procedure. You only have to pair the device, then the friendly name and all associated parameters will be automatically recovered (configuration.yalm wasn't removed).

_Note :_ If you have groups. repairs all device from the group and simply restart zigbee2mqtt for have them working again.

Let me know if you have any question. And thanks for your advices @Koenkk

All 32 comments

  • Switching requires repairing: https://www.zigbee2mqtt.io/information/FAQ.html#requires-repairing
  • For the pan_id, it doesn't really matter, just use something different (increment or decrement by one)
  • Network key has nothing do with collision/interference, but it's for sure to recommend Zigbee2MQTT generating one by setting the following in configuration.yaml:
advanced:
  network_key: GENERATE

why does the panid/epanid have to change and what happens if it doesn't?

Hi,
I鈥檒l receive my zzh in few days and I plan to do the same migration.

Does anyone know the best procedure to repair all devices ? Do I need to first remove all devices (using CC2531 and command zigbee2mqtt/bridge/config/remove), then install the zzh and pair again the devices ? Or is there any faster solution ?
I have around 50 devices, it鈥檒l be fun 馃憤

Also it seems that zzh uses only zigbee 3.0. Do you know if all devices are compatible with 3.0 ?

And last question :-) I鈥檓 using the source firmware with my CC2531. I only see one firmware for the zzh. How this firmware works compared to the standard or sources firmwares of the CC2531 ?

I鈥檒l try to create a documentation for this migration.

Thanks.

My idea would be ,if there is some possibility of cloning (for example with a mac address) both Coordinators, or something like that, but that's probably just a utopia. I have "only" 23 devices, but with 50 devices it is better to burn out :) (joke)

I am interested in this topic, too. Currenty 25 devices and the CC2531 may hit its limit soon.
Repairing all would be quite some work. Also can I keep the friendly names in configuration.yaml?
Whats the technical reason why repairing is needed?

why does the panid/epanid have to change and what happens if it doesn't?

Zigbee2MQTT will probably refuse to start (the error message indicates that you have to change the panid).

Does anyone know the best procedure to repair all devices ? Do I need to first remove all devices (using CC2531 and command zigbee2mqtt/bridge/config/remove), then install the zzh and pair again the devices ? Or is there any faster solution ?

Remove data/databse.db and change the panid in configuration.yaml.

And last question :-) I鈥檓 using the source firmware with my CC2531. I only see one firmware for the zzh. How this firmware works compared to the standard or sources firmwares of the CC2531 ?

CC2652R firmware is a source routing firmware.

Whats the technical reason why repairing is needed?

  • The data inside the adapter is incompatible between CC2531 and CC2652R
  • Since CC2652R firmware is Zigbee 3.0, it has additional security requirements. One of them is a persistent key which is only shared during pairing (which we don't have with the 1.2 CC2531).

Also can I keep the friendly names in configuration.yaml?

Yes, to resart remove data/databse.db and change the panid in configuration.yaml.

I probably have to change the adapter as well.
In my configuration.yaml there is no advanced: PAN_ID configured yet:

  • Does that mean that zigbee2mqtt is using the default value: pan_id: 0x1a62?
  • And if I change the adapter, I have to manually add a different pan_id to the configuration.yaml?
  • How can you generate a new pan_id?
  • Yes
  • Yes
  • Just use a different one, so if using the default (0x1a62) take 0x1a63

Hi there,

Just received my zzh and it works perfectly well !
It took me around 2 hours to update it and repair my 50 devices... it's quite easy as the device configuration is kept and the pairing with the zzh is incredibly fast and stable.

Here is a step by step procedure to update an existing configuration with CC2531 adapter to zzh (CC26X2R1) adapter if it can helps.

Here is my configuration prior the update :

  • Raspberrypi 3B+ with raspbian stretch
  • zigbee2mqtt already configured with a CC2531 adapter and source routing firmware (Zigbee 1.2)

PART 1. Flash the zzh (CC26X2R1)

_Note_ : your zzh stick might not be on the same port (eg, /dev/ttyACM0 for CC2531 and /dev/USB0 for zzh). use following command to know your configuration

pi@raspberry:/ $ ls -l /dev/serial/by-id

  • Download and unzip the Z-Stack firmware for your coordinator
    wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC26X2R1_20200805.zip && unzip CC26X2R1_20200805.zip

_Note :_ this link is for the current firmware (2020-08-05), check firmware version on following page : https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_3.x.0/bin

Now, you should have a file named CC26X2R1_20200805.hex

  • Flash your coordinator with this firmware
    ./cc2538-bsl.py -p /dev/ttyUSB0 -evw CC26X2R1_20200805.hex

You should see something like that :
pi@raspberrypi:~/cc2538-bsl-master $ ./cc2538-bsl.py -p /dev/ttyUSB0 -evw CC26X2R1_20200805.hex Opening port /dev/ttyUSB0, baud 500000 Reading data from CC26X2R1_20200805.hex Your firmware looks like an Intel Hex file Connecting to target... CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8 Primary IEEE Address: xxxxx Performing mass erase Erasing all main bank flash sectors Erase done Writing 360448 bytes starting at address 0x00000000 Write 104 bytes at 0x00057F980 Write done Verifying by comparing CRC32 calculations. Verified (match: 0x1aded532)

_Note_ : I had to try many times to have a correct flash. In case of wrong flash, then you might have following error message while launching zigbee2mqtt
Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)

Now your coordinator is ready. The LED should be turned off (seems normal).

PART 2. Update Zigbee2mqtt configuration

  • Ensure that you have the latest version of zigbee2mqtt (for update, see : https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html)

  • Go to the zigbee2mqtt folder
    cd /opt/zigbee2mqtt/

  • Backup your data folder in case of issue
    cp -R data data-backup

  • Remove you data/database.db file
    rm data/database.db

  • Edit your configuration file (eg.
    vi data/configuration.yaml

  • under section serial : If needed, update your Serial (eg. Port : /dev/ttyUSB0)

  • under section advanced: (to create is not present), add or edit pan_id to 0x1a63 (or higher if you already update it)
  • OPTIONAL : As you'll have to repair all devices, if not already done, you can add more security by adding a network key. Always under section advanced, add : network_key: GENERATE
  • Set the permit_join to true
  • Save your configuration file

PART 3. Validation and new pairing

  • Start zigbee2mqtt
    systemctl stop zigbee2mqtt
  • You should see that you have currently 0 devices joined (as we deletes database.db file)
  • For each device you have, follow the pairing procedure. You only have to pair the device, then the friendly name and all associated parameters will be automatically recovered (configuration.yalm wasn't removed).

_Note :_ If you have groups. repairs all device from the group and simply restart zigbee2mqtt for have them working again.

Let me know if you have any question. And thanks for your advices @Koenkk

So it is no problem migrating from zigbee 1.2 coordinator to 3.0? Even for 1.2 devices?

It鈥檚 not an issue, except that you have to pair again all your devices

PART 2. Update Zigbee2mqtt configuration

* Ensure that you have the latest version of zigbee2mqtt (for update, see : https://www.zigbee2mqtt.io/getting_started/running_zigbee2mqtt.html)

* Go to the zigbee2mqtt folder
  `cd /opt/zigbee2mqtt/`

* Backup your data folder in case of issue
  `cp -R data data-backup`

* Remove you data/database.db file
  `rm data/database.db`

* Edit your configuration file (eg.
  `vi data/configuration.yaml `

* under section `serial :` If needed, update your Serial (eg. Port : /dev/ttyUSB0)

In Hass OS is zigbee2mqtt folder with database.db in "/share/zigbee2MQTT" But really nice Instructions ! :)

About security. Do I deduct correctly that state.json is the only file needed to move the coordinator to a new device (rpi)? If so, can the network be hijacked? Use that network-key?

@VincentSC you need to move everything in the data directory.

I'm switching my network (Zigbee2MQTT on Home Assistant) to a CC2652RB coordinator because of my constantly growing network so I'm going to have to re-pair everything. I can reset some lightbulbs by switching them on and off a couple times, I can take battery powerd devices near the new coordinator, but I also have a bunch of Hue bulbs/spots that are either in a ceiling or some even outside in wall light fixtures. Now, these bulbs are extremely difficult to reach or take out of their enclosures and the only way I know for them to re-pair is by either removing them from the current network or using touchlink. I've noticed that after removing the Hue bulbs from the network, they often refuse to join any new network, whereas they join fine after a touchlink or two.

I was thinking of just getting my Windows laptop, install Zigbee2MQTT on it, and then go around the house with a USB extension cable and a old coordinator. Keep it close to a bulb, and reset the devices with touchlink. But as I usually issue commands to Zigbee2MQTT through Home Assistant, I have no idea how to send the touchlink command to Zigbee2MQTT when installed on Windows with npm.

Any suggestions? I guess I could also VM a hassio instance, but I'm guessing there should be an easier way.

I migrated my zigbee network from CC2531 to CC2652 like this:

  • Set rtscts: false
  • Set pan_id: 0x1a63
  • Update serial port
  • Delete database.db
  • Did not change network key

Everything works after resetting devices which is a lot of work.

But now I get this:

zigbee2mqtt:warn 2020-09-21 22:43:50: Received message from unsupported device with Zigbee model 'undefined'

So I think I missed one or more devices. It is quite hard to keep track of ~30 devices. Is there anything I could do to find out the device type or something?

@cody82 i had similar Problem with Osram Flex RGBW (4052899926110) . On CC2531 was pairing fine, but with CC2652 i had Message from Zigbee2MQTT unknown device. I tried Copy strings from old "database.db" to new (created from CC2652) without "id". Examples: "type":"Router","ieeeAddr":"0x841826***","nwkAddr":31117,"manufId":48042,"manufName":"OSRAM","powerSource":"Mains (single phase)","modelId":"Flex RGBW"****************
and now again working with new Stick.

Hi,

I am about to change from CC2531 to the ZZH adapter on a raspberry pi 3b+ with Buster.
If I make a clone of my current SD Card, can I just go back (if this change fails) to previous CC2531 installation when I replace the SD with the cloned SD?

Greetzzz,

Gerben

* Yes

* Yes

* Just use a different one, so if using the default (0x1a62) take 0x1a63

@Koenkk,

Do I need to be Root user to change from CC2531 to the ZZH adapter?

@Anjerlaan you only have to make a backup of your Zigbee2MQTT data folder.

Do I need to be Root user to change from CC2531 to the ZZH adapter?

This depends on your system setup, if you use root for CC2531 also use it for ZZH

@Anjerlaan you only have to make a backup of your Zigbee2MQTT data folder.

Do I need to be Root user to change from CC2531 to the ZZH adapter?

This depends on your system setup, if you use root for CC2531 also use it for ZZH

@koenkk
I am having a problem now
I had succesfully installed the ZZH adapter.
And I could repair all devices wihout a problem.
Also the groups were joining all relevant devices

However this was all done without restarting the Raspberry Pi
After the re-start or shutdown/start Zigbee2MQTT runs with an error (not always, 2 out of 5).

okt 10 18:04:45 Domotica-Pi systemd[1]: Started zigbee2mqtt.
okt 10 18:04:46 Domotica-Pi npm[2465]: > [email protected] start /opt/zigbee2mqtt
okt 10 18:04:46 Domotica-Pi npm[2465]: > node index.js
okt 10 18:04:48 Domotica-Pi npm[2465]: Zigbee2MQTT:info  2020-10-10 18:04:48: Logging to console and directory: 'data/log/2020-10-10.18-04-48' filename: log.txt
okt 10 18:04:48 Domotica-Pi npm[2465]: Zigbee2MQTT:debug 2020-10-10 18:04:48: Removing old log directory 'data/log/2020-10-10.18-00-13'
okt 10 18:04:49 Domotica-Pi npm[2465]: Zigbee2MQTT:debug 2020-10-10 18:04:49: Loaded state from file /opt/zigbee2mqtt/data/state.json
okt 10 18:04:49 Domotica-Pi npm[2465]: Zigbee2MQTT:info  2020-10-10 18:04:49: Starting Zigbee2MQTT version 1.15.0 (commit #ed8b4e5)
okt 10 18:04:49 Domotica-Pi npm[2465]: Zigbee2MQTT:info  2020-10-10 18:04:49: Starting zigbee-herdsman...
okt 10 18:04:49 Domotica-Pi npm[2465]: Zigbee2MQTT:debug 2020-10-10 18:04:49: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null},"backupPath":"/opt/zigbee2mqtt/data/coordinator_backup.json","databaseBackupPath":"/opt/zigbee2mqtt/data/database.db.backup","databasePath":"/opt/zigbee2mqtt/data/database.db","network":{"channelList":[25],"extendedPanID":[221,221,221,221,221,221,221,221],"networkKey":"HIDDEN","panID":6755},"serialPort":{"path":"/dev/ttyUSB1"}}'
okt 10 18:05:09 Domotica-Pi npm[2465]: Zigbee2MQTT:error 2020-10-10 18:05:09: Error while starting zigbee-herdsman
okt 10 18:05:09 Domotica-Pi npm[2465]: Zigbee2MQTT:error 2020-10-10 18:05:09: Failed to start zigbee
okt 10 18:05:09 Domotica-Pi npm[2465]: Zigbee2MQTT:error 2020-10-10 18:05:09: Exiting...
okt 10 18:05:09 Domotica-Pi npm[2465]: Zigbee2MQTT:error 2020-10-10 18:05:09: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
okt 10 18:05:09 Domotica-Pi npm[2465]:     at ZStackAdapter.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:92:31)
okt 10 18:05:09 Domotica-Pi npm[2465]:     at Generator.throw (<anonymous>)
okt 10 18:05:09 Domotica-Pi npm[2465]:     at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! code ELIFECYCLE
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! errno 1
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! [email protected] start: `node index.js`
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! Exit status 1
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR!
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! Failed at the [email protected] start script.
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR! A complete log of this run can be found in:
okt 10 18:05:09 Domotica-Pi npm[2465]: npm ERR!     /home/pi/.npm/_logs/2020-10-10T16_05_09_631Z-debug.log
okt 10 18:05:09 Domotica-Pi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
okt 10 18:05:09 Domotica-Pi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
okt 10 18:05:10 Domotica-Pi systemd[1]: zigbee2mqtt.service: Service RestartSec=100ms expired, scheduling restart.
okt 10 18:05:10 Domotica-Pi systemd[1]: zigbee2mqtt.service: Scheduled restart job, restart counter is at 3.
okt 10 18:05:10 Domotica-Pi systemd[1]: Stopped zigbee2mqtt.

@Anjerlaan do you have multiple USB devices connected? If so check if the port is correct: https://www.zigbee2mqtt.io/information/FAQ.html#verify-that-you-put-the-correct-port-in-configurationyaml

@Anjerlaan do you have multiple USB devices connected? If so check if the port is correct: https://www.zigbee2mqtt.io/information/FAQ.html#verify-that-you-put-the-correct-port-in-configurationyaml

I already figured it out.
the USB ports switch sometimes after reboot, because there are 2 USB devices attached.

I followed this tutorial tot fix the USB ports.
https://www.freva.com/nl/2019/06/20/geef-vaste-usb-poortnamen-aan-je-raspberry-pi/

And that worked.

Would be possible if zigbee2mqtt automatically recognizes the controllers port number instead of a manual path in a config file?

@Anjerlaan for the ZZH auto discovery is not possible because the used IDs are very generic (and also found in many other devices).

@Anjerlaan for the ZZH auto discovery is not possible because the used IDs are very generic (and also found in many other devices).

True because in the tutorial example one of the USB devices had exactly the same values as the ZZH

Works perfect thanks. One advise for flashing the stick, get it into bootloader... I forgot and got the error message: ' ERROR: Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)'.

I solved this by pressing the small button on top of the stick when putting it in my computer.Hope I can help someone not to do that :)

Hello!
I have tried to flash the adapter for almost two hours (with Pi and Win10) - no success, Z2M does not start (CC2652RB_20201026.hex)
I have now tested version 20200925 - finally successful!
Does someone also have this problem?

Zigbee2MQTT:info  2020-11-03 12:03:51: Starting zigbee-herdsman...
Zigbee2MQTT:error 2020-11-03 12:04:12: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2020-11-03 12:04:12: Failed to start zigbee
Zigbee2MQTT:error 2020-11-03 12:04:12: Exiting...
Zigbee2MQTT:error 2020-11-03 12:04:12: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:94:31)
    at Generator.throw (<anonymous>)
    at rejected (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)

I flashed with CC26X2R1, you should use that one for this adapter. What adapter do you have?

I use this firmware for zig-a-zig-ah! adapter

I flashed with CC26X2R1, you should use that one for this adapter. What adapter do you have?

I use this firmware for zig-a-zig-ah! adapter

Thank you!
I mixed up the firmware - embarrassing

Glad I could help 馃憤

Just droppin a comment in case it helps someone... ZZH adaptor arrived, and I swapped the antenna for my bigger (better?) antenna, which was apparently not specced for the output so nothing was working. Stick to the provided antenna if you have any issues pairing devices.

Thanks everyone for this thread it helped me a lot! Especially @noodlesft great write up bud.
I had an issue migrating from CC2531 to the CC2652RB (ZZH). I had the LED disabled on my CC2531 and left it in the configuration.yaml when I migrated which causes zigbee2mqtt to fail to start. It does show in the logs that the LED is causing problems but it's a little cryptic.

This line is incompatible with the ZZH USB adapter and must be removed
disable_led: true

Was this page helpful?
0 / 5 - 0 ratings