I’m using a version of the Chromecast Radio script setup with my Logitech Squeezeboxes. It’s working well and now I’m looking to incorporate some other aspects of my Logitech Media Server - mainly all the stored music by dynamically building an input_select of all the available artists in LMS.
Through the dev services, I’m able to push a link to the artist folder as a playlist and that works. I’ve manually built an artist list as an input_select to control my music:
input_select:
artist_picker:
name: 'Select Artist:'
options:
- Bruno Mars
- Ed Sheeran
script:
artist:
alias: Play artist on squeezebox
sequence:
- service: media_player.volume_set
data:
entity_id: media_player.kitchen_radio
volume_level: '0.35'
- service: media_player.play_media
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Kitchen Radio") %} media_player.kitchen_radio
{% elif is_state("input_select.chromecast_radio", "Living Room") %} media_player.living_room
{% endif %}
media_content_id: >
{% if is_state("input_select.artist_picker", "Bruno Mars") %} /media/usb/Music/Bruno Mars
{% elif is_state("input_select.artist_picker", "Ed Sheeran") %} /media/usb/Music/Ed Sheeran
{% endif %}
media_content_type: 'PLAYLIST'
I know that through JSONRPC I can pull a list of all available artists using this script:
curl -X GET -H "Content-Type: application/json" \
-d '{"id":1,"method":"slim.request","params":["-",["artists",0,10000,"tags:la"]]}' \
http://192.168.1.77:9000/jsonrpc.js
LMS only re-scans once a day so this call would only need to happen daily. What I want to do is build the artist input_select dynamically using the set_options service. This is where my knowledge is limited though, I don’t know how to adjust the output of the curl to make it fit the YAML requirements
options: ["Artist 1", "Artist 2", "Artist 3"]
@smazman I know you’ve got some Squeezebox skills so don’t know if you can help here?