in today's video we're going to be having a look at how to set up sonoff's latest zigbee dongle
in home assistant i'm going to be showing you how to flash a new software onto the
dongle as well as a full setup and install of an mqtt broker with zigbee to mqtt check it out
what's going on guys i hope you're all doing well so this is sewn off zigbee 3.0 usb dongle
plus they come pre-flash with the z-stack 3.0 coordinator firmware and you can currently pick
them up for just under 11 in the us and about 24 pounds in the uk there is a planned price increase
for this product but i'm not sure if it will have taken effect by the time this video is live or not
so it might be a little bit more expensive when you're watching this straight out of
the box you can just plug this dongle straight into whatever you're running home assistant on
and it will be detected and it will work however i would highly recommend you update the firmware
on it just to be able to do things like pair more devices to it and have some of the newer software
fixes we're going to start off by flashing some new firmware onto the dongle and to do
this there's a couple of different methods that we can use the first method involves taking the
device apart in order to access the boot button on the main board this will allow you to enter
the bootloader mode and the second method involves using a python script the python script will allow
you to automatically enter the bootloader mode without having to take the device apart for this
tutorial i'm going to be using a windows machine and i'm going to be following that first method
of taking the device apart now that might sound like it's a lot of work but it's really not it
is just a case of taking out two screws which is very simple to do and the reason i chose to do
this method is just because this was the original method of flashing software onto the dongle and
the newer method of using the python script came out afterwards if you are interested in doing the
second method of using the python script i will be covering that in a future video where i show
you how to flash one of these as a repeater so you can use it to extend your zigbee network
and i'll also have a link to the official sewn off instructions that show you how to use that python
script as always this video will be chaptered so if there's a particular part that you want to see
then you'll find those timestamps in the description below so with that said
let's flash this thing the first thing we're going to need to do is to download the new firmware for
our dongle and we're going to be getting this from co-encounters github repo for this video i'm going
to be making use of the latest stable release of the firmware which at the time of recording this
was the 17th of december 2021 if you are after a more up-to-date version then you can switch the
branch over to the developer branch and you can use the more up-to-date developer branch
but it is a developer branch so do expect some bugs from here we're going to choose the top one
which contains that launch pad coordinator and we're just going to download that next up we're
going to need to download a bit of software that we're going to use to flash the firmware
that we just got onto our dongle and to do this we're going to be using a tool called the flash
programmer and again you'll find a link to this in the description below on the flash programmer page
you're going to just need to scroll down until you see the downloads and then you're going to want
to choose this flash programmer 2 and then the download options now there is a bit of annoying
caveat to this download where you're going to have to sign up in order to access the download
but once you have done that you can download and install it so you should now have the flash
programmer set up and installed what we now need to do is to just tell the flash programmer where
the firmware is where our dongle is and then we can begin the flashing process but in order for
the flash programmer to see the firmware we are going to need to extract it when you downloaded
the dongle firmware it should have downloaded as a zip file so all we need to do is just locate
that file and just extract it out so i've got mine here on the desktop and all we're going to
do is just right click it and choose extract all we'll then get an extracted folder and inside of
that we'll have a dot hex file which will be the file that we use to pass to our flash programmer
and if we jump back to the flash programmer we can now point it at that extracted file
to do this we're going to choose browse at the top we then just need to locate our file and we're
going to select it and choose open next up we're going to disassemble the dongle and it is just a
simple case of removing the two screws and then carefully sliding it out of the metal enclosure
i really like the design of this dongle and although the enclosure looks like a heatsink
it is in fact not one on the main board you'll see two buttons a reset button and a boot button
and it's gonna be the boot button that we need to press and hold in order to get us into that
bootloader mode again we're following the method where we need to physically take this apart and
press and hold that button in order to get it into boot mode but if you didn't want to do that there
is the option to use the python script method but for now what we need to do is press and hold that
button and as you're holding it down you're going to want to plug it into your machine an
easy alternative if you can't physically get this into your machine whilst holding the button is you
could use something like a usb extension cable but you need to ensure that you're holding that button
down before you connect it to your machine once it's connected you want to just press and hold
that for roughly 10 seconds just to ensure that it does go into the bootloader mode when you connect
the dongle to the machine you should see it appear in the left hand side as a connected device and
it'll probably come under silicon labs usb just under that we need to make sure we select it and
then we need to select a target device for it so we need to choose cc2652p if yours doesn't show
up as silicon labs in the connected devices and you can just see unknown devices for all of them
then more than likely it's a driver issue if you open up your device manager and have a look under
other devices then you should see a little yellow triangle next to the usb and this just means that
the drive is not installed a simple way to fix it is to use the windows update so you can just right
click on it and choose to update the driver and then we can search with windows updates
if you select this it should just open up your windows updates and prompt you to access that page
i'm using windows 11 here and all i need to do is just head into the optional update and from within
here i can just choose the driver updates and then choose silicon labs and click download and install
if you're using windows 10 then it's a very similar process and once that's installed you
should see that that little yellow triangle is gone and i can now see the silicon labs usb so
if we click the refresh on the left hand side or if you just wait a second it should just
automatically refresh and we can see the silicon's lab usb just there if you did add it again through
a driver you're going to want to make sure that the selected target device is set so again just
check that that's set to cc2652p then we just need to check that a couple of other options are
ticked and unticked so you want to make sure in actions that a race is ticked program is ticked
verify is ticked and then in the top right you'll see some image override options and you want to
ensure that the disabled bootloader is unticked if you do tick it you can cause yourself a couple of
issues so just ensure that is unticked then you can go ahead and click the play button if you do
click that play button and it instantly goes red then more than likely you're not in the bootloader
mode so you're going to want to just remove your usb and you're going to want to try that process
of getting into boot loader again so just make sure you're holding down that boot button before
you plug it into your machine and when you do plug into the machine you're going to want to hold it
down for about 10 seconds or so you can then repeat that process of clicking the play button
and hopefully that goes through if it does keep going red and failing and you are struggling with
this then i would suggest checking out the python method so hopefully you're not struggling and you
did manage to get into the bootloader mode and when you do hit the play button you'll hopefully
see that a success message and that lets you know then that you've successfully flashed the dongle
at this point now that's the new firmware flash to the dongle so you can just go ahead and plug
this straight into home assistant and you're good to go if you do already know how to set up an mqtt
broker or you already know how to set up zigbee to mqtt then you can just skip the rest of this video
or maybe you're not going to use those and you're going to use zha then again you can also skip the
rest of this video but if you do want to know how to set those things up then stick around because
we're about to run through them we're going to start off by installing our mqtt broker and for
this we're going to be making use of mosquito so from our home assistant dashboard we're going
to head into configuration and from here we're just gonna choose add-ons and backups and in the
bottom right corner we should see the add-on store so we're gonna go ahead and press that
and from here we can just search through for the mosquito broker or at the top here there's
a handy little search bar so you can just start typing mosquito broker in there and it
will start to appear however i can just see it here so i'm just going to choose it here
i'm just going to click install that should just take a couple of minutes to install and once that
is done there are a couple of extra bits that we need to do in order to finalize the mqtt broker
setup the first one is a bit of a personal preference really but i would recommend it
especially as this is going to be your mqtt broker but it's this option here for the watchdog so if
the mqtt broker crashes then the watchdog will automatically restart the add-on which is really
what you want with the broker but this is just personal preference really you can do whatever
options suit you so i'm going to turn the watch dog on but i'm going to leave auto update off
the next bit of our broker setup is we need to create a user for the broker to use now there's
a couple of different ways of doing this you can just go directly into the configuration
and just hard code a user in there or you can go into the home assistant users and create a
user that it can use like that i'm going to use the home assistant way just because i don't want
to give the account full permissions and with home assistant we can easily control that so
let's head into the configuration here and we're going to choose people and zones
and up at the top there we want to select users and from here we're just going to go down to the
bottom right corner and we're just going to click add user that will then just give us this handy
form to fill in to create a new user now this user is going to be specifically for mqtt so i'd give
it a display name and a username that's going to make sense for that user just because you'll
probably see this name appearing in the logs and you'll want to know what it is so go ahead and
fill that in with some credentials i've then also gone ahead and take this optional can only login
from the local network this is gonna stop this user from being able to log in externally from
the network but as this is mqtt and it's local this is gonna be fine for me so i'm gonna go ahead
and click create and with that done we've got our new mqtt user which is local only and you'll also
notice that we didn't add it as an administrator so it's got basic user permissions and it's local
only we can now move on to the setup of zigbee to mqtt so to do this we're going to head back
into configuration i'm going to choose add-ons and backups again and from here we're again going to
choose the add-on store zigbee to mqtt isn't part of the official add-ons or the community add-ons
so we're going to need to manually add this ourselves to do this we're going to click
the three dots up at the top and we're going to choose repositories and from here we're going to
just need to add the url for the repository you can find this in the description below so go and
grab that and just paste it in here and with that pasted in you can just click add and then close
you should now be able to see these two zigbee to mqtt add-ons we've got the
standard one and we've got the development one we're gonna go ahead and click the standard one
and we're gonna click install this should also just take a couple of minutes to install and when
it is done we've got those personal preferences to make again i'm gonna again turn on the watchdog
but i'm also gonna choose to turn on the sidebar just so i can have that easily accessible all the
time in the sidebar there with that done we can head into the configuration for the add-on so
up at the top we're going to choose configuration and in here there's going to be a couple of lines
that we need to add so we're just going to add in the user credentials for the user that we created
for the mqtt broker on line 7 there we can see we've got the mqtt options and on the line below
we've got the base topic so just underneath this one we're going to want to add in our username and
password so let's go ahead and do that now and that should look a little something like this
so you've got user followed by the username of the account that you just created in my case
it was mqtt user and just below that we've got the password and again that's followed by the password
that you also created for that account and once you've done that that's the user credential side
of things all done the final part of the config for this is to just tell zigbee to mqtt which port
you've got your zigbee dongle plugged into so if you haven't already you're going to want to unplug
your dongle from the machine that you were using to flash it and just reassemble it with that now
reassembled you can go ahead and plug that into your pi or whatever machine you're currently using
to run your home assistant on with plugging in your zigbee dongle if you do happen to have a usb
extension cable i would highly recommend using one as it can help avoid any interference caused by
your machine and it can also help to increase your zigbee range now that we've got that plugged into
our home assistant we can figure out what port our dongle's using and we can use that information
to finish the configuration for zigbee to mqtt so to do this we're going to head into configuration
again and from here we're going to want to choose add-ons backups and supervisor and up at the top
we're going to select system and from here just underneath the host card we're going to click the
three dots and we're going to choose hardware from here we can see a list of different bits
of hardware that make up our home assistant and we can just scroll through this list until we
find our usb dongle but a nice and simple way of actually finding the dongle is to just do a search
so by making use of the flash programmer i know that the usb dongle was identifying itself as
a silicon lab product so if i just do a search for silicon you'll see as i start typing that it
comes up with the usb dongle here so this is the bit of information that i actually want so we've
got our usb dongle there and if i just select that it will tell me all the bits of information
i need about it and the bit of information that we care about is this device path here
and i can see it comes under dev forward slash tty usb 0 so i'm just going to copy this section here
and now that we've got that bit of information in our clipboard we're going to head back into
configuration and again we're going to choose add-ons i'm going to select our zigbee to mqtt
add-on and head into the configuration and in here we're going to want to just update this port with
the information that we've got on our clipboard we're then just going to scroll all the way down
and we're going to hit save and with that now done that should be all the configuration for
our broker and also for zigbee to mqtt so what we now need to do is just to kickstart both of them
so we're going to go back into configuration we're then going to choose add-ons and we're going to
select the mqtt broker first and we're just going to hit start once that started we're just going to
go back and we're going to do the same thing but with zigbee to mqtt so we're going to select that
and again we're just going to press start your broker and zigbee to mqtt should now both be
running and there shouldn't be any issues with them if you check out the log for zigbee to mqtt
it should just be all green and you shouldn't see any red error messages before we start adding any
zigbee devices there's just one final step we need to do which is to just enable the mqtt integration
so for the last time if we head to configuration and this time we're going to choose devices and
services and you should see that it's discovered mqtt so we're just going to click configure there
i'm just going to click submit and then finish and that's literally it everything should now
be running and you're now free to start playing around with zigbee to mqtt and start adding your
own devices in so let's just add a couple together and then we'll wrap this up so i'm just gonna
select zigbee to mqtt in my sidebar there then up at the top here we're gonna just select this
permit join all and that's gonna allow zigbee to mqtt to start discovering zigbee devices so i've
got one of these acara buttons to hand so i'm just gonna pop this into pairing mode so that button's
now in pairing mode and i can see it popping up here my car buttons now paired and if i wanted
to i could rename it here to give it a nicer friendly name so let's just go ahead and quickly
do that i'm also going to select this update home assistant entity switch here and click save
changes so i added that akara button and i also went ahead and added one of the acara wireless
switches now back here in our integrations i can see that i've got two devices under the mosquito
broker and if i click on those i can see that it's automatically pulled through that acara butter
and also the akara wireless switch and there we go guys that's been a quick look at how to flash
firmware to the sonoff zigbee dongle as well as a quick guide on setting up an mqtt broker
and zigbee to mqtt all within home assistant if you have enjoyed this video then don't forget to
drop me a like and if you're not already hit that subscribe button and ding dong that notification
bell you'll then be alerted to any future video that i do and as always a massive thank you to
these awesome dudes these awesome dudes are my patreons if you're interested in helping support
my channel which in turn allows me to create content like this then you'll find a link to my
patreon in the description below but thank you for watching and i'll catch you in the next one cheers
you