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
  trigger:
    platform: state
    entity_id: input_select.freetoair
  action:
    - service: homeassistant.turn_on
      data_template:
        entity_id: >
         {% if is_state('input_select.freetoair', 'ABC HD') %}
         script.abc
         {% elif is_state('input_select.freetoair', 'SBS HD') %}
         script.sbs
         {% elif is_state('input_select.freetoair', '7HD') %}
         script.7hd
         {% elif is_state('input_select.freetoair', '7TWO') %}
         script.7two
         {% elif is_state('input_select.freetoair', '7mate') %}
         script.7mate
         {% elif is_state('input_select.freetoair', '9HD') %}
         script.9hd
         {% elif is_state('input_select.freetoair', '10HD') %}
         script.10hd
         {% elif is_state('input_select.freetoair', 'Racing.com') %}
         script.racingfta
         {% 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?