Garage Light Automation

Hi,

I’m completely new to HA and I’m having trouble with an automation for my garage light automation. Here’s the idea: Come home, open garage, garage lights turn on, close garage door, garage is door is closed for 1 minute turn off the garage lights. This part works fine.

I often work in the garage with the lights on, obviously, so if someone were to open the garage to leave the house in their car, the garage door would close 1 minute later the lights would turn off. Is there a way I can put a ‘if the garage light was already on for 5+ minutes’ stop the automation’? See below for my current automation.

alias: Garage Light Off
description: Closing Garage door turns Garage Light Off
trigger:
  - platform: device
    device_id: e420dba1ae53036af579eb5d15595341
    domain: cover
    entity_id: cover.garage_door_door
    type: closed
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition:
  - condition: device
    type: is_on
    device_id: 80da1a7567444c0f5fb7374eb6c7d244
    entity_id: switch.garage
    domain: switch
    for:
      hours: 0
      minutes: 0
      seconds: 0
action:
  - type: turn_off
    device_id: 80da1a7567444c0f5fb7374eb6c7d244
    entity_id: switch.garage
    domain: switch
mode: single

Thank you in advanced.

i m not sure to understand ,
but i often call a script in my automations.
in scripts i put condition so, if the condition is false it stop the script but not the automation. (elif)

action:
  - service: script.withyourcondtionactions1
    data: {}
  - service: script.withyourcondtionactions2
    data: {}
  - type: turn_off
      device_id: 80da1a7567444c0f5fb7374eb6c7d244
      entity_id: switch.garage
      domain: switch

I figured it out. I was way over thinking it.

alias: Auto Garage Light Off
description: >-
  Auto turns off garage light if door is closed for 1 minute but will not turn
  off if garage light was already on for +5 minutes
trigger:
  - platform: device
    device_id: e420dba1ae53036af579eb5d15595341
    domain: cover
    entity_id: cover.garage_door_door
    type: closed
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: device
            type: is_on
            device_id: 80da1a7567444c0f5fb7374eb6c7d244
            entity_id: switch.garage
            domain: switch
            for:
              hours: 0
              minutes: 5
              seconds: 0
        sequence: []
      - conditions:
          - condition: device
            type: is_on
            device_id: 80da1a7567444c0f5fb7374eb6c7d244
            entity_id: switch.garage
            domain: switch
            for:
              hours: 0
              minutes: 0
              seconds: 0
        sequence:
          - type: turn_off
            device_id: 80da1a7567444c0f5fb7374eb6c7d244
            entity_id: switch.garage
            domain: switch
    default: []
mode: single