Thanks for these contributions.
I am also trying to get this working but without success so far. Having trouble with the paths.
Before attempting this I had
homeassistant:
media_dirs:
media: /media
and the Media Browser would play .mp3 files from various folders including /media/Music/Playlist. The full path being
/usr/share/hassio/media/Music/Playlist
The developer tool shows this when playing from this folder -
media_content_id: http://192.168.1.29:8123/media/media/Music/Playlist/Ike%20n%20Tina%20Turner%20-%20Nutbush%20City%20Limits.mp3?authSig=....
I set up
homeassistant:
allowlist_external_dirs:
- "/media/Music/Playlist"
and
sensor:
- platform: folder
folder: "/media/Music/Playlist/"
as the only valid config.yaml allowed.
I get this for the sensor-
so its seeing the tracks I want.
But when I launch my script using
media_content_id: ā{{ state_attr(āsensor.playlistā, āfile_listā)|random }}ā
the developer tool shows
media_content_id: http://192.168.1.29:8123/media/Music/Playlist/Ike%20n%20Tina%20Turner%20-%20Nutbush%20City%20Limits.mp3?authSig=....
i.e with one āmediaā folder level short, and the player does not play the track.
If I change media_dirs to this -
media_dirs:
media: /
the developer still shows
media_content_id: http://192.168.1.29:8123/media/Music/Playlist/Ike%20n%20Tina%20Turner%20-%20Nutbush%20City%20Limits.mp3?authSig=....
and the track does not play.
Where to go with this?
TIA