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.
What you need
Three things, and the sensor you pick decides whether you keep this automation or delete it after a week.
- A motion sensor covering the way you walk into the room. Get one that reports light level in lux as well as motion, usually sold as a multi-sensor. That second reading is the whole trick, for reasons a few paragraphs down.
- A light the platform can switch: a smart bulb, a smart switch in place of the wall switch, or an ordinary lamp plugged into a smart plug.
- A hub to run the automation. On Apple Home that means a HomePod or an Apple TV, and sensor-triggered automations do not run without one.
How it works
The timer is the part you tune. Five minutes fits a hallway you pass through. Fifteen suits a bathroom. Any fresh movement restarts the count, so the light does not drop out from under someone who is still moving around.
This is where most people's version turns annoying.
You go shopping for a motion sensor, so you come home with a sensor that reports motion and nothing else. It fires just as happily at two in the afternoon with sunlight already across the floor, and the light comes on for nobody's benefit. A sensor that reports light level too lets the automation check whether the room is dark before it bothers.
Add that check and the automation goes quiet whenever the sun is doing the job for free.
The check has one wrinkle. A light sensor sitting in its own light's throw reads well above the threshold as soon as the light comes on. The second person through the door then arrives in a room that no longer looks dark. A naive version refuses to run for them, so their motion is ignored. The first person's timer runs out underneath them, and the light goes off with someone standing right there. The automation has to accept two reasons to run: the room is dark, or this light is already on.
Get the next idea in your inbox
Automation ideas like this one, plus the week's smart home news and gear. Every Friday, free.
Why the light comes on when nobody is there
Because passive infrared sensors do not see people. They see moving heat, so a curtain lifting over a radiator or a car's headlights sweeping through a window can be enough to set one off.
Placement is most of the fix, and it is worth doing before you commit. Add the sensor to your app first, hold it where you plan to mount it, then walk the room and watch what it reports. Aiming it across the doorway rather than out at the window is trivial at that stage and a nuisance once it is stuck to the wall.
The darkness check is where platforms differ
The plain version runs everywhere. Apple Home builds the timeout right into the automation as a "Turn Off After" step, and Alexa can drive the whole thing from the occupancy sensing already inside an Echo.
The light-level condition is the split. Home Assistant, Homey and SmartThings can hold a numeric lux condition without complaint. On Apple Home and Alexa, the honest fallback is restricting the automation to a time window such as sunset to sunrise. It is cruder, since it knows nothing about an overcast afternoon or a room with the blinds shut, but it catches the case that actually irritates you.
When motion is the wrong sensor
Sit still and a motion sensor stops reporting. The timer runs down and the light goes off on someone who never left, which is why waving an arm at the ceiling is a familiar smart home ritual.
So this automation belongs where people pass through: hallways, stairs, bathrooms, garages, the cupboard under the stairs. For rooms where people settle, a presence sensor holds the room occupied while you sit still, and that is a different automation: lights that follow occupancy rather than movement. Some sensors carry both kinds of detection in one unit, so the choice is not permanent.
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: Hallway light on motion, only when dark
description: >-
Turns the hallway light on when motion is detected and the room is dark, then
off again five minutes after the sensor goes quiet. Swap in your own entity
names.
mode: restart
triggers:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "on"
conditions:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.hallway_illuminance
below: 40
- condition: state
entity_id: light.hallway_ceiling
state: "on"
actions:
- action: light.turn_on
target:
entity_id: light.hallway_ceiling
- wait_for_trigger:
- trigger: state
entity_id: binary_sensor.hallway_motion
to: "off"
- delay:
minutes: 5
- action: light.turn_off
target:
entity_id: light.hallway_ceiling
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 lights or devices on when a room is occupied, off when empty
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.
Notify when an appliance finishes its cycle, from its power draw
This automation watches the power an appliance pulls through an energy-monitoring smart plug and alerts you once the draw stays low long enough to mean the cycle is truly over. Without it, wet laundry sits until it turns musty, or you keep checking a machine that finished an hour ago.
Tagged: lighting, motion-detection, sensors