Why is this invalid - 'for:' in 'condition'?

Got this automation and I have narrowed it to one line that it doesn’t like.

  - alias: 'Upstairs Bath Fan Auto Off'
    trigger:
      # If the bathroom is unoccupied for a while
      - platform: state
        entity_id: binary_sensor.upstairs_hall_bath_occupied
        to: 'off'
        for: '00:30:00'
      # If the humidity has gone down and staying down
      - platform: template
        value_template: "{{ states('sensor.upstairs_hall_bath_4_in_1_sensor_relative_humidity') | float > (states('sensor.upstairs_thermostat_relative_humidity_corrected') | float + 5) }}"
        for: '0:20:00'
    condition:
      # If the bathroom is unoccupied for a while
      - condition: state
        entity_id: binary_sensor.upstairs_hall_bath_occupied
        state: 'off'
        for: '00:30:00'
      # If the humidity has gone down and staying down
      - condition: template
        value_template: "{{ states('sensor.upstairs_hall_bath_4_in_1_sensor_relative_humidity') | float > (states('sensor.upstairs_thermostat_relative_humidity_corrected') | float + 5) }}"
        # *************************************************
        #for: '00:20:00'   <----- ***THIS LINE FAILS WHEN UNCOMMENTED***
        # *************************************************
    action:
      service: switch.turn_off
      entity_id: switch.upstairs_hall_bath_exhaust_fan_switch

Error:

 Invalid config for [automation]: [for] is an invalid option for [automation]. Check: automation->condition->1->for. (See ?, line ?). 

Am I missing something obvious?
Is ‘for’ duration not allowed for a template condition?

Surprisingly the for-attribute in a state does not support time-definition as string.

for:
  minutes: 30

should do.

No joy. Note, I edited my post with **** to make it easier to tell the line in question.

It reports no errors on that state one – only the template one below it fails with ‘for’ (which I want to have).

With the ‘for’ under ‘template’ commented, it has no errors. Uncommented, it fails. I changed it to this and it still fails…

    condition:
      # If the bathroom is unoccupied for a while
      - condition: state
        entity_id: binary_sensor.upstairs_hall_bath_occupied
        state: 'off'
        #for: '00:30:00'
        for:
          minutes: 30
      # If the humidity has gone down and staying down
      - condition: template
        value_template: "{{ states('sensor.upstairs_hall_bath_4_in_1_sensor_relative_humidity') | float > (states('sensor.upstairs_thermostat_relative_humidity_corrected') | float + 5) }}"
# ************************************
        #for: '00:20:00'
        for:
          minutes: 20
# ***********************************
    action:

Since the error comes/goes when I put it in the ‘template’ I presume that’s the issue?

Template condition has no support for for:

1 Like

Well that’s an inconvenient surprise…I rather expected since the template trigger can do it the condition could also.

I guess I’ll have to do a more convoluted template to account for time updated…or build another binary-sensor that I can use ‘for’ on