A single, fully unified blueprint for smart lighting control that seamlessly combines a Motion Sensor and ANY Switch/Button/Remote (Zigbee, ZHA, Z-Wave, MQTT, or State triggers).
It solves the classic problem of manual light overrides conflicting with motion sensors.
Features
- Manual Mode (Switch Override): Turning on the light via switch enters Manual Mode. The light will stay on until X duration after the LAST detected motion (defaults to 2 hours). If motion occurs again, the timeout timer automatically resets. If no motion occurs at all, it stays on until manually turned off.
- Auto Mode (Motion Sensor): If the light is turned on purely by motion, it automatically turns off M minutes after motion stops.
- Sensor Lockout / Debounce: Manual turn-off via switch activates an N-minute lockout window (defaults to 2 minutes). During this window, motion will not turn the light back on β giving you time to walk out of the room without triggering the sensor.
- Single Timer Efficiency: Uses just one helper timer for both the manual timeout and the sensor lockout, as their states never overlap.
- HA Restart Persistence: Automatically restores the manual timeout state if Home Assistant restarts while Manual Mode is active.
Prerequisites (Create Helpers First)
Before creating an automation from this blueprint, create two helpers via Settings β Devices & Services β Helpers:
input_boolean(e.g.,input_boolean.hallway_manual_mode) β Flag for tracking manual mode.timer(e.g.,timer.hallway_light) β Shared timer for manual timeout & lockout.
Links & Installation
You can import this blueprint directly using the button at the top of this post, or inspect the source file directly on GitHub:
- GitHub Repository: Light switch motion unified.yaml
- Raw YAML Link:
https://raw.githubusercontent.com/olegchumakov/ha_blueprints/refs/heads/main/Light%20switch%20motion%20unified.yaml