Skip to content

Guide

Alexa routines as presence sensors: how to build them and how they quietly break

Amazon Echos can feed presence into Home Assistant with one switch and two Alexa routines. Mine stopped working without a single error. Here's how to build it, how it breaks, and the small watchdog that now tells me when it does.

By CJ Zwart

Published

About a 12-minute read

All articles

This started with my first attempt at a full Home Assistant alarm build, back in 2023 or 2024. I read that Echos could double as motion detectors, and with an Echo Show in almost every room of my house, that was too good to pass up. Digging into what Amazon actually exposes led me, eventually, to this setup: an Alexa routine flips a switch in Home Assistant when the Echo detects someone, and a second routine flips it back when the room goes quiet. I've run four of these since May 2025.

In November 2026 I noticed they had stopped updating on my security dashboard. All four had been frozen for at least a week. No errors, no notifications, no unavailable entities. The switches just kept showing whatever they had last been told. This is the build, what went wrong, how I fixed it, and the watchdog I added so it can't happen quietly again.

At a glance

What it does
Turns an Echo's presence detection into a Home Assistant entity, updated within seconds in my use, with no extra hardware
What you need
An Echo the Alexa app offers for Presence Detection (for me, only Echo Shows), Home Assistant exposed to Alexa, and one switch plus two routines per Echo
Original method
NickC's 2022 Home Assistant community guide
What went wrong
Alexa lost the link between my routines and their Home Assistant switches. The routines stayed enabled, with nothing to switch
How long
At least 7 days, as far back as my history goes. The real start is unknown
Fix
Re-picking the switch in each routine brought back Kitchen, Desk and Dashboard. I dropped Bedroom: its Echo was retired and the replacement isn't offered for Presence Detection
Prevention
A watchdog package that checks every morning at 9:00 and alerts me about any switch Alexa hasn't changed in 24 hours
Native alternative
The Alexa Devices integration has a motion sensor, but only for Echos where Amazon reports one. None of mine do
Credit: The method is NickC's, from his February 2022 post in the Home Assistant community, "Simple way to get Amazon Echo 4th generation ultrasound motion/presence sensors into Home Assistant" (opens in a new tab). I built mine from it in May 2025. No company was involved in this article and nothing in it is sponsored.

What you get

A presence sensor tells you a room is occupied, not just that something moved a moment ago. Some Echos can detect people near them, and Alexa lets you use that as the trigger for a routine. Home Assistant can't read that signal from my Echos directly (more on the native integration further down), but it doesn't need to. Alexa can already turn Home Assistant devices on and off. So you give it a switch to turn on.

The whole thing is a relay. The Echo detects you, Alexa runs a routine, the routine turns on a switch in Home Assistant, and anything in Home Assistant can react to that switch. When the Echo stops detecting anyone, a second routine turns the switch off.

Not every Echo can do this. In the current Alexa app, Presence Detection sits under Events with People Recognition, and the app says presence uses Visual ID. When I pick a device for it, the app lists only "Visual ID supported devices": my three Echo Shows. My Echo Spots aren't offered at all. NickC's 2022 guide was about the ultrasound sensing in 4th-generation Echos. I can't tell from the app how Alexa detects people now, so I'll only repeat what the app says.

In my house, two of these switches drive occupancy on my 3D floor plan: the dashboard area and the kitchen. In my use the switch changes within seconds of someone walking in.

NickC said himself, two months after posting the guide, that it worked but wasn't very reliable for him: some Echos didn't always trigger, turning off often took a long time, and he suspected motion outside a window caused false triggers. Later in the same thread, several people reported routines that worked when run by hand but never fired on real presence, and nobody posted a fix. Mine have worked well when the routines are intact. Yours may behave differently, especially on other Echo models.

Building it in 2026

The switch

You need one switch per Echo that does nothing when turned on or off. Home Assistant just remembers the state Alexa sets.

The original guide made this with a YAML template switch whose on and off actions called an empty script. You don't need the empty script any more. I made mine in the UI as template switch helpers with no actions at all: Settings > Devices & services > Helpers > Create helper > Template > Switch. Give it a clear name like "Kitchen presence", leave the actions empty, and save.

A Toggle helper (input_boolean) does the same job. One person in the original thread switched to exactly that in 2023 when the template switch gave them trouble. I used template switches because that's what the guide used, and everything below works the same with either.

Optional: a proper occupancy sensor

A switch can be flipped from a dashboard by accident, and it doesn't look like a sensor anywhere in Home Assistant. I added a template binary sensor for each switch that just mirrors it (Create helper > Template > Binary sensor, with this as its state template):

{{ is_state('switch.kitchen_presence', 'on') }}

Give it the Occupancy device class and use the binary sensor in dashboards and automations instead of the switch.

Expose the switches to Alexa

I use Home Assistant Cloud. If Alexa isn't linked yet, turn on Alexa in Home Assistant Cloud, then in the Alexa app enable the Home Assistant skill, link your account and discover devices. To expose the switches, go to Settings > Voice assistants > Expose and add each switch for Alexa. If you link Alexa with the manual Alexa skill instead, expose them through that skill's filter. I haven't tested that route myself. Either way, check that the switches show up as devices in the Alexa app before building the routines.

Two routines per Echo

In the Alexa app, open Routines and tap + to create a routine for each Echo. I name mine after the room, like "Kitchen Motion" and "Kitchen no motion". For the event, choose Presence Detection (under Events with People Recognition), then pick the Echo.

  • When: that Echo, with People are detected
  • Alexa will: add an action, pick that room's switch, and set Power: On

Save it, then create a second routine:

  • When: the same Echo, with People aren't detected
  • Alexa will: the same switch, Power: Off

Check that both routines show as enabled.

If the app shows Set up now next to an Echo instead of letting you pick it, follow that prompt first. Two of my Shows show it today, even though the presence routines I built on them in May 2025 still run.

The switch shows up in Alexa under its Home Assistant name. Leave the time at Anytime. I didn't find a setting for how long the room has to be empty before "People aren't detected" fires, which may be why turning off can feel slow.

The Alexa app's Edit Routine screen. When: People are detected, on the kitchen Echo Show. Alexa will: Kitchen Motion Sensor, Power: On.
The "on" half of my kitchen pair in the Alexa app. The "off" routine is the same with People aren't detected and Power: Off.

Test each pair before moving on. Walk into the room and watch the switch in Home Assistant, then leave and wait for it to turn off. If it never changes, run the routine by hand from the Alexa app. If that works but real presence doesn't, the trigger is the problem, not Home Assistant.

How it breaks

The presence sensors on my security dashboard had stopped updating, so I went through the history of all four switches. Across the whole 7 days my recorder keeps, not one of them had a real change. Every entry in their history was Home Assistant restarting and restoring the state it already had. Two were stuck on, one was stuck off, and one had no value at all.

My first suspicion was Home Assistant's connection to Alexa, but that was fine. In the same 7 days, the Home Assistant Cloud user had made 172 other changes, mostly turning lights and fans on and off. Commands were getting through. Nothing was sending any for these four switches.

The cause was on the Alexa side. All eight routines still existed and were all enabled, but the action in every one of them pointed at a device Alexa no longer had. Even if a routine fired, it had nothing to turn on. I don't know when or why Alexa dropped the devices, and my history doesn't go back far enough to tell me. Five other routines in my account had the same missing device, so it wasn't something about these switches.

The fix took a few minutes. I opened each routine in the Alexa app and picked the switch again as its action. Within about 20 minutes, the Kitchen, Desk and Dashboard switches had each changed, and every change was made by the Home Assistant Cloud user, which is how Alexa's changes show up. Desk changed before a Home Assistant restart and kept its new state through it; Dashboard and Kitchen changed after it. Bedroom changed too, but that turned out to be a different story (below).

A broken routine doesn't look broken. It stays enabled, changes nothing, and leaves your switch showing a plausible but wrong state.

Why nothing warned me

From Home Assistant's side, nothing was wrong. A switch that nobody changes is a perfectly valid switch. It isn't unavailable, it has a state, and that state survives restarts. Home Assistant has no way to know that something was supposed to be changing it.

From Alexa's side, the routines were all still enabled. I never got a notification that a routine had lost its device, and the Alexa app showed no warning on any of them.

So both systems looked healthy and the data was quietly wrong. The only sign was the data itself: my security dashboard's presence sensors never changed, and my floor plan kept insisting the dashboard area was occupied and the kitchen was empty.

The other way it breaks

There's a second version of the same problem. If the Echo that triggers a routine stops being an Alexa device, the routine's trigger never fires, and the switch freezes the same way. That happened to my Bedroom pair. I built those routines on an Echo Show 5 that I later turned into a View Assist device, so it isn't an Alexa device any more. I had forgotten the routines were still tied to it; I'd have told you they used the bedroom's Echo Spot. Its switch did change right after I re-linked the routine, but most likely because the routine ran once when I saved it, not because anyone walked in. I planned to move both routines to the Echo Spot, but the Spot isn't offered for Presence Detection, so Bedroom has no Echo that can do this and I dropped it. If you replace or retire an Echo, move its routines to the new one, and check that the new one is offered for Presence Detection first.

How to check yours

  • In Home Assistant: open the switch's history. If it hasn't changed in a day in a room people use every day, or every change lines up with a restart, suspect the routine.
  • In the Alexa app: open each presence routine and look at its action. If the device is missing or blank, pick the switch again.
  • The trigger Echo: make sure it is still in your Alexa devices and online.

The watchdog

Re-linking fixed it, but I don't want to find the next one by accident a week later. So I added a small Home Assistant package that watches for it. It's been running on my Home Assistant since November 10, 2026.

What it does

It keeps one date and time helper per switch, holding the last time Alexa changed that switch. Every change records who made it, and changes that come through Home Assistant Cloud carry its user. The package only updates a helper when that user made the change. A Home Assistant restart rewriting the state doesn't count, and neither does me toggling the switch from the app, because either of those could make a dead routine look alive.

Every morning at 9:00, it checks the helpers. If Alexa hasn't changed a switch in 24 hours, or never has, it sends a push to my phone naming the switch and saying how to fix it. If either routine of a pair breaks, the switch can change at most once more before it sticks: a dead "on" routine leaves it off, and a dead "off" routine leaves it on. So a broken routine shows up at the first 9:00 check after the switch has been stuck for a day. The check is skipped while my alarm is armed away, because an empty house legitimately leaves the switches alone.

Run the daily check by hand and you always get a push: the same alert if any switch is stale, or an "all OK" push with how long ago Alexa last changed each switch. That's a quick way to confirm everything is wired up.

Installing it

It's a package because it creates its own helpers, and blueprints can't do that. The file, its README and its tests are on GitHub: EndOfTheLine-HA/ha-echo-presence-watchdog (opens in a new tab).

  1. If you don't use packages yet, add packages: !include_dir_named packages under homeassistant: in configuration.yaml and create a packages folder next to it.
  2. Copy packages/echo_presence_watchdog.yaml (opens in a new tab) from the repository into that folder.
  3. Edit the four things marked CHANGE ME in the file: your switch entity ids, your Home Assistant Cloud user id, your phone's notify action (it appears twice), and your alarm entity (or delete that condition). The file comes with four sample rooms. Each room appears in four places: its helper, the trigger list, the switch-to-helper map, and the daily check's list. Keep those in step, and delete sample rooms you don't use from all four.
  4. Check the configuration under Developer tools > YAML, then restart, or reload Automations and Input datetimes.
  5. In each room, let Alexa turn the switch on and then off (walk in, then leave, or run each routine from the Alexa app). The room's helper should jump to the current time after each change. If the switch changes but the helper doesn't, check the user id and the switch-to-helper map. If the switch doesn't change, check the routine.

Finding your Home Assistant Cloud user id

The easiest way: let Alexa change one of the switches from off to on or on to off (walk into the room, or run the routine from the Alexa app), then straight away paste this into Developer tools > Template, with your own switch:

{{ states.switch.kitchen_presence.context.user_id }}

The long string it shows is the id to put in the package. If it shows None or your own user's id, the last change didn't come from Alexa; let Alexa change the switch again and check right away. Use this method rather than the Users page. With advanced mode on in your profile, Settings > People > Users does list "Home Assistant Cloud" and shows its id when you open it, but there can be more than one. Mine has two, and the first one I opened was not the one Alexa's changes come from. Pick the wrong one and the watchdog alerts on every switch every morning.

Limits worth knowing

  • A room nobody enters for a whole day will trigger an alert even though nothing is broken. So will the opposite: a room someone never leaves. My desk switch once stayed on for more than 14 hours straight because I was at it the whole time, and that was correct. Raise the 24 hours, or leave that room out.
  • A new date and time helper starts at midnight today on my version of Home Assistant, not "never". So on the first day after installing, a broken routine won't be flagged until the following morning. The walk-through in step 5 covers that.
  • If you ever unlink and relink Home Assistant Cloud and its user id changes, the helpers stop updating and you get an alert. That's the right outcome, but it means editing the id.
  • If you use the manual Alexa skill instead of Home Assistant Cloud, Alexa's changes should carry the user that owns the skill's access token. I haven't tested this.

Native Alexa Devices vs routines

Home Assistant's built-in Alexa Devices integration can create a motion sensor for an Echo. I looked into it before keeping the routines, and the short answer is: it depends entirely on what Amazon reports for your Echo.

The integration only creates the motion sensor when Amazon reports that sensor for a given device. According to the official docs, its sensors are fetched from Amazon's cloud every 5 minutes by default, and Amazon sometimes only sends sensor updates when the sensor is used in an Alexa routine.

On my devices, Amazon reports nothing but reachability for every Echo, so no motion sensor exists, even though Alexa runs presence routines from those same Echos within seconds. The library behind the integration lists Echo Show motion data as something to look at next on its roadmap, so this may change. I couldn't test the native sensor at all, because none of my Echos have one.

If you already use Alexa Devices, check yours before building routines. Open each Echo's device page under Settings > Devices & services > Alexa Devices and look for a motion entity. You can also open the three dots menu on the integration entry, Download diagnostics, and search the file for detectionState. If your Echo has the sensor, the native route may be all you need.

Alexa routines and a switchAlexa Devices motion sensor
How it gets presenceAlexa runs a routine that changes a Home Assistant switchHome Assistant fetches Amazon's sensor data
SpeedSeconds, in my useSensor data polled every 5 minutes by default
Which EchosEchos the Alexa app offers for Presence Detection (Visual ID supported, Echo Shows for me)Only Echos where Amazon reports the sensor
Setup per EchoOne switch and two routinesNothing
How it failsSilently: the switch keeps its last stateUntested by me
NeedsHome Assistant exposed to AlexaThe Alexa Devices integration

Alexa Devices also gives each Echo a voice event entity that fires when someone talks to Alexa on it, with their first name if Alexa's Voice ID recognizes them. It isn't presence, but it is a signal that someone is in the room.

Where things stand

  • Kitchen, Desk and Dashboard: working again since November 10, 2026, after re-picking the switch in each routine.
  • Bedroom: dropped. Its routines were tied to the Echo Show 5 I turned into a View Assist device, and the bedroom's Echo Spot isn't offered for Presence Detection. I took it out of the watchdog too.
  • The watchdog: live since November 10, 2026. The daily check and the manual status run are tested, and the recording side has logged real Alexa changes, most recently at 1:37 AM on November 11, when the dashboard switch's helper updated the same second Alexa changed it.
  • Other routines: five more of my Alexa routines lost their devices the same way. Those are on my list.