ESPresense v3: Room-Level Presence Detection with ESP32 for Home Assistant Made Simple

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today I'm going to show you how to use an ESP 32 board like this to achieve room level presence detection with ESP presence and home assistant and if you're ready let's go this is one of the easiest setups out there for this you're going to need an esp32 board a micro USB cable and a standard 5vt power supply and you can even print a simple case like this or this to protect your ESP 32 board the number of boards that you'll need depends on the size of your house house so for example in my case I will only need four boards to cover all my house I plan to use one for my entrance SL kitchen one for the living room one for my bedroom and one for the bathroom that way I will be able to accurately detect in which room I left my phone since apparently I am not able to not lose it every 5 minutes and not only that I will be able to use this as an additional device tracker to improve the accuracy for my presence detection and it allows you to create more contextual automations since now you will know which person is in every room so your automations can adjust based on who is present in the room this will be better with something like a smartwatch or a miand that will be with you all the time to get this working just go to my website first you need to install the mosquito broker add-on in home assistant if you don't know how to do it I will put the link in the description to one of my videos with that out of the way just click on ESP pressent installation then click here to go to the installation page and now just connect the micro USB cable to your esp32 board and connect it to your computer then just click on connect and here you just need to select your device in my case is the com 7 and then click connect once it's connected just click on install ESP presence select erase device and then click on next and then install if the installation doesn't start like you watching you might need to press one time the button on the left and that's it the then click on next and now configure your Wi-Fi and click connect every time that I tried it it failed but just click skip then click on loog and consult then click on back again and that's it then just click visit device here we will give it a name then enter your mqtt credentials if you're using the mosquito add-on as I suggested the server should be home assistant so just enter the IP address and use the username and password of your home assistant then just leave everything as default and we are going to disable the status Le for this just enter minus one here and then just click on Save and now just click on restart device and now go to home assistant here go to settings devices and services click on mqtt click on devices and if everything went well you should now have one ESP presence device just click on it here we have two important settings to adjust the first one is the absorption this is the value to account for the amount of stuff between your rooms we are going to use this value to calibrate our device for this just click on visit then add a slash UI at the end and here go to fingerprints and here we need to understand how this works so you can understand its limitations to calculate the distance they are using the RSSI value that is the signal restraint with which ESP present detects another Bluetooth device this means the calculation of the distance can be affected if for example you put your phone in a box because the signal strength will be lower so with that in mind we are not trying to get an exact value only a close approximation so what I want you to do is put the device that you want to track 2 m away of the ESP person device that you want to calibrate and adjust absortion value until the distance is close enough to the real value every time that you adjust the absorption value you need to wait a little bit for the distance to be stable again and try to repeat this exercise putting the device further away and that's it I know that this is not the most accurate way to De calibrate the device but it's simple enough for anyone to do to get better results out of the ESP presence device and the other one is the max distance this is the max distance from the board to thech devices you might want to adjust this value if you find overlapping between your rooms and now I'm going to show you how to track your rle phone for this first install the home assistant app you can use this button here and then just open Home assistant on your phone open the sidebar go to settings scroll down and touch companion app here go to manage sensors and we are going to scroll down to Bluetooth here you need to activate the Bluetooth L energy transmitter just activate this scroll down and we are going to adjust the advertise mode to balance and the transmitter power to low these settings were the one that gave me the best performance without impacting my battery life and that's it now for the miand you need to activate the discoverability option if you don't find the option in the set Life app you can use the app notify and fitness for meand and activate it there and after that you can safely uninstall the application in version three of ESP presence they added a more reliable Bluetooth tracking for iOS devices for this just go to home assistant and here go to settings click on devices and services mqdt click on devices select the ESP presence device more close to your iPhone and then click on visit here we just need to add at the end a slash UI and then just give it a name and click en roll and now you just need to go to your iPhone look for Bluetooth devices find ESP presence device and tap once to connect it will disconnect itself automatically atically so if you see disconnected everything is okay and after that es pres will be able to accurately track your iPhone and now we need to create a sensor in home assistant for each device that we want to track for this just go to settings devices and services click on mqtt click on devices and here we're going to click on the closest ESP pressing device that we have then click on visit here just add UI at the end then click on fingerprints and here we need to find the ID the device that we want to track and just copy it and then go to home assistant click on file editor and here under sensor we are going to paste the value now go back to my website and here we are going to copy the value for create ESP present sensor and just paste it since I already have sensor I'm going to raise this and then just update the ID on the template paste it in device ID and at the end of estate topic here just update the name and the way time out this is the amount of time in seconds that ESP pres will wait before setting the device as a away and then just click on Save now go to developer tools and restart home assistant after it finished just click on States and here we're going to to look for the name of the device and that's it you can see now that home assistant already knows that the device is near the ESP present entrance device and now I'm going to show you how to use this with a device tracker one of the limitation that we have is that this is only a sensor not a device tracker so we cannot directly assign it to a person to track it in our house so for that I'm going to show you how to create a device tracker for this just go to my website and here just copy the code for simulate device tracker now go back to home assistant and go to file editor here we need to paste the code on our known devices Jamel file for this just click here and if it doesn't exist just click on here and create known devices dojo and click okay now just click on it and paste the code here you just need toate the ID and the name of your device then just click on Save and then just go to developer tools and restart home assistant after it's finished just click on States and here we are going to filter theice trucker and here it is now we need to create an automation for this just click on settings click on automations click on create Automation and create new automation then go back to my website and here we're going to copy automation to translate ESP present sensors to device tracker just click on it and then go back to home assist assant click on the three dots here click on editing Jam just select everything and paste it now you need to update the ID of the tracker that you want to update here and in location name you need to update the names of your ESP present devices and then just click on Save give it a name and click rename now click on the three dots again and click on editing visual editor what I wanted to show you is why the template condition is needed since this is a Bluetooth device and the distance is updated constantly if we don't set this condition every time the dist time updates the automation will execute since we want to test this for the first time click on the three dots and click on disave then click on Save and we are going to wait for it to be triggered and then we are going to activate it again and click on Save again now if you go to developer tools and look for device tracker 1+ 7 you can see that now now I have a device tracker and I can go to settings people select my user and add it as a device tracker and then click update this way all my automations using person will benefit with this device tracker I have been doing some testing to verify the accuracy of this I tested two Android phones one iPhone one Smartwatch and one miat and I found that unless you're using a meand we are going to get a lot of false negatives which means that even though the device is home it's not going to be detected by Bluetooth and this is because of the way that mobile devices are built to preserve vir life what this means is that if you're not using your phone or your Smartwatch and it enter s sleep mode it will stop advertising its Bluetooth signal and because of that ESP present will not be able to detect that it is home so to get around this limitation if you are not only tracking neand we can modify the automation to get all the benefits without its Throwbacks for this we are going to raise two lines the line eight and nine and then click save what this is going to do is that when the device is not home like this instead of setting the device tracker to away it will set it to unknown this is going to tell home assistant to ignore the device tracker that way if we get a false negative instead of setting the person to a away it will just ignore the bluetoo glow energy device tracker and it will use another device tracker to determine if we are home or not this way we get all the benefits without being affected with the false negatives and that's it if you want to know more check out my level up your presence detection in home assistant video and if you like my work please consider support me on coffee using the Buton of my website or the link in the description either way I will be journalism and don't forget to subscribe for more content like this I'll see you on the next video [Music] bye
Info
Channel: fixtSE
Views: 5,723
Rating: undefined out of 5
Keywords: ESPresense, Presence Detection, ESP32, Home Assistant, Mosquitto Broker, Home Automation, Room Level Presence Detection, ESPresense Installation, ESPresense Configuration, Calibration, Android Phone Tracking, MiBand Tracking, iPhone Tracking, Sensor Creation, Device Tracker, Accuracy Detection, ESP32 Tutorial, Home Assistant Setup, Smart Home Automation, ESP32 Integration, IoT Devices, Home Assistant Add-ons, home assistant espresense
Id: u7pn2_2l7OI
Channel Id: undefined
Length: 11min 43sec (703 seconds)
Published: Sat Sep 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.