Script to change hdmi input on Onkyo reciever

As the title says. Can anybody help me how I can use a script to change the receiver input.
It’s all very confusing, so a little help would be nice.

Use the media_player.select_source service.

Got it to work :slight_smile:
Had to use media_player.receiver instead of media_player.onkyo_tx_rz820

alias: PC Inngang
sequence:
  - service: media_player.select_source
    data:
      source: PC
    target:
      entity_id: media_player.receiver
mode: single
icon: mdi:desktop-classic

But cant get this to work on my LG tv

What is your source_list on the LG entity?

The inputs that I want to select is HDMI 2 that I have named SHIELD witch is the audio return channel Input
and then I have HDMI 4 that is named PC.
Have tried both but no luck.

What sources show in ha attributes?

EDIT mine shows

source_list: AV, Al Jazeera, Amazon Alexa, Amazon Prime Video, Apple TV, Art Gallery, Disney+, Freeview On Demand, HDMI 1, HDMI 2, HDMI 3, HDMI 4, Highbrow, LG Content Store, Live TV, Music, Neon, Netflix, Photo & Video, Sports Alert, TV Cast, TV3, TVNZ OnDemand, Tennis TV, Twitch, Web Browser, YouTube

And this works:

service: media_player.select_source
data:
  source: HDMI 1
target:
  entity_id: media_player.lg_webos_smart_tv

I don’t know what works when you rename. As I say look at your source_list