Hello everyone,
I’m trying to template an automation that plays predefined playlist on my 4 Bose Soundtouch speakers. Currently I have 4 seperate automations that are working fine but I’d like to combine them into one. My current setup and config:
-
4 Bose Soundtouch media players
media_player.soundtouch_kuche
media_player.soundtouch_wohnzimmer
media_player.soundtouch_room2
media_player.soundtouch_schlafzimmer
-
4
input_select
to chose from 6 predefined playlistsinput_select.soundtouch_presets_kueche
input_select.soundtouch_presets_wohnzimmer
input_select.soundtouch_presets_room2
input_select.soundtouch_presets_schlafzimmer
They look like this:
soundtouch_presets_kueche: name: Soundtouch Presets options: - "-- Select --" - "Deep Mix Moscow Radio" - "Spotify: Slow Blues" - "SomaFM: Covers" - "Spotify: Sunday Soul" - "Spotify: Mix der Woche" - "Spotify: Mellow Beats"
-
4 Automations that observe each
input_select
and play desired playlist e.g.- id: soundtouch_presets_kueche alias: Soundtouch Preset Kueche trigger: platform: state entity_id: input_select.soundtouch_presets_kueche action: - service: media_player.play_media data_template: entity_id: media_player.soundtouch_kuche media_content_id: > {% if is_state("input_select.soundtouch_presets_kueche", "Deep Mix Moscow Radio") %} 1 {% elif is_state("input_select.soundtouch_presets_kueche", "Spotify: Slow Blues") %} 2 {% elif is_state("input_select.soundtouch_presets_kueche", "SomaFM: Covers") %} 3 {% elif is_state("input_select.soundtouch_presets_kueche", "Spotify: Sunday Soul") %} 4 {% elif is_state("input_select.soundtouch_presets_kueche", "Spotify: Mix der Woche") %} 5 {% elif is_state("input_select.soundtouch_presets_kueche", "Spotify: Mellow Beats") %} 6 {% endif %} media_content_type: PLAYLIST - service: input_select.select_option data: entity_id: input_select.soundtouch_presets_kueche option: -- Select --
I tried the following approach to monitor the state of all 4 input_select
but somehow it’s not working:
- id: soundtouch_presets
alias: Soundtouch Preset Select
trigger:
platform: state
entity_id:
- input_select.soundtouch_presets_schlafzimmer
- input_select.soundtouch_presets_kueche
- input_select.soundtouch_presets_room2
- input_select.soundtouch_presets_wohnzimmer
action:
- service: media_player.play_media
data_template:
entity_id: >
{% if trigger.entity_id == "input_select.soundtouch_presets_schlafzimmer" %} media_player.soundtouch_schlafzimmer
{% elif trigger.entity_id == "input_select.soundtouch_presets_kueche" %} media_player.soundtouch_kuche
{% elif trigger.entity_id == "input_select.soundtouch_presets_room2" %} media_player.soundtouch_room2
{% elif trigger.entity_id == "input_select.soundtouch_presets_wohnzimmer" %} media_player.soundtouch_wohnzimmer
{% endif %}
media_content_id: >
{% if trigger.to_state == "Deep Mix Moscow Radio" %} 1
{% elif trigger.to_state == "Spotify: Slow Blues" %} 2
{% elif trigger.to_state == "SomaFM: Covers" %} 3
{% elif trigger.to_state == "Spotify: Sunday Soul" %} 4
{% elif trigger.to_state == "Spotify: Mix der Woche" %} 5
{% elif trigger.to_state == "Spotify: Mellow Beats" %} 6
{% endif %}
media_content_type: PLAYLIST
Homeassistants log shows the following error when one of the 4 input_select
are set to a playlist:
WARNING [homeassistant.components.media_player.soundtouch] Unable to find preset with id
Can anybody help?