Input_text as input for media_content_id:

What about just putting it all in a script? Here’s a quick and dirty outline of what I’m thinking:

play_random_track:
  alias: Play a Random Music Track
  sequence:
    - service: media_player.play_media
      data:
        media_content_id: '{{"address_of_pi/local/Playlist/"+ random_track + ".mp3"}}' 
        media_content_type: mp3
      target:
        entity_id: media_player.my_player
  variables:
    random_track: |-
      {{ ['track_1', 'track_2', 'track_3', 'track_4', 'track_5']|random }}

EDIT

Just saw this: Random MP3 file … might be even better since you don’t have to worry about making the list yourself.

2 Likes