Select media player for my button

type: button
name: Slam!FM
tap_action:
  action: call-service
  service: media_player.select_source
    service_data:
      entity_id: '{{ value.input_text.selected_mediaplayer }}'
      source: SLAM!

Inside input_text.selected_mediaplayer is the text media_player.woonkamer that’s my media player. I would like to use the text from input_text.selected_mediaplayer (that I can alter somewhere else) inside my button but I don’t know how I can make this work?

I have tried the following with no luck

Summary
type: button
name: Slam!FM
tap_action:
  action: call-service
  service: media_player.select_source
    data_template:
      entity_id: '{{ value.input_text.selected_mediaplayer }}'
      source: SLAM!

I get this error (can’t call service)

type: button
name: Slam!FM
tap_action:
  action: call-service
  service: media_player.select_source
    service_data:
      source: SLAM!
    data_template:
      entity_id: '{{ value.input_text.selected_mediaplayer }}'

I get this error (can’t call service)

Should be:

"{{ states('input_text.selected_mediaplayer') }}"

However you still can’t template Lovelace cards like that without using a custom template card. There are two. One uses Jinja templates (like the above) and the other uses JavaScript. The JS version has less of a performance hit on your frontend. See the links for more info.

I don’t get it. I tried this now but it still doesn’t work? Am I missing something?

Edit: I have installed Lovelace card templater

Summary
type: 'custom:card-templater'
card:
  type: button
  icon: 'mdi:radio'
  name: Slam!FM
  tap_action:
    action: call-service
    service: media_player.media_play
    service_data:
      entity_id: '{{ states('input_text.selected_mediaplayer') }}'
type: 'custom:card-templater'
card:
    type: button
    icon: 'mdi:radio'
    name: Slam!FM
    tap_action:
      action: call-service
      service: media_player.select_source
      name_template:
        entity_id: '{{ states(''input_text.selected_mediaplayer'') }}'
        source: SLAM!

type: 'custom:card-templater'
card:
    type: button
    icon: 'mdi:radio'
    name: Slam!FM
    tap_action:
      action: call-service
      service: media_player.select_source
      service_data:
        entity_id: '{{ states(''input_text.selected_mediaplayer'') }}'
        source: SLAM!