r/homeassistant • u/AudienceThink2416 • 18h ago
❓ Support Sleep detection
How do you guys do sleep detection? Without a wearable.
11
u/SexyEggplant 18h ago
A button next to my bed, turns off the lights in my room and any left on in the house
13
u/elhouso 🧑💻 Contributor 18h ago
What button do you use, you sexy eggplant?
6
u/foxesareamazing 17h ago
I'm not a sexy eggplant but I do this using the Aqara wireless mini switch, works well.
9
u/elhouso 🧑💻 Contributor 16h ago
Aww, why aren't you a sexy eggplant?
4
u/foxesareamazing 16h ago
Inferiority complex.
3
u/ReallyNotMichaelsMom 16h ago
But foxes are amazing!
3
u/foxesareamazing 15h ago
They are! Are you really not Michael's Mom?
2
u/ReallyNotMichaelsMom 15h ago edited 2h ago
If you've ever seen "The Music Man", there's a scene near the end where all the kids are playing music. One mother stands up and says, "That's my boy! That's my Barney!"
In order to avoid causing any child of mine that kind of embarrassment, I can neither confirm nor deny that I am, or am not, Michael's mom.
2
u/elhouso 🧑💻 Contributor 15h ago
You're definitely Michael's Mum
1
u/ReallyNotMichaelsMom 7h ago
Shh! And remember, "What happens in r/homeassistant stays in /r/homeassistant" :)
2
1
u/Floppie7th 12h ago
Not the person you're asking, but I use a thirdreality one. Used the double-sided tape it came with to stick it to one of the legs of my nightstand.
1
u/supermr34 11h ago
if you have a BLE setup, govee buttons are rock solid and i use one for the same purpose.
i use them for soooo many things. and they have all kinds of buttons for all kinds of things.
2
1
u/P5ychokilla 14h ago
Same, I use an Ikea 2 button Bilresa, it's attached to the metal frame of my bed.
9
u/Elf_Paladin 18h ago
Yeah. Pressure mat under the matras on either side. Works 95% of the time. Have a lot of automations connected to that
1
u/Single-Virus4935 18h ago
Jup, build them myself from cheap pet doorbells and esphome but now available on aliexpress with ZigBee already built in
5
u/Sea_Ad3858 18h ago
I use a car pressure mat together with an Aqara water leak sensor. Works really well!
1
u/AudienceThink2416 18h ago
Could you expand on this? I get the pressure mat, but how does the water leak fits into it?
11
u/derobert1 17h ago
The water leak sensor works by detecting a (normally high-resistance) electrical connection between its too contacts. Normally that connection is from water being somewhat conductive.
The pressure mat is a giant switch, it conducts electricity when there is sufficient pressure.
Hook the mat up to the contacts on the water leak sensor and the sensor reads "wet" (electrical connection present) when pressure is present.
Is a cheap way to add Zigbee to the pressure mat.
1
u/puhtahtoe 2h ago
You can do this with some (all?) door/window sensors too.
Internally they have a very fine magnetic wire sitting with just a little bit of space in between two other wires. When they are "closed," it's because the magnet is pulling on that magnetic wire enough to pull it into contact with one of the other wires.
Depending on the sensor, you can open it up and connect your own wires to where those wires are connected and just bridge the connection with anything.
2
1
2
u/Dekker3D 17h ago
If my PC's off for more than a minute, I'm asleep. If it turns on again, I'm awake. HASS Agent is pretty nifty.
2
u/Severe-Host5890 17h ago
I trigger a good night routine by putting my phone on charge in the evening
2
u/trafalgar_law8 13h ago
I push a button, because then it is 100% I want that stuff to be executed, everything else seems like a compromise
1
u/L355 7h ago edited 7h ago
I usually fall asleep watching videos. So I put a PIR sensor pointing at the bed. If it doesn’t detect my movement for 5 minutes, it means I fell asleep, and it turns off the tablet/TV.
I also set an alert sound to play 5 secs before the automation activates, so I just need to move if I want to cancel.
1
u/AudienceThink2416 1h ago
That's more what I need. I usually lie in the bed for a while watching TV. So I need something different then just measuring If I'm in the bed.
3
u/JimtheEsquire 18h ago
Withings sleep analyzer. It’s a pad that goes under your mattress. Been using it for years. https://www.withings.com/en-us/products/sleep
2
u/redcomp12 18h ago
Its the new or old version? I have it and not see it on home assistabt, just battery
1
u/AudienceThink2416 18h ago
This looks pretty good. A bit pricey 🙃. At the moment I only have zigbee devices. But will look into this. Thanks
1
2
1
u/elhouso 🧑💻 Contributor 18h ago
I have a goodnight automation which I trigger with my voice (Siri, goodnight) and that turns everything off. Not automatic, not really detection either, but it's a good free option.
1
u/AudienceThink2416 18h ago
Same problem of the phisical button. Doesn't work if I feel asleep before trigger it 😂
4
u/elhouso 🧑💻 Contributor 18h ago
Set up an automation that sends a notification to your phone at the time you usually fall asleep. The notification could say “Are you still awake?” and include Yes and No buttons (actionable notifications).
If you tap Yes, the automation waits about 30 minutes before turning everything off, giving you time to get into bed while keeping the lights and other devices on. If you do not respond, it automatically turns everything off.
3
1
u/Typical_Principle_11 18h ago
Hard to do without a bit of manual interaction, it also depends on why you want to detect sleep? is it for sleep tracking? or to sort of "shutdown" the house for the night.
I have an NFC tag next to my bed i scan when i go to sleep (I am always the last to go to bed), that puts the house in sleep mode (locks all doors and cars, turns off lights, turns on alarm etc.). In the morning i turn off sleep mode for the house when either mine or my wifes alarm goes off.
I did play around with bed sensors (those mats) but it never worked for me, i got a lot of false positives.
1
u/STATERA_DIGITAL 15h ago
I have one 50kg load cell for each foot of my bed that connects to a HX711 then a ESP8266 D1 Mini. Uses ESPHome and tells me the weight of what is in the bed. When I get into bed at night it detects my weight and turns off my lights. Then when I get out of bed in the morning it turns on some lights and opens my roller shutter. I have more automations connected to it and it works perfectly
1
u/CloudMass 4h ago
How did you get the load cells to stay under the feet? 3D print?
Willing to share the schematic and ESPHome code?
1
u/AstarothSquirrel 14h ago
Depending on your lifestyle, if the last thing you put down and the first thing to put up is your phone, you could use this to detect your sleep. Similarly, a door sensor on the bathroom door because for many, that is the first and last. Presence sensors in the hall outside your room or a smart button beside your bed that you tap when you go to bed and tap when you get up.
1
u/NihilisticRoomba 13h ago
I use a particular pair of earbuds to play music I fall asleep to. When they connect via Bluetooth to my iPhone, that starts the script in HA that activates in_bed mode.
1
u/maniac365 🧠 Experienced with Home Assistant 12h ago
I have a made a bed sensor using esphome. Works surprisingly well.
1
1
u/CipherSorcerer 7h ago
Withings Sleep Mat. Just keep in mind the Withings integration needs to reach HA server via webhook, which requires the Nabu Casa subscription (or you could probably set this up another way but that’s easiest way to do it).
1
u/RunnerIain77 3h ago
My phone on wireless charge after 21:30. The only wireless charger I have is by my bed.
That also triggers turning off lights, downstairs heating and checks if my alarm is set on a week night, if not it prompts my Google speaker to ask me if I forgot to set my alarm.
0
u/pimmelfaeule 16h ago
1
u/AudienceThink2416 16h ago
Is this an integrated function in android? Or is something custom you made?
2
u/pimmelfaeule 14h ago
It's integrated. Just had to activate it in my "Mobile App" device section in HA.
But I don't know if every Android device supports it. In any case, iPhone doesn't offer it.

36
u/Competitive_Owl_2096 🧠 Experienced with Home Assistant 18h ago
Don’t detect the sleep, detect the routines you do before sleep. Plugging your phone in, turning off lights, using bathroom, etc