Connect Spotify to denon

Hi guys,
I’m pretty new with home assistant. I installed it on my pi and I configured my denon AVR and also installed the spotify connect addon.
Now I can successfully see hassio in the spotify app and I can play music through home assistant.
To do so, the only configuration that I added in configuration.yml is

# Denon
  - platform: denonavr
    #name: NAME
    show_all_sources: True
    timeout: 10
      - zone: Zone2
#        name: NAME

Now, I wanted to create a script to start to play with some automation. What I wanted to do is to simply play a spotify playlist using my denon.
I was reading this thread that I think it’s a bit old now. I’ve tried all the scripts suggested there, the last one is

  alias: 'Spotify Demo'
    - service: media_player.play_media
        entity_id: media_player.spotify
        media_content_type: playlist
        media_content_id: >
          {%- set plists = ["spotify:user:spotify:playlist:37i9dQZF1DX55dNU0PWnO5", 
             ] -%}
            {% set pindex =  (range(0, (plists | length - 1 ) )|random) -%}
            {{ plists[pindex] }}

but when I start the script, nothing happens and I don’t see any error. What am I doing wrong?

In addition, can you guys tell me where the entity_id media_player.spotify is coming from?