Use input_select on media card

I have the following configuration:

input_select.yaml

media_devices:
  name: dispositivos_media
  options:
    - Sala - Coluna
    - Sala - TV
    - Suite - TV
    - Cozinha - Coluna
    - Escritório - TV

template.yaml

    - unique_id: "all_media"
      icon: "mdi:multimedia"
      state: >-
        {% if is_state('input_select.media_devices', 'Sala - Coluna') %} media_player.sala_2
        {% elif is_state('input_select.media_devices'), 'Sala - TV') %} media_player.tv_da_sala_de_estar
        {% elif is_state('input_select.media_devices'), 'Suite - TV') %} media_player.tv_do_quarto
        {% elif is_state('input_select.media_devices'), 'Cozinha - Coluna') %} media_player.cozinha_2
        {% elif is_state('input_select.media_devices'), 'Escritório - TV') %} media_player.tv_escritorio
        {% endif %}
      attributes:
        friendly_name: "Dispositivos Multimedia"

lovelace card

type: vertical-stack
cards:
  - type: entities
    entities:
      - input_select.media_devices
  - type: custom:config-template-card
    entities:
      - input_select.media_devices
    card:
      type: custom:mushroom-media-player-card
      entity: ${ states['input_select.media_devices'].state }
      icon_type: icon
      use_media_info: true
      show_volume_level: true
      media_controls:
        - on_off
        - play_pause_stop
      volume_controls:
        - volume_mute
        - volume_set
        - volume_buttons

The card is not getting the device associated with the name, ie, if i select ‘Sala - Coluna’, it will fill the card with the device name ‘Sala - Coluna’ and not with the media_player.sala_2. If i change the input_select and use the same names as the media_player entities, everything works as expected.

What am i doing wrong?

Thanks in advance

Test two thing:

Look at the true state in Developer Tools to make sure the state is truly in this format
Sala - Coluna

Add Double Quotes to the state in the IF statement
state: >-
{% if is_state(‘input_select.media_devices’,“Sala - Coluna”) %} media_player.sala_2

It still doesn’t assume that ‘Sala - Coluna’ is media_player.sala_2