This automation uses a presence sensor to switch a light on when someone is in a room and off once it empties. A plain motion sensor times out and drops the light while you sit still, so you end up waving an arm to bring it back.
What you need
- A presence sensor for the room, usually sold as an mmWave or human presence sensor. What matters is that it uses radar to keep reporting you as present after you stop moving, rather than a plain PIR motion sensor that only reacts to movement. Some pair the two: radar to hold you, and a PIR element for a fast catch as you walk in. Others are radar only. Either works, because the radar is what does the real job here.
- A smart light for the room. To control a fan or a heater instead, put it on a smart plug or an in-wall relay. Your hub drives a switched load the same way it drives a bulb.
- A hub that can act on a held presence state and a delay. Home Assistant and Homey do this cleanly. The cloud assistants do a lighter version, covered below.
- Optional: a light sensor, or a presence sensor with one built in. It does two jobs here. It keeps the light off when the room is already bright, and it is what brings the light on at dusk in a room that has been occupied all afternoon.
How it works
A plain motion sensor turns the light on when it sees movement and off on a timer after the last motion it caught. Sit still to read or work, and the timer runs out. The light dies, and you wave an arm to bring it back. That arm-wave is the sign you are switching on motion, not on occupancy.
Presence sensing drops the timer. Radar is what makes that possible. It keeps seeing you after you stop moving, down to the rise and fall of breathing. So the room reads occupied for as long as anyone is in it, and clear only once it truly empties. Some sensors add a PIR element for a faster catch the instant you walk in, but it is the radar that holds you in a chair. The rule is then plain: presence turns on means light on, presence stays clear for a couple of minutes means light off. Gate the turn-on on a brightness reading and the light stays dark when the afternoon sun already did the job.
That gate needs care, though. A brightness reading checked only at the moment presence arrives is read once and then forgotten. Walk into a bright room at three and settle in, and nothing looks at the room again. The sun goes down around you and the light never arrives. So give the room going dark a cue of its own, and act on it while someone is still there. Occupied and dark, whichever of the two comes last, is the version that holds up across an afternoon.
A presence sensor is only as good as its radar's real reach, and that reach can fall well short of the number on the box. A sensor rated for several meters can have its range set wide open and still register someone only when they are right next to it. It reports the room empty while you sit at the far side of it. Then the light cuts out while you are still there, the same arm-waving you left motion sensing to escape. The fault is not in the automation. It is a sensor that stopped seeing a person who was still there.
Get the next idea in your inbox
Automation ideas like this one, plus the week's smart home news and gear. Every Friday, free.
Getting presence to hold
This idea lives or dies on the sensor's setup, not the automation. Worth getting right before you trust it:
- Aim and range. Radar covers a cone, and its useful reach is often shorter than the spec. Verify it rather than trusting the box. Point it where people actually sit, and open its range to the whole room rather than the near wall. A sensor that only registers you a short distance away will drop you the moment you settle.
- A moving fan or a billowing curtain reads as a person to radar. Better sensors let you carve out a zone to ignore, so the fan in the corner does not hold the light on in an empty room.
- The clear delay. Presence sensors carry their own no-presence timer, usually adjustable from a few seconds to a minute. The automation adds a little grace on top. Too short and a brief radar dropout blinks the light; too long and an empty room burns power. A minute or two, combined, is a sane start.
- Where the light sensor sits. The light you are switching lands on it too. If switching on carries the reading above your threshold, then switching off by hand while you are still in the room drops it back below, and that is exactly the cue to switch it on again. Put the sensor out of the controlled light's throw. If the brightness reading comes from the presence sensor itself, which has to point where people sit, leave the brightness gate out of any room you like to darken by hand.
- If your sensor exposes PIR and radar as two separate readings rather than one occupancy state, hold the light while either is active and release it only when both go quiet. That is the manual version of what a fused presence entity gives you.
Where it runs, and where it half-runs
Home Assistant and Homey run the full version locally: held presence, brightness watched rather than merely sampled, a clearing delay. The cloud assistants are more limited but not shut out. A recent Amazon Echo with built-in ultrasound or Omnisense sensing can trigger an Alexa Routine as a room fills or empties, no extra sensor needed. That handles plain on and off well. Those routines do not do the only-when-dark part reliably, and they will not go back to check the room is still empty after a wait. And getting a third-party presence sensor into Alexa or Google is its own snag. Pairing a sensor's hub over Matter often will not surface the presence the way the vendor's own skill does. The sensor you bought may not appear where you expect it. For the full version, this is a Home Assistant or Homey job.
This idea is shared for inspiration only, not professional advice. If it involves wiring, breakers, or high-draw appliances, verify ratings and your local electrical code, or hire a licensed electrician. Read our full disclaimer.
Get the Home Assistant Automation YAML
Example automation (Home Assistant). A starting point; swap in your own entity names.
alias: Lights follow the room, on when occupied and dark, off once it empties
description: Turn a light on when the room is occupied and dark, whichever of the two happens last, and off a couple of minutes after presence clears. Swap in your own entity names.
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.office_presence
to: "on"
id: occupied
- trigger: numeric_state
entity_id: sensor.office_illuminance
below: 40
id: dark
- trigger: state
entity_id: binary_sensor.office_presence
to: "off"
for:
minutes: 2
id: empty
actions:
- choose:
- conditions:
- condition: trigger
id:
- occupied
- dark
- condition: state
entity_id: binary_sensor.office_presence
state: "on"
- condition: numeric_state
entity_id: sensor.office_illuminance
below: 40
sequence:
- action: homeassistant.turn_on
target:
entity_id: light.office
- conditions:
- condition: trigger
id: empty
sequence:
- action: homeassistant.turn_off
target:
entity_id: light.office
Related Ideas
Simulate occupancy with randomized lighting while away to deter burglars
This automation cycles lights on and off across rooms at randomized times while you are away, imitating how a person moves through a house after dark. A single lamp on a fixed timer does the opposite, handing a watcher the repeating pattern that marks an empty house.
Turn on or adjust lights automatically at sunset, sunrise, or by sun position
This automation triggers your lights from sunset, sunrise, or the sun's elevation rather than a fixed clock time, with an offset so they arrive before the room goes dim. A time you set in autumn is wrong by spring, because the daylight moves and the timer does not.
Turn on lights automatically when motion is detected
Motion-activated lighting turns a lamp or ceiling light on the moment a sensor sees movement, then off again once the room has been quiet for a few minutes. Without it, you are feeling along the wall for a switch in a room you are only crossing.
Use geofencing to adjust your thermostat when you leave and come home
This automation uses your phone's location to set the thermostat back when everyone leaves and bring it up to comfort when the first person returns. A fixed schedule keeps heating an empty house on the days your plans change; geofencing follows the people, not the clock.
Tagged: presence-detection, lighting-automation, energy-saving