Receiver not changing source

Hi, I’m quite new to HA and doing my (almost) first steps.

I stream audio to a Chromecast attached to the receiver. I have configured my Yamaha receiver in the config file so that I can control ist with HA. The receiver turns on when the stream is startet and turns off when the stream is being stopped.

The problem I have is that the source is not changed (in my case to HDMI4 named ChromeCast) when e.g. AV3 was configured for watching TV.

I’m quite sure the bug is sitting in front of the screen :slight_smile: but I would be happy if somebody could help me.

This is the code I used:

Yamaha Receiver

media_player:

  • platform: yamaha
    host: 192.168.192.34
    source_ignore:
    • “AUX”
    • “HDMI6”
      source_names:
      HDMI4: “ChromeCast”
      zone_ignore:
    • “Zone_2”
      zone_names:
      Main_Zone: “Wohnzimmer”

automation yamaha_receiver:
- alias: “Toggle Yamaha-receiver on off when casting to Wohnzimmer”
trigger:
- platform: state
entity_id: media_player.wohnzimmer
action:
- service_template: >
{% if is_state(‘media_player.wohnzimmer’ , ‘off’) %}
media_player.turn_off
{% else %}
media_player.turn_on
{% endif %}
entity_id: media_player.Yamaha_Receiver_Wohnzimmer
- condition: state
entity_id: media_player.wohnzimmer
state: ‘on’
- service: media_player.select_source
data:
entity_id: media_player.Yamaha_Receiver_Wohnzimmer
source: ‘ChromeCast’

# Yamaha Receiver
media_player:
  - platform: yamaha
    host: 192.168.192.34
    source_ignore:
      - "AUX"
      - "HDMI6"
    source_names:
      HDMI4: "ChromeCast"
    zone_ignore:
      - "Zone_2"
    zone_names:
      Main_Zone: "Wohnzimmer"
      
      
automation yamaha_receiver:
    - alias: "Toggle Yamaha-receiver on off when casting to Wohnzimmer"
      trigger: 
        - platform: state
          entity_id: media_player.wohnzimmer
      action:
        - service_template: > 
            {% if is_state('media_player.wohnzimmer' , 'off') %} 
            media_player.turn_off
            {% else %}
            media_player.turn_on
            {% endif %}
          entity_id: media_player.Yamaha_Receiver_Wohnzimmer
        - condition: state
          entity_id: media_player.wohnzimmer
          state: 'on'
        - service: media_player.select_source
          data:
           entity_id: media_player.Yamaha_Receiver_Wohnzimmer
           source: 'ChromeCast'