Easy Aqara bed sensor vs ESPHome

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] foreign [Music] [Music] would be more of a gimmick than something that was actually useful but it turns out I was completely wrong I've got a pressure pad wired up underneath each side of the mattress and they are connected into my home automation platform called home assistant they can be used to trigger automations when either someone gets into bed just like you saw at the start of the video or when someone gets out of bed I found they worked best under my mattress when I followed them over and put them at about butt level down the bed it took a bit of trial and error to get them into the right place but they've been really reliable ever since in my house I use the sensors to not only trigger automations but also to prevent some automations from running when someone is detected in bed for example I don't want the ceiling lights to come on in the bedroom if there's someone having a sleep and these pressure pads don't just have to be used for bed sensors they open up a whole world of automation options you could put them under the sofa cushion to detect if someone is sitting on the couch and then automatically pause whatever is playing on the TV and increase the light brightness when that person stands up and leaves to go to the bathroom or to get a snack another great use for these is to keep an electronic eye on a person who needs care or to let you know if your children get out of bed in the middle of the night you could put one under your dog's bed and trigger an automation telling them they're a good doggo over your smart speaker when they get into bed or under a doormat so you know when there's someone or something standing at your door there are so many options and that can be all triggered with the same types of automations I'll show you how I've configured my automations later in the video but first I'm going to show you two ways that you can make one of these bad sensors yourself the easy way and the fun way as usual I've written an article on my home automation guy website that shows you both the easy and fun way to make these sensors along with links to all the equipment that you need screenshots code samples and other important information so that you can follow along without having to constantly pause and restart the video so sit back relax and watch the full video through if you then want to make this at home you can then follow the link in the description to check out the article if you're going to follow the link you may as well hit the Subscribe button whilst you're down there either way no matter what method you choose to make these sensors you'll first need to buy a pressure mat I bought two of these pressure mats from Amazon and they were less than 25 dollars each they're really quite basic and are essentially just a pressure switch that makes contact and closes the circuit when you add weight to the mat and squish it down mine came with four wires and honestly I don't really know what they all do I found that the bottom two wires were the switching wires that I needed and I was able to find this out using a multimeter on the continuity setting when I press down on the mat with the wires connected to the meter it made The Telltale beeping sound telling me that contact had been made a note of these wires because you'll need them for both of these methods if you don't have a multimeter you can probably just guess at the wires and if it doesn't work when you build the sensor then keep trying all the other combinations until you get it to work it's not very scientific but it'll do the easiest and fastest way to hook this pressure mount up to your smart home platform is to use an acara leak detect sensor like this this sensor uses zigbee and is compatible with the acara Hub Apple home kit and of course home assistant using Zha or zigbee to mqtt it has these convenient terminals on the back which you can unscrew with an allen key and then attach the two switching wires to these terminals one on either side it doesn't really matter which wire goes on which side all we're doing is completing the circuit across the two terminals once you connect this sensor to your home automation system in this case home assistant you'll see that when the sensor is pressed down it will change the state of the sensor to indicate that water is detected even though this now works fine and you can use this sensor as is in your automations you probably don't want your smart home telling you that you've leaked into the bed that's an entirely different thing to fix this in home assistant you can go to the settings of the water leak entity and change the show as setting from moisture to occupancy and whilst you're there you can give it a more reasonable name like bed occupied you can now put this sensor under your mattress or under your sofa cushion and it will tell you if the bed or pressure sensor has detected occupancy or not rather than telling you if it's wet or dry if you're lucky or unlucky enough to share your bed with someone and you have specific sides of the bed you can make two of these sensors and then your smart home will know who exactly is in bed if you tend to be in bed alone or different people at different times I don't really care I don't judge then you can wire two or more of these pressure mats up to the same leak detector terminals strategically place the mats under your mattress and it will trigger the sensor no matter what part of the bed is occupied I have two separate bed sensors in my home and my partner and I generally sleep on the same side of the bed each night I use two home assistant binary sensor helpers in my home to give me a bit more information and to trigger different automations the first helper is called main bed occupied and I've added both the sensors here as members if you make sure that the all entities toggle here is turned off then the binary sensor will turn on when either of the two sensors detects a person this means that the bed is occupied by at least one person the second sensor is almost the same but has the all entities toggle turned to on this means that the sensor only turns on when all of the sensors are turned on or both sides of the bed are occupied this generally means that we're both in bed and I use this sensor to automatically turn on nighttime mode which turns off all the lights activates the house alarm and puts the house into a low power mode I'll show you that Automation in detail a bit later on so that was the easy way to make one of these pressure sensors for your smart home it's time to look at the fun way I originally set out to use this project as a way to learn more about a technology called ESP home ESP home is a system that lets you program itty bitty teeny weeny low power computers like this one and turn them into almost any kind of smart home sensor it looked like a really powerful but complicated system and I thought a simple project like an on off bed switch would be the perfect way for me to get stuck in and learn the basics so the next part of this video is me making the same bed sensor using an esp32 device and learning how the basics of this technology works so come along for the ride and learn something with me the theory is basically the same we wire up the pressure mount into some input output pins on an ESP microcomputer and have it tell home assistant if the map is pressed down or not I know a lot of people don't really like soldering so I found some esp32 devices on Amazon that already have the pins soldered onto them then I found a prototyping board that you can just plug this device into that lets you screw the wires into a terminal block the screw terminals on the side aligned to the pins and you can see how they line up by looking at the back of the board it's a great way to prototype using ESP devices without having to stuff around with soldering things and I highly recommend them I've decided to wire my sensor into the 13th i o pin known as gpio 13 for no particular reason other than that it's located on the bottom left of the ESP device right next to where the Ground Terminal is the pins are labeled on the ESP board itself and they probably don't correlate perfectly with what's written on the prototyping board so make sure that you double check the actual labeling on the device there are some great resources online that show you what each of the pins mean and I've linked to some in the article I've written on my home automation guy website about this I'm now going to screw the same two wires from the pressure mat that we use for the leak sensor into the ground or gnd terminal and the D13 gpio pin try and do a better job than I have you shouldn't have these strands of wire poking out but hopefully you won't be trying to film yourself doing this when it's your turn once you've wired in the pressure mat you can take your newly built sensor over to your PC and plug it into a USB port open up a browser and head over to the web.asphome.io website which is a web tool that lets you flash the ESP home software onto your new ESP device hit the connect button and select the ESP device from the list that pops up if no compatible devices are found then you probably need to install the drivers or make sure that you're using a USB cable that actually has data pins in it and not just a charging cable if you hit cancel here it should show you a whole list of troubleshooting options and links to install the correct drivers for your operating system with the drivers installed and the correct cable plugged in you can try again and hopefully this time you'll see a device listed select it and click connect then choose the prepare for first use Link and let it install the firmware finally join the device to your Wi-Fi network next up we need to go to home assistant and make sure that the ESP home add-on is installed if you're not using home assistant OS then you'll need to install the docker version and the instructions for that are linked in the article below open up the ESP home web interface and you should hopefully see your new ESP home device automatically discovered click the adopt button and bring it into your control you can now give it a name click adopt and install to make it yours so to recap what you've done so far is install the ESP home software onto your device and connected it to your ESP home control center in here you can start configuring your ESP device to make it do whatever it is you want to do to configure your bad sensor we'll start by clicking the edit button and that will bring up the default configuration that was pre-installed when we adopted the device scroll to the bottom of the configuration and paste in the configuration from my home automation guy website article this will create a binary sensor in the ESP home device which will eventually be accessible in home assistant the first part of this configuration tells ESP home that this is a gpio binary sensor meaning that the value of the sensor comes from the gpio pins and we're using pen 13 because that's the one we connected our wire to the inverted input and pull-up settings tell the ESP device that the sensor is considered on when the pressure mat has weight on it and therefore closes the connection you can read all about these settings on the ESP home website if you want to know more about them we then give the sensor a name and a device class in this case we want it to behave like an occupancy sensor rather than say a leak detector or a door sensor finally I've added some filters which have helped me improve the accuracy of this sensor the delayed on setting means that the sensor won't turn on until the sensor is in this state for at least five seconds and the delayed off means it won't turn off until the sensor has been in that state for 30 seconds what this essentially means is that it won't report you as being in bed until you're laying on the sensor for more than five seconds this helps reduce false positives if something briefly causes the sensor to close and open up again the same thing happens when you get up off the sensor you have to get off the sensor for at least 30 seconds before it's reported as the bed being unoccupied I found that without these filters the sensor would flip between occupied and unoccupied all night as I rolled around in my sleep adding these filters helped keep them very accurate and consistent so with the configuration added you can click the save button and install to wirelessly push this new configuration to the ESP device once you've deployed the configuration you should see the logs page telling you that the device is online and connected we can now press the mat down for more than five seconds and you should see the log update to tell you that the binary sensor has been triggered lift your hands off the map for more than 30 seconds and you'll see the sensor turn off again the ESP device should also have been added to home assistant at this point and you should see the same thing happen with that sensor when you hold the mat down for over five seconds and then again after 30 seconds of the weight being removed the beauty of the ASP device is that you can wire in a second pad to the ground pin and another gpio pin in this case I've chosen pin 12 and you can copy and paste the configuration from the original sensor to create a second bed sensor for the other side of your bed just update the pins and make sure that each sensor has a unique name then re-save and install the configuration you should now see two separate bed sensors in home assistant and you can add them to the helpers just like I did before you can actually take this even further and create a super duper multi-sensor by attaching temperature sensors PIR motion sensors millimeter wave sensors all to the same ESP board giving you a Swiss army knife equivalent of home automation sensors this is exactly what Lewis did when he was designing his everything presence one smart home sensor and I used several of those around my house but not for much longer because I plan on creating a few of my own clever multi-sensor for a few specific places in my house and then 3D printing special cases for them if you want to see me do that then subscribe to the channel and then you'll be notified when I do a video about it now before we go I promise to show you how I use these sensors in my automations the first one is the automation that played out at the beginning of this video the automation is triggered when the bid occupied changes to on so if anyone has gotten into bed it then simply calls the cover.close service to close the Blind and the light.turn off service to turn off the bed head and ceiling lights another automation puts my home into nighttime mode when both of us have been in bed for at least half an hour this is triggered when the both in bed helper goes from off to on for at least 30 minutes there are a couple of other things that can also trigger this automation like scanning an NFC tag or if one person is in bed and the other one isn't home but that's not for this video the condition then checks to make sure that it's night time and then the automation runs my nighttime script which Powers down all my Sonos devices my TV stand our work desks and does a bunch of other clever power saving things it then goes on to activate the home alarm system to night mode finally I use the bed sensor to stop some automations from running at night specifically I don't want the lights to turn on in the bedroom when motion is detected if someone is in bed here you can see that I'm using a condition to check the state of the main bed occupied helper to make sure it's off before I run the actions to turn on my bedroom lights all in all this is a very useful sensor to have in your smart home and you now know how to get it working nice and easily using an acara leak sensor or you can level up your smart home game by starting to learn about ESP home do you use ESP home in your smart home what for let me know in the comments below and whilst you're down there please give the video a thumbs up if you found it useful and if you're feeling super generous I would really appreciate a super thanks we'll let you donate money to my channel so I can continue to make videos like this in the future or you can subscribe to the channel for free and get notified when I release new videos and then together we can make your home smarter
Info
Channel: Home Automation Guy
Views: 106,730
Rating: undefined out of 5
Keywords:
Id: 2tL7n8RRLBc
Channel Id: undefined
Length: 15min 59sec (959 seconds)
Published: Sat Sep 02 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.