Possible issue with state_attr in value template used for comparisons


I’m looking for a little assistance, I think I’m stuck:

I’m using HADashboard to change the modes of my Nest thermostats. HADash is using an input_select containing wife friendly names for the modes. State changes in the input_select triggers an automation to change the mode.

Now what Im attempting to do is the reverse. I want HADashboard to update its status is someone changes the mode at the physical thermostat. I know this works by specifying a mode and running
the action. What Im stuck on is this automation:

- id: '1620093391031'
  alias: Thermostat Control - 1st Floor HVAC Mode Sync
  description: ''
  - platform: state
    entity_id: climate.1st_floor_thermostat
    attribute: hvac_modes
  condition: []
  - service: input_select.select_option
      entity_id: input_select.1stfloor_thermostat_mode
      option:  >
        {% if state_attr("climate.1st_floor_thermostat" , "hvac_modes") == 'off' %}
        {% elif state_attr("climate.1st_floor_thermostat" , "hvac_modes") == 'cool' %}
          'Cool Only'
        {% elif state_attr("climate.1st_floor_thermostat" , "hvac_modes") == 'heat' %}
          'Heat Only'     
        {% elif state_attr("climate.1st_floor_thermostat" , "hvac_modes") == 'heat_cool' %}
        {% elif state_attr("climate.1st_floor_thermostat" , "hvac_modes") == 'fan_only' %}
          'Circulate Air'
        {% endif %}'
  mode: single

When I run this, I get the following error in the log:

Logger: homeassistant.components.input_select
Source: components/input_select/init.py:269
Integration: Input select (documentation, issues)
First occurred: 10:27:53 PM (4 occurrences)
Last logged: 10:38:44 PM
Invalid option: (possible options: Off, Cool Only, Heat Only, Auto, Circulate Air)

I know from past experience that this is probably due to my template being wrong. Since this is the first time I’ve tried to use an attribute’s value for my comparisons, I have a sneaking suspicion that is where my problem lays.

Also, my second question. When I change the mode at the thermostat, the state change is not triggering the automation. I thought how I had it configured would work. Any thoughts?