I am trying to use the new sonos sensor about favourites and created this script to play randomly favourites, but i get no success…
sonos_random:
alias: Play Sonos Favourites
sequence:
- service: media_player.play_media
data:
media_content_id: '{{ state_attr("sensor.sonos_favorites", "items") | list | random }}'
media_content_type: audio/mp4
target:
entity_id: media_player.sonos
mode: single
icon: mdi:playlist-music
Can anybody help me to trace where is the error?
1 post - 1 participant