Had a look at the cookbook?
triggers:
- trigger: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
to: 'on'
- trigger: state
entity_id: binary_sensor.lumi_lumi_sensor_motion_aq2_motion
to: 'off'
for:
seconds: 30
actions:
- action: "light.turn_{{ trigger.to_state.state }}"
target:
entity_id: light.your_light_here # change this
Motion activated lights automation - Community Guides - Home Assistant Community
If you require a scene, you could use the ‘choose’ funtion to differentiate between on/off trgiggers In the end it would look something like this:
description: "Aqara-motion-sensor automation"
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.lumi_lumi_sensor_motion_aq2_motion
from: "off"
to: "on"
id: "On"
- trigger: state
entity_id:
- binary_sensor.lumi_lumi_sensor_motion_aq2_motion
from: "on"
to: "off"
for:
hours: 0
minutes: 0
seconds: 30
id: "Off"
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- "On"
sequence:
- action: scene.turn_on
metadata: {}
data: {}
target:
entity_id: scene.aqara_lamp_25_cool
- conditions:
- condition: trigger
id:
- "Off"
sequence:
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.lumi_lumi_light_aqcn02_light