Hobby project. It supplements human supervision and does not replace it. Nobody should rely on it as a safety system.
We recently moved my mother in with us, as we determined it wasn’t safe for her to be living on her own anymore. She has early stages of dementia, and now that she’s living with us, we found she has episodes of night wandering, where she doesn’t realize it’s 2:00am, so she gets up, gets dressed, makes her bed, and wanders around the house. We tried placing notes on her mirror, and large easy-to-read clocks where she could see them, but nothing seemed to work aside from us actually getting up and guiding her back to bed.
So, I decided to see if I could use Home Assistant to help re-direct her back to bed. Full disclosure, I used AI to build and test most of this.
What it does
A set of automations that notice when mom gets out of bed at night and respond in steps: a gentle nudge first, a heads-up to the other adults second, and loud alarms when something looks wrong (a long absence, a hazard door, or a possible fall). The aim is to avoid waking two tired adults for every bathroom trip, while still catching the situations that matter.
Hardware (swap in your own)
- Bed-presence sensors on her bed, and on each side of our bed. Our bed sensors decide who is “up” and who gets alerted. I used ElevatedSensors Bed Presence Sensors for ESPHome)
- Motion/presence sensors in her bedroom, the bathroom, the family room, the kitchen, and a hazard spot (the laundry room, which has the basement door). (I use Aqara P1 PIR sensors for bedroom, bathroom and laundry room, and a ThirdReality R3 for the family room)
- An LED strip under her bed as a night-light. (Govee RGBWWIC LED Strip Light 2 Pro)
- A speaker in the hall near her room and one in the family room, for a short pre-recorded voice message.(I used my Sonos Roam for the hallway, and our Sonos surrounds for the family room, and a pre-recorded MP3 for the audio)
- Phones running the HA companion app, with iOS Critical Alerts allowed so the serious alerts get through Do Not Disturb.
The pieces
1. Evening guide light. After sunset, if mom is moving around her bedroom and isn’t in bed yet, the under-bed strip comes on dim and warm (25%). It goes off 30 seconds after she’s in bed, or 5 minutes after the last motion.
2. Night mode arms itself. Once her bed has been occupied for 20 minutes straight, she counts as “settled.” Between 9 PM and 6:30 AM, as long as no adult is currently out of bed, the system arms for the night. (Arming also turns off a family-room fan, it made the presence sensor read “occupied” and could hide a fall.) System disarms at 6:30 AM if an adult is already up. If both adults are still in bed, it stays armed until the first one gets up, so a sleep-in doesn’t leave mom unmonitored.
3. Mom gets up (step one). About 15 seconds after she leaves the bed, the under-bed strip comes on and a short, calm recording plays in the hall, up to three times, 22 seconds apart. It’s a neutral voice that says her name and suggests going back to bed (e.g., “Marilyn, it’s still night time. Everyone is asleep. Time to go back to bed.”) I used TTS to make the recording because we thought that having a familiar voice (me) coming from a disembodied speaker might be more confusing. Every play checks that the bed is still empty. If she heads to the bathroom, the recording waits until she’s done (up to 5 minutes), then pauses a few seconds before playing again. The recording is skipped if an adult is already up and with her in the family room, or if a caregiver is present.
4. Still up (step two). After 5 minutes out of bed, or about 30 seconds after she’s sensed in the family room, a normal phone notice goes out (“Mom is up since 2:14am, last seen: bathroom”) and a similar recording plays in the family room. The notice goes to whoever is out of bed, or both adults if neither is. The family-room-sighting version goes to both. It is skipped if an adult is already up with her in the family room. The sighting-triggered recording has a 5-minute cooldown so it doesn’t repeat.
5. Real alarms (critical alerts). These punch through silent mode and repeat every 5 minutes:
- Mom has been out of bed 20 minutes, even if she’s been seen. This one is not suppressed if an adult is up.
- She enters the laundry room (the basement stairs are here, so we want to be alerted if she is sensed there).
- A “silence watchdog”: out of bed with no sighting anywhere for 20 minutes, which is the possible-fall case. It is held off only when an adult is up and in the family room where they could see her. The catch is that the sensor can’t tell who is in the room. Any motion in the bathroom, her bedroom, the laundry room, the family room, or the kitchen resets that clock.
Optional extras
- We added a daytime “she’s up” toggle: a normal push when her bed has been empty 15 seconds. It turns itself off when night mode arms. We built this when mom was sick and stayed in bed during the day, so we could be alerted if she got up.
- We also added a “night alert” toggle: a critical push after just 5 seconds out of bed. This was also for when m,om was ill, and needed additional help at night. It isn’t bathroom-aware, so it fires on routine trips.
- We added a “caregiver present” switch (set automatically from a caregiver calendar event, or by hand) which suppresses the voice prompts when a caregiver is in the house. This was added so that when we have a hired caregiver (and we are away), the system doesn’t rely on the same bed-presence and notifications for us.
- Two dashboard buttons that play the voice message on demand. I added these so that if I woke up and heard that she was up and moving around, I could manually fire the voice message before I got up to manually guide her back to bed. It usually works.
- A morning AI-agent report (cron job) that reads the HA logbook and writes a plain-English summary of the night. I use Hermes for this.
Lessons learned
- Start gentle and escalate slowly. Bathroom trips were the hardest part to get right. A motion sensor drops back to “off” after about 30 seconds of stillness, so “she’s in the bathroom” needs a hold or delay.
- Bed sensors can drop to
unavailableduring a network/mesh update. That caused false critical alerts. Gate on a real occupied-to-empty change, and decide whether you want unavailable to read as “alert” or “ignore.” - Test every alert tier on every phone. Critical Alerts need explicit permission in iOS.
- Lights and local audio keep working without internet, but phone pushes don’t. We discovered this during an Internet outage, which prevented phone alerts from being sent. A local fallback (a speaker that sounds the critical alert) is still on my to-do list.
- Write the spec in plain language first, have a coding agent build it, then audit the live configs against the spec. Specs drift, and the audit found real differences. I use two agents to check eachother’s work. I use Hermes (with Nous Deepseek) to write the spec, and then used OpenCode in HA (with Claude Sonnet) to write the automations from the spec> Then I had Hermes review the automations that OpenCreated (my Hermes agent can access my HA via Tailscale).
Before implementing these automations, we were getting up almost nightly when we heard mom moving around in the middle of the night, to manually guide her back to bed. This was after she had already gotten up, got dressed, made her bed, and was wandering around.
The automations have been in place for a couple months now, and as we have tuned them over time, mom is almost always going back to bed after she gets up to use the bathroom. Maybe three times in the past couple months, have we had to get up to manually re-direct her.
I would call this a success! But the real win isn’t the tech. My mom no longer wanders the house in the middle of the night, and we sleep through the night with a lot less worry. That was the whole point.