I need help. I got an Onkyo receiver and I am trying to set up my Homeassistant so I can play radio stations. I am not sure if I need anything else but I have been trying to set up the automation but nothing happens when triggered. Anyone has an example that I could use.
Does the Onkyo receiver show itself as a Chromecast device? (ie: “chromecast built-in”) (my Sony Bravia TV does) If so, you could use this. Its awesome.
It says it has chromecast built in but in home assistant under the states tab I only see "media_player.onkyo_receiver. Nothing that says chromecast.
it doesn’t need to say chromecast. just use media_player.onkyo_receiver as the media player in the setup I linked and it should work. Towards the bottom of that thread is a copy of how to set it up as a package. That’s the easiest way to include it in your HA.
Quick one ! does it work with hassio?
yep. Its the main thing I use for music at home and I’m on Hassio
here is my setup:
create chromecast_radio.yaml in packages folder and put this in it-
group:
radio:
name: Radio
entities:
- input_select.radio_station
- input_select.chromecast_radio
- script.radio
- input_number.volume_radio
input_select:
radio_station:
name: 'Select Radio Station:'
options:
- Hit 92-9
- Nova 93-7
- Mix 94-5
- 96FM
- 80's
- OldSkool Hits
- Raw FM (dance)
- 181FM Power (Todays Hits)
- 181FM 90's Dance
- 181FM Star 90's
- 181FM The Breeze
- Heat Radio (RnB)
- Fresh 92-7
- DI Chill & Tropical House
- DI Disco House
- DI Funky House
- DI Liquid D&B
initial: Raw FM (dance)
icon: mdi:radio
chromecast_radio:
name: 'Select Speakers:'
options:
- Lounge
- Bedroom
- House
initial: Lounge
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
hide_entity: True
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", "Lounge") %} media_player.lounge_speakers
{% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% 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", "Lounge") %} media_player.lounge_speakers
{% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% 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", "Lounge") %} media_player.lounge_speakers
{% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
{% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
{% endif %}
media_content_id: >
{% if is_state("input_select.radio_station", "Hit 92-9") %} http://sc01.scahw.com.au/6ppm_32
{% elif is_state("input_select.radio_station", "Nova 93-7") %} http://streaming.novaentertainment.com.au/nova937
{% elif is_state("input_select.radio_station", "Mix 94-5") %} http://sc01.scahw.com.au/6mix_32
{% elif is_state("input_select.radio_station", "96FM") %} https://icy.ihrcast.arn.com.au/au_012_icy
{% elif is_state("input_select.radio_station", "80's") %} http://streaming.the80s.com.au/;stream/1
{% elif is_state("input_select.radio_station", "OldSkool Hits") %} http://sc01.scahw.com.au/loveland_32
{% elif is_state("input_select.radio_station", "Raw FM (dance)") %} http://stream.rawfm.com.au:8000/;stream.nsv
{% 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 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
{% endif %}
media_content_type: 'audio/mp4'
I did checkconfig and it was valid. I then ran the script by pressing ‘start playing’ execute but nothing happened. Only the volume changed.
check you stream links. Sometimes even the links I have will fail from time to time and I have to stream a different station. Or check log for errors
I got this from the log: Error executing service <ServiceCall media_player.play_media: entity_id=[‘media_player.onkyo_receiver’], media_content_id=, media_content_type=audio/mp4>
I’m not quite sure how to help with that… have you tried multiple streams? perhaps its just the stream you are trying that has a problem…?
Are you using the code from my example above or from the original thread?
I used the one from your example. I am just gonna try and work on it tonight and see what happens.
what should the receiver be set to in order to hear? I probably got it set incorrectly.
not sure as I don’t have one but I would expect it to auto switch to the correct input. My TV automatically switches over from whatever is showing if I send something to it, even switching itself on if its currently off
It’s just not working out for me. I am now following your example and got rid of all that I had. I did not have a package folder so I created one inside my Config folder. I then created a chromecast_radio.yaml file and place that in the package folder. Now I am not sure what to do from here on. Forgive me I am kind a new to this.
you need to have the correct code in your config.yaml to tell HA to look for packages. here is my example:
configuration.yaml
homeassistant:
name: Home # Name of the location where Home Assistant is running
latitude: !secret latitude #Location required to calculate the time the sun rises and sets
longitude: !secret longitude
elevation: 16 #altitude above sea level in meters
unit_system: metric
time_zone: Australia/Perth # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
customize: !include customize.yaml # Customization file
packages: !include_dir_named packages # package setup
NOTE: it needs to go under the homeassistant:
label, indented by 2 spaces.
Ok I realize that packages is only an easier way to store files and not to clog up my ha. I am getting duplicate files when I use packages so I am placing the files as I normally do.
that wont work with my code above. put it in packages and nowhere else. ie: remove the duplicates from elsewhere. Its not quite the same as simply having the files elsewhere. Using packages allows for multiple entities of things such as customize:
and homeassistant
: whereas you cant do that in your normal yaml files.
ok got it.
What packages folder are you talking about?