- Add complete homeassistant skill source to skills/ directory - Includes all scripts, references, and automation templates - Matches format of other skills in repository
40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
automation:
|
|
- alias: "Motion-Activated Light"
|
|
id: motion_light_template
|
|
description: "Turn on lights when motion detected, turn off after motion stops"
|
|
|
|
trigger:
|
|
- trigger: state
|
|
entity_id: binary_sensor.REPLACE_WITH_MOTION_SENSOR
|
|
to: "on"
|
|
|
|
condition:
|
|
# Optional: Only trigger during dark hours
|
|
- condition: sun
|
|
after: sunset
|
|
before: sunrise
|
|
|
|
action:
|
|
# Turn on the light
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.REPLACE_WITH_LIGHT
|
|
data:
|
|
brightness: 255 # Adjust brightness (0-255)
|
|
|
|
# Wait for motion to stop
|
|
- wait_for_trigger:
|
|
- trigger: state
|
|
entity_id: binary_sensor.REPLACE_WITH_MOTION_SENSOR
|
|
to: "off"
|
|
for:
|
|
minutes: 5 # Adjust delay before turning off
|
|
timeout:
|
|
hours: 2 # Maximum time to wait
|
|
continue_on_timeout: true
|
|
|
|
# Turn off the light
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.REPLACE_WITH_LIGHT
|