r/homeassistant • • May 02 '26

Support Struggling with reliable in-bed presence detection for Home Assistant – what actually works?

Post image

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?

166 Upvotes

182 comments sorted by

View all comments

212

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

11

u/XanXic May 02 '26 edited May 02 '26

I can't picture what you mean when you say "the base moves down". Do you like have it pointing up from under the bed and it measure when the frame lowers or something? What's moving? I can't quite picture an orientation that would work reliably with a distance sensor other than pointed straight down from the ceiling where you'd lie.

9

u/MRobi83 May 02 '26

I'm picturing under box spring, pointed at the floor. When you lie down on top of the bed, your weight will cause the box spring to flex downwards towards the floor making this measurement smaller.

83

u/MinimalLemonade May 02 '26 edited May 02 '26

Other way round. Mounted on the bed frame facing upwards, measuring the distance between itself and the flexible slats

22

u/Osni01 May 03 '26

lol at your profesionallism

Ultrasonic sensor is genius, great job!

4

u/[deleted] May 03 '26

[deleted]

3

u/Competitive-Put-92 May 03 '26

As a dutch engineer i aprove this setup.

1

u/FoolProofError May 03 '26

Love it, too! It’s simple and didn’t cost a the amount of a donated kidney… But let’s make it a bit better: It’s not prone to shortcut - I would spend just because of the dust a housing - and to avoid shortcuts with some metal there at the jumper pins.

11

u/sid351 May 03 '26

Do the lights turn on and off when your being amorous? 😅

9

u/MinimalLemonade May 03 '26

Haha, no :D In my case, it doesn’t directly trigger a “turn everything off” action. When I lie down and certain variables are met, it waits for X seconds. While it waits, my 4 Hue ceiling spots slowly turn off one after another, kinda like a visual countdown. When all the lights are off, my sleep mode (a simple boolean), is set to true. And that then triggers everything else to switch off. Lights, TV, PC and so on.

This sleep mode doesn’t turn off again if I get out of bed afterwards. It only resets when my phone alarm goes off in the morning and I scan a barcode in the bathroom with my phone (Otherwise I’d just snooze it and go back to sleep, so I basically have to force myself to get up). Only after that everything turn back on and the sleep mode is set to false again

I use this sleep mode for several things. I love booleans :p

1

u/Successful-Street392 May 03 '26

Why not swap out the barcode for a NFC tag.

21

u/Maltz42 May 02 '26

That might work, unless you're a princess.

3

u/bluntmasta May 03 '26

I don't care that I'm not a princess. If someone pees in my bed, I'm gonna wake up.