Random song chosen in automation

I’m looking for a way to random play one of the songs from the same location (file system) when automation is run. How can I try to attempt it? Automation is time triggered. Right now I have it done that always one song is played.

Jumping in, not because I have a great way to do this but mainly I want to see what approaches other folks suggest.

What I’m currently doing is below. I’m using a script for each song because I had different media types and had trouble calling them directly with the same general method. I truncated it down a bit as I have quite a few songs I’m randomly picking from.

service: script.turn_on
data: {}
  entity_id: >
    {{ ['script.script1',
    'script.script2', 'script.script3'] |
    random }}

If someone has an easy way to randomly play a song from a selected folder, that would be SOOO much more elegant/easy.

1 Like