Beginner's Guide to ESPHome ESP8266, ESP32, Beken Devices and more

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so if you saw the title yeah we're going to be doing some Back to Basics with ESP home and before you Taz Moto users hardcore ones like myself click off stay around because it's definitely cool to learn both projects because it all applies to all the various chips even the beckon ones you know we did that to you Cloud cutter you know those are all don't be supported by tasmota so but they are supported in ESP home and ESP home because you know ESP supports esp8266 such as the S31 plugs esp32s all the cool products you see out there and you're probably scared of seeing some of that yamama stuff we're going to jump in and try to break some of that down for you and that way you're not scared of some of that different things of add devices that you bring into home assistant with all the things so we are going to be using the ESP 8266 little node MCU here it's a little breakout board but the cool part why we're doing that is the little Port here if you screw up on your firmware you just plug in and rewrite it there's no soldering here on this video it's all going to be just a few things thrown together and I do promise we will get to the whole OTA password debacle with ESB home so let's jump in so at anytime during the video If you have a question or comment definitely feel free to leave it down below while you're there give us a thumbs up subscribe whatever it may be if you really get stuck there's also the Discord link you can come jump into the digiblur DIY Discord and ask for help tons of cool people there and come hang out and have fun so what exactly is ESP home think of it like a program that allows you to put some code or programs that you don't have to be some master engineer ER on these little devices that control relays they got buttons lights got power monitoring it's on pretty much a ton of different things anything you can think of pretty much in the home automation world we can really use with an ESP chip now they have broadened out from esp8266 the ESP 32s as things just evolve and get better there's even some raspberry pi microcontrollers and then you'll hear about the beckon chip sets all it is just a little chip and then you'll hear them called Socks system on chip and it's really that's what it is it's a whole CPU like small computer and even a lot of most of them have a Wi-Fi chip in there as well so we can put them around the home they run on low voltage they can do all the cool things feed everything and then we can control them using home assistant node red automation whatever it may be but you don't have to be a super nerd to know like C++ programming everything you really just and I'll tell you a secret you just need to be able to copy and paste there's so many examples out there I don't really remember all the stuff and I just take pieces of code and copy and paste it into mine and cross my fingers and get it to work right it's trial and error so the first thing we need to do if you're a home assistant user if you're using the hos yep you know the deal it's fairly simple to go to the add-ons install the es home dashboard you can click here show up on the add-ons on your hos it's that simple to get it installed in the home assistant now if you're not there's the manual methods if you want to just run it on the command line you can you may not get the gooey there's Docker compose all there to meet everybody I know I do just the docker container things unraid users you know my buddies out there jump over here into the apps just search es home you'll find ESP home here by this Digi blur guy repository he's kind of shady just you know but you can do the install there follow the stuff it's a simple little Docker container and it starts up and gets the same exact dashboard that you would in the hos world now if you already have ESP home installed do make sure you're running the latest version as the recording of this video 2023 1116 is the latest I know some people really have some old dashboards you know something they haven't touched in a while so do make sure you update everything and before you do that go ahead and backup any yamoo files you may have in there but there also is the create backup for updating for the hos users so once you have your dashboard ready to go you going to have no devices and simply the device are just small yamoo files and if you want to edit them manually you can if you want to drop in yamoo files in your ESP home config folder it should pick them right up but you really don't need to do any of that you know behind the scenes manipulation so we're just going to hit new device and you can install things some other ways but I'm going to do my own way that's like simple to me so I'm just going to hit continue first you want to start off with your name of your device I'm just going to call this one my node MCU Das test now if this of course your first device is going to ask for your WiFi SSID and password so go ahead and put those in and once you do put that Wi-Fi password in you do probably want to go check it in your secrets file to make sure you did type it correctly so now you're here the select device type and I know I talked about the Beck chipsets they don't have it listed here but you could just pick one if you're building one for a Beck one and then you could overwrite and change the chips just don't freak out I've seen people like oh which one do I pick but we're going to be doing just the regular esp8266 I'm going to say skip for right now cuz I don't want to install it on my node MCU just yet now we have it here showing offline now don't forget I told you about go check your secrets make sure your Wi-Fi SS ID and password are correct and do take note the default method this secrets files different than the secrets file of Home assistant itself because you know this is a different module add-on Docker container Etc so now we're going to get into edit our device now it's yaml everybody's seen yaml don't be don't freak out about it it's just a lot of different things I don't remember all the damn tabs and spaces everything I just go copy and paste stuff out the docs so we' got our name node MCU friendly name and we it's the board you you don't have to worry about changing than that let me go hide this over here and see if we can zoom in a little bit for some people so now the logger we're going to leave that there the encryption totally up to you I don't use the encryption I have a private Network I'm not sending this out I don't have a public you know like a network in a business or a university or something like that that I would have my devices on so I don't need my encryption it just creates another step for me if you're wor wondering about the whole password deal the OTA password if you just delete the password out on a device that's already there that's a bad idea because once you lose that password you're going to have to manually flash this device and that could be something you have to solder or whatever so if you ever put a password on a device I'm going say it again do not lose that key again I'm not on a public network if something is on doing stuff on my network I have bigger issues than my ESP home devices so I'm just going to Nuke it out of there WiFi you see that points to your secrets and then this is a very good idea to leave this in here is the fallback hotspot now I don't really need a password on it that's totally up to you cuz again I'm I forget the password what this allows you to do if for some reason this device cannot connect to your network due to like you got something wrong with your network or the password is different or whatever and say it's something you've got that's up in the ceiling and you don't want to you can't take it down to reflash it or whatever or reset it this is where you'll just connect with your phone and change the SSID and password on the device and reflash it with over the air reflash it with the correct SS ID and password for Simplicity sakes I'm going go ahead and nuke this tot lip you don't have to the AP will just default to being the name it'll be node MCU test I know it's the access point if I see that name I really don't need to be some other special name captive portal you need to leave the captive portal in there because that's going to allow you to put it on your network so really right now you're done this device we can go ahead and install it and it's exactly what we're going to do because I don't want to start adding anything to it it's like I try to get my rolling chassis first of things whether it be a light switch or whatever it is and get it on the network try it out and then you can add stuff to it and then you can just install it over the air that's the cool part about all of this so do make sure you hit save and we're going to hit and install now we can't do it wirelessly just yet so you you can plug plug it into this computer I really don't like to do it that way plug it into the dashboard with a whole VM thing or whatever it may be you may not be able to plug it into it I'm just going to use the manual download method it's pretty easy to do once you hit manual download it's going to go through it's going to compile some of the people on the pies the uh home assistant green this may take a while I'm sorry um others it may go fairly quickly the first one is really going to take long because it has to install all the toolkit stuff as you can see there but once we start to make little small changes it doesn't have to recompile the whole thing it's it'll just put in small pieces and compile that it's fairly quick so once you get to this point it says success it will download the bin file to your computer now we do need to go over and write this to our node MCU so remember I'm just using the little node MCU with the USB adapter on it and and I'm just going to plug in my USB cable it is the older School micro USB some of them have the USB C's on them and just go ahead and plug it in if you're on a Windows computer if it's your first time using a node MCU or any type of Flasher like that do make sure you go check your Windows update your device manager drivers look for a new device there you may have to install a driver like the cp2102 or whatever it might be on your chip but a lot of times the Windows update will have that you just got to go hit accept like under the optional updates and of course if you ever forget any of this these steps about creating your new device this says say esp32 on my website of course I'll leave all the links down below you can follow through this has all the steps and screenshots Etc so now we need to put that bin file on our node MCU so what we're going to do is hit connect and mine is a cp2102 I'm going to hit connect you may be tempted to hit this prepare for first use I don't use that method I already have mine ready to go so I'm going to hit install and I'm going to go ahead and pick my file it just downloaded and then I'll hit install at this point especially with the no MCU it should just fire off you don't have to hold any buttons down but some of the esp32 no mcus that make you hold down that boot Button while you're plugging it in kind of puts it in that mode like you're trying to go in right to the B but most of them should automatically jump in now if you're using an other device like a I say you're flashing a sonoff basic or something like that you will need to hold the button down on those to get those into boot mode it varies per device so we got configuration installed hit close it should be ready to go and sometimes it may take a little bit to come up but you will see it shows online and then we get the logs and we're going to do get the logs Wireless LLY and there we go we have it on our Wi-Fi now this is where we can start adding some of the other cool stuff so one of the things I like to add next is going to be the web server just come over here to the ESP home documentation and here we are the web server component for this now it does say Port 80 but that's already default and so really you got to do is just copy that one little section there are other things you can do to add like authorization username password to pull up the web page on it but we're just going to throw it in default and call it a day we'll paste it in here ESP home if you like don't know what a command is if you just go and like say I'm web server and hover over it it'll show you that component and then you could actually jump to it like otaa I didn't say if I didn't know what OTA is you could just just hover over it and then go to OTA component takes you straight there that's pretty cool feature to link to the docs now I've only added that web server I'm going to hit save install now here's the cool part I don't need to have it go back and get the bin use the web page I could actually go put this across the house and still as long as I had it powered up and hit wirelessly and it will go ahead and send over that new bin file right over the air so all your future updates and everything you'll do is you know you'll be sending that straight over the air to your devices as needed so there's it uploading doesn't take that long at all to upload and just don't power cycle it while it's doing the Flash and the reboot that's actually went it's right into the chip just give it a second be patient it'll flash itself and reconnect to the network now behind me what I'm clicking on if probably wondering there's a stop button back here it's not actually stopping the device you're just saying stop this window so let going hit stop and put me back to the dashboard and you'll notice now we have a visit Button as well as the edit and logs I'm going to go over the settings of what these different buttons do here but visit that's going to jump you to the actual web server on the Node MCU itself so this is actually coming from your device how cool is that a whole web page from the little chip itself now we don't have anything down here now there'll be logs over here if we have something but nothing's really going on with this chip yet it's just getting on our Wi-Fi and sitting there so we're not going to add it into home assistant just yet because we don't have any entities right now now the other buttons of course you know edit you know logs the three dots have other different features in there validate all all the validate does is says hey is my yaml okay and it says yep and configuration's valid and has the little green check mark and you could hit install whatever it's just checking your your work now you can do show API Key Well I nuked the API key you can download the yamoo I've never used that one rename that'll rename the whole yamoo file and change everything in there and reflash that name I've had an issue with that once do make sure you do your backups with this stuff I have had it nuke one of my Yama files before now clean build files don't be scared of that one all that's doing sometimes when you have you go to hit installed it may eror out especially if you've changed a lot of stuff like on the ESP 32 or whatever you've just radically changed the whole device it's not a bad idea hit clean build files that cleans the entire cash for building this device and makes it start from Ground Zero it does not nuke your yamoo file so don't worry about that it's just the temporary files so it will take a little bit longer to build but you know that's there I've used it a lot to fix some issues now of course there's the delete we're not deleting things the other cool things you got the search up here it's going to search for your devices you have a bunch of them I really wish they would have a smaller like treats kind of thing where you could categorize them and not these huge blocks but maybe we'll get that one day because when you've got like 50 devices in here it's a pain so there is update all mash it pretty simple it'll update all your devices it might be good may be bad you be the judge of what you want to do with that so now we're going to go back to this device and I need to add something for we're going to do an LED I'm going to do a button on this just to kind of mock up like a smart plug would have you got a button on a smart plug got a LED and then you got even a relay on it so for my particular setup is this is our little node MCU and I'm going be using a little breadboard adapter just to show things now you know course you if you want to use like a real Shelly Shelly one um real light switch whatever it's all going to be kind of the same as 31 plugs but this allows us to test things and really not worry about messing anything up or trying to do any soldering or whatever it may be so we're going to put this in a little breadboard adapter and that will allow us to put the little cool little jumper wires and just do this prototyping and Dev work and I'm just putting in a little button and then we'll throw in the LED so the longer pen is ground and then the others are are the red blue and green so I'm just going to shove this into ground so I'm just going to use the red pen on the LED it's a multicolor LED I don't need all three colors and then I'm just going to shove it into one of these gpio pins that's the general purpose input output and basically think of it's like different channels or addresses on the chip to you know Drive things in or out and we'll get to that in the code cuz you're going to say hey I need to send an output to turn on this on this number now the button here uh I'm just going to tie that to ground and then I'll tie the other side to another GPI opin so pretty simple setup here we've got a button just to mimic like say on a smart switch or something like that that's going to go into D6 and then we're going to have an output for the LED on D5 and let's go jump into the yaml and get this set up and copy and paste some stuff to be able to control the LED with this button so first thing I want to do is let's go set up the light I did put that on D5 if you're ever curious of like CU I really hate the on the 8266 the D PIN numbers there's an awesome reference on random nerd tutorials if you scroll down here look for your node MCU is you can can see they have the map of this thing I think the whole weimo D1 mini started this junk but um maybe I might be wrong on that but you can see we got D5 is actually gpio4 in the ESP 32 World they don't do that stupid D number they just go with the actual gpio numbers on the chip somebody thought it would be a good idea to map these things in Stupid Ways and they also have in here if you're curious if you're building something they have like best GPI IO pins to use for certain things cuz some pins are good and some pins are bad to use I wouldn't say bad maybe just limited on what they can do so back in the docs I want to go grab a light going to be an output like light components there it is light I just want to do they do have a status light on the actual node MCU we're not going to be doing that one just yet I need to grab just a single color light now of course if I did hook up those other pins I could have done an RGB light but we're going to do monoch mono we're going to do monochromatic light just single Channel keep it simple stupid yep the whole kiss principle we're just going to copy and paste back in our Yama file paste it in cut out that I don't need that you see it says light monochromatic kitchen lights we're just going to call I don't want to confuse it with my whole setup here um we're just going to say n now this is where things can get confusing and know we're just talking about copying and pasting but I want to try to explain some of this stuff the platform monochromatic you doing the name now if you don't put a name on it it's going to keep it internal it's still going to assign it to the chip but then you won't be able to see it on Home assistant so very important to put the name output it's you're giving it little like a like a custom internal name because we need to tie it to the output of like well how does it get that light is that a light driver is it some other deal because there's tons of different ways to control lights with ESP home so now in the output section there's a platform we are using an esp8266 now if you're esp32 there's like lead SE drivers there's also in beckan you have different ones check all the docks based on your chipset pwm it's going to allow us to make the light you know bright or dim you'll notice ID output component here matches here the pin is D1 you can use the D but then no not that one but you can or you can use GPI numbers so I did D5 we're going to put D5 there I'm going to go ahead and put gpio4 Sometimes some board it gave me an error saying D5 wasn't any good so I just I want to go back and check to be sure is D5 is is gpio4 it's not a bad idea to just use the gpio numbering scheme I promise you so we'll go ahead and save this and again we'll hit install and do the whole wirelessly thing I'm going cut this part out and jump to when it's done once it's flashed go back to the visit use baby steps I know we're going through taking time but this is the way you learn go back and hit visit now you'll notice guess what we got an entity Now red LED it's the state is off I'm going to go ahead and turn it on you should be able to see it above my big head there's the red LED it transitions there is you know this transition length is 1 second that's a default setting if you don't like that you can change it to make it shorter or longer now let's test to make sure we can dim this thing yep sure enough we can dim it way down it's an LED and pretty slick stuff we just added a simple LED and we didn't really do any coding now let's go ahead and add that for the button to you know turn the light on and off now you may be tempted to jump in here to like hey I want to go look at the button components it's a little bit different because it's actually going to be a binary sensor so I was going to do the binary sensor now if you want a good example and maybe you don't want to come in here and do a binary sensor and you're not really you're confused about it about hey hey the pull-ups and everything and the pull-up resistors and let's go look at one that works let's jump into my website let's look at the sonoff S31 plug we just covered recently with ESP home and tasmota you'll notice a lot of the same stuff and now that you've kind of got accustomed to this you can probably read some of this now you may not be able to write it that's very common with some programming languages you want to call it that but you can read it you can copy and past past it so now I'm going to take and copy this binary sensor out of here sensor here and I'm going to comment this out because I don't want to do the onpress event yet so here we are binary sensor that's a module of ESP home the platform is gpio so it's going to be an input on a pen so now it's going to ask you well which pen there's gp0 that's the sonof 31 we're not using that pin we're actually remember we did the D6 that was gpio2 and then mode input pullup and now this probably is not the time to go over all of this because there's a ton of different ways but basically what's happening is the PIN is waiting for and we tied ours to ground so when we push the button it's going to pull that to ground well you don't want that flapping in the wind so what happens is you tell her to do a pullup well the chip keeps it up so then when it pulls it down it can pull it down so it's kind of like think of it's springloaded and so that's what we're going to do with input pull up and the inverted is not going to be true on this one I don't believe but we'll see let's do false you don't know give it a shot screw it up go put true so we're going to call this the button sure enough that sounds good I commented this out just using the pound sign or if you're one of the younger ones the hashtags so we'll hit install do the wirelessly and let it update and then we'll go jump into the web page see if we're right on this thing or not and hit visit and for some reason doesn't refresh you may need to refresh now I look like I was wrong see it says on so when I push the button but it's pushed down now it goes to off and then the button is on so I was wrong there so let's go ahead and change that to inverted true so now we get the off and we push the button there's the on and now we're just going to go put in a on press to actually turn that light on uncomment those this is going to be a a light not a switch so let's just change it to light and oh we don't have an ID the internal ID on the actual light itself so let's go do add one let's do ID red LED and so then light toggle red LED so basically on press toggle the light now you'll notice all this is happening on the chip itself we're not making automations in home assist assistant so we haven't even put this in home assistant yet it's all happening internally so now we go back to visit once we did that we should be able to if I just push the button and you can see just pushing the button turns the LED on and off so it's just just like a light switch whether you push the button on it it turns on the LED or it would be a smart plug that has a button on the side and then it just turns on the relay or whatever lights Etc you can see really the Simplicity of how this is set up and configured in the yamama file itself now this is all fine and dandy but how do we add this to home assistant and control it in there this has been nagging me down here during the whole video if your autodiscovery Works mdns Discovery and all that works on your network if you click on this you should see a new component and I have quite a few here but this is my test box so look there it is node MCU test I can dig through there hit configure and we can hit submit it automatically puts it into my ESP home integration if it's not there you can hit add integration and actually go put in the host name or the IP address of the device that would be if your mdn autois Discovery everything is not exactly working correctly that can be a very whole thing depending on your setup so come to here we should get node MCU test and I have seen this quite a bit when you add something to it you just need to refresh the page and then you'll get the other sensors once it refreshes you can see we get the red LED there's the button showing the off and see it shows the on goes very quickly because this is all local if you do pick up the red LED the stupid entity card um you can change the dimming level there I slid it out of the frame of the camera so what we get for being unscripted right but um that's how you add a device all in straight into home assistant and build it yourself then you can see adding more buttons and more relays and everything you really just need to go through and just add more code to your yaml pull stuff out of the documents or adding sensors Etc and then you got get really stuck go dig around hey I want something that I'm going to pull out of here on say this wise plug outdoor outlet the yam file gets fairly big I got two buttons there's two outputs there's a light there's a lux sensor on this there's power monitoring there's a binary sensors there's a status LED we can go pull the status LED in for ours but you can see the thing of this if you want just this go copying that not stealing somebody else's code you're just taking modules that someone else already wrote you can read it but maybe don't understand exactly how to write it I never remember just paste it into yours and call it a day make it work so hopefully this was able to get your feet wet and dig a little deeper into more than just copying and pasting an entire script and just hoping it works now if you can see how easy it is if you want to play around with some sensors air quality sensors you build your own thing you can do Bluetooth stuff distance electric the whole nine probably something I would probably get into just to maybe add a little more to things and is probably get into some of the like temperature sensors like say the ahts um they're I squared seed it's a little bit more than what we're doing here in this video but you can see here it's all copy and paste you want the sensor in there that's pretty much it you add the I squared c section you follow right along in the docks for your sensor and call it a day the docs are pretty damn good on here for having to do all your things you know for whatever sensors you need so if you got any other questions on things you really get stuck with something you got a weird device whether it be like a dimmer a switch or some of those 2ya MCU secondary deals and you don't really know some of the things on there um maybe we can cover some of that but we can definitely help you out in the Discord you'll find that Discord link Down Below in the video description so I do appreciate you watching all the YouTube members patreon members definitely couldn't do it without you definitely shoot us a comment press a subscribe thumbs up whatever it may be and well y'all take care
Info
Channel: digiblurDIY
Views: 13,535
Rating: undefined out of 5
Keywords: digiblur, digiblurDIY, home automation, hass.io, hassos, tasmota, esp32, esp8266, arduino, esphome, diy, smart home, electronics, cameras, zigbee, wifi, esphome how to, getting started with esphome
Id: AAMMob9f-mk
Channel Id: undefined
Length: 33min 46sec (2026 seconds)
Published: Fri Dec 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.