Sending a random song to google cast?

I’m trying to send a random song to my google cast:

  trigger:
    platform: state
    entity_id: input_boolean.longman
    to: 'on'
  action:
    service: media_player.play_media
    data:
      entity_id: media_player.koket
      media_content_id: >
        {{ ["http://192.168.1.64:8091/Brotfest/2%20-%20Slyde%20-%20Kiss%20Kiss%20Bang%20Bang%20%28Twocker%20Remix%29.mp3", "http://192.168.1.64:8091/Brotfest/1%20-%20Dillon%20Francis%20-%20Bootleg%20Fireworks%20%28Burning%20Up%29%20%28Original%20Mix%29.mp3"] | random}}
      media_content_type: audio/mp3

when I go into my inspector i says

media_content_id: {{ [“http://192.168.1.64:8091/Brotfest/2%20-%20Slyde%20-%20Kiss%20Kiss%20Bang%20Bang%20(Twocker%20Remix).mp3”, “http://192.168.1.64:8091/Brotfest/1%20-%20Dillon%20Francis%20-%20Bootleg%20Fireworks%20(Burning%20Up)%20(Original%20Mix).mp3”] | random}}

No sound either. What’s wrong?

Try data_template: in place of data: to let HA know to parse the template.

1 Like