Files
alexei.dolgolyov e98df855d9 Fix false manual override detection and brightness threshold guard in Motion Light
- Add configurable grace period (default 10s) to prevent false manual
  override detection from delayed device state reports (e.g., Zigbee)
- Fix any_device_on guard to respect brightness_threshold so lights
  below the threshold don't block the automation from triggering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:28:16 +03:00

2.3 KiB

Motion Light Automation Blueprint

This blueprint creates a smart motion-activated light control system. It handles motion detection, luminance-based triggering, and manual override detection to provide intelligent lighting automation.

Features

  • Multiple motion sensor support (triggers on ANY sensor)
  • Condition switches (ALL must be ON for automation to work)
  • Multiple lights and/or switches control
  • Light groups and area-based targeting
  • Configurable timeout delay before turning off
  • Minimum on duration (prevents rapid on/off cycling)
  • Motion sensor debounce (filter false triggers)
  • Smooth light transitions with configurable duration
  • Luminance sensor support (only trigger in dark conditions)
  • Time-based conditions (only active during specified hours)
  • Day/Night mode (different light settings based on time)
  • Scene support (activate scenes instead of light parameters)
  • Dim before off (visual warning before turning off)
  • Manual override detection (stops automation if user changes light) with configurable grace period
  • Brightness threshold (only trigger if light is dim)
  • Custom light parameters (brightness, color, etc.)
  • Callback actions for enable/disable/manual events
  • Debug notifications for troubleshooting

State Machine

The automation tracks these states via persistent storage:

State Value Description
NONE 0 Idle, waiting for motion
ENABLING 2 Light turn-on command sent, waiting for state change
ENABLED 1 Light is ON and controlled by automation
MANUAL 3 User took control, automation paused until light turns off

Behavior Notes

  • Will NOT turn on light if it's already ON (prevents hijacking user control)
  • If user changes light while automation is active, enters MANUAL mode (after grace period)
  • Grace period prevents false manual overrides from delayed device state reports (e.g., Zigbee)
  • MANUAL mode exits when light is turned OFF (by any means)
  • Timeout delay only applies when turning OFF (motion cleared)
  • Time conditions support overnight windows (e.g., 22:00 to 06:00)
  • Day/Night mode uses separate time window from time conditions

Requirements

  • At least one motion sensor
  • input_text entity for persistent state storage
  • Target light(s), switch(es), group, or area to control

Author

Alexei Dolgolyov (dolgolyov.alexei@gmail.com)