Sonoffs Zigbee 3.0 USB Dongle Plus Firmware

Hello,
Can someone help all of the (mere mortal) beginners out here?
I’d like to update my Sonoff Zigbee Plus as its firmware is from 2021… I have Home Assistant running on a dedicated NUC (HAOS). I’ve installed the pyscript addon and enabled the integration. I’ve updated the above script from Jerms (thanks!) with what are the latest github download links (as of this writing on 21Mar2023), updated the top three lines to reflect my dev, that it’s a coordinator, and the usb hub number (someone please correct me if I’m wrong here). Here’s what it looks like:

$1: dev
$2: coordinator
$3: 0

# USE AT YOUR OWN RISK
# There is absolutely NO ERROR CHECKING.

# Must be run from a valid python environment.
# The HA Docker container has all requirements installed.

basepath=/config/sonoff_temp

cd /
rm -rf $basepath
mkdir $basepath
cd $basepath

# https://github.com/JelmerT/cc2538-bsl
wget https://github.com/JelmerT/cc2538-bsl/raw/master/cc2538-bsl.py

# https://github.com/Koenkk/Z-Stack-firmware
# No attempt is made to use github api to download latest versions.
# Urls will need to be edited to point to correct files as updates are posted to github.
mkdir master
cd master
# Master branch coordinator as of 3/21/23
wget https://github.com/Koenkk/Z-Stack-firmware/blob/a7745634b539df3d0b1ad1ae84a137017af58fe2/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
wget https://github.com/Koenkk/Z-Stack-firmware/blob/a7745634b539df3d0b1ad1ae84a137017af58fe2/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20221102.zip
for f in *.zip; do unzip $f; done 

cd ..
mkdir dev
cd dev
# Dev branch coordinator as of 3/21/23
wget https://github.com/Koenkk/Z-Stack-firmware/blob/9686fb220acb102819715d45a6a7de6c387ebfd9/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221102.zip
wget https://github.com/Koenkk/Z-Stack-firmware/blob/9686fb220acb102819715d45a6a7de6c387ebfd9/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20221102.zip
for f in *.zip; do unzip $f; done

cd ..
python $basepath/cc2538-bsl.py -evw -p /dev/ttyUSB$3 \
  --bootloader-sonoff-usb  $basepath/$1/*$2*.hex

cd /config
rm -rf $basepath

I’ve save this in the config\pyscript directory and have rebooted the HA server completely. Twice.
My understanding is the script should run at startup, but I’m not seeing an update in the firmware version.
I’m using ZHA, so I check this at Settings → Devices and Services → Sonoff Zigbee 3.0 USB Dongle Plus → [click on ## devices] → [scroll to bottom and click on] Zigbee Coordinator → [click on vertical three dots under Device Info and choose] Download Diagnostics → save that file and search it for “build”

I also tried running it from terminal, but no joy…

What am I missing and how do I go about running this script to update the firmware?

Do not run at startup, use the terminal. What errors are you seeing?
First, you need to disable ZHA so it doesn’t own the port. Then, you need to first run “pip3 install pyserial intelhex” because those packages are not installed by default in homeassistant.

Here is my script that does the extra pip install automatically. Everything is hard coded for the coordinator and port, just replace the wget for the firmware you want (be sure you get the right one). Your script is downloading both the router and coordinator, you only need one. If this doesn’t work, perhaps your port is not /dev/ttyUSB0

I’ve updated a few times and honestly have not noticed a difference. If things are working, don’t bother updating unless you don’t mind getting a new zigbee stick if something goes wrong.

# $1: dev or master
# $2: router or coordinator
# $3: ttyUSB port number

# USE AT YOUR OWN RISK
# There is absolutely NO ERROR CHECKING.

# Must be run from a valid python environment.
# The HA Docker container has all requirements installed.
pip3 install pyserial intelhex
basepath=/config/sonoff_temp

cd /
rm -rf $basepath
mkdir $basepath
cd $basepath

# https://github.com/JelmerT/cc2538-bsl
wget https://github.com/JelmerT/cc2538-bsl/raw/master/cc2538-bsl.py

# https://github.com/Koenkk/Z-Stack-firmware
# No attempt is made to use github api to download latest versions.
# Urls will need to be edited to point to correct files as updates are posted to github.
mkdir master
cd master
# Master branch coordinator as of 5/11/22
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20221226.zip
#wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20220125.zip
for f in *.zip; do unzip $f; done 

#cd ..
#mkdir dev
#cd dev
# Dev branch coordinator as of 5/11/22
#wget https://github.com/Koenkk/Z-Stack-firmware/raw/develop/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20220507.zip
#wget https://github.com/Koenkk/Z-Stack-firmware/raw/develop/router/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_router_20220125.zip
#for f in *.zip; do unzip $f; done

cd ..
python3 $basepath/cc2538-bsl.py -evw -p /dev/ttyUSB0 \
  --bootloader-sonoff-usb  $basepath/master/*coordinator*.hex

cd /config
rm -rf $basepath

1 Like

Yes, After the upgrade all will work as normal :slight_smile:

I have used this video to update one stick to the latest firmware and one as a router.
This is the easiest and quickest way.

I just purchased one of these dongles. I am replaceing the zigbee of a HUSBZB-1 Are there any gotchas that I need to be wary of?

Thanks

Be aware if you are using the zwave on the HUSBZB-1 and migrate the zigbee network using ZHA’s functionality, you will have to change the zigbee ieee of the HUSBZB-1 afterwards.

If the HUSBZB-1 is powered the zigbee radio is transmitting, even if not actually in use by any software. When you migrate the HUSBZB-1 zigbee net, its zigbee ieee is copied to the new stick. Two radios with the same zigbee ieee cannot be active at the same time.

Some of the SILabs flashing tools will allow you to change the zigbee ieee on the HUSBZB-1. Just be aware it is a one time irreversible change fo SILabs
chips unless you invest in a jtag programmer.

If I don’t try to migrate the network then the two can coinside peacefully??

Yes. Might be best to put them on different channels, just to minimize any interference issues, but I doubt it would make much difference.

I’d probably keep one setup as ZHA and the other as zigbee2mqtt, if only for testing purposes.

Thanks for the info. I am hoping the new Sonoff will detect the new door sensors properly.

Thanks again

So several things here. Plugging in the Sonoff Dongle it isn’t found by HA. I have tried to Add zigbee2mqtt from the integrations and the store and I am coming up with nothing.

Question Does the Sonoff Dongle require a USB 3.0 ? Is there somewhere in HA that I might need to enable new device sensing?

If I delete the ZHA for the HUSBZB-1 I should be able to set ZHA up to work with the Sonoff , IF I get the HA to recognize it is there at all.

If it weren’t for the fact that I cannot get battery status on these Aquara devices I probably wouldn’t bother

Thanks

Hi all,

need help, I opened a threat here:
ZigBee / ZHA - error/situation - Configuration / Zigbee - Home Assistant Community (home-assistant.io)

and i suppose need to reflash the firmware, in this case it is possible to loose my network?

thx for answer…
Nick

My experience:

  1. My Installation:
    OS Version: Home Assistant OS 10.3
    Home Assistant Core: 2023.7.1
    ttyUSB0
    /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0
  2. Sonoff Zigbee Dongle stopped working around beginning of July 2023
  3. You can check the hardware with Configuration → System → Hardware → All Hardware (Einstellungen → System → Hardware → Gesamte Hardware). This gives also the number of the USB port (in my case 0)
  4. After just opening a Terminal from within Home Assistant website (homeassistant:8123) flashing with @jerrm 's program (see above) worked after updates as described.
  5. The (original) network configuration is active again after firmware update (preserved) without further action.
  6. My steps to update the firmware for the stick as “configurator” using the @jerm 's program but not the entire script

mkdir /config/sonoff_temp
mkdir /config/sonoff_temp/master
cd /config/sonoff_temp/master
wget https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_other_coordinator_20230507.zip
unzip *.zip
cd …
wget https://github.com/JelmerT/cc2538-bsl/raw/master/cc2538-bsl.py
pip3 install pyserial intelhex
python /config/sonoff_temp/cc2538-bsl.py -evw -p /dev/ttyUSB0 --bootloader-sonoff-usb /config/sonoff_temp/master/coordinator.hex
rm -rf /config/sonoff_temp

1 Like

thx hspiess,

I try to firmware again and is giving error, then did not connect again, delete the old network, and when I connect the stick is found all my device, crazy …

I order new stick Home Assistant SkyConnect and I will try to add to zg2tt… and then I will play with this one…

Anyhow, a lot of devices is disconnecting …

brb with news…

Nick

Just wanted to say thank you for this @jaaem. Worked fine for me, and I’m no developer.

Only real issue I found was that my process was to edit the script I required in Visual Studio and then copy paste it into terminal in HA. When doing this I found it consistently missed the first character. The $ symbol of $1 at the top and then the script autoran as expected. Not sure why but easy enough to work around once I realised.

I have been following this thread.

Yesterday after about 8 months, my ZBDongle-P just stopped working. I have tried to reboot and for a split second the devices come up then everything goes unavailable.

I followed this guide to flash and end up with the following error

Writing 360448 bytes starting at address 0x00000000
ERROR: Timeout waiting for ACK/NACK after ‘Send data (0x24)’

I am running HASSIO as a VM within Proxmox
USB0 - Confirmed
ZHA - Disabled

One note, I plugged in a spare Eero router last night to play with Thread Devices - Not sure if that has something to do with it (interference??). I have removed Eero and powered off all thread devices.
In addition in the past week, I have noticed that new devices I have added would drop.

Anyone with Any thoughts?

I’ve had the exact same error –> I’ve finally managed to upgrade the firmware after all.

First I tried to upgrade using the ZigStar addon in HA → didn’t work:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service banner: starting

-----------------------------------------------------------
 Add-on: ZigStar TI CC2652P/P7 FW Flasher
 ZigStar TI CC2652P/P7 firmware flasher add-on
-----------------------------------------------------------
 Add-on version: 0.4.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 11.4  (amd64 / qemux86-64)
 Home Assistant Core: 2024.1.3
 Home Assistant Supervisor: 2023.12.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service banner successfully started
s6-rc: info: service cc2652-flasher: starting
[01:54:19] INFO: Starting CC2652P flasher with Sonoff /dev/ttyUSB0
Setting filename to /root/firmware.hex
sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from /root/firmware.hex
Your firmware looks like an Intel Hex file
Connecting to target...
pg_rev = 3, protocols = f, wafer_id = 0xbb41
CC135x PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:2B:48:1C:69
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
 Write 248 bytes at 0x00000000
 Write 248 bytes at 0x000000F8
// CUT //
Write 248 bytes at 0x00011DC8
 Write 248 bytes at 0x00011EC0
ERROR: No response from target on status request. (Did you disable the bootloader?)
[01:54:23] INFO: cc2652-flasher-up script exited with code 1
s6-rc: warning: unable to start service cc2652-flasher: command exited 1
s6-rc: info: service banner: stopping
s6-rc: info: service banner successfully stopped
s6-rc: info: service legacy-cont-init: stopping
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Then I decided to skip the “middleman” (being the HA instance) and use the python script directly from Proxmox CLI.

Unfortunately, the 0x24 error appeared:

root@s720proxmox:~/cc2538-bsl-master# python3 cc2538-bsl.py -p /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_74af528edd9ced1185ae7afaa7669f5d-if00-port0 -evw --bootloader-sonoff-usb CC1352P2_CC2652P_launchpad_coordinator_20230507.hex 
sonoff
Opening port /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_74af528edd9ced1185ae7afaa7669f5d-if00-port0, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20230507.hex
Firmware file: Intel Hex
Connecting to target...
CC1350 PG2.0 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:2B:48:1C:69
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
ERROR: Timeout waiting for ACK/NACK after 'Send data (0x24)'

Reboot didn’t help. Detaching and reattaching the dongle didn’t help.

What helped? I’m not sure, but I disconnected all USB devices from the PC, so that only the dongle was connected. Then I think it started working. I guess something was interfering.

Conclusion:

  • try directly from Proxmox CLI
  • shut down HA instance just to be sure it isn’t using the port
  • maybe try a different USB port
  • disconnect all other USB devices from the machine
  • good luck!
1 Like

Hi,

I have a SONOFF Zigbee 3.0 USB Dongle Plus connected to /dev/ttyUSB0 on my HomeAssistant machine. That’s an Odroid running Home Assistant OS. I thought it should be possible to run this script right on that machine. I connected via SSH, and stopped HA by running ha core stop. Then I ran the script.

First, I had issues that the script was not able to install some Python packages. I was able to resolve that by using a Python Virtual Environment. But now the actual firmware updater exits with the following output:

sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from /root/config/zigbee-firmware/tmp/master/CC1352P2_CC2652P_launchpad_coordinator_20230507.hex
Your firmware looks like an Intel Hex file
Connecting to target...
ERROR: Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)'

I read in this thread that this could have to do with some other process still being connected to the USB port. Could it be that stopping HA with the mentioned command is not enough?

I’d love to hear if someone was able to pull off a firmware update this way. Otherwise, I suppose disconnecting the Zigbee Stick from my HA machine and connecting it to my MacBook would be the next thing to try…

@mmattel thanks for sharing your script!
I copy pasted from my mobile phone into a new file via the HA file editor, used the HA terminal to chmod and make it executable, updated the firmware file name to the latest version, disabled ZHA and then used the HA terminal to execute your script. Worked perfectly and one I reenabled ZHA my Sonoff dongle was good to go and running the latest firmware. I’m trying to fix the IKEA Tradfri remote battery drain issue and I hear the newer firmware fixes it.

For reference these steps worked for me on my Windows VirtualBox instance of HAOS. No reboot or anything else required.

1 Like

@bartkummel not sure if my instructions above help in any way but all I did was Disable ZHA and then run the script with HA terminal. Didn’t disable or stop anything else.

1 Like

Thanks for your reply, @JJW.AU! I tried your approach, with only disabling ZHA and letting HA run. This also doesn’t work for me. Output is slightly different compared to my previous attempt:
</s> <s>Opening port /dev/ttyUSB0, baud 500000</s> <s>Reading data from /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_04630975aec9eb11bf748d4f1d69213e-if00-port0</s> <s>Cannot auto-detect firmware filetype: Assuming .bin</s> <s>Connecting to target...</s> <s>ERROR: device reports readiness to read but returned no data (device disconnected or multiple access on port?)</s> <s>

Scratch that. I made an error editing the script. Your approach actually did work, when I corrected that! Thanks a lot!