How to activate my ventilation for 10 minuts in datatemplate?

Hi

Part of my datatemplate is

        {% elif hum_d < 6 and is_state('binary_sensor.toilet', 'on') %} 60

what activates the toilet ventilation at 60(%) for a standard time of 2 (?) minutes.
Does anyone knows how to set the minimum time for ventilation after triggering for 10 minutes?

Just adding ‘for 10 minutes’ doesn’t work

See full config below:

- alias: Badkamer ventilatie
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: sensor.badkamer_2
  - platform: state
    entity_id: binary_sensor.toilet
  action:
  - service: fan.set_percentage
    entity_id: fan.mechanische_ventilatie
    data_template:
      percentage: >
        {% set hum = states('sensor.badkamer_2') | float %}
        {% set hum_d = ( ( states('sensor.badkamer_2') | float ) - ( states('sensor.slaapkamer_2') | float) ) %}
        {% if hum_d < 6 and is_state('binary_sensor.toilet', 'off') %} 0
        {% elif hum_d < 6 and is_state('binary_sensor.toilet', 'on') %} 60
        {% else %} {{ ( states('sensor.badkamer_2')|float * 1.6 ) - 60 }}
        {% endif %}

Thanks!!