LG WebOS change source at power on

Hi all,
I’m trying to figure out how to change source to HDMI2 at power on.
I have the following script:

telecamere:
  alias: telecamere
  sequence:
    - service: homeassistant.turn_on
      entity_id: media_player.tv_soggiorno
    - delay: 
        seconds: 2
    - service: media_player.select_source
      entity_id: media_player.tv_soggiorno
      data:
        source: hdmi2

when I trigger the script, the TV turns on, but it does not change the source.
Any idea what’s wrong?
Thanks.

I don’t know if this is any help to you but for my LG TV I have a card set up to switch inputs. Here is a cut/paste from that card.

cards:
  - cards: []
    type: horizontal-stack
  - cards:
      - entity: media_player.mancave_lg_tv
        icon: 'mdi:satellite'
        name: DirecTV
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: DirecTV

I see there are a few differences from what you have. Might be worth a try. Have you tried increasing the delay on your script to longer than 2 seconds?

1 Like

Hi
do you happen to have a card that switches channels for live tv? In the latest versions of webos integration we lost this capability and I haven’t manage to make my own.

Here is the entire card. I checked before replying and it does still switch for all of the sources shown.

cards:
  - cards: []
    type: horizontal-stack
  - cards:
      - entity: media_player.mancave_lg_tv
        icon: 'mdi:satellite'
        name: DirecTV
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: DirecTV
        theme: darkblue
        type: entity-button
      - entity: media_player.mancave_lg_tv
        entity_picture: /local/netflix.png
        name: Netflix
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: Netflix
        type: entity-button
      - entity: media_player.mancave_lg_tv
        icon: 'mdi:antenna'
        name: Antenna
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: LiveTV
        type: entity-button
    type: horizontal-stack
  - cards:
      - entity: media_player.mancave_lg_tv
        icon: 'mdi:youtube'
        name: YouTube
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: YouTube
        type: entity-button
      - entity: media_player.playstation_4
        name: PS4
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: Playstation
        type: entity-button
      - entity: media_player.mancave_lg_tv
        name: Hulu
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            entity_id: media_player.mancave_lg_tv
            source: Hulu
        type: entity-button
    type: horizontal-stack
  - cards:
      - entity: script.tv_volup
        hold_action:
          action: more-info
        icon: 'mdi:volume-plus'
        name: Volume Up
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        theme: darkblue
        type: button
      - entity: script.tv_voldown
        hold_action:
          action: more-info
        icon: 'mdi:volume-minus'
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        type: button
      - entity: script.tv_mute
        hold_action:
          action: more-info
        icon: 'mdi:volume-mute'
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        type: button
    type: horizontal-stack
  - cards:
      - entity: script.tv_ch_up
        hold_action:
          action: more-info
        icon: 'mdi:arrow-up'
        name: Channel Up
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        theme: darkblue
        type: button
      - entity: script.tv_ch_down
        hold_action:
          action: more-info
        icon: 'mdi:arrow-down'
        show_icon: true
        show_name: true
        tap_action:
          action: toggle
        type: button
    type: horizontal-stack
  - cards:
      - entity: media_player.mancave_tv
        type: media-control
    type: horizontal-stack
title: New Card TV Sources
type: vertical-stack

2 Likes

Forgot to mention I also had to set up scripts for volume up/down, mute and channel up/down. I’m sure there are better ways to do this but I plagiarized from other posts to get as far as I did :slight_smile:

tv_volup:
  alias: Volume Up
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: VOLUMEUP
tv_voldown:
  alias: Volume Down
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: VOLUMEDOWN
tv_mute:
  alias: Mute
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: MUTE
tv_ch_up:
  alias: Channel Up
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: CHANNELUP
tv_ch_down:
  alias: Channel Down
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: CHANNELDOWN      
    

This is great! It is working fine.
Thanks

  • if you know, how can I create a button for channel 1 in live tv? can you give an example if it is not difficult for you?

in every case I am very happy with this set up

Very usefull :slight_smile:
Where do I have to add the below?

tv_volup:
  alias: Volume Up
  sequence:
  - service: webostv.button
    data:
      entity_id: media_player.mancave_lg_tv
      button: VOLUMEUP

Etc…

Thanks as well! :slight_smile:

Hi all,
don’t know if this can be helpful to you, but here is a link to add a custom card on lovelace with the LG remote:

LG_Remote_Card

it’s in Italian though.

Cris

Unfortunately that configuration does not work for me.
Cris

Got it… it was just the name of the source. worked with the following:

source: "HDMI 2"

I created or added to scripts.yaml. I don’t recall whether the file existed when I started.

In your configuration.yaml file make sure you have this as well.

script: !include scripts.yaml

Sorry…not sure I can help you there.

1 Like

In the scripts the file is there

cris, the “LG-Remote_Card” page is also available In English :slight_smile:
With some little changes I was able to add it.

Thanks for the tip!