Motion activated lights automation

This gets asked a lot so here is an example for automating a light to come on with movement and go off after there is no movement for a short time.

triggers:
  - trigger: state
    entity_id: binary_sensor.your_motion_sensor_here # change this
    to: 'on'
  - trigger: state
    entity_id: binary_sensor.your_motion_sensor_here # change this
    to: 'off'
    for:
      minutes: 2 # adjust as necessary 
actions:
  - action: "light.turn_{{ trigger.to_state.state }}"
    target:
      entity_id: light.your_light_here # change this

The Home Assistant Cookbook - Index.

28 Likes