Konfiguracja Radia dla Packages. Jak korzystać z packages: https://forum.arturhome.pl/t/package-w-home-assistant/707
chromecast_radio.yaml
Kod:
input_select:
radio_station:
name: 'Wybierz Stację Radiową:'
options:
- RMF FM
- RMF MAXX
- RMF Classisc
- AntyRadio
- Absolute Radio Classisc Rock
- Meloradio
- Muzo Radio
- RadioZET
- ChilliZet
- Eska
- Jedynka
- Dwójka
- Trójka
- Złote przeboje
- Spotyfy
- Na Cały Dzień
- DI Disco House
- DI Funky House
- DI Liquid D&B
- Aloha Joe's Relaxation Island
- Spectrum Fit
- Energy FM Australia
- Jazz Relax
- Australian Country
- Rebel FM
initial: RMF FM
icon: mdi:radio
chromecast_radio:
name: 'Wybierz Głośniki:'
options:
- Salon
- Salon Alexa
- Kuchnia
- Lounge and Office
- House
- House except office
- Everywhere
- Everywhere except office
- Back yard
initial: Salon
icon: mdi:speaker-wireless
input_number:
volume_radio:
name: Volume
icon: mdi:volume-high
min: 0
max: 1
step: 0.05
automation:
- alias: 'Listen Radio'
trigger:
- platform: state
entity_id: input_select.radio_station
action:
- service: script.radio
- alias: 'Set Chromecast Radio Volume'
trigger:
platform: state
entity_id: input_number.volume_radio
action:
service: media_player.volume_set
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Salon") %} media_player.pokoj_dzienny
{% elif is_state("input_select.chromecast_radio", "Salon Alexa") %} media_player.artur_s_echo_dot
{% elif is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.artur_s_echo_show
{% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
{% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
{% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
{% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
{% endif %}
volume_level: '{{ states.input_number.volume_radio.state }}'
script:
radio:
alias: Play Radio on Chromecast Audio
sequence:
- service: media_player.volume_set
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Salon") %} media_player.pokoj_dzienny
{% elif is_state("input_select.chromecast_radio", "Salon Alexa") %} media_player.artur_s_echo_dot
{% elif is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.artur_s_echo_show
{% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
{% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
{% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
{% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
{% endif %}
volume_level: '{{ states.input_number.volume_radio.state }}'
- service: media_player.play_media
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Salon") %} media_player.pokoj_dzienny
{% elif is_state("input_select.chromecast_radio", "Salon Alexa") %} media_player.artur_s_echo_dot
{% elif is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.artur_s_echo_show
{% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
{% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
{% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
{% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
{% endif %}
media_content_id: >
{% if is_state("input_select.radio_station", "RMF FM") %} http://217.74.72.11/rmf_fm
{% elif is_state("input_select.radio_station", "RMF MAXX") %} http://www.rmfon.pl/n/rmfmaxxx.pls
{% elif is_state("input_select.radio_station", "RMF Classic") %} http://rmfstream1.interia.pl:8000/rmf_classic
{% elif is_state("input_select.radio_station", "AntyRadio") %} http://stream.polandrockfestival.pl:8000/
{% elif is_state("input_select.radio_station", "Absolute Radio Classisc Rock") %} http://icy-e-bab-04-cr.sharp-stream.com/absoluteclassicrock.mp3
{% elif is_state("input_select.radio_station", "Meloradio") %} https://ml.cdn.eurozet.pl/mel-net.mp3
{% elif is_state("input_select.radio_station", "Muzo Radio") %} http://stream4.nadaje.com/muzo
{% elif is_state("input_select.radio_station", "RadioZET") %} https://zt.cdn.eurozet.pl/zet-tun.mp3
{% elif is_state("input_select.radio_station", "ChilliZet") %} http://chi-net.cdn.eurozet.pl:8900/
{% elif is_state("input_select.radio_station", "Eska") %} http://www.pldm.ml/radio.php?id=-1&url=http://www.eskago.pl/radio/eska-malopolska-zakopane
{% elif is_state("input_select.radio_station", "Jedynka") %} http://mp3.polskieradio.pl:8900/
{% elif is_state("input_select.radio_station", "Dwójka") %} http://mp3.polskieradio.pl:8902/
{% elif is_state("input_select.radio_station", "Trójka") %} http://mp3.polskieradio.pl:8904/
{% elif is_state("input_select.radio_station", "Złote przeboje") %} http://mainstream.radioagora.pl/tuba9-1.mp3
{% elif is_state("input_select.radio_station", "Spotify") %} spotify:playlist:37i9dQZF1E33339f3jF222
{% elif is_state("input_select.radio_station", "Na Cały Dzień") %} https://stream.open.fm/69
{% 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 Funky House") %} http://pub1.diforfree.org:8000/di_funkyhouse_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", "Aloha Joe's Relaxation Island") %} http://s2.voscast.com:7932/
{% elif is_state("input_select.radio_station", "Spectrum Fit") %} http://51.255.235.165:5292/
{% elif is_state("input_select.radio_station", "Energy FM Australia") %} http://s3.viastreaming.net:8502/
{% elif is_state("input_select.radio_station", "Jazz Relax") %} http://199.195.194.94:8036/stream
{% elif is_state("input_select.radio_station", "Australian Country") %} https://streaming.radio.co/s5ea3fdd1c/listen
{% elif is_state("input_select.radio_station", "Rebel FM") %} https://au1.fastcast4u.com/proxy/rblgc?mp=/stream
{% endif %}
media_content_type: 'audio/mp4'
radiostop:
alias: Radio Stop
sequence:
- service: media_player.turn_off
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Salon") %} media_player.pokoj_dzienny
{% elif is_state("input_select.chromecast_radio", "Salon Alexa") %} media_player.artur_s_echo_dot
{% elif is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.artur_s_echo_show
{% elif is_state("input_select.chromecast_radio", "Salon + Salon Alexa") %} media_player.group
{% elif is_state("input_select.chromecast_radio", "Wszystkie") %} media_player.all
{% endif %}
Karta HA :
entities:
- entity: input_select.radio_station
- entity: input_select.chromecast_radio
- entity: script.radio
- entity: input_number.volume_radio
- entity: script.radio_stop
header:
image: /local/images/internet_radio.jpg
type: picture
show_header_toggle: false
type: entities
Obrazek: