Flash Sonoff Zigbee 3.0 USB Dongle Plus With Python For Use In Home Assistant | pt8
Vložit
- čas přidán 25. 08. 2024
- In this video I'm looking at flashing the Sonoff Zigbee 3.0 USB Dongle Plus which is a fantastic piece of kit and comes ready to use out of the box. However I'm going to flash it with the latest firmware using Python, which you might find easier than dismantling the dongle to flash it, and gives you access to the latest functionality and lets you support a greater number of devices.
This is a step by step video and at the end I'll show you how to get the dongle set up in Home Assistant using Mosquitto MQTT broker and Zigbee2MQTT before I finally add in some of my Aqara Zigbee devices.
Links to downloads can be found below 👇
Remember to SUBSCRIBE to the channel so you don't miss future content
SUPPORT THE CHANNEL 🙌
Buy Me a Coffee: www.buymeacoff...
READ MORE 🌐
My Website: www.byteofgeek...
YOU CAN FIND ME ON 👍
Twitter: / byteofgeek
Instagram: / byteofgeek
Facebook: / byteofgeek
#byteofgeek #technology #homeassistant #homeautomation #smarthome #zigbee
Some of the links above may be affiliate links in which I receive a small commission if you click on the link and purchase an item. You're not obligated to use these links but if you do then it does help fund the channel to bring extra content to you!
The following is the download links and commands to go with the video.
Python
www.python.org...
Device Drivers
www.silabs.com...
Backup Dongle
python -m pip install --upgrade pip
pip install wheel pyserial intelhex python-magic
pip install zigpy-znp
python -m zigpy_znp.tools.nvram_read COM3 -o nvram_backup.json
Bootloader
github.com/Jel...
Z Stack Firmware
github.com/Koe...
Flash Dongle
python cc2538-bsl.py -p COM3 -e -v -w --bootloader-sonoff-usb CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
Zigbee2MQTT Repository
github.com/zig...
Do you think this is easier than taking the Sonoff dongle apart? Let me know down below and if you enjoyed the video then don't forget to LIKE and SUBSCRIBE to the channel 👍
I did it your way then tried the router install via the take it apart way. Your way worked first time but it took me a handful of goes the button way, to get the router firmware going. a right pain in the a**.
works like a charm, exelent explanation and good documentation!!
This was a life saver for me, thanks 😃
Absolutely! I've tried several other methods and could never get the Dongle into Bootloader mode. I tried other Python methods but your description was thorough and complete and worked straight off.
I really appreciate the effort you put into making this video both clear and concise.
@@davidquirk8097 thanks for the feedback and glad it helped you out 👍
Thank you so much!
I had no luck flashing with the TI flash programmer, this video was exactly what I needed to get my momentum back!
Thank you, I tried a half dozen tutorials before I found yours. They all failed and were hard to follow.
Yours was successful and detailed. You may include the command line texts as it goes by fast and is hard to read but I was able.
thanks again.
The first time I watched this I thought it sounded and looked so complicated I could never do it, but I did it and it works! I did get stuck with the 502 bad gateway thing and gave up and went to bed, but now I'm up and it works....I guess it just needed more time. Thank you so much for this tutorial and your thorough and clear explanation! 🙂
Cool, glad it's all working for you 👍
man you had no idea how many vidoes i went and searched and before i came across this life saver video. Thank you
Good to hear it helped 👍
That was really good. I spend hours trying to flash my sonoff dongle. Found your video and I was done in 5 minutes. A few coffees sent your way. Cheers.
Glad it helped and thanks for the support 👍
Great tutorial! Explains everything step by step and it's easy to follow. I tried two other tutorials on YT but this is actually the first one that got me all the way through. That hint about setting mqtt IP address in Z2M really helped. Adding zigbee devices is now a breeze and I can finally put those old aqara gateways to rest or use them as a doorbell/night lamp. Thank you sir! You saved my day.
Thanks for the feedback Jakub, glad it helped you get set up 👍
Just came back to this after a fresh install of home assistant to fix the dongle, still fixing my Z2M issues as always
Thanks so much! I couldn't get the Texas Instruments Flasher software to flash my device, but this worked perfectly.
Thanks! For whatever reason that I'll never know, I wasn't permitted to download that other flashing software so thank you kindly for showing another way.
Good to hear and thanks for watching 👍
Thanks, got an nvram error on my HomeAssistant ZHA integration and the manual bootloader method did not work. With your description I was able to reflash the Sonoff stick and my ZHA Integration ist ready to work directly again!
Great news, glad it helped 👍
Many many thanks for this super manual. This was the first that really works simple
Thanks for this. Worked perfectly on a Mac. I installed python, installed pip, downloaded those scripts, found my dev (mine was /dev/cu.serialusb-210), ran your commands and it all worked. Thanks
Hey good to hear, seems pretty straightforward on a Mac 👍
I had troubles at the pip install zigpy-znp step, it would error out at failed building wheel for multidect and the fix was to install Microsoft Visual Studio. I think it has something to do with C# or C++ and it needs those in order to do the install. After that I got stuck at the next step when I tried to do the backup from COM4 in my case, it kept saying there were errors in the py script, something about AttrubuteError, create pseudo member. At this point I gave up and will try the GUI based flash with the software from TI.
Im having the exact same issues. :(
I was having the same problems. I had to uninstall Python and install an older version. I used Python 3.9.13. Same website but under Python Releases for Windows
Do you happen to know whether I can flash a dongle as a router and plug that one into a random USB port in my house? In an attempt to extend my network range.
Thanks for the video! I made a mistake and got a synch error, doyou know what the command to use the zigpy backup would be ?
Really really useful, thank you very much! Obviously, for future firmwares, make sure to change the file names, before launching the scripts, to the correct date the file has.
Thanks for the feedback, yes absolutely have to change the filename depending on when you're downloading the file 🙂
Thank you. It amazes me that the cc2538-bsl GitHub page misses the important part of the filename needs to be in the command string.
What's missing?
the filename needs to be in command string. It didn't state that in the GitHub page (which is why I watched the YT video)
Ok. Now I get it. Thanks for the response 👍
Thank you, this is a great tutorial! Your method works, just need to use Python 3.9.13 as mentioned by someone in the comment.
I tried but came to a stop when my cmd got me this message: pip' is not recognized as an internal or external command.
Now what?
Thanks, very good guide!
Thanks for letting me know, hope it helped 🙂
another question is if I configured Sonoff Zigbee at 7:02, how do I revert back :(
If you click on the 3 dots on the tile in integrations, there should be either a disable or remove option there 🙂
Great tutorial, thanks! As I'm runnning ConBee II and just purchased the SonOff Dongle, I'm interested in the process to do a migration for z2m. As far as I understood, I need to also flash the coordinator ID of the ConBee II to the Sonoff Stick. Do you have some hints on that matter?
Thanks for sharing this, I was about to give up on my (expensive!!) aqara door sensors after failing to upgrade the firmware of my sonoff dongle using the python script on linux. No idea why it did not work, but perhaps it's because my daily linux driver being a little obscure and locked down (F36SB). Word of warning for folks who like to copy/paste between working docs: there's a double dash towards the end of the process, just before --bootloader.... It caught me out as it translated between too many copy/pastes to some weird long dash.
Good shout, glad you got there in the end 👍
You may have to run "python -m pip xxxxx" instead of just "pip xxx" depending on your python install / configurations.
The first script doesn't work, neither in powershell nor cmd. I tried both normal user and administrator on both but nothing. Is really that necessary? Isn't possible to download wathever it is with a normal link?
Great video, but could you please share the Repository URL for the zigbee2mqtt addon? I cannot see it in the description.
Thanks for watching and highlighting the missing link Daniel, it is now there in the description 👍
Hi nice video, I use the same USB dongle as a coordinator and also as a router I flashed through a program from Texas Instruments with USB dog resolution it seems to me to be easier!
Thanks for the feedback, it sounds like you're doing the hardware route then?
Can you make this tutorial with the new interface of Home Assistant ?
I'll check the differences and see what would need doing 👍
Thanks!
Thanks for the support 🙂
Having spent hours on other methods that didn’t work I tried this one, spent a little time downloading and setting everything up then tried to flash. Didn’t work . Opens port,baud 500,000, reading data from launchpad file, firmware look like intel hex file, error 2, no such file or directory
I don't understand why MQTT etc is required when the device works straight out of the box with Home Assistant? Thank you.
Better device support with MQTT and ZHA doesn't show all the entities compared to MQTT on a number of devices
I was having an error when running command pip install zigpy-znp (out at failed building wheel for multidect and the fix was to install Microsoft Visual Studioproblems). I had to uninstall Python and install an older version. I used Python 3.9.13. Same website but under Python Releases for Windows. Then everything worked. Also had to change the date on the hex file.
Thanks! You are a genius. The Python 3.9.13 works like a charm!
Having problems with "pip install zigpy-znp" and even tried python -m pip install zigpy-znp. I get
ERROR: Failed building wheel for multidict
Failed to build frozenlist multidict
ERROR: Could not build wheels for frozenlist, multidict, which is required to install pyproject.toml-based projects
Of course nothing else works.
i get this error : Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)'
Are you using a dongle P or E?
thanks for your reply. im using a P@@Byteofgeek
Appreciate the video and work! I'm almost there, but running into an error at the end... Any idea what might be happening here?
Opening port COM3, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20230507.HEX
Cannot auto-detect firmware filetype: Assuming .bin
Connecting to target...
CC1350 PG2.1 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:29:E8:CE:64
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 508113 bytes starting at address 0x00000000
ERROR: Invalid data size: 508113. Size must be a multiple of 4.
Hi im getting a "USB-Enhanced-SERIAL CH9102" under ports instead of the Silicon labs title...help
There are two versions of the dongle now with the newer one having a different chipset. This was introduced after the video was done so this won't work on that
I got an error at the end of flashing, is it now flashed or not? I am not sure..
Opening port COM3, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20230507.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: 00:12:4B:00:26:B8:76:A9
Performing mass erase
Erasing all main bank flash sectors
Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
Write done
Verifying by comparing CRC32 calculations.
Verified (match: 0xe83aa727)
ERROR: int() can't convert non-string with explicit base
edit: put it back in my HA-device and it works. Gives the just installed firmware as version.
Not seen that error before Eddy but glad you got it working in the end
I just bought two Sonoff Zigbee 3.0 USB Dongle Plus but when plug into HA does not recognize them, also when plugged into Windows device and checking the Device Manager it shows as USB-Enhanced-SERIAL CH9102 (COM4) dongles and both showing, can I still flash it, did I get a lemon? Cheers
I have seen that sonoff have a new version of the dongle (ZBDongle-E) that is shorter and uses a different Chipset, I think this has been introduced because of the chip shortages. Is it that one that you have?
@@Byteofgeek I have the same CH9103.... getting timeoutError when trying to read....
11:03 this part is not clear, what server and what port ? I am getting 502 badgateway
IP address of your home assistant device, unless you've changed anything the port will probably been the same as mine. 👍
My dongle is being detected as USB-Enhanced-SERIAL CH9102 instead of the Silicon Labs CP210x -- any ideas why? thanks
Turns out its the "E" version - Seems like they made it when the CP chips ran out. More difficult to flash so I'm running stock fw and ZHA
Thanks for confirming, I think a few people have bought the E dongle, maybe because it's cheaper?? and have come across this problem according to the comments.
I keep gerning bad gateway 502.
There are No red lines in my log file, but it says error multiple places.
Like fail to start and Error down udevadm ENOENT
OK can you check you've specified the correct COM port for the dongle?
@@Byteofgeek
If it is the dongle port I took the one as shown in the video. I have also checked that multiple times, so it should not be it. I also updated the dongle multiple times after the error, just to make sure
Weird, when I enter the flash commad just nothing happens, just the command prompt comes back (even without the stick inserted there is no error).
OK that's odd 🤔
@@Byteofgeek Made it work now by using a linux VM ... maybe windows had its days...
It's a sign 😉
Is this the Dongle-P or Dongle-E?
This is the plus, at the time of recording the video the dongle-e had not been released
sadly not working.....sonoff flashed OK but I get a bad gateway 502
OK, did you put your ip address in like I've shown in the video for this problem?
It was a me or a software problem, the flash of the firmware was fine, TY.
I am getting timeout error in part 5:12 anyone know how to solve this ?
i am getting the same error. how did you fix it?
Keep getting this error...python: can't open file 'cc2538-bsl.py': [Errno 2] No such file or directory. Any ideas?
OK 2 things to check, make sure it's a command prompt in administrator mode and also make sure you're in the correct folder - can you actually see the cc2538-bsl file if you type dir or do you see another folder again?
@@Byteofgeek yes,command prompt as admin. Type Dir in the command prompt?
Yes if you type DIR at the command prompt it will list the contents of the folder for you.
@@Byteofgeek yes,it's showing in the folder that I have it all in.
I re-downloaded and now it tries to flash,but now I get this error....ERROR: Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)' I can't get it to flash with the Texas Instruments flasher because it can't find the dongle. I'm just wondering if the Dongle is bad?
Should I Submit the Sonoff Zigbee 3.0 like I did with MQTT?
Where are you referring to?
@@Byteofgeek I can see it was not submitted in the video either.
So I don’t think it is necessary
rotzooi werkt niet
Doesn't work on yours, working fine for plenty of others. Post what the problem is and let's see if someone can help make it work for YOU 👍
Flashing Dongle with Router not CoOrdinator but all the same. But getting error, can anyone guide me.
D:\Router Flash\cc2538-bsl-master>python cc2538-bsl.py -p COM3 -e -v -w --bootloader-sonoff-usb C1352P2_CC2652P_launchpad_router_20221102.hex
sonoff
Opening port COM3, baud 500000
Reading data from C1352P2_CC2652P_launchpad_router_20221102.hex
Your firmware looks like an Intel Hex file
ERROR: [Errno 2] No such file or directory: 'C1352P2_CC2652P_launchpad_router_20221102.hex'
Make sure you have the matching filename in the line you're typing in at the command prompt
no offense, but the title reads flashing the sonoff zigbee dongle in HA and not in Windows...flashing it in Windows is nothing new, whether flashing thru Python nor TI Flashing tool 😑
Ah I thought I'd changed that, thanks for pointing it out 👍
Ive tried this guide and everything besides the fw upgrade it self works but I get the following error
C:\Temp\cc2538-bsl-master>python cc2538-bsl.py -p COM7 -e -v -w --bootloader-sonoff-usb CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
sonoff
Opening port COM7, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20220219.hex
Your firmware looks like an Intel Hex file
Connecting to target...
ERROR: Timeout waiting for ACK/NACK after 'Synch (0x55 0x55)'
I've tried to upgrade the Driver but windows states that I already have the best driver
Do you have an idea how to solve this?
You haven't got the new SONOFF Zigbee 3.0 USB Dongle Plus-ZBDongle-E have you?
@@Byteofgeek oh yes that is what is written on the box and invoice and it is about 51 mm so I’m Pritty sure
OK that has a different chipset so I'm almost certain this won't work but I don't have one to test unfortunately
@@Byteofgeek Buttons on the device are also twisted 90° compared to the one you were using
@@andersrasmussen2096 I have the same issue as you, did you find a solution?
Thanks!
Thanks for the support 👍
Thanks!
Appreciate the support 🙏