Randomize media_player.content_id problem

I have a problem with sending a randomized content_id to my Chromecast.
For some reason it only updates the template after a HA restart.

Script:

  sleep:
    alias: Good Night
    sequence:
      - alias: Set Volume
        service: media_player.volume_set
        data:
          entity_id: media_player.bed_room
          volume_level: '1.0'
      - alias: Say Sleep Left   
        service: tts.google_say
        entity_id: media_player.bed_room
        data_template:
          message: 'Next alarm in  {{  (states.sensor.nextalarm.state.split(" ")[0] | int *60 ) | timestamp_custom("%H") | int }} hours and {{  (states.sensor.nextalarm.state.split(" ")[0] | int *60 ) | timestamp_custom("%M")  }} minutes . Good night.'
          cache: false 
      - delay: '00:00:15' 
      - alias: Set Volume2
        service: media_player.volume_set
        data:
          entity_id: media_player.bed_room
          volume_level: '0.75'          
      - alias: Sleep Pill
        service: media_player.play_media
        entity_id: media_player.bed_room
        data_template: 
          media_content_id: 
            '{{ ["https://dl.dropboxusercontent.com/s/wlbuf1942joj1j8/30%20Minute%20Deep%20Sleep%20Music%20Relaxing%20Music%2C%20Meditation%20Music%2C%20Relaxation%20Music%2C%20Soft%20Music%20604B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/pclex2gh8sff7mp/30%20Minute%20Deep%20Sleep%20Music%20Calming%20Music%2C%20Relaxing%20Music%2C%20Soothing%20Music%2C%20Calming%20Music%20426B.mp3?dl=0", 
           "https://dl.dropboxusercontent.com/s/tflavwyxnzlpbek/30%20Minute%20Deep%20Sleep%20Music%20Delta%20Waves%2C%20Sleep%20Hypnosis%2C%20Music%20Sleep%2C%20Fall%20Asleep%2C%20Sleep%20Song%20074.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/avauugij2334rog/30%20Minute%20Deep%20Sleep%20Music%2C%20Peaceful%20Music%2C%20Meditation%20Music%2C%20Sleep%20Meditation%20Music%2C%202972B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/dxvtepx18gyuudo/30%20Minute%20Deep%20Sleeping%20Music%20Relaxing%20Music%2C%20Meditation%20Music%2C%20Calming%20Music%2C%20Relaxation%20992B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/bqvzwn2swxovvql/30%20Minute%20Delta%20Waves%20Sleep%20Music%20Relaxing%20Music%2C%20Calming%20Music%2C%20Soothing%20Music%2C%20Soft%20Music%20169B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/mbza1sdm1zng0q4/30%20Minute%20Relaxing%20Music%20Sleep%20Calming%20Music%2C%20Soothing%20Music%2C%20Relaxation%20Music%2C%20Soft%20Music%20649B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/285h3zkc0bo8ggt/30%20Minute%20Relaxing%20Sleep%20Music%2C%20Calm%20Music%2C%20Soft%20Music%2C%20Relaxing%2C%20Instrumental%20Music%2C%20Sleep%202479B.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/abqfvqc9wqsciz2/30%20Minute%20Relaxing%20Sleep%20Music%2C%20Calm%20Music%2C%20Soft%20Music%2C%20Relaxing%2C%20Instrumental%20Music%2C%20Sleep%2C%202313D.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/75i2fbf6b2orfe0/30%20Minute%20Sleep%20Hypnosis%20Dream%20Music%2C%20Calming%20Music%2C%20Beat%20Insomnia%2C%20Meditation%20Music%20226.mp3?dl=0",
           "https://dl.dropboxusercontent.com/s/4hjg6uiuyxj1ulw/Delta%20Waves%20Sleep%20Music%2030%20Minute%2C%20Relaxing%20Music%2C%20Meditation%20Music%2C%20Sleeping%20Music%2C%20Relax%20160B.mp3?dl=0"] | random}}'
          media_content_type: 'audio/mp3'

The code randomizes correct in the frontend on the templates page.

Any ideas what might be the problem?

Looks like you facing the same Problem as described in Error #5678

Thanks, I’ll keep track of the Github page

Thanks for adding your observations. I’d like to see this one get fixed soon and the more people that report, the better the chance is of that happening.

2 Likes