Motion-Activated Lighting with Home Assistant — Local, No Cloud

Introduction
This is a simple and reliable way to turn on lights automatically when motion is detected using Home Assistant.
The goal is to keep everything local, fast, and independent from cloud services.
This setup works well for hallways, bedrooms, bathrooms, or entry points.

What you need
Home Assistant running (Raspberry Pi, NUC, etc.)
A motion sensor (Zigbee or WiFi)
A smart light or smart relay (Zigbee or WiFi)
Recommended:
Zigbee motion sensor (more stable, lower latency)
Zigbee light switch or smart bulb

Basic concept
The logic is simple:
If motion is detected → turn light ON
If no motion for X minutes → turn light OFF

Step-by-step setup
1. Add your devices to Home Assistant
Make sure:
Motion sensor appears as a binary sensor (motion / no motion)
Light appears as a controllable entity (switch or light)
Example:
binary_sensor.hallway_motion
light.hallway_light

2. Create the automation
Go to:
Settings → Automations → Create Automation

Trigger
Type: State
Entity: motion sensor
To: on

Action
Type: Turn on light
Entity: your light

3. Add auto-off delay
Add a second automation OR extend the first one:
Trigger:
Motion = off
For: 5 minutes (adjust as needed)
Action:
Turn off light

Recommended improvement (important)
Instead of instant OFF, always use a delay:
Bathroom: 2–5 min
Hallway: 1–3 min
Bedroom: 10–15 min
This avoids flickering lights when you are still in the room.

Common mistakes
❌ Motion sensor too sensitive
→ leads to constant toggling
❌ No delay before turning off
→ lights turn off while still inside
❌ Mixing cloud devices
→ introduces lag and instability

Advanced idea (optional)
If you want better behavior:
Add “sun condition”
Only activate when it is dark
Condition example:
If sun is below horizon → allow automation

Related: Frigate + Home Assistant on Raspberry Pi 5 → 
Conclusion
This setup is one of the simplest but most useful automations in Home Assistant.
It improves comfort, reduces manual switching, and works fully locally without dependency on external services.