Start an action based on Timer state

Hi there!

I’m busy with my first foray into possible automations :slight_smile:

I’ve so far created an automation that turns on the light in the toilette when motion is detected, and based on time of day, the brightness varies - and then the lights turn off when there’s no motion.

This is how the automation looks like:

- id: '1653391054137'
  alias: Light on in Toilette when motion is detected
  description: ''
  trigger:
  - platform: state
    entity_id:
    - binary_sensor.toilette_motion_sensor_a34a1c25_ias_zone
    to: 'on'
  condition: []
  action:
  - if:
    - condition: time
      before: 06:00:00
      weekday:
      - sun
      - sat
      - fri
      - thu
      - wed
      - tue
      - mon
      after: 00:00:00
    then:
    - service: light.turn_on
      data:
        brightness_pct: 5
      target:
        area_id: toilette
        device_id: 5a8f8481370ca86a7c2c8389561da6a9
        entity_id: light.toilette_lamp_level_light_color_on_off
    - delay:
        hours: 0
        minutes: 1
        seconds: 1
        milliseconds: 0
    - condition: state
      entity_id: binary_sensor.toilette_motion_sensor_a34a1c25_ias_zone
      state: 'off'
    - service: light.turn_on
      data:
        brightness: 0
    else:
    - service: light.turn_on
      data:
        brightness: 255
      target:
        area_id: toilette
        device_id: 5a8f8481370ca86a7c2c8389561da6a9
        entity_id: light.toilette_lamp_level_light_color_on_off
    - delay:
        hours: 0
        minutes: 1
        seconds: 1
        milliseconds: 0
    - condition: state
      entity_id: binary_sensor.toilette_motion_sensor_a34a1c25_ias_zone
      state: 'off'
    - service: light.turn_on
      data:
        brightness: 0
      target:
        area_id: toilette
        device_id: 5a8f8481370ca86a7c2c8389561da6a9
        entity_id: light.toilette_lamp_level_light_color_on_off
  mode: single

Now, I want to add an additional element: turn on the exhaust fan with a Shelly switch when I’m there for more than 2 minutes (for obvious reasons :wink: ) How would I go about this?

EDIT: Am I overthinking it?? Should I just create another automation where the trigger is the motion sensor’s on state, with a “for:” 2 minutes, then an action to turn on the fan for x minutes?