I have a custom intent to play a Sonos Favorite on a selected sonos speaker. Works fine. Here are the relevant parts:
entity sonos_favorites has these attributes
items:
FV:2/23: RP Main Mix
FV:2/22: RP Mellow Mix
My working custom sentence
language: "en"
intents:
PlayMusic:
data:
- sentences:
- "Play {source} (on|in) [the] {media_player}"
lists:
source:
values:
- in: "mellow"
out: "FV:2/22" # I hard coded this infrom sonos_favorites
- in: "main"
out: "FV:2/23"
- in: "world"
out: "FV:2/20"
media_player:
values:
- in: "(living room)"
out: "media_player.living_room"
My working custom intent_script
# Media
PlayMusic:
action:
service: "media_player.play_media"
target:
entity_id: "{{ media_player }}"
data:
media_content_type: favorite_item_id
media_content_id: "{{ source }}"
speech:
text: |-
"OK, playing {{ source }} on {{ state_attr(media_player, 'friendly_name') }}"
When I say “play mellow in study” the response is “OK, playing FV:2/22 on study” and it plays the correct favorite. Good.
BUT
I want it to display/say “OK, playing RP Mellow on study” which is the sonos_favorites name for value FV:2/22
So
- how do I either set the intent list out to “RP Mellow” from the sonos_favorites array I have looked at the sonos examples and had no luck getting the name from the value
OR - Once “FV:2/22” is sent/passed to the intent script how do i template/translate it into “RP Mellow” with an if statement
I have tried to get the name vs the value of of the sonos_favorites array with no look and I have tried templateing the iintent_script with no luck as well.
thanks