I have an input_button to execute an automation that will play the selected station on the selected media player. However, I am running into some issues and am not sure where I messed up. Can you please help?
**Input Select**
music_stations:
name: Station List
options:
- 93XRT
- 98 Rock
music_players:
name: Music Player
options:
- media_player.echo_office
- media_player.echo_dining_room
**Automation**
- alias: Play Music
trigger:
- platform: state
entity_id: input_button.play_music
action:
- service: media_player.play_media
entity_id: input_select.music_players
data:
media_content_type: "TUNEIN"
media_content_id: input_select.music_stations
Uhh, where are you attempting to insert this YAML exactly? It looks like you’ve jumbled together bits and pieces for two template selects and one automation, but these parts can not be combined like this.
Template select go into your configuration.yaml (or linked in separate file(s)), while automations typically go into automations.yaml (or linked in separate file(s)). There are also a whole lot of mandatory code missing, and your indentation is a mess which is a problem as it is a part of the syntax.
Sorry for the confusion, I do have the input selects, input button and automation in the correct files. For the purpose of this example, I could have been more clear about that. I edited the above to reflect.
You are never getting the value of the input_select, you are literally attempting to play media with id “input_select.music_stations”.
**Automation**
- alias: Play Music
triggers:
- trigger: state
entity_id: input_button.play_music
actions:
- action: media_player.play_media
target:
entity_id: "{{ states('input_select.music_players') }}"
data:
media_content_type: "TUNEIN"
media_content_id: "{{ states('input_select.music_stations') }}"
Also you were for some reason using the old automation syntax, which you should no longer do unless you for some reason is stuck on an old version of Home Assistant.