Automation turn off light after x amount of time

  • When the timer starts, it sets the light’s brightness to 5%.
  • When the timer finishes, it sets the light’s brightness to 0%.
alias: example 
trigger:
  - id: '5'
    platform: event
    event_type: timer.started
    event_data:
      entity_id: timer.your_timer
  - id: '0'
    platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.your_timer
action:
  - service: light.turn_on
    target:
      entity_id: light.your_light
    data:
      brightness_pct: "{{ trigger.id }}"

EDIT

Correction. Wrapped id values in quotes to ensure they are interpreted as strings.

4 Likes