I am trying to play a single song from a playlist at random. From research I copied and merged several similar scipts to get the following code. It runs with the following error
Failed to perform the action script/aa_random_song2. required key not provided @ data[‘config_entry_id’]
I am not an expert in YAML. Could anyone assist me with a script that will select a song at random from a playlist and play one song on a nominated device.
Appreciate any help.
alias: Play Random Song Script
description: ""
sequence:
- data:
media_type: track
search: Jukebox Queen
limit: 1
order_by: random
response_variable: random_track
action: music_assistant.get_library
- data:
media_content_id: "{{ random_track.tracks[0].uri }}"
media_type: track
enqueue: play
radio_mode: true
target:
entity_id: media_player.spanish_hub
action: music_assistant.play_media
Thank you for the responses. I took the easy approach, set a timer 3:30; play a random song; after timer finishes turn off speaker. Not elegant but mostly does the job.