I have this simple script:
lista_radio:
alias: Lista Radio
sequence:
- service: media_player.play_media
data:
media_content_id: media-source://radio_browser/62b0d769-6c12-410a-92da-00a6e6afc616
media_content_type: music
target: >
entity_id: >
{% if is_state("input_select.media_players", "Salotto Audio") %} media_player.salotto_audio
{% elif is_state("input_select.media_players", "Nest Hub") %} media_player.nest_hub
{% elif is_state("input_select.media_players", "Salotto Sonos") %} media_player.salotto
{% elif is_state("input_select.media_players", "Studio") %} media_player.studio
{% elif is_state("input_select.media_players", "Echo Plus") %} media_player.echo_plus
{% elif is_state("input_select.media_players", "Echo Show") %} media_player.echo_show
{% elif is_state("input_select.media_players", "Echo Show 5") %} media_player.echo_show_5
{% elif is_state("input_select.media_players", "Google Home") %} media_player.google_home
{% elif is_state("input_select.media_players", "Google Home Mini") %} media_player.google_home_mini
{% elif is_state("input_select.media_players", "Home") %} media_player.home
{% elif is_state("input_select.media_players", "S22") %} media_player.companion_app
{% elif is_state("input_select.media_players", "Tablet A8") %} media_player.tablet
{% elif is_state("input_select.media_players", "iMac") %} media_player.imac
{% endif %}
mode: single
icon: mdi:radio
and in the dashboard i have a simple card:
type: entities
entities:
- input_select.media_players
- script.lista_radio
- script.media_stop
But it doesn’t work. I can select the media player, but when i press activate the script i get nothing from every media player i choose.
Can somebody help me to trace where is the error?