Setting up Zigbee2MQTT and MQTT broker Mosquito in Home Assistant

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone thanks for watching i'm simon from homesite and today i'm going to be addressing installing mqtt with mosquito as the broker and zigbee to mqtt using a cc2531 let's go so i've had a bunch of questions around zigbee and mqtt and how it all sort of interoperates so first of all people have been asking what it is people have been asking how do i install an mqtt broker and in this case mosquito now that's a one that's natively supported in home assistant works really well really simple to install and how do i install zigbee to mqtt as well and how do they interoperate so today i'm going to do this video i'm going to do a quick explanation of mqtt that's very quick and then i'm going to install zigbee to mqtt and install mosquito broker or using a cc2531 which is pre-flashed so hopefully you'll like this video and hopefully you'll subscribe to my channel down below as well [Music] so first of all i said i'll talk you very very quickly through mqtt and zigbee so let's start with zigbee zigbee's a wireless protocol it runs on 2.4 gigahertz the same as one of the wi-fi bands but it it supports um secure 128-bit encryption natively it's this open standard again a bit like wi-fi but one of the cool things about the zigbee protocol is it supports that mesh networking so if you've got a light bulb in one room that's able to boost the signal to other other devices in that room or even further onto other devices which are able to boost that signal again and they can find a path back to that gateway so because it can be a really cool protocol it's been really widely adopted for for home automation less so for sort of iot as in industrial ethernet of things so moving on to mqtt mqtt starts with message queueing telemetry transport it's a really lightweight protocol um it is able to pass information within very small amounts of bandwidth but securely as well it's got this concept for publish and subscribe and you must have a broker in it too to handle those messages now typically a device will publish its state or and others can subscribe onto that to understand that state so if you think about a light bulb a light bulb is going to publish its state back to the broker and the broker is going to send that to all the people that are interested in that so that might be your home assistant so home assistant if you think about decoupling that from your your mosquito broker and your home assistant you've got to sort of think about them in two slightly different terms even though they might be running on the same box but their broker is able to send that information to your home assistant and then that's able to then update your the information that's displayed on your screens now interestingly as well it's the same for a publish can be a control as well so it doesn't just have to be a status it could be a control so the home assistant might send a publish to the mqtt broker in our case mosquito and that will send it on to again it will push it onto other people i.e the light bulb itself who are interested in doing that thing who are turning on now you could have now that could turn on a bunch of lights so it could be a single topic that's sending to the to multiple lights so we could really go into mqtt and if you if you really want that i could go into a lot of detail so let me know in the comments and i'll do a better video on it but for now all we're really interested in is zigbee to mqtt getting that working because that will do the translation from zigbee through to mqtt and that will pass it into mosquito and that will allow it all to work with home assistant as well so let's get it all installed so we're starting off in our home assistant supervisor we're gonna go to our add-on store and first of all i'm gonna we're gonna look for zigbee now you can see the zigbee to mqtt which is gonna be the first thing we install isn't there we need to add the repository so if we click on the three little dots at the top right we can paste in this text here once we hit add it will then have somewhere else to go off and look for for software so now that's added you can see it's down here alternatively you can just search for zigbee again and you'll see that that now comes up so once we click on the one we want we can hit install now this takes about five minutes so i fast forwarded through this bit now once we've got to here you can see it's installed successfully now i want to show it in my sidebar because it's quite an important part of my home assistant so we can tick that option and we can try and start it now spoiler alert this is going to fail to start with now we there's a few more things that we need to do to get zigbee to mqtt working first so we can look into the documentation here and this will tell us about the the debug modes and all sorts of things like that if we look in our configuration we can see the most one of the most important parts at this point is this port this serial port this dev forward slash tty acm0 now that is the device that you're using to interpret the zigbee protocol now there's a couple of ways of finding that device you can click on the three little dots and click hardware and scroll through this massive long list i'm sure when i first started using home assistant it wasn't as long as this and it was quite simple and this was the way that i used to find that device name but here i mean unless you knew the name of the device it's like a needle in a haystack so if we come out of here now i've started off with my device plugged in already now i've unplugged it and plugged it back in again so if i scroll down to the bottom you can see the device has been unplugged and plugged back in so you can see this is here this dev four slash tty acm0 that's the name of the device so i'm going to select that part and copy it now i don't know how this zigbee term qtt config knew that already it might be because i've already had it installed once um but it might be because it's looked and understood and found that device now if we look in our log we can see we've still got some red text which is never good never a good sign in the log we can see that the mqtt service hasn't found a broker so that's what we're going to install next and that's mosquito so we can simply search for mosquito click on that hit install again spoiler alert takes about four minutes i think on my installation so once we've installed that we can start it up now in this one this config is a lot simpler unless you wanted to to put on an anonymous configuration so that you could send information to it anonymously or use a ssl you use it through secure method then you can pretty much just start it up as it is so there you go that started no often to show in the sidebar because it sits in the background and just interprets those messages coming through so the other thing you're going to need to do is set up a user a specific user for mqtt is advised now you could use your normal user but you probably don't want this user to be an administrator so i'm just setting up for now mqtt underscore user and the password is mqtt underscore pass like normal you'd have to enter that password in twice and create once we've got that done i'm going to try zigbee to mqtt and you can see that that's failed but it will take us straight through to that configuration and we can now take a look in our log again so we should have we've got a broker now so we can start this up and see what happens we come back to our log and refresh a couple of times so it's looking better we've got more green less red always a good start but we're not quite there yet we've still got some red some error whilst starting now we're getting failure to connect okay so that user that we've just created i'm also going to put that into the configuration of this zigbee to mqtt and hopefully that'll get it started so into our configuration and in this part here where we've got mqtt colon i'm simply going to add some additional lines which i've already prepared but it's just user colon the name and then password colon and the password so i'll hit save to that and restart the add-on now if i come back to my log now hopefully we should see all green no red that's what that's what we're looking for it looks pretty good so hopefully now we can come to our zigbee to mqtt interface i could have clicked on this little z in the bottom on the on the sidebar here here we go fantastic so i'm going to permit joining on this button up here in the top and i'm going to put some of my devices into pairing mode now again i've shortcut this a little bit so i've i started off with the bulb and now i'm adding in this ikea multi remote now sometimes when you're adding these devices they don't always come through you might have to refresh have a couple of goes at it and we can see that this ikea remote we can see battery life if i click a button you can see that it's sort of flashing up really quick it's because it clears it back down again after that's just this particular remote but looks good we can we can certainly talk to it if i click on the bowl we can change the color we can do all sorts of things now this is obviously dependent on the device that you've got and the type of things that it supports now these names aren't particularly user friendly so let's just change those i'm just going to call this bulb for now but you'd probably want to put what room it's in or the device the lamp whatever now if we click in settings we can see it's got this home assistant support switch now you're probably going to want to have that turned on we go to the integrations and go to mqtt and the three little dots at the bottom right and system options we can automatically have devices that it sees learnt and added into the system now it depends how much of a control freak you are you might want to add them directly in through configuration.yaml and get that extra little bit of control but for ease you might just want to have them as soon as they appear in home resistant for them to be added automatically now i didn't have that setting ticked so it wouldn't have added my multi remote so i've just removed it and i'll add it back in again now and we'll just follow that process through and make sure that it adds it in so i've just re-added my multi-remote you can see these green boxes down here they're flashed up and it starts what they're called the interview process where they're learning about each other the device is telling it what it supports and giving zigbee to mqtt a chance to set it up and make sure that it's got everything set up just right so i'm going to change the name of this to multi-remote you can also load this map and it should show you how things are connected together now one of the great things about zigbee is that you don't have to have everything talking back to the central hub it can talk through other devices see here this bulb acts as a router as well so the multi-remote actually talking to the bulb and the bottle was passing onto my home assistant which is represented by the star now if we look in our logs and i click a button on the remote and scroll down a little bit you can see this is the zigbee mqtt publishing that mqtt message so you can see that's the topic we spoke about and the payload so that's toggle we got brightness up click as well now we could pass that directly into a mqtt in node in node red if we wanted to so if we look through our integrations you can see at the minute there's no entities we've got two disabled entities by default not quite sure why it does it like this you have to enable them manually so if we click on the entities we can see we've got all of these marked as unavailable so we select all of the entities we want and we can click enable selected up here in the top right hand corner once we've clicked enable now this is asking me to restart now i didn't really question it at the time and i just went to configuration checked my config and did a restart however i'm not sure that's strictly needed i've not seen it before however i do normally configure my devices directly to configuration.yaml anyway so now that's restarted we can click on our entities and we can see that they've come up now hopefully we've got some control fantastic i can change the color of my bulb directly through here and if i look at my multi-remote i should be able to view the status and i can see it's really quickly flashing up with the with the buttons that i've pressed and you can see all the other types as well like the battery so that should tell me the percentage there we go got a new battery in there now you can see this entity id is not particularly helpful this lights.0x00 that seems like a computer name rather than a friendly name so we can change that so if we come back here we can call this we can call it whatever we want however i've made the little mistake here of calling rgb bulb really has to be prefixed with that domain that light dot or that switch dot that sensor dot so whatever it starts with currently leave that alone and just change everything after the dot now i don't know why it doesn't like that so i'm just going to retype it all light dot bulb i'm going to put and update so that's now updated that into our home assistant and hopefully i've still got control if i click back through i can change it back to blue cool obviously you can't see that working but it is great there is another way of doing as well through the integrations you can choose the entities through here and you can see that i can rename the action for example on this multi-remote i can rename the battery so it will make sense so that i can really use it in my system so the final thing i'm going to say is about this cc2531 made by it'd now they're dirt cheap they really really are cheap you can buy them pre-flashed for about 15 pounds you can buy them with the aerial built-in or with a separate aerial which i use now i do genuinely use this for my home network and i don't really have any issues um i see some people having issues with and moving to a combi 2 stick and decons which to be honest i've never had the call to work for never to work towards using because this little thing's been so reliable and i've only got maybe 30 zigbee devices um so maybe once you get to a critical mass you do need to move to something like the combi 2 stick but i'll put a little link to this down the description below i'll put all my stuff down in the description as well including my configurations and repository links and all that sort of thing i really hope that you've liked this video i hope that you found it useful if you do have any comments any criticisms even leave them in the comments section below and i'll be sure to come back to you if you've got any questions or need a hand with anything again just let me know please subscribe to my channel to make sure you don't miss out anymore and i'll see you next time thank you very much
Info
Channel: Home Sight
Views: 86,212
Rating: undefined out of 5
Keywords: mqtt, home assistant, tutorial, mosquitto, mosquitto mqtt, node-red, mqtt tutorial, what is mqtt, mqtt broker, home assistant automation, home assistant mqtt, home automation ideas, home automation setup, mosquitto mqtt tutorial, Zigbee2MQTT, CC2531, ITEAD, ITEAD CC2531, CC2531 Zigbee2MQTT
Id: -YeObwEZqL4
Channel Id: undefined
Length: 16min 33sec (993 seconds)
Published: Mon Mar 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.