Yamaha AVR netradio

Inspired from @Bob_NL [Chromecast Radio with station and player selection] I made something similar for the Netradio feature on Yamaha AVRs.

Group:

group:
  yamaha_radio:
    name: Yamaha Radio
    entities:
    - input_select.yamaha_radio_station
    - script.yamaha_radio

Selector:

input_select:
  yamaha_radio_station:
    name: 'Select Radio Station:'
    options:
      - BBC Radio1
      - BBC Radio 1Xtra
      - 538 - Dance Department
      - 538 IBIZA
      - Ibiza Sonica 95.2 FM
      - DNB FM
      - dnbzone laut.fm

Script:

script:
  yamaha_radio:
    sequence:
      - service: media_player.turn_on
        data:
          entity_id: media_player.yamaha_receiver
      - service: media_player.volume_set
        data:
          entity_id: media_player.yamaha_receiver
          volume_level: 0.48
      - service: media_player.play_media
        data_template:
          entity_id: media_player.yamaha_receiver
          media_content_type: "NET RADIO"
          media_content_id: >
            {% if is_state("input_select.yamaha_radio_station", "BBC Radio1") %} Lesezeichen>Radio>BBC Radio 1
            {% elif is_state("input_select.yamaha_radio_station", "BBC Radio 1Xtra") %} Lesezeichen>Radio>BBC Radio 1Xtra
            {% elif is_state("input_select.yamaha_radio_station", "538 - Dance Department") %} Lesezeichen>Radio>538 - Dance Department
            {% elif is_state("input_select.yamaha_radio_station", "538 IBIZA") %} Lesezeichen>Radio>538 IBIZA
            {% elif is_state("input_select.yamaha_radio_station", "Ibiza Sonica 95.2 FM") %} Lesezeichen>Radio>Ibiza Sonica 95.2 FM
            {% elif is_state("input_select.yamaha_radio_station", "DNB FM") %} Lesezeichen>Radio>DNB FM
            {% elif is_state("input_select.yamaha_radio_station", "dnbzone laut.fm") %} Lesezeichen>Radio>dnbzone laut.fm
            {% endif %}

Customize:

customize:
  script.yamaha_radio:
    friendly_name: Start Playing
    icon: mdi:play

There is a small bug in the yamaha rxv library - when there are more items that fit in one screen (normally about 8) - then you can’t select them. I already created a PR for that.

1 Like

This is wonderfuk. Thanks for posting your code. I am eagerly waiting to try this out tonight!

You could probably clean up your media_content_id by reusing the input_select.yamaha_radio_station state directly, and concatenating it with Lesezeichen>Radio>. That would be much easier to add/remove a station.

That’s true - as long as you only have one bookmark list.

@Romanski

Hi

Just got my new Rx-a3080 with net radio etc. And some multicast 20 speakers.

Is it possible to use this radio selector with the multicast 20s?

Can we set a Radio URL that is not available on net radio?
for whatever reason our new local radio station is available on tunein (iOS app etc) but not available on yamahas netradio which is a rebranded version of tunein provided by Airablenow

Cheers

Update: I changed the condition to an “and”-construction, to remove an error in the log, when the receiver is turned off.

Thanks!

If you allow me to add something: I made a volume slider to go with this.

input_number:
  slider1:
    name: Volume
    initial: 55
    min: 30
    max: 71
    step: 1
 
automation:
  - alias: Set Home Cinema Main Slider Position
    trigger:
    - platform: state
      entity_id: media_player.receiver
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: "{{ not states.media_player.receiver.state == 'off' }}"
        - condition: template
          value_template: "{{ not is_state_attr('media_player.receiver', 'volume_level', states('input_number.slider1') | int / 100) }}"
    action:
      - service: input_number.set_value
        entity_id: input_number.slider1
        data_template:
          value: "{{ trigger.to_state.attributes.volume_level | multiply(100) | int }}"
  - alias: Set Home Cinema Main Volume
    trigger:
      - platform: state
        entity_id: input_number.slider1
    condition:
      - condition: template
        value_template: "{{ not is_state_attr('media_player.receiver', 'volume_level', states('input_number.slider1') | int / 100) }}"
    action:
      - service: media_player.volume_set
        entity_id: media_player.receiver
        data_template:
          volume_level: "{{ states('input_number.slider1') | int / 100 }}" 

And in group.yaml, add in the proper place:

- input_number.slider1

Please make sure to adapt the entity_id’s to how they are in your system.