Delay fail after data_template in Automation

Hi all, so I’ve got this automation for changing TV channels from within HA using an input_select, and it works well and all that. I want to introduce an automatic state change for the input_select, so when I change the channel, after a second it revert back to a default option. The automation is as follows:

- alias: FTA Automation
  initial_state: 'on'
  hide_entity: true
    platform: state
    entity_id: input_select.freetoair
    - service: homeassistant.turn_on
        entity_id: >
         {% if is_state('input_select.freetoair', 'ABC HD') %}
         {% elif is_state('input_select.freetoair', 'SBS HD') %}
         {% elif is_state('input_select.freetoair', '7HD') %}
         {% elif is_state('input_select.freetoair', '7TWO') %}
         {% elif is_state('input_select.freetoair', '7mate') %}
         {% elif is_state('input_select.freetoair', '9HD') %}
         {% elif is_state('input_select.freetoair', '10HD') %}
         {% elif is_state('input_select.freetoair', '') %}
         {% endif %}
    - delay: 00:00:01
    - service: input_select.select_option
      entity_id: input_select.freetoair
      option: 'FREE TO AIR'

Looking at the script as is, there’s no syntax error, however in the config editor while all the “-” in the action field are red, the delay one (the line right after {% endif %}) is in black. I must be missing something obvious for this, but I can’t for the life of me figure out what? Do I need to add something else after the first action to close off the “If” condition?

It’s worth noting that the automation works fine if I don’t have anything else after the {% endif %}. However, if I put anything else after it, HA throws up an error.

Anyone have any ideas?