Sonoffs Zigbee 3.0 USB Dongle Plus Firmware

I found this thread to be incredibly helpful when going through this yesterday (esp @bartkummel’s superb summary and @mmattel’s & @jerrm’s scripts!).

In case it’s helpful I just went through this process for two Sonoff Zigbee 3.0 P dongles that I’m running on via HA VMs on Proxmox (setup via the community scripts). I’ve tried to highlight a few of the little extra tips that I’ve picked up elsewhere in the thread that helped me after reading the summary post above - after noting them down for the first one I followed them for the 2nd dongle and it seemed to all work OK!

  1. Install “Install Advanced SSH & Web Terminal” Add-on in HA (it needs to be the advanced one otherwise you won’t have Python available)
  2. Set the SSH password in the Configuration page for the above
  3. Start Advanced SSH & Web Terminal
  4. You need to stop anything currently using the dongle - Settings > Add-ons > Stop Zigbee2MQTT (or ZHA if you’re using that)
  5. SSH in using hassio@[HA VM IP] (default username - can be changed)
  6. In the SSH terminal stop HA with ha core stop
  7. Make a new directory for the files mkdir sonoff
  8. Change into the directory cd sonoff
  9. Download @mmattel’s script - wget https://github.com/mmattel/Raspberry-Pi-Setup/raw/a9cd3c77683f3cb86c7e5d20566999bf288e0169/scripts/firmware_sonoff.sh
  10. Make it executable: chmod +x firmware_sonoff.sh
  11. Open it for editing: nano firmware_sonoff.sh (then use Alt-# to enable line numbers in nano)
  12. We need to switch it to use the new Python virtual environment we’re about to create. To do so:
  • line set base directory to /root/sonoff/sonoff-zb3.0p
  • line 85 set the firmware version (from Z-Stack-firmware/coordinator/Z-Stack_3.x.0/bin at master · Koenkk/Z-Stack-firmware · GitHub - picking the correct one - in my case this was CC1352P2_CC2652P_launchpad_coordinator_20240710.zip (if you want to have options for other firmware options than just master/coordinator then remember to change them too)
  • line 135 replace python with /root/sonoff/venv-for-firmware-update/bin/python
  • lines 182 and 187 replace occurrences of pip with /root/sonoff/venv-for-firmware-update/bin/pip
  1. Create the Python virtual environment: python3 -m venv ./venv-for-firmware-update
  2. Make all files in the new subdirectory executable: chmod +x -R venv-for-firmware-update
  3. Activate the venv: ./venv-for-firmware-update/bin/activate
  4. Check all looks OK and confirm USB number by running script with no arguments: ./firmware_sonoff.sh
  5. If standard (usbtty0) and wanting to flash master branch of the co-ordinator then: ./firmware_sonoff.sh master coordinator 0
  6. Restart HA: ha core start
  7. Restart Zigbee2MQTT
  8. Stop Advanced SSH & Web Terminal (if you’re not planning to use it for anything else, to improve security)

I hope the above is helpful and builds on all the other good work so far in this thread - happy to revise as necessary.

6 Likes

thanks man! this was exactly the step by step instructions I was looking for

1 Like

That’s insanely detailed explanation! You my man require 1000 hearts. Just a small information to anyone who faced an error like this :
Opening port /dev/ttyUSB0, baud 500000
Reading data from /root/sonoff/sonoff-zb3.0p/tmp/master/coordinator.hex
Your firmware looks like an Intel Hex file
ERROR: [Errno 2] No such file or directory: ‘/root/sonoff/sonoff-zb3.0p/tmp/master/coordinator.hex’

You probably by mistake copied the URL like this:
wget Z-Stack-firmware/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20240710.zip at 14cd338d263a1f6344e20167b96f5ca55895553c · Koenkk/Z-Stack-firmware · GitHub

Instead of the correct one:
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20240710.zip

Besides my mistake amazing tutorial thanks!

1 Like

Hi,
I fixed most of the errors and got it running until:

Archive:  CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
  inflating: CC1352P2_CC2652P_launchpad_coordinator_20240710.hex  
sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from /sonoff/sonoff-zb3.0p/tmp/master/CC1352P2_CC2652P_launchpad_coordinator_20240710.hex
Your firmware looks like an Intel Hex file
Connecting to target...
Traceback (most recent call last):
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1174, in main_cli
    device = CC26xx(cmd)
             ^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 845, in __init__
    user_id = self.command_interface.cmdMemReadCC26xx(FCFG_USER_ID)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 621, in cmdMemReadCC26xx
    data = self.receivePacket()
           ^^^^^^^^^^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 371, in receivePacket
    raise CmdException("Received packet checksum error")
CmdException: Received packet checksum error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1297, in <module>
    main_cli()
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1292, in main_cli
    if QUIET >= 10:
       ^^^^^
UnboundLocalError: cannot access local variable 'QUIET' where it is not associated with a value

I have a cc3653.

After repeating it seveall times it worked…
strange…

Archive:  CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
  inflating: CC1352P2_CC2652P_launchpad_coordinator_20240710.hex  
sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from /sonoff/sonoff-zb3.0p/tmp/master/CC1352P2_CC2652P_launchpad_coordinator_20240710.hex
Your firmware looks like an Intel Hex file
Connecting to target...
Traceback (most recent call last):
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1174, in main_cli
    device = CC26xx(cmd)
             ^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 845, in __init__
    user_id = self.command_interface.cmdMemReadCC26xx(FCFG_USER_ID)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 621, in cmdMemReadCC26xx
    data = self.receivePacket()
           ^^^^^^^^^^^^^^^^^^^^
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 371, in receivePacket
    raise CmdException("Received packet checksum error")
CmdException: Received packet checksum error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1297, in <module>
    main_cli()
  File "/sonoff/sonoff-zb3.0p/tmp/cc2538_bsl.py", line 1292, in main_cli
    if QUIET >= 10:
       ^^^^^
UnboundLocalError: cannot access local variable 'QUIET' where it is not associated with a value