Hi,
I’m trying to extent my “Wakeup Light with Radio” automation by adding a selector for different radio streams.
First I tried to code a script (for testing purposes) but I can’t get it to work.
input_select entry:
input_select:
radio_station:
name: Radio Station
options:
- Radio 538
- Q-Music
- 3FM
initial: Radio 538
icon: mdi:radio
Script:
radio538:
alias: Play Radio538 on Chromecast Audio
sequence:
- alias: Start stream
service: media_player.play_media
data:
entity_id: media_player.cc_audio
media_content_id: >
{% if is_state("input_select.radio_station", "Radio 538") %} 'http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3'
{%-elif is_state("input_select.radio_station", "Q-Music") %} 'http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3'
{%-elif is_state("input_select.radio_station", "3FM") %} 'http://icecast.omroep.nl/3fm-bb-mp3'
{% endif %}
media_content_type: 'audio/mp4'
Input selector shows up in my frontend but does not play when I execute the script. Chromecast is activated.
All 3 streams work fine seperately. There are also no errors in my log file.
Help is appreciated.