This is a simple automation that turns a light on when there is motion, and turns it off when there is not.
Get started
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
blueprint:
name: Motion Controlled Lighting
description: Turn a light on and off based on detected motion
domain: automation
input:
motion_sensor:
name: Motion Sensor
description: A sensor that detects motion
selector:
entity:
domain: binary_sensor
light:
name: Light
description: A light that is turned on and off
selector:
entity:
domain: light
duration:
name: Duration
description: How long the light should stay on for, after motion is detected, before turning off (defaults to 30 seconds)
default: '0:00:60'
trigger:
- entity_id: !input motion_sensor
for: !input duration
platform: state
to: 'off'
- entity_id: !input motion_sensor
platform: state
to: 'on'
condition: []
action:
- data:
entity_id: '{{light}}'
service: 'light.turn_{{mode}}'
variables:
motion: !input motion_sensor
light: !input light
mode: '{{ states(motion) }}'
mode: single