Hopefully it’s just something really obvious that I’m missing but here goes.
I’m trying to set up a multiroom audio setup on my Amazon Echos to trigger some preset playlists which are selected via input_select and the target is also set via another input_select.
So far I have the input_selects set up without issue, and they’re setting a templated sensor to set the correct target and media type:
- platform: template
sensors:
audiocaster_target: # Used to determine target for audio casting
unique_id: 65887a2b-d04f-437e-a4ae-90c421254fc5
value_template: >
{% if is_state("input_select.select_media_player", "Living Room") %}
media_player.living_room
{% elif is_state("input_select.select_media_player", "Kitchen") %}
media_player.kitchen
{% elif is_state("input_select.select_media_player", "Master Bedroom") %}
media_player.master_bedroom
{% elif is_state("input_select.select_media_player", "Guest Bedroom") %}
media_player.guest_bedroom
{% elif is_state("input_select.select_media_player", "Office") %}
media_player.office
{% elif is_state("input_select.select_media_player", "Everywhere") %}
media_player.everywhere
{% endif %}
audiocaster_media_type:
unique_id: 65887a2b-d04f-437e-a4ae-90c421254fc6
value_template: >
{% if is_state("input_select.select_media", "Kerrang Radio") %}
TUNEIN
{% else %}
AMAZON_MUSIC
{% endif %}
This gives me the correct target and media type, so no issue there.
Next I have created the following script which I intend to populate with these values and trigger from a button:
audiocaster:
sequence:
- service: media_player.play_media
data_template:
target: '{{ states("sensor.audiocaster_target") }}'
data:
media_content_id: '{{ states("input_select.select_media") }}'
media_type: '{{ states("sensor.audiocaster_media_type") }}'
mode: single
alias: Audiocaster
But this consistently fails with:
Failed to call service script/audiocaster. extra keys not allowed @ data['target']
Any ideas what I’m doing wrong here?