A big step above my notes in script form.
Try this to pull down the current versions without needing to edit urls.
Consider it untested pseudo code. I did a quick check on the snippets, but not in context of the whole script.
download_firmware () {
# https://github.com/Koenkk/Z-Stack-firmware
cd $basepath/$tmp
git clone https://github.com/Koenkk/Z-Stack-firmware.git
if [ $1 == "dev" ]; then
git -C Z-Stack-firmware checkout develop
fi
for f in Z-Stack-firmware/$2/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_$2_*.zip
do
unzip $f
done
}
flash_firmware () {
# for more options see: https://github.com/JelmerT/cc2538-bsl#cc26xx-and-cc13xx
python $basepath/$tmp/cc2538-bsl.py -evw -p \
/dev/ttyUSB$3 \
--bootloader-sonoff-usb \
$basepath/$tmp/*.hex
}
I had the same issue. I’ve read in a different post that the serial channel might be used by other applications.
I’ve stopped home assistant
ha homeassistant stop
<<do patching here>>
ha homeassistant start
Be sure to check you have the updated script. This flag should be in the flash_firmware() function
--bootloader-sonoff-usb
Same issue here, works fine in Z2M, but I cannot update firmware.
Z2M is not running, I’ve tried it with designating port:
sudo python3 cc2538-bsl.py -ewv -p /dev/ttyUSB0 --bootloader-sonoff-usb ./CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
and without designating port:
sudo python3 cc2538-bsl.py -ewv --bootloader-sonoff-usb ./CC1352P2_CC2652P_launchpad_coordinator_20221226.hex
Also tried doing both with jusy ‘python’ vs ‘python3’ and get ACK/NACK error, also tried it on two widnows machines, same timeout errors.
I have the Sonoff Dongle Plus-E
/dev/ttyUSB0
designates a port in linux, under Windows it will be something like COM3, however you have to make sure you have the drivers installed. This video helped me:
Flashing Sonoff Zigbee Dongle Plus in Windows (Python Method) - YouTube
Caveat: I have the -P version of the dongle, but I don’t think that matters
“P” vs “E” makes all the difference. Different chips, different firmware, different methods, different tools.
cc2538-bsl is a tool for the TI chip in the ZBDongle-P.
See @Hedda’s ZBDongle-E post for links to tools and firmware for the SI Labs based ZBDongle-E.
I was able to update the sonoff firmware with this program, very quick and simple
It was the only one I could try in every possible way, this is the only one that really worked…
Anybody wrote a detailed article how I can do this with HA running on a RPI4 installed using the provided HA Image ?
Or is there even a HACS integration which flashes the device?!
Thanks
Sorry, you cannot update the firmware of the stick while plugged in to a PI with HA running.
Hello, I have read this thread and there is still one question that was not explicitly asked and answered. Please could you confirm wheather the Zigbee dongle will work the same way after flashing without need to re-pairing all zigbee devices?
My setup is Sonoff Zigbee 3.0 USB stick P + Zigbe2MQTT (Docker) + HA (Docker)
Thank you for your advise
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
Yes, After the upgrade all will work as normal
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