I am trying to setup a stereo receiver to run my whole home stereo system and would like to use the FM source, but have the users select the station from a drop-down list.
I have the input select added to my configuration.yaml file as well as created a “shell_commands.yaml” file and included it into the configuration file.
I can send the shell commands manually from the console, so I know they’re functioning. if I create a button on the lovelace UI and set it to call service and point it to any of the shell commands, I can make the receiver change to AM/FM/station of choice etc. But when I change the input select drop down menu, it doesn’t execute the shell_command. I see the state change and automation trigger show up in the logbook… but the receiver doesn’t respond, so the shell command clearly didn’t execute. What am I missing? I have been trying to google and follow other snippets, and I thought I had it working the other day but only had one entry in the input_select. now that there is a bunch, i can’t get it to work again.
The pic below shows the card i’ve creatd. the FM and AM buttons both work by calling for a shell command.
configration.yaml
input_select:
radio_station: #used to select whole home stereo's radio station
name: Radio Station
options:
- ""
- "94.5 Virgin Radio"
- "95.3 Z95.3"
- "96.9 JackFM"
- "97.7 Ici Radio-Canada Première"
- "99.3 The FOX"
- "101.1 Rock 101"
- "102.7 The Peak FM"
- "103.5 Move"
- "105.7 CBC"
icon: mdi:radio
initial: ""
shell_command: !include shell_commands.yaml
shell_commands.yaml
#shell commands for assisting automations and other functions
z2radio_off: onkyo --host 192.168.0.24 ZPW00
z2radio_945: onkyo --host 192.168.0.24 TUZ09450
z2radio_953: onkyo --host 192.168.0.24 TUZ09530
z2radio_969: onkyo --host 192.168.0.24 TUZ09690
z2radio_977: onkyo --host 192.168.0.24 TUZ09770
z2radio_993: onkyo --host 192.168.0.24 TUZ09930
z2radio_1011: onkyo --host 192.168.0.24 TUZ10110
z2radio_1027: onkyo --host 192.168.0.24 TUZ10270
z2radio_1035: onkyo --host 192.168.0.24 TUZ10350
z2radio_1057: onkyo --host 192.168.0.24 TUZ10570
z2radio_source_fm: onkyo --host 192.168.0.24 SLZ24
z2radio_source_am: onkyo --host 192.168.0.24 SLZ25
z2radio_source_bluetooth: onkyo --host 192.168.0.24 SLZ2E
z2radio_power_on: onkyo --host 192.168.0.24 ZPW01
z2radio_power_off: onkyo --host 192.168.0.24 ZPW00
and my automations.yaml entry
- id: '44545'
alias: Change Radio Station
description: Change radio station based on dropdown menu selection
trigger:
platform: state
entity_id: input_select.radio_station
action:
service: >
{% if is_state("input_select.radio_station", "94.5 Virgin Radio") %}
shell_command: z2radio_945
{% elif is_state("input_select.radio_station", "95.3 Z95.3") %}
shell_command: z2radio_953
{% elif is_state("input_select.radio_station", "96.9 JackFM") %}
shell_command: z2radio_969
{% elif is_state("input_select.radio_station", "97.7 Ici Radio-Canada Première") %}
shell_command: z2radio_977
{% elif is_state("input_select.radio_station", "99.3 The FOX") %}
shell_command: z2radio_993
{% elif is_state("input_select.radio_station", "101.1 Rock 101") %}
shell_command: z2radio_1011
{% elif is_state("input_select.radio_station", "102.7 The Peak FM") %}
shell_command: z2radio_1027
{% elif is_state("input_select.radio_station", "103.5 Move") %}
shell_command: z2radio_1035
{% elif is_state("input_select.radio_station", "105.7 CBC Music") %}
shell_command: z2radio_1057
{% endif %}
Any help is appreciated.