Automation generator

Generate Home Assistant YAML from common smart home scenarios

Choose a scenario, device, and room. SmartHomeCompat fills practical entity placeholders first, then advanced users can edit the exact Home Assistant entity IDs.

Turn on a light when a presence or motion sensor detects occupancy.

Entity placeholders are generated automatically from this room. Edit them only if you already know your Home Assistant entity IDs.

Advanced: edit Home Assistant entity IDs

Recommended devices

Aqara Presence Sensor FP2Eve MotionAqara Motion Sensor P1

Share or save this result

Copy the current setup URL or a concise diagnosis summary.

Home Assistant YAML
alias: Turn on light when presence is detected
trigger:
  - platform: state
    entity_id: binary_sensor.hallway_presence
    to: "on"
condition:
  - condition: sun
    after: sunset
action:
  - service: light.turn_on
    target:
      entity_id: light.hallway
mode: single
# Device context: Aqara Presence Sensor FP2
# Replace entity IDs with your actual Home Assistant entities before saving.