I have this script that turns on radio every morning:
accendi_radio_mattina:
alias: Accendi Radio Mattina
sequence:
- service: switch.turn_on
entity_id: switch.ampli_on
- delay: 00:00:01
- service: media_player.volume_set
data_template:
entity_id: media_player.salotto_audio
volume_level: 0.5
- service: input_number.set_value
data_template:
entity_id: input_number.radio_volume
value: 0.5
- service: input_boolean.turn_on
entity_id: input_boolean.radio_play
- service: media_player.play_media
data_template:
entity_id: media_player.salotto_audio
media_content_id: "http://broadcast.infomaniak.net/tsfjazz-high.mp3"
media_content_type: 'audio/mp4'
But i have several radio station configured in another script. How to change this script to turn on randomly radios configured in another script?
The list of configured radios is the following:
media_content_id: >
{% if 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
{% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
{% elif is_state("input_select.radio_station", "Sky Radio") %} http://19993.live.streamtheworld.com:80/SKYRADIO_SC6
{% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
{% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
{% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
{% elif is_state("input_select.radio_station", "Hot 108") %} http://jbmedia-edge1.cdnstream.com:80/hot108
{% elif is_state("input_select.radio_station", "The Beat") %} http://live.leanstream.co/CKBTFM-MP3
{% elif is_state("input_select.radio_station", "Alt Rock") %} http://149.56.23.7:20254/stream
{% elif is_state("input_select.radio_station", "Hit Remixes") %} http://149.56.23.7:20252/stream
{% elif is_state("input_select.radio_station", "Play Radio") %} http://176.9.31.78:8222
{% elif is_state("input_select.radio_station", "Elium-Rock") %} http://listen.radionomy.com/Elium-Rock
{% elif is_state("input_select.radio_station", "Classic Rock Florida") %} http://listen.shoutcast.com/Classic-RockFlorida
{% elif is_state("input_select.radio_station", "181FM Power (Todays Hits)") %} http://listen.181fm.com/181-power_128k.mp3?
{% elif is_state("input_select.radio_station", "181FM 90's Dance") %} http://listen.181fm.com/181-90sdance_128k.mp3
{% elif is_state("input_select.radio_station", "181FM Star 90's") %} http://listen.181fm.com/181-star90s_128k.mp3
{% elif is_state("input_select.radio_station", "181FM The Breeze") %} http://listen.181fm.com/181-breeze_128k.mp3
{% elif is_state("input_select.radio_station", "Heat Radio (RnB)") %} http://174.37.159.206:8106/stream
{% elif is_state("input_select.radio_station", "Fresh 92-7") %} http://live.fresh927.com.au/freshmp3
{% elif is_state("input_select.radio_station", "DI Chill & Tropical House") %} http://pub1.diforfree.org:8000/di_chillntropicalhouse_hi
{% elif is_state("input_select.radio_station", "DI Disco House") %} http://pub1.diforfree.org:8000/di_discohouse_hi
{% elif is_state("input_select.radio_station", "DI Liquid D&B") %} http://pub1.diforfree.org:8000/di_liquiddnb_hi
{% elif is_state("input_select.radio_station", "Jazz Blues") %} http://icepe5.infomaniak.ch/jazzblues-high.mp3
{% elif is_state("input_select.radio_station", "TSF Jazz") %} http://broadcast.infomaniak.net/tsfjazz-high.mp3
{% elif is_state("input_select.radio_station", "Jazz FM") %} http://tx.sharp-stream.com/icecast.php?i=jazzfmmobile.mp3
{% elif is_state("input_select.radio_station", "ABC Classic 2") %} http://live-radio02.mediahubaustralia.com/FM2W/mp3/
{% elif is_state("input_select.radio_station", "Boston Baroque Radio") %} http://peridot.streamguys.com:7010/bblive-sgplayer
{% elif is_state("input_select.radio_station", "Radio1") %} http://icestreaming.rai.it/1.mp3
{% elif is_state("input_select.radio_station", "Radio2") %} http://icestreaming.rai.it/2.mp3
{% elif is_state("input_select.radio_station", "Radio3") %} http://icestreaming.rai.it/3.mp3
{% elif is_state("input_select.radio_station", "GrParlamento") %} http://icestreaming.rai.it/7.mp3
{% elif is_state("input_select.radio_station", "Radio24") %} http://shoutcast.radio24.it:8000/listen.pls
{% elif is_state("input_select.radio_station", "Deejay") %} http://radiodeejay-lh.akamaihd.net/i/RadioDeejay_Live_1@189857/master.m3u8
{% elif is_state("input_select.radio_station", "Virgin") %} http://icecast.unitedradio.it/Virgin.mp3
{% elif is_state("input_select.radio_station", "Capital") %} http://radiocapital-lh.akamaihd.net/i/RadioCapital_Live_1@196312/master.m3u8
{% elif is_state("input_select.radio_station", "Radio 105") %} http://icecast.105.net/105.mp3
{% elif is_state("input_select.radio_station", "Radio Italia") %} http://sr9.inmystream.info:8006
{% elif is_state("input_select.radio_station", "Radio Sportiva") %} http://nr5.newradio.it:8545/stream.mp3
{% elif is_state("input_select.radio_station", "R101") %} http://icecast.unitedradio.it/r101
{% elif is_state("input_select.radio_station", "RDS") %} http://stream1.rds.it:8000/rds64k
{% elif is_state("input_select.radio_station", "Subasio") %} http://onair18.xdevel.com:8152
{% elif is_state("input_select.radio_station", "Radio Montecarlo") %} http://edge.radiomontecarlo.net/RMC.mp3
{% elif is_state("input_select.radio_station", "Radio Montecarlo 2") %} http://edge.radiomontecarlo.net/MC2.mp3
{% endif %}
media_content_type: 'audio/mp4'