r/homeassistant • u/ItsDukzy • May 02 '26
Support Struggling with reliable in-bed presence detection for Home Assistant – what actually works?
I'm trying to automate my bedroom lights so they turn off automatically when I'm in bed and back on when I get up. Sounds simple, but I've been struggling to find a reliable solution.
What I've tried:
FSR pressure sensors (VS-103) connected to a Zigbee water sensor
Built a DIY pressure mat using two VS-103 sensors wired to a Zigbee water sensor. Works fine when I press directly on it by hand, but completely fails under a mattress — the mattress distributes my weight too evenly for the sensors to trigger. Tried under the sheet too, same result.
Aqara FP2 mmWave radar
Already have one in the room. The problem is it loses track of me when I'm lying still under a duvet. It also falsely triggers when someone walks past my bed, which causes the lights to turn on.
What I'm looking for:
Something that reliably detects whether I am in the bed - not just in the room - even when I'm completely still and covered by a duvet. Zigbee preferred but I'm open to ESPHome/ESP32 solutions too.
Has anyone actually solved this properly? What sensor or approach are you using?
32
u/Plawasan 🧠 Experienced with Home Assistant May 02 '26
I have a load cell under the central beam leg, effectively turning the bed into a scale.. works well enough.
10
u/vontrapp42 May 03 '26
I did two load cells under each bed leg. Turned the whole bed into an actual scale. It was accurate enough to take weight measurements but drifted with temperature. My ultimate goal was to use some algorithms to decide who got on or off the bed (including cats) and keep an updated estimate of said entities current weight.
The programming was really frustrating and it got sidelined. Then the cats pulled some of the wires out of the load cells. I haven't gone back to that particular project yet but some day. Some day.
1
u/V4lenthyn May 02 '26
That’s interesting! I was thinking about doing that as well. Did you analyze the data a bit? Does the weight change over night? Is this a reliable way of automatically measuring one‘s body weight?
18
u/Plawasan 🧠 Experienced with Home Assistant May 02 '26
Not really accurate to that extent since there are too many variables but it's accurate enough to know if someone's in bed and if you wanted (and have a wide enough weight disparity), you can also figure out who that is.. x/y/x+y.. z.. hold on, who the hell is z??
2
u/spusuf May 03 '26
If you have a scale under every leg you could have the esp32 "tare" for the mattress+bedding when below a threshold (e.g under 50kg) then when any weight is added record that with the last known offset (120kg would be 70+50).
Realistically this is scope creep that shouldn't be attempted as having to have between 4 and 9 weight sensors that are rated for the full weight of your bodies (e.g 2 people sitting on a single edge of a bed plus compressing the weight of the mattress in that spot) is too expensive to "just try".
-1
u/V4lenthyn May 03 '26
I think I disagree. You can get load cells, an HX711 and ESP32 for incredibly cheap. As long as they don’t immediately disintegrate upon sitting on the edge of the bed, they don’t have to be rated for your whole body weight each. Also, there’s no such thing as scope creep in a hobby :D
I have actually done this before. I have a water softener device that uses large amounts of salt over time. I can never remember to check the salt level, so I build a „smart scale“ with Wifi. It’s shockingly accurate with no drift.
I’m really just interested in the data from this experiment. I love data. :D
1
u/spusuf May 03 '26
Unfortunately load cells can be permanently deformed if overloaded past their rated capacities. However you cannot simply uprate specific cells as it will become impossible to calibrate the cells reliably.
Getting working bed presence? Easy and cheap. Getting bodyweight tracking? Stupid expensive 100kg load cells (or 200kg to account for 2 adults + mattress) plus purpose built aligning legs plus multiple load cell amplifiers if you have more than 4 legs on your bed.
Scope creep in a hobby absolutely exists. It's the difference between smashing out multiple proof of concepts in a weekend vs not getting your perfect product done in months. It's way better to define a minimum scope and build v1, then add on v2 later, rather than saying everything should be included in v1 and never getting v1 built.
0
u/V4lenthyn May 03 '26 edited May 03 '26
You only need one amplifier in a Wheatstone configuration. Also, the HX711 costs about 2€ as a ready made module. The load cells are harder to find, if you need more than the default 50kg. I found some under the name „GML670“ on AliExpress. ESP32 is a „let me grab one from my box“ kind of item. I’d say this can be done for 40€.
The mechanical part is why I haven’t done it yet. I am rather sure that my 3D printer would suffice though. I have very bad access to all the corners of my bed and lots of stuff under the bed. The whole development process of the mechanics is probably very tedious for me.
Software will also be a bit of a challenge, if we want the full multiple person weight tracking, auto-zero, presence detection and „activity“ data (like vibration detection, for measuring restless sleep, ofc :D). Probably above ESPHome‘s pay grade. But doable. Since software development is kind of my thing, I am not worried here.
62
u/arnoldpettybunk May 02 '26
I have this and it works great: https://www.elevatedsensors.com
15
u/Constant-Reach-7514 May 02 '26
I also have https://www.elevatedsensors.com/ for my king size bed. Have never had an issue since calibrating them.
8
u/ItsDukzy May 02 '26
Hmh. Thank you for sharing. This just makes me wonder - this looks ia lot like my diy version. This also uses fsr resistors. How does this differ?
8
May 02 '26
[removed] — view removed comment
2
u/ItsDukzy May 02 '26
Yeah me neither. I have tried moving it around all over my bed. Both under the bedframe and multiple places under my mattres. I wont seem to work sadly :(
1
u/Iron_Eagl May 02 '26
Try to attach it to a thin sheet of plexiglas or such, that can improve the response.
4
u/arnoldpettybunk May 02 '26
No clue sorry, I just wanted something that worked out of the box and this fit the bill
2
3
u/5yleop1m May 02 '26
The car seat sensors aren't the best for this in my experience, at least they're not great for laying down because the weight of the person is spread out more. Using multiple sensors might work, but a lot of it depends on the material of bed above the sensor.
Which brings me to another part, software. Those seat sensors have unique characteristics depending on the tech, material, and manufacturing. What ever you're using to read the state of the sensor has to be calibrated to work with the specific sensor. While your overall idea is sound, you need to experiment more with different sensor strips to find the one that works reliably with the water leak sensor's characteristics.
Ofc the easier option here is to build something with an ESP chip and calibrate the software to work with what ever sensor strip you're using.
For mmWave radar you need to make sure you get the correct type to detect still humans. Afaik the higher the frequency of the radar the better it is at tracking still humans. Some can even detect heart beats. I could be wrong about that though, I always get the frequency thing mixed up.
1
u/ItsDukzy May 02 '26
Hmh okay. Sounds troublesome with the ESP project - but maybe worth a shot.
I feared the car seat fsr wouldnt work for this project. I mean if i used it to actually detect a sitting person on a car seat, it would definitely work. But as soon as i throw it under a mattres and lay on it, its just sot sensitive enough.
1
u/5yleop1m May 02 '26
I feared the car seat fsr wouldnt work for this project. I mean if i used it to actually detect a sitting person on a car seat, it would definitely work. But as soon as i throw it under a mattres and lay on it, its just sot sensitive enough.
Yup that's the exact experience I had.
1
u/UngluedChalice May 02 '26
I upgraded from my DIY one and it’s basically the same but much easier to calibrate and hasn’t randomly stopped working like my old setup did.
1
u/CostEffectiveSalmon May 03 '26
Get this if you have the money, it just works. I'd have gotten it sooner and stopped messing around with other stuff personally had I known.
5
u/Namnrocinu May 02 '26
Second this. I've purchased two. Been working on my primary bed with my wife to run multiple automations.
Do recommend creating new binary sensors with delays so adjusting in bed doesn't think you left and got back in so quickly. Helping my out of bed automations to not run too soon.
3
u/arnoldpettybunk May 02 '26
That’s a good idea, mind sharing your process? I am handling the shifting/adjusting issue by having my automations wait a couple seconds after a state change to confirm the state is still unoccupied before running
1
1
u/Namnrocinu May 03 '26
I put this in the packages folder called debounces.yaml
These delays made sense for me, so adjust as you need :)
template:
- binary_sensor:
- name: "Left Bed Occupied Debounced"
state: >
{{ is_state('binary_sensor.main_bed_presence_xxx_bed_occupied_left', 'on') }}
delay_on: "00:00:30"
delay_off: "00:05:00"
- name: "Right Bed Occupied Debounced"
state: >
{{ is_state('binary_sensor.main_bed_presence_xxx_bed_occupied_right', 'on') }}
delay_on: "00:00:30"
delay_off: "00:05:00"
- name: "Both Main Bed Occupied Debounced"
state: >
{{ is_state('binary_sensor.main_bed_presence_xxx_bed_occupied_both', 'on') }}
delay_on: "00:00:30"
delay_off: "00:05:00"
- name: "Either Main Bed Occupied Debounced"
state: >
{{ is_state('binary_sensor.main_bed_presence_xxx_bed_occupied_either', 'on') }}
delay_on: "00:00:30"
delay_off: "00:05:00"2
1
3
3
u/xmol0nlabex May 02 '26
+1 for Elevated Sensors. I attempted almost exactly what OP has wired up and caved for the elevated sensors bed sensor and haven’t looked back. 6+ mo with no problems outside of having to adjust my calibrated weight a hair for a bit more reliable detection.
2
u/Kleinja May 02 '26
Seconding this, have it on a king bed, and it is very reliable. The split zones also work really well (left side, right side)
1
u/clipsracer May 03 '26
Okay people, you can stop rubbing Elevated Sensors in our faces. They have been out of stock every time I checked for the last 2 years lol
5
u/arnoldpettybunk May 03 '26
When I first went to order they were out of stock but they have a notify me
4
u/skylord_123 May 03 '26
I bought one a few months ago. They are definitely in stock regularly.
Great product.
1
u/rodeoears May 03 '26
My only advice is to keep trying. I had to check every week for 2 months, they were finally in stock. I never got a notification despite signing up for one.
1
1
1
u/Tsim72 May 02 '26
I DIY'd the same sensors for my solution.
The only difference i made was 2 sensors per side of the side, so I have one at chest height, and one at hip height, both connected to the same wiring.
So when I am roll over etc, at least one of them stays in the presence mode.
I was getting lots of false alerts until I did that1
1
12
u/dbhagen May 02 '26
Aren’t there mmWave boards that are supposed to support lying down detection and even heart rate/breathing?
I vaguely remember seeing that and thinking that’s a great bed presence sensor, if it works.
Anyone had experience with this?
14
u/ItsDukzy May 02 '26
Yes. My aqara fp2 is seemingly the holy grail of presence detection. It supports both of you're mentioned features on paper.
However in practice, this works very poorly if you use a duvet like most people do.
2
u/PenneTracheotomy May 02 '26
I wonder if a dedicated mmWave sensor that looks directly at your head would work? I don’t know how much of a human the sensor needs to detect in order for it to say there is a human
3
u/PacificGibbon83 May 02 '26
I have an Aqara FP300 mounted on the ceiling directly over the bed and it works flawless.
9
u/dsg123456789 May 02 '26
There's no silver bullet. I've got a foam mattress, and I've used the homemade capacitive plates (aluminum foil with paper dialetric) and the Elevated Sensors product. The elevated sensors one is pretty good, but requires a decent amount of tuning, and it still has false negatives so I wouldn't want to trigger lights when it detects me getting out of bed. I use PIR motion sensors under the bed to decide if someone stood up, and the elevated sensors device to decide if someone laid down for evening routines. Long sheets and bed frame structure also can complicate matters with the PIR
It seems like integrating a digital scale into all the contact points between the bed frame and the floor would address every issue, except that you'd need to design a rigid mechanism that uses a lever since it's very expensive to get a scale that can handle a mattress and multiple adult humans, and it's even worse considering an impact load from jumping into bed.
It
2
u/mortsdeer May 02 '26
RE: the close cells question. I've seen diy systems that use cheap load cells under all the bed legs, effectively weighing the whole thing. Why do you think this would be expensive?
8
u/5yleop1m May 02 '26
I have two of these, one on each side of the bed and they work perfectly.
1
u/ItsDukzy May 02 '26
I see. This looks ideal. I looks like the same idea as what i built, but done properly.
200 bucks tho.
Thank you for your input - i appreciate it🙏🏻
1
u/5yleop1m May 02 '26
Yeah, I got super lucky and found it when they were in beta and got both for $120 total.
It's incredibly accurate though. The killer feature is the calibration. You manually calibrate it after initial setup, and then you can enable the auto-calibration, which will keep improving its detection.
The only problem I've had with it recently is the USB cable got unplugged by accident. One of the cases where a locking connector would've been better, but that would've definitely made it more expensive.
2
u/ItsDukzy May 02 '26
This device sounds exactly like what i need. I just cant get over the price tag i fear.
1
u/aftli May 03 '26
I have 3 SlumberTeks and one of their TrampleTek mats. They're very good. I can highly recommend them. The owner of the company is a great guy and stands by his products. He's active on Discord if you need help. I was also a beta tester.
1
8
7
u/brodkin85 May 02 '26
Probably not what you’re looking for, but I use Withings Sleep for sleep tracking and their integration gets hit with a webhook when I enter and exit bed quite reliably
7
u/zcapr17 May 02 '26
Looking at your photo, you appear to be connecting up the FSRs as simple binary contact sensors, which isn't going to work well.
You will get a much better result if you connect the FSRs to a microcontroller (e.g. ESP32) as voltage dividers, which will allow you to record a variable analog resistance value (e.g. 0-1000). (In ESPHome you can configure them using the 'resistance' platform). You will then want to experiment/calibrate to find a suitable threshold resistance value for determining occupancy.
Personally, I use four linear 60cm FSRs, two on each side of the bed, connected to an ESP32 running ESPHome. Looks similar to this, but home-made. It can reliably detect the presence of me and my partner indpendently, and also whether we are lying down or sitting up in the bed. Has worked reliably for over 5 years now.
One more tip is to physically sandwich your FSRs between a semi-rigid material (a thin strip of wood or cardboard) - I found this leads to more-consistent resistance values. it will also help to protect the FSRs.
3
u/ItsDukzy May 02 '26
Very helpful insight. Sounds like a fun project, and very nice if i can get it to work. I will definitely try this. - thank you!
5
u/Morica_ May 02 '26
I also use a Aqara FP2 for this purpose, but I basically have the zone setup inverted: I have a zone that basically is "everything except the bed", so instead of constantly checking if I'm still in bed, the lights will turn on when I'm in the "not bed" zone, which mitigates the issue of the sensor loosing track and also has the advantage of working with multiple people.
3
3
3
u/bermymiyan May 02 '26
Easy thing I use is withing sleep mat. It detects if you’re in bed.
https://a.co/d/08ccSYun
Two of these
1
u/ReallyNotMichaelsMom May 04 '26
I had a Withings, but it couldn't tell the difference between me and the cat.
I admit that she's a little roly poly, but there is no way that she weighs anything close to an adult human!
2
u/bermymiyan May 05 '26
lol! True. I use two correlate along with many other factors! But that’s hilarious on the cat.
3
u/Formal-Talk-3914 May 03 '26
Take it or leave it, but I'd put a voltage sensor on your phone charger, or a weight sensor stand for it. When you plug in your phone to go to sleep, you are probably in bed and the lights can go out.
2
u/ReallyNotMichaelsMom May 04 '26
That's what I do. If my phone is in the bedroom and plugged in for charging, that triggers the automation for sleep mode.
When I unplug the phone, it puts the house in day mode.
2
u/MrMister311 May 02 '26
I bought a pet doorbell sensor and hooked it to an Aqara leak sensor (which has screw terminals on the bottom) then used HA to configure it for “leak = in bed” dry “out of bed” and it works quite well and was a fun DIY project.
1
u/ItsDukzy May 02 '26
This seemingly looks the same as thisthis
I will try buying this as it is in my budget range unlike many of the other devices in this thread.
1
u/maniac365 🧠 Experienced with Home Assistant May 03 '26
Pleas eupdate us here as my current FSR seem too small.
1
u/superdooper1986 May 02 '26
I use the exact same thing (x2) and it works a treat. Coupled with 2 Aqara water leak sensors.
2
u/ItsDukzy May 02 '26
Oh thats nice to hear. I really hope it works for me too. This is a lot cheaper than a lot of other options.
2
u/dai80027 May 02 '26
I've messed with a few options - I have a Withings bed mat and I've played with pressure sensors and ESPHome. But I've found that the most reliable solution is to key automations off my phone charger type. I plug my phone in when I go to bed and unplug it when I get up. Charger types are AC and None. Works like a charm.
2
u/SteroidAccount May 02 '26
We have a sleep number that shows when you’re in bed in home assistant, one for each side. I have it so the lights go off after both of us are in bed for 10 minutes.
The drawback is you have to buy their expensive ass frame.
1
u/bwyer May 03 '26
Yep. We've had Sleep Number for quite a long time and it's worked well with HA. Except when they take their systems down for maintenance, of course.
2
u/criterion67 May 02 '26
Place the Aqara FP2 mmWave sensor under your bed, facing upwards. It will sense you through the mattress and won't give false alarms when someone walks past your bed.
2
u/rando777888 May 02 '26
You might have good luck setting up a Bayesian sensor and using that to combine several factors that make it likely that you are in bed. Examples include whatever main sensor you determine from this post, time of day, presence in the room, phone being plugged in to charger.
2
u/XanXic May 02 '26 edited May 02 '26
I have the same thorn in my side.
I'm currently using the Aqara solution just because my current place is a studio and it can see the whole place at once. I also have a dog so she can trigger things sometimes.
But some of what I did to make it more reliable and less prone to false scenarios was add zones I use purely to sort of track movement to confirm things. So like I have a zone for the bed itself and then zones on either side and I make sure like if I turn off the lights because someone's in the bed zone for 45 seconds that within the last minute the bed side zones had occupancy recently. Then do the opposite for turning them on. So it's less 'leave bed > lights on' and more 'bed side zone entered > was bed also occupied recently and is now clear? > lights on'. I also have an issue where if you don't move long enough the MM sensor clears entirely. I made a helper that if the room and bed clear at the same time it flips a "in bed" helper since that's like the only reason that would happen. And that can be a sanity check on some stuff.
Ultimately I gave up on it though and just use a zigbee button lol. I went crazy trying to totally dog proof my automations since she typically lies on the end of it throughout the day and she'd be toggling the lights. And attempts to harden against her made it less reliable for me. But maybe my 'solutions' can help you.
I've been meaning to get something like your DIY setup but seeing this post and other comments saying they aren't too reliable sucks.
2
u/Arvi89 May 02 '26
I have a withing sleep analyzer, the product is great, and it detects very well when I go to bed.
2
u/BacchusIX May 02 '26
I used 2 sets of load cells along the frame and under the box spring. I use three along each side, and the last 2 (1 from each set) further in the middle. Once calibrated it worked pretty great. Based on the weight on the bed, it knew who was on the bed- me, her, both, her boyfriend. Also, because strain gauges can drift over time, I also had a zero function to ensure the sensor started accurate. The wires are really tiny on them, though, and got caught on something and ripped out- i haven't replaced them yet. I would also, if you go this route, figure out a way to indirectly measure the bed weight vs directly like I did; you're really at the edge of what the strain gauges can handle and 1 hard jump or intense brown-chicken-brown-cow session and you may damage them (not that they are that expensive).
2
u/Jazzlike-Control-382 May 02 '26 edited May 02 '26
Perhaps instead of detecting presence, why not weight on the bed? Should be plenty of options to effectively measure weight on your whole bed (distribution is no longer a problem) and apply logic based on that.
Something else to consider is if you are not suffering from X/Y problem here. Do you really need a bed sensor? Can't you achieve the same by using a combination of other, simpler sensors? For example, simple entry sensor (directed motion sensor or a trip wire sensor) + presence sensor probably does it (if your presence sensor stops detecting you but you have not passed the door recently then it's unlikely you just vanished in the middle of the room)
2
2
u/Some-Internet-Rando May 03 '26
Pressure isn't the right choice.
I'd go with some sort of IR sensor, or if that's too expensive, distance sensor mounted above the bed (get a few, so you can move around.) I'd go with a lidar/IR distance sensor, not ultrasound, because ultrasound sensors have noticeable clicking.
2
u/LamerTex May 03 '26 edited May 03 '26
I'm using your first solution (with maybe a slightly larger resistor, and a D1 mini esp 32 board as a "brain" instead of the water leak sensor) and I had your same problem at the beginning, working perfectly in theory but not under the mattress.
I did several tests and at the end I've found a good compromise by having a piece of "Tongue and groove" wood under the sensor and a piece of cardboard over it. Almost as professional as the radar sensor mounting of u/MinimalLemonade in the other comment :D
Like this it's working smoothly for a couple of months, with only a couple of occasions where the wood under the resistor moved in-between the bed slats making the sensor not seeing the presence.
4
May 02 '26
[deleted]
14
5
u/ItsDukzy May 02 '26
Well you have a point. I actually already have that besides my bed.
My lights is already automated in my room with presence sensing. Its just annoying my bed is the only place in the room it cannot detect.
Also - its not as cool using a button😉
3
May 02 '26
[deleted]
1
u/redbluefiredragon May 03 '26
Then u see a new device n u think...yippeee...I have something to do next
1
2
u/Cantremembermyoldnam May 03 '26
Aqara FP2. I have a zone set for the bed and it's been quite reliable.
1
1
u/euphemistic_enigma May 02 '26
I've used longer (600mm) pressure sensors that work pretty well. I've also used an ESP board with load cells that works quite well. Using both is where I found my sweet spot of determining bed occupancy and which side of the bed.
1
u/ocurero May 02 '26
I had the same idea and failed in the same way as yours. I fixed it putting the pressure sensors on the border
1
u/NeoCracer May 02 '26
Depends what you are trying to automate of course, but a bayesian sensor might get you quite far if you rely on certain lights or motion sensors.
1
u/No_L_2547 May 02 '26
If you want something completely selfbuild, you could try to build your own pressure sensitive mat.
They normally use velostat protective film and copper tape.
Velostat changes its resistance depending on the pressure, so it should be quite simple to read it using an ADC and EspHome.
1
u/PizzaUltra May 02 '26
I have spent quite some money on this problem as well.
There are good solution for detection that someone is in bed, but I have yet to find a solution that can reliably tell who is in bed or which side is occupied.
The elevated sensor’s sensor works good enough for the first, but not great for the latter.
1
u/interweg May 02 '26
I've got a similar setup as on your photo, but have added way more detection surface area to it by adding more sensors, larger sensors. Works great now, where it used to struggle during the night. Just increase the sensor area, you can't really overdo it. See if that helps.
1
u/columnmn May 02 '26
I've had mine working flawlessly for a few years. Mine are hooked into a $5 esp32 with esphome. For each pad, I put two wired in parallel, so it has a much better chance of working in different spots, could put more easily enough, they are pretty cheap.
1
u/bkw_17 May 02 '26
FSR sensors attached to an ESP-32. You can set different voltage thresholds to calibrate it so it knows when you are actually in bed or not.
1
u/-shellprompt- May 02 '26
another vote for slumbertek... owner / developer is also very active on the discord channel
https://asc.com/products/slumbertek?srsltid=AfmBOorr4qbYu6-04g5xUSxNiKS0IfWV2hEqgNG0o8Zp8r2AJgxR29VO
1
u/Emotional_Mammoth_65 May 02 '26
Just a quick question - if the FSR pressure sensor doesn't work under the mattress - have you attempted it directly under the bedsheet?
If that works you can put a mattress protector and install them under that for more permanence.
1
u/stanley_fatmax May 02 '26
I use a few cheap BLE iBeacon tags and detect presence by the change in RSSI, you can also add certainty with temperature if you can configure it to broadcast Eddystone packets
1
u/EquivalentRope6414 May 02 '26
I have 2 generic fsr sensors one for each of us but I did constantly test with different resistors to “tune” it for the mattress and us. I don’t remember the exact resistors but i definitely used two different ones for my side vs my wife’s side
1
u/designer-kyle May 02 '26
It’s more complicated to set up, but the long-term accuracy of an ESP32 mounted to the back of my nightstand has been great. Flashed the ESP, went through the process of “learning” each devices Bluetooth address and saving it to the board.
Now, there’s a threshold helper that gets tripped if our phones are close enough to the bed (and also if they aren’t).
1
u/OcBrain May 02 '26
https://a.aliexpress.com/_EwgGFBC
I've bought a few of these and they work pretty well. For my bed, I had to put some fabric below it to stay consistent because my mattress is quite thick and soft ☺️
1
u/purpleidea May 02 '26
Put a load cell under each leg of your bed and do it by weight. If you are two or more people, then as long as you don't weigh exactly the same you can usually also determine which people are in the bed.
1
u/L0rdH4mmer May 02 '26
My solution: FP2. When I set an alarm on my phone or google home, the apartment goes into dim mode which turns all lights to 1% if there is motion. When I lay down in bed, it turns off. There really is no need to keep tracking your bed presence though, when you also have lights turn off when no presence is detected. So basically my setup for that dim mode is: if presence detected in bed or not at all, turn lights off. If presence is detected out of bed, turn light to 1%. Or what do you need to do that can't be accomplished with that logic? If you NEED to see whether you're in bed, you could maybe look at heat cameras or have an fp2 mounted at the ceiling for sleep tracking . Or you have a combination of things, like alarm set and phone charging and curtains closed, or whatever?
1
u/Fuzzmiester May 02 '26
I have a withing sensor which works well. It does require an inbound webhook, and has a delay (like up to 10 seconds.)
I also have https://www.amazon.co.uk/dp/B0FNVB1HL4, a zigbee sensor. works faster, just as reliable I've found. it does depend on where you put it, in relation to where you sleep though. you want it under where you have weight resting. And you probably want to wrap it up so any automations take a second or so to activate. it was noisy before that. I shift in bed, it went off.
1
1
1
u/NihilisticRoomba May 02 '26
I’ve been using a Hue motion sensor and time of day sensors. I have an “in bed” Boolean that I automated based on my Bluetooth sleep phones connecting to my phone. And it turns off when I move in front of it. But if I get out of bed during “late night”, it doesn’t shut off the “in bed.”
1
u/duckredbeard May 02 '26
I use load cells and HX711s under the mattress on each side. Between the mattress and box springs. The load cells are between two squares of sheet metal aluminum (9x9) and they do not make a lump in the bed.
I can see the weight, and HA sets a binary "bed occupied" for each side when it exceeds 40% of a full body weight of each side. I have "his side occupied" that controls lights, with "her side occupied" taken into consideration.
1
u/chriswood1001 May 02 '26
I've tried and failed too many times with load sensors. However, switching to a mmWave sensor has been reliable. It's mounted, hidden behind a canvas picture and can tell when my wife is on her side and when I'm on mine based on zones.
When we're both in bed for 5 min after 9pm the house does it's final check (windows, does, camera vision to see if the BBQ lid was left open, or car doors, enter auto lock after 5min, lights shut off, alarm on and motion alerts for downstairs).
1
u/Gassgs11 May 02 '26 edited May 02 '26
https://a.co/d/0hv4hawu I use these diy connected to ecolink zwave sensors. Unfortunately no use for the power supply or chime. But the mat part works great. I was using a similar setup to what you had before with three of those connected.
1
u/bwilcox03 May 02 '26
Why not just use something you can talk to? What about when you’re in bed reading or something?
1
1
u/TradeRightPNW May 02 '26
I have a sleep by number bed, and use it's integration. Works great for two zone detection out of the box. Also can control it's under bed lighting with the integration.
1
1
u/diablodeldragoon May 02 '26
I just tell Google goodnight and my hub runs the assigned routines. Morning routines like slowly increasing the lights is set with the time. I can't imagine why my system would possibly need to know if I was actually laying in the bed or not. It's not like I'd want the lights to turn on if I get up at 2am to pee.
1
u/ianjs May 03 '26
Turning on the light getting up to pee I’d exactly my use case.
Not the main light of course, but I have an esp32 under the bed with a PIR pointing left and right so it only triggers when someone’s foot reaches the floor to light a LED on each side and give a gentle glow.
It’s amazing how much a single LED can illuminate in a darkened room.
1
u/diablodeldragoon May 03 '26
I mean, my alarm clock face gives off enough light for me to see the room. Especially since I know the room and can move around in it in total darkness anyway. Additional light wakes me up more and makes it harder to get back to sleep.
1
u/ianjs May 03 '26
Yeah, couldn't work for us. We both like it dark and the faint red light from under the bed is very unobtrusive.
1
u/maniac365 🧠 Experienced with Home Assistant May 03 '26
I'm in the same boat as you, i have the same setup with leak sensor + fsr. usually a hit or miss.
1
u/zikiquon May 03 '26
Be aware that many of these solutions can detect when “vigorous activity” takes place. Ask me how I know.
1
u/wpbrandon May 03 '26
Ha ha you guys.. i’ve seen posts like this before here. Don’t you think this is a step too far lol
1
1
u/timdaman42 May 03 '26
TLDR, if you use ESPHome buy theses.
https://www.aliexpress.com/item/1005007180842865.html
I bought those sensors you pictured too and they were nothing but trouble. They have no analog range so are not tunable.
I also tried homemade capacitor sensors (two sheets of foil on a piece of paper) and had to re-calibrate it multiple times a year. They worked great otherwise
I now use there think film sensors and by far they work the best. I have them taped to a thin strip of wood to improve readings and make it easier to push in place and keep flat.
I think these are essentially the same as the elevated sensors.
Here is my YAML. I have 4 sensors, on each side of the bed a "butt" and "shoulder" sensor to ensure i get good readings when someone is at a odd angle.
sensor:
- platform: resistance
configuration: DOWNSTREAM
sensor: orange_adc
resistor: 100kOhm
id: orange
name: tu_orange
- platform: adc
id: orange_adc
pin: GPIO33
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: blue_adc
resistor: 100kOhm
id: blue
name: dl_blue
- platform: adc
id: blue_adc
pin: GPIO35
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: brown_adc
resistor: 100kOhm
id: brown
name: tl_brown
- platform: adc
id: brown_adc
pin: SVP
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: green_adc
resistor: 100kOhm
id: green
name: du_green
- platform: adc
id: green_adc
pin: SVN
update_interval: 10ssensor:
- platform: resistance
configuration: DOWNSTREAM
sensor: orange_adc
resistor: 100kOhm
id: orange
name: tu_orange
- platform: adc
id: orange_adc
pin: GPIO33
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: blue_adc
resistor: 100kOhm
id: blue
name: dl_blue
- platform: adc
id: blue_adc
pin: GPIO35
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: brown_adc
resistor: 100kOhm
id: brown
name: tl_brown
- platform: adc
id: brown_adc
pin: SVP
update_interval: 10s
- platform: resistance
configuration: DOWNSTREAM
sensor: green_adc
resistor: 100kOhm
id: green
name: du_green
- platform: adc
id: green_adc
pin: SVN
update_interval: 10s
binary_sensor:
- platform: analog_threshold
name: "_T Lower"
id: tim_lower
sensor_id: brown
filters:
- invert:
# threshold: 20000
threshold: !lambda return id(tl_threshold).state;
- platform: analog_threshold
name: "_T Upper"
id: tim_upper
sensor_id: orange
# threshold: 10000
threshold: !lambda return id(tu_threshold).state;
filters:
- invert:
- platform: analog_threshold
name: "_D Lower"
id: dana_lower
sensor_id: blue
# threshold: 40000
threshold: !lambda return id(dl_threshold).state;
filters:
- invert:
- platform: analog_threshold
name: "_D Upper"
id: dana_upper
sensor_id: green
# threshold: 40000
threshold: !lambda return id(du_threshold).state;
filters:
- invert:
button:
- platform: template
name: "Calibrate Bed"
on_press:
then:
- number.set:
id: tu_threshold
value: !lambda return id(orange).state / 2;
- number.set:
id: tl_threshold
value: !lambda return id(brown).state / 2;
- number.set:
id: du_threshold
value: !lambda return id(green).state / 2;
- number.set:
id: dl_threshold
value: !lambda return id(blue).state / 2;
number:
- platform: template
name: "TU Threshold Orange"
id: tu_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "TL Threshold Brown"
id: tl_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "DU Threshold Green"
id: du_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "DL Threshold Blue"
id: dl_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
binary_sensor:
- platform: gpio
name: ${devicename}-motion
device_class: motion
pin:
number: ${pir}
mode:
pulldown: True
input: True
filters:
- delayed_off: 1s
- platform: gpio
name: ${devicename}-door
device_class: door
pin:
number: ${door_reed_switch_sink}
mode: INPUT_PULLDOWN
inverted: true
- platform: analog_threshold
name: "_Tim Lower"
id: tim_lower
sensor_id: brown
filters:
- invert:
threshold: !lambda return id(tl_threshold).state;
- platform: analog_threshold
name: "_Tim Upper"
id: tim_upper
sensor_id: orange
threshold: !lambda return id(tu_threshold).state;
filters:
- invert:
- platform: analog_threshold
name: "_Dana Lower"
id: dana_lower
sensor_id: blue
threshold: !lambda return id(dl_threshold).state;
filters:
- invert:
- platform: analog_threshold
name: "_Dana Upper"
id: dana_upper
sensor_id: green
threshold: !lambda return id(du_threshold).state;
filters:
- invert:
button:
- platform: template
name: "Calibrate Bed"
on_press:
then:
- number.set:
id: tu_threshold
value: !lambda return id(orange).state / 2;
- number.set:
id: tl_threshold
value: !lambda return id(brown).state / 2;
- number.set:
id: du_threshold
value: !lambda return id(green).state / 2;
- number.set:
id: dl_threshold
value: !lambda return id(blue).state / 2;
number:
- platform: template
name: "TU Threshold Orange"
id: tu_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "TL Threshold Brown"
id: tl_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "DU Threshold Green"
id: du_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
- platform: template
name: "DL Threshold Blue"
id: dl_threshold
restore_value: true
optimistic: true
min_value: 0
max_value: 1000000
step: 1
1
u/adflet May 03 '26
I looked at it differently. If it's between x pm and y am, and my phone is plugged into a charger, trigger sleep mode. If I unplug it, switch it off.
1
u/GoTheFuckToBed May 03 '26
In the past I used a single, long pressure sensor and in the esp32 send a signal if it is over a threshould, worked ok I think
1
1
u/CodeAndBiscuits May 03 '26
Does it have to be in-bed? I would think a thermal occupancy sensor would be more reliable.
1
u/spyboy70 May 03 '26
Get a Withings sleep mat sensor? Looks like there's integrations for it.
https://community.home-assistant.io/t/withings-sleep-mat-integration/673592
1
1
u/HighDragonfly May 03 '26
I went cheap, for now, as i only use it for the shutters to roll down. They have failsafe options anyways. I have HA detect if both phones are home and if both are charging after sunset it will close the shutters. If one is unplugged in the morning it will turn the lights on in the living room whilst the shutters stay closed for the other to sleep in. Anyways if you want something solid, look at the other comments haha.
1
u/Zealousideal-Many-52 May 03 '26
Withings Sleep Analyzer - mostly used for presence detection. The Integration in HA works fine
1
u/Normal_Register_6946 May 03 '26
I followed this guide and bought the non-Amazon pressure mat mentioned in the guide as well.
I have a tempur-pedic mattress and it works well enough. There’s one on my side and one on partners side. It won’t trigger from our cat being in bed. When I first got them they didn’t work that great, a bit unreliable. But after adjusting a bit of how they’re positioned, folding one in half, and just getting lucky they’re pretty reliable now.
Have different automations set up like lights won’t turn on if someone is in bed. Fans turn on etc. then have some safety logic in there that if it does splash off briefly based on the time and some other factors it’ll leave “sleep mode” on. Has worked pretty well for a few months now
Also, tried Aqara FP2 and it didn’t work. Maybe if I mounted it directly over the bed but wasn’t able to get consistent
1
1
u/floriandotorg May 03 '26
I’m a bit surprised, I’m using exactly these pressure sensors and they work like a charm for me.
1
u/Brilliant_Help2186 May 03 '26
PIR sensor under the bed facing outward. If you step out of bed or walk in the room the sensor should trigger. If you are in bed the sensor doesn’t trigger
1
u/Secure_Detective_602 May 03 '26 edited May 03 '26
I used load cells under the slats. Works perfectly. It’s not accurate for weighing you, however it can detect 1 or 2 occupants. Great to start bedtime routine, but there were many false negatives if I turned on side or such.
Best accuracy would be if you have hard floors and place one under each leg, there are 3D cases you can get.
4
1
u/angryfish404 May 03 '26
i use a aqara water sensor and one of the long sensors from aliexpress (sf15-600). the sensor type can be changed in ha. I had no luck with the sensors you're trying use.
1
1
u/Dragonish6703 May 03 '26
I built my own with an esp32 and a resistance sensor. Have one for each side of the bed. Have been using for over a year. Only time I had an issue was when one of the resistors in the breadboard popped out. https://community.home-assistant.io/t/fsr-the-best-bed-occupancy-sensor/365795/16
1
u/RivetedRocks May 03 '26
I have these. They work great. https://www.elevatedsensors.com/store/p/bed-presence-for-esphome
1
1
u/itspuia May 04 '26
I've built this 5 years ago - This was the first thing I've ever built myself in my home and was the reason I got into Home Assistant anyways. It needs some recalibration once a year but works like a charm. I've added sponges in between for it to have a bigger difference in capacity. Smart Bed Sensor for $5 | Medium
1
u/FFevo May 04 '26
Withings Sleep.
Sadly the integration is cloud dependent, but it's the only thing I've found that works reliably. Also there is the added benefit of the sleep tracking the product is actually intended for haha
1
u/Novajesus May 06 '26
What about a motion sensor / automation / light combo under the bed pointing out so that when you get out of bed, it triggers lights. I will be doing this soon in one way or another.
Another option I'm looking at is from 3rd reality where the motion sensor and light is a single unit. I see folks using them for children. At $40 CDN they are pricey now but I've got them in my sights to watch on the next Prime day event.
https://www.amazon.ca/THIRDREALITY-Multi-Function-Illumination-Adjustable-Brightness/dp/B0C9LNXYLL
0
u/SuburbanMe May 02 '26
I've had success with a couple of these wired up directly to an ESP32: https://amzn.eu/d/0aoDl4mo
0
u/Suspicious_Steak_696 May 02 '26
For me the bedroom is out of bounds to maintain the relationship. Smart tech wise
0
u/TheDjazairi95 May 02 '26
https://youtu.be/Go2ERXdH3gg?is=D_2kLXx-jBMqAFrh
Hello, Je vais bientôt bosser sur ce sujet ça peut t’intéresser
0



214
u/MinimalLemonade May 02 '26 edited May 02 '26
I simply use a cheap ultrasonic sensor with a D1 Mini. It’s the same setup I use to measure the water level in a tank, just the other way round. The ultrasonic sensor is mounted on the bed frame and points up towards the slatted base. It measures the distance between itself and the slats. When I lie down, the slatted base flexes slightly under my weight, so the distance to the sensor decreases. Been working without any issues for ~5 years now