this post was submitted on 17 Mar 2025
26 points (100.0% liked)

homeassistant

13401 readers
3 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 2 years ago
MODERATORS
 

Anyone try to build a bed occupancy sensor integrated with Home Assistant? I've looked into load sensors but all of them seem to have pretty small weight limits (low enough to where I don't think it would even support the empty bed).

What devices/sensors have you used for this? And what does your setup look like?

top 42 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 22 hours ago

I built one with an esp32 and some tin foil and foam. link to guide. If you go this route read through this whole thread for improvements to the final product.

[–] [email protected] 8 points 4 days ago (2 children)

Aliexpress has load cells that go up to the hundreds of KGS. One of those, an esp32/pico and some wiring and you should be good to go?

[–] [email protected] 3 points 4 days ago

Couldn't find the exact one I ordered a few months ago, but this type of pressure sensor aliexpress link is apparently a common bed occupancy sensor type used when building medical beds for hospitals and care homes so staff can be alerted when a patient gets out of bed. I'm not sure the specific model I linked is quite right specs-wise, but the idea is that it goes on a slat or other surface between the matress and the frame that doesn't necessarily get the full weight of the occupant, but still gets enough to measure on the sensor.

[–] [email protected] 3 points 4 days ago

This. I bought a few myself, but didn't have time to put them together with ESP32/program them with ESPHome

[–] [email protected] 4 points 4 days ago (1 children)

https://community.home-assistant.io/t/fsr-the-best-bed-occupancy-sensor/365795

This is the best write-up I've seen - essentially a force sensitive resistor on the bed slats and an ESP32 will get you the results you're after.

[–] [email protected] 2 points 4 days ago

I’ve got parts on order for this very project, should arrive this week.

I previously tried using one of those large pressure mats but it didn’t work under the mattress.

[–] [email protected] 2 points 4 days ago

I’ve got this setup: Two of those flat contact sensors that are designed to go under a mat, connected to an ESP32 running ESP Home. Some people use leak sensors with screw terminals instead of the ESP32 and attach the contact sensor that way. My use case is that we’ve got cats and motion sensors, so when everyone is in bed, the lights don’t react to the motion. Also, alarm system goes into night mode, any reminders before going to bed also fire. There are a set of rules about whether the doorbell can be heard in the bedroom, and also the light comes on in the night if someone gets up.

[–] [email protected] 3 points 4 days ago (6 children)

I can't believe I'm even engaging this post, but... what's the use-case? Gotta say, this sounds extra creepy.

[–] [email protected] 10 points 4 days ago (1 children)

Turn on the lights in the bedroom based on presence sensor, but only if the bed occupancy sensor detects no one is in bed.

[–] [email protected] 4 points 4 days ago (1 children)

Turn off the lights when 2 people in bed. Turn the lights on really low when only 1 person gets up. Track time you went to bed / time in bed as a low-budget sleep tracker not tied to a big data broker, like a smart watch would be....

[–] And009 1 points 4 days ago* (last edited 4 days ago) (2 children)
[–] [email protected] 5 points 4 days ago

Self-hosted. The data stays within my home- It is processed locally on my server.

[–] [email protected] 2 points 3 days ago (1 children)

You must be here from c/all. Home Assistant is a self-hosted application and stores all of its data locally on hardware you own and control. If there's data mining, its because you put it there yourself.

[–] And009 1 points 3 days ago (1 children)

Yeah as if people aren't linking it to Google and Alexa for voice commands

[–] [email protected] 2 points 2 days ago

So don't do that if that's important to you. I don't. Besides, home assistant has its own local voice commands if you want them.

[–] [email protected] 7 points 4 days ago* (last edited 4 days ago)

Some of us like to automate our homes with our home automation systems instead of finding new ways to remote control them.

Just because you go to a dark place in your imagination doesn't mean everyone else does.

[–] [email protected] 5 points 4 days ago (1 children)

@just_another_person Turning on or off nightlights. Changing iOS focus (e.g., sleeping). Activating outside security monitoring… all kinds of interesting use cases.

[–] [email protected] 1 points 4 days ago (1 children)

Can one change iOS focus modes from home assistant?

[–] [email protected] 1 points 4 days ago

@spitfire I said that but the fact is I don’t really know. But I’d like to know. I know #HA #HomeAssistant can launch apps and select channels on #AppleTV so I think it should be possible on iOS. Using webhooks maybe.

[–] [email protected] 1 points 3 days ago

If I'm in the bedroom, I may want my ceiling lights on if someone is in there if it's dark outside, but if my wife and I are in bed, then only turn on the baseboard lights, at 1% brightness when someone is still in bed. Presence sensors aren't that fine grained, and I certainly don't want to wake up my wife when this old fart gets up to go pee again. She's grumpy when awakened. 🤣

[–] [email protected] 2 points 4 days ago (1 children)

Taking care of an elderly person whose a fall risk? There are lots of valid reasons.

[–] [email protected] 1 points 4 days ago (1 children)

Presence sensors do fall detection and human presence to a great degree. No need for a BED sensor and measuring occupancy.

[–] [email protected] 4 points 4 days ago

And how is a presence sensor in a bedroom less creepy? Its measuring the same thing as you say.

[–] [email protected] 2 points 4 days ago (1 children)

Gotta make sure the dogs aren't jumping on the bed while the humans are gone. What else could you possibly use this for? 🤷🏻‍♂️

[–] [email protected] 1 points 4 days ago (6 children)

Human trafficking or people being held against their will???

Why would anyone ask about "occupancy" of a bed? Motion or Presence sensors are fine. Like, you want to enact a trigger based on when someone gets IN the bed? That's makes no sense.

This whole question comes off as extra fucking creepy to me.

[–] [email protected] 9 points 4 days ago

Maybe if you'd read the replies to your question you wouldn't be creeped out. There are a lot of good use cases and I haven't even though how it could be misused before you brought it up.

[–] [email protected] 7 points 4 days ago* (last edited 4 days ago)

You're the only creepy one here bro. If you can't even imagine practical uses for this you definitely need therapy.

[–] [email protected] 2 points 3 days ago

Honest question, do you use Home Assistant?

[–] [email protected] 3 points 4 days ago

@just_another_person
Don’t open the blinds as long as there is someone in bed?

[–] [email protected] 3 points 4 days ago* (last edited 4 days ago)

You're right in that it's a useful tool for various kinds of abuse, but so is almost every useful home automation/home security sensor.

The most obvious/useful use cases I can see are:

  • turn on bedroom lights when the last person gets out of the bed
  • turn off whole house lights when the last person gets into bed.

Both should be easy with load cells under the bed legs but rather difficult otherwise.

(Useful assuming a household of two adults in one bed that is).

[–] [email protected] 3 points 4 days ago* (last edited 4 days ago) (1 children)

Yeah it's creepy, but I think the more logical reason for wanting it is to know whether or not their spouse is being faithful. My previous comment was sarcastic because I thought you were being sarcastic yourself.

[–] [email protected] 1 points 4 days ago

I guess?? Still....

[–] And009 2 points 4 days ago

I've worked on such IOT devices for the hospital.

[–] [email protected] 2 points 4 days ago (1 children)

I have an Aqara FP-2 doing just this thing. It works pretty well after setting up zones. Those get pulled into Home Assistant and then you can tie those to automations to control lamps or what have you.

[–] [email protected] 1 points 4 days ago

I also used a mmWave sensor in the past for this, one from a youtuber. Worked well enough for my case, but it had some interruptions during the night.

[–] [email protected] 2 points 4 days ago

I don’t have one myself, but several of the guys on YouTube use them. See “The Home Automation Guy” or “Smart Home Solver“. I can’t remember the brand they use.

[–] [email protected] 1 points 4 days ago (1 children)

How about mm radar?

I grabbed a couple of Ali last month to use for lighting sensors for the hall and toilet, not set up yet

[–] [email protected] 1 points 3 days ago

Those don't work well if you stop moving for extended periods of time, and do not see through bed sheets in my experience

[–] [email protected] 1 points 4 days ago* (last edited 4 days ago)

Use car occupancy sensors and an esp board. That's what I did. I stuck them to corregated cardboard and put one under each side. Aim for the butt area as that seems to apply the most pressure. I would order 4. 2 for each side because you can put them in parallel to divide the resistance and make them easier to trigger.

Buy them on AliExpress or eBay.

[–] [email protected] 1 points 4 days ago (2 children)

I've never done anything like this, but would it be possible to place such a sensor between the mattress and the frame instead? That would result in a fraction of the load due to the distribution of the weight. The challenge would be to set the threshold right.

[–] [email protected] 1 points 3 days ago

I believe that's how most people do it. It works for me. You can also put two in parallel or just add a resistor across the leads to divide the resistance to make it more sensitive. If you used a potentiometer it would make it easier to adjust to hit the exact threshold.

[–] [email protected] 1 points 4 days ago

@bus_factor Some of the #mmWave (Radar) Presence sensors may be able to detect bed presence through the mattress, mounted under frame. I have not tried this yet but I’ve been planning to. The Aqara FP-1 or Aqara FP-2 are candidates, but maybe too pricey for an experiment. The Apollo MTR-1 is far less expensive and excellent for short range. It is also small and with a sturdy enclosure you could easily place it between and mattress. These sensors can pick up very small motions, even the human heartbeat (sometimes through walls). I use both Aqara (easier set up) and Apollo MTR-1 for room and zone presence detection, with #HomeAssistant for integrated automation.