Getting started with ESPHome

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to show you how to get started with ESP home it's a great app for integrating DIY smart sensors like this one into home assistant and whether you're just getting started with ESP home or if you're fumbling your way through it or if you consider yourself an ESP home expert and just looking for a couple of tips and tricks then this video might be for you so let's Dive In [Applause] so firstly I'm going to give you a quick overview of how ESP home works and then I'm going to show you different ways that you can install ESP home and then I'm going to show you how to understand and structure the yaml files and then finally I'm going to give you a couple of examples so we're going to have a physical switch and that's going to create a switch in home assistant and then we're going to use a PIR sensor and have that as a sensor in home system as well so firstly what actually is ESP home well it's a piece of software that's component based so you can add lots of different components together and create a piece of firmware which you then upload to one of these devices most commonly you will create temperature and humidity sensors but there is a lot more it can do as well lately the most powerful tool is the Bluetooth proxy which allows you to link Bluetooth devices through one of these to home assistant instead of having a Bluetooth dongle directly on your home assistant instance so that's really useful another really common use case for ESP home is presence detection so in this video I'm going to show you a PIR sensor but there's lots of other types of present sensors as well so you can have Bluetooth sensors and also lately mm wave sensors have become really popular so the first thing you're going to want to do is you're going to want to install the ESP home add-on in home system so just go to the add-on Store and search for ESP home and then install it and then from there you'll have a menu on the left hand side where you can navigate ESP home and you'll be able to add your devices so now that we've got that installed we're going to press new device it's got some information here about it not having a secure connection so my browser hasn't got a secure connection which means that I can't actually install it directly from ESP home in here I'm going to need to use the web version instead but I'll show you that shortly so for now we're going to press continue and now it's asking me to create a new configuration so this is the name of the device it's also asking for Wi-Fi credentials now this is because we haven't got any setup yet because it's the first device once we've done it once it won't ask again and they'll be stored in the secrets file up here let's press next and now you've got to select the device type so as you can see here it now supports the Raspberry Pi Pico W which is great esp8266 which we're going to use and then the esp32 and a few of the variants that have also been added recently so now we've done that we can see it's creating a new configuration file and it's asking us to install it but we're not going to do that for now we're going to press Skip and have a look at the configuration so if you press edit you can see this is the configuration now this is just some default configuration it's got the Wi-Fi settings here but not much else really so now we want to install this default config onto the ESP device and then going forwards we'll be able to update it wirelessly so let's press the three dots and press install and it will take us back to to these options of what we can do to install it so at the moment we can't do it wirelessly we can't do it by this computer plugged in from this interface because I haven't got a secure https connection and we can't do it via the server because this computer I'm running on isn't the computer that's running home assistant so we're going to do manual download and then it allows us to download the file as you can see here it's suggesting that we use the modern format for the website so now it's compiling the firmware and then we will be able to have a file to upload to the device so that took a couple of minutes to complete but it's now finished and you can see that it's downloaded a bin file so to go to the website we can cheat and press new device and then press open ESP home web now let's press connect and this is the device here it's a bit of a strange name but I know that this is the device because this is the com Port that was added when I plugged it in so if we now press connect now what we want to do instead of pressing prepare for first time use we want to press install and then it's going to allow us to choose that file that we just created so here's the bin file let's double click that press install we can see that it's erasing the flash memory on the device to start off with and then it should add the new firmware great so that says it's installed so let's press close and now let's go back to ESP home once you've got your device set up in ESP home then it should appear automatically as an integration in home assistant you might need to press configure and then add it to home system but then you'll be able to see all of the entities for that device so we can now see that the device is showing us online and we can also see it's picked up another ESP home device as well one of my Bluetooth proxies so if we press logs and then wirelessly then we should be able to see some information you can see it's connected to the device wirelessly and it's working as expected now let's go to the integration section and see if it's discovered it here we go so we can see we've got a test one device here so we're going to press configure now that it's been configured you can see that it's got one panel for all of the SP home devices that have already been set up as Integrations so test one is the one we're interested in you can see it's got one device and one entity so if we press here we can see that it hasn't actually really got any proper entities and that's because it's just a default configuration at the moment so the first thing we're going to do is we're going to add our capacitive touch button to the configuration and connect it up to the ESP device so to update the code we just need to press edit and then make the Amendments here I'm going to paste this code for now and I'll explain it later so we press save and then install and then it gives us the options again of how to install it but now we've already got it installed we can do wirelessly this will again take a minute or two to update the firmware on the device so now it's uploading to the device itself there we go it's done you can now see that it's connecting to the home assistant instant and it says that it's successfully connected what we can actually do now is press stop confusingly that doesn't actually stop the device it just exits out of this we're now going to click back into this integration and we can see there's now two entities so we can see here the Touch button so you can see at the moment that the sensor is showing that the Touch button is on but that's because I haven't got the Touch button connected to the device yet and you can see here the different pins on the ESP device and you can see here this is the Touch button and it's got a ground connection a VCC which is the plus voltage and then an i o pin which is going to be an input pin in here so we all we need to do is connect these three wires up to here so we're going to use D2 which is this one here and then we're going to connect these three wires so let's do that now and then as soon as we do that we will see what we should see at least that the Touch button will show us off until I press the button so I'm going to connect this to the 3.3 volts because these buttons can actually deal with down to two volts here we go so you see how I've connected it and the Touch button is showing us off and now I'm going to press the button hold it and you can see it shows on release and it shows off with these touch buttons you can actually configure them so that when you press them they latch on so they will stay on and then press it again to go off or you can have it as it's set at the moment whereby you hold it and then it shows that it's on and you release and it shows that it's off to do that you need to amend the pads on the back so there's an A and A B solder pad and you have to solder those if you want them to do different Behavior so now on to the PIR example so it's the same setup as the Touch button basically but just a different PIN number so we're going to be using D1 instead so you can see as I move or wave my hand in front of it then it's going to go to on so looking at the wiring we've got ground here and then we've got the signal line the input to here and then we've got the 5 volt line so we've got here we've connected to the D1 here ground and here five volt so on the D1 mini we have 5 volts available and 3.3 volts available because we've got five volts coming in from the USB port and then we've got a voltage regulator on board that can down regulate it to 3.3 Volts for this sensor we need 5 volts so I'm using the 5 volt one whilst we're talking about voltage this needs between 5 volts and 12 volts to work however it has got an onboard regulator itself so what you actually can do if you need to run it from 3.3 volts is you see this pin here actually bypasses the voltage regulator and so you could plug it into 3.3 volts on the microcontroller and this spare pin here so now you've got your sensor working and you've got an entity and home system that you can use so all you need to do now is create an Automation and then use these sensors as a trigger in this example we've only used binary sensor for both of them but there's lots of different other types of inputs and outputs available for ESP home so just take a look at the documentation and there's a lot of examples for most things so you should be able to figure it out it's worth noting that different pins on the microcontroller have different functionality some are for input some for output some for both some of the analog some are for digital and in this example we've used digital inputs but you need to choose the pins carefully as well so for this device D1 D2 5 6 and 7 are your safe pins so I've used D1 and D2 here it's worth noting also that pull down and pull-up resistors can be used to make things more reliable so what I've done for these is is they pull down by default so in the configuration I've set them to pull up and that means that false positives will be reduced so before we wrap things up let's have a quick run through the config file and I'll show you some things you can use so starting at the top we've got an ESP home section which I don't really tend to touch other than the name and the friendly name so you just name that what you want for the device the next section you've got board so this is the board type so I'm using a D1 mini but as you can see here if you hover over it and you press this list it will give you a list of all the different boards so for example you might use a node MCU instead of a D1 mini so you need to put something different here for that now for the logger you can select different logging modes so you can have debug and verbose Etc so that if you need more logging information if you've got issues then you can Define that here and again it gives you links if you hover over it to the document Temptation where you can see more about it the API section is how home assistant communicates with the ESP device so when you create a new device it automatically creates one of these for you the OTA section means over there and that's for over-the-air updates so you can define a password here which is auto generated normally so that not anyone can just do updates to your devices without your permission the Wi-Fi section is fairly self-explanatory so the SSID of the Wi-Fi access point and the password but you can also Define other things like whether you want it to be a static IP address AP is an access point as it says here so it's a failover access point if it can't communicate with your Wi-Fi then it will create its own access points so that you can still get into the device the captive portal section relates to the AP section above so basically it just gives you a front end so that you can access things if it can't get onto the Wi-Fi and then this is the section that I added so going through this we've got a binary sensor section and then these are different sensors so we've got two sensors set up so the platform I've chosen is gpio because we were having it as an input for the pin number you can normally put something like gpio4 here for example but with the D1 mini you can actually put the D number that's on the device itself instead so it just makes it a bit easier and then the mode that's whether it's an input or not so here I've got input true and then also I've got the pull-up section set to True which means there's a pull-up resistor that gets enabled so the name is the name of the entity that will appear in home assistant it will get prefixed with the name of the device just to ensure that it's Unique so one bit of functionality which can be useful especially if you use and get lots of times within your script I mean this is a fairly small script but if it's a bigger script then you might use the same variable multiple times so what you can do is is you can use something called substitutions so here you can have a substitution section and then you can have the name of the variable and then the value of the variable and then you can reference that further down so say if I wanted to access that for the name for example then I would do this so you do dollar sign Open brackets and then the name of the variable and then close the brackets another section that's quite useful is packages you'll probably see some references to that sometimes especially if you've got Bluetooth proxies so here's an example of a Bluetooth proxy reference using a package and then it's got the URL here we can actually go to that URL and GitHub and see what it looks like so if you look here you can see that it's just simply a yaml configuration so this package just contains some other information that it will then include in your yaml file there's some good documentation on the substitution and package sections so if you have a look in the documentation here you can see there's a substitution section and there's a packages section so I'll have a read through that and finally I'm going to show you web server so if you put this in you can Define any port number you like but it creates a front end for the ESP device and that means that without home system you can actually have a look at the entity States so I'm going to save this upload it to the device and then show you what it looks like so I've now uploaded the new firmware to the device and then I've just gone to the URL of the device so test1.local you could use the IP address instead and as you can see it's got the two entities here that I set up for this video so PIR and touch button and you can see that the PIR is showing us on at the moment and the Touch button is showing us off so now I'm just going to go in front of the PIR and the stage should change to one and there you go there's a few bits so hopefully get you started using ESP home I've seen some examples online where they don't show you using the pull-up configuration and this is where you can get into trouble and have false positives another reason why you can have false positives if you've got an unstable voltage so make sure that you've got a good voltage input it's the correct voltage and it's a good power supply well hopefully I've shown you enough in this video to help you get started with ESP home I'll probably revisit this topic and I'll connect lots of other different sensors to ESP home because there's lots out there you can go on AliExpress and get loads of different sensors for just a couple of dollars each so that's it for today please consider subscribing if you liked the video and comment down below with your ideas and thanks until next time [Music] foreign [Applause] [Music]
Info
Channel: Let's Automate
Views: 23,402
Rating: undefined out of 5
Keywords: esp32, esp8266, esphome, homeassistant, home assistant
Id: cfkW7ZmiMEw
Channel Id: undefined
Length: 15min 23sec (923 seconds)
Published: Fri Jul 28 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.