BLUEPRINTS ! Passing an !input as a variable to an action template

I’ve been working a lot with blueprints, but I can’t seem to be able to get past this. From what I’ve read, you can’t use an !input as a condition in a template without first converting it into a variable. Would someone please take a look at this blueprint and see what you believe may be wrong?

blueprint:
  name: Set Room Occupancy Echo Group
  description: Set a Room's Echo Group based on it's Occupancy
  domain: automation
  input:
    name_of_group:
      name: Name of Echo Group
      description: >
        Please use lower case and underscore seperators!
        Example: living_room_occupancy_echos
    occupancy_sensor:
      name: Room Occupancy Sensor
      description: Select the sensor used to determine if the room is occupied.
      selector:
        entity:
          domain: binary_sensor
    echo_devices:
      name: Echo Devices
      description: Select the echo device(s) for this room.  Multiple echos seperated by comma.
      selector:
        entity:
          domain: media_player

trigger:
  - platform: state
    entity_id: !input occupancy_sensor
  - platform: homeassistant
    event: start

variables:
  # Make inputs available as a script level variable
  sensor_var: !input occupancy_sensor
  devices_var: !input echo_devices

action:
  - service: group.set
    data:
      object_id: !input name_of_group
      entities: |
        {% if {{ states(sensor_var) }} == 'on') %}
          {{ devices_var }}
        {% else %}
          []
        {% endif %}
mode: single
Logger: homeassistant.components.automation
Source: components/automation/__init__.py:638
Integration: Automation (documentation, issues)
First occurred: 12:14:27 (16 occurrences)
Last logged: 14:41:34

Blueprint Set Room Occupancy Echo Group generated invalid automation with inputs OrderedDict([('occupancy_sensor', 'binary_sensor.kitchen_is_occupied'), ('echo_devices', 'media_player.kitchen_echo'), ('name_of_group', 'kitchen_occupancy_echos')]): template value should be a string for dictionary value @ data['action'][0]['data']. Got None
Blueprint Set Room Occupancy Echo Group generated invalid automation with inputs OrderedDict([('name_of_group', 'kitchen_occupancy_echos'), ('occupancy_sensor', 'binary_sensor.kitchen_is_occupied'), ('echo_devices', 'media_player.kitchen_echo')]): template value should be a string for dictionary value @ data['action'][0]['data']. Got None

Posting my own solution. It was a syntax issue:

is_state(sensor_var, 'on')