LG webOS Smart TV - Enable Turn On Action for HA 2022.2+

@arsenal3008 he was referring to this post, and not the post above

it works for me like this:

alias: WebOS On
description: ""
trigger:
  - platform: device
    device_id: <device_id>
    domain: webostv
    type: webostv.turn_on
condition: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: <mac-address>
      broadcast_address: <ip-address>
      broadcast_port: 22
  - service: media_player.select_source
    data:
      source: Media Station X
    target:
      device_id: <device_id>
      entity_id: media_player.lg_webos_smart_tv

i have this issue on 1/3 TVs. it will randomly not turn on or will turn on very delayed. the other 2 work without issue always. iā€™ll see if adding the ip fixes it.

thanks for the tip!

EDIT: it didnā€™t fix it. i restarted HA completely and now the device in question responds to WoL instantly.

1 Like

Hello!
Almost the same change was applied to Samsung TVs on the newest beta 2023.4+, so here is a similar blueprint:

Iā€™ll check if I can create dynamic triggers and do a single blueprint for all TVs now that blueprint can take multiple filters.

Is this configuration suitable for LG?

For LG grab the one at the first post

do not use this anymore, thereā€™s definitely an issue with the blueprint. i have 4 LG TVs, two of them are the same model. both on wifi, but one of them responds extremely inconsistently to WoL using this blueprint. with a simple automation it works 100% of the time. this drove me crazy for a week as i figured there couldnā€™t be anything wrong with this blueprint.

the original post says something about disabling/enabling the automation if there are issues. i could get it to work a few times by restarting HA, but it would come back very quickly. not sure why you linked to HA core webos issues, the issue is with this blueprint. webos WoL works great.

thereā€™s a few unneeded things that could be causing an issue. looks like timeout + queued mode might get a little strange. something like this should be kept as simple as possible. butā€¦ itā€™s so easy to do yourself itā€™s not worth figuring out.

this automation is so simple and works 100% of the time when does like this:

alias: webos wake on lan
description: ""
trigger:
  - platform: device
    device_id: ...
    domain: webostv
    type: webostv.turn_on
condition: []
action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: aa:11:22:bb:44:55
mode: single

Hey there, itā€™s a shame youā€™re having issues but Iā€™ve been using my own blueprint for over a year on 3 different models without any issues, all my devices are connected through ethernet.

Itā€™s weird that only one of the four TVs you have is inconsistent despite all of em using the same blueprint, if you want further help send some logs and blueprint configuration.

Back then there was an issue where the media player capabilities wasnā€™t checked correctly but that has been fixed for a long time now and likely are unrelated to your problem.

As long as it works weā€™re all happy

itā€™s obviously been an issue before. you brought it up in the OP.

and this blueprint did work. then it stops responding for no reason and doesnā€™t work again until you restart HA completely. basic WoL works 100% of the time and i havenā€™t had an issue since removing this. just an FYI for anyone who might be experiencing the same :wink: they should also just do WoL themselves as itā€™s very easy. this catch-all automation definitely has issues.

As long as you donā€™t send any evidence or logs I canā€™t help you or even know what issues youā€™re facing.
Letā€™s wait and see if other members show up with the same problem and a more collaborative attitude.

The Blueprint for the LG TV works fine for over 1 year now. Itā€™s my favorite automation. However, one thing has not yet been solved.
The source are clearly listed. I also can see and change them in the configuration of the integration once the TV is on. But, I want a specific source to start as default. This source is an app on the TV that works instead of a settop box.

This is what I programmed in Automation.yaml that I thought would do this. But it doesnā€™t work :sleepy:

Is it possible to select this source?
Where/what did I do wrong?

Apologies but I havenā€™t found the proper way the past the code in this message.

  • id: ā€˜1671053808257ā€™
    alias: KPN as source
    description: KPN
    trigger:ā€™
    • platform: device
      device_id: ca8c09588e2199253d1ae974d8c0d691
      domain: media_player
      entity_id: media_player.lg_webos_tv_617e
      type: turned_on
      condition:
    • condition: time
      after: 00:00:05
      action:
    • service: media_player.select_source
      data:
      source: KPN
      target:
      device_id: ca8c09588e2199253d1ae974d8c0d691
      mode: single

Hello, the newer blueprint version has this built-in, so you only need to do something like this:

description: ""
use_blueprint:
  path: cvroque/webostv_turn_on.yaml
  input:
    webostv: media_player.your_tv
    on_action:
      - service: media_player.select_source
        data:
          source: KPN
        target:
          entity_id: media_player.your_tv
    webostv_mac: AA-BB-CC-DD-EE-99

The blueprint will wait until the TV is available and then change the source! Just make sure that the service to change source actually works by manually testing.

1 Like

Thank you Carlos. Do I have to deinstall the current blueprint first?

Yes, unfortunately HA doesnā€™t have a way to upgrade yet.

1 Like

Hopefully a last question:
This script is in Automation.yaml?

First post here. Thank you for the Blueprint. Iā€™ve added the Plex Integration. Iā€™ve added the LG WebOS integration. Iā€™ve setup the Blueprint, pointing to that device and the MAC ID.

My 2022 LG OLED65C2PUA is recognized. Iā€™ve added a media control card to the dashboard and I can turn the TV on and off through that card.

Once on, I can click ā€¦ Source Plex. Thatā€™s what Iā€™m looking for, and itā€™s there, and it works. I can turn off the TV through the card, but when I go back to turn on, it turns on to my regular HDMI input, my cable provider. When I go back to the three dots, itā€™s set to Living Room TV again.

My question is this.

Is there a way through this automation or some other way to have the TV turn and and when I use this card, ALWAYS be on the Plex app source.

Thank you

If I build this automation via the UI it gives me the following YAML:
You can see that the time of 5 seconds is also included in the trigger and not as an extra condition.

description: ""
mode: single
trigger:
  - platform: device
    device_id: 14a866fc3d7397b331fce4d9fadd65ba
    domain: media_player
    entity_id: media_player.lg_webos_woonkamer
    type: turned_on
    for:
      hours: 0
      minutes: 0
      seconds: 5
condition: []
action:
  - service: media_player.select_source
    data:
      source: KPN
    target:
      entity_id: media_player.lg_webos_woonkamer

You also update this blueprint to include as ā€œActions to run after TV is turned Onā€.

If you want to create your own script/automation, you can also use a wait_for_trigger step to delay your script until your TV is really on and ready to receive input. This is my script to turn on my TV with Plex in this case.

Plex Script
alias: TV Woonkamer - Start Plex
mode: restart
icon: mdi:television-shimmer
sequence:
  - if:
      - condition: or
        conditions:
          - condition: device
            device_id: 14a866fc3d7397b331fce4d9fadd65ba
            domain: media_player
            entity_id: media_player.lg_webos_woonkamer
            type: is_off
    then:
      - service: media_player.turn_on
        data: {}
        target:
          device_id: 14a866fc3d7397b331fce4d9fadd65ba
      - wait_for_trigger:
          - platform: device
            device_id: 14a866fc3d7397b331fce4d9fadd65ba
            domain: media_player
            entity_id: media_player.lg_webos_woonkamer
            type: turned_on
        timeout:
          hours: 0
          minutes: 0
          seconds: 1
          milliseconds: 0
      - service: media_player.select_source
        data:
          source: Plex
        target:
          device_id: 14a866fc3d7397b331fce4d9fadd65ba
      - service: media_player.volume_set
        data:
          volume_level: 0.2
        target:
          entity_id: media_player.lg_webos_woonkamer
    else:
      - service: media_player.select_source
        data:
          source: Plex
        target:
          entity_id: media_player.lg_webos_woonkamer
      - service: media_player.volume_set
        data:
          volume_level: 0.2
        target:
          device_id: 14a866fc3d7397b331fce4d9fadd65ba

Guys,
When I turn the TV off with the media controller there is a delay of like 5-10 before the change appears on the app.
This does not work for my automation which is waiting for the off state of the TV to turn off.

Everything is in local network. Is there anything I can do to speed this up?

Turning on works instantly. However, when I turn off the TV it takes few seconds for the app to recognize that.

this is all included in vanilla HA. i would structure it like this.

make an automation as follows:

then make another automation that when the TV is TURNED ON (not requested) you switch to plex or whatever. this works flawless and requires no blueprints.

1 Like

no, while webOS seems to accept requests quickly, it isnā€™t very fast at updating its state on any of my OLEDS from the past few years. you would work around this by creating a script with the first step being to turn off the TV, then calling whatever you are expecting to be called when the TV is turned off.

you can also try ā€œwhen tv is requested to turn offā€ as the trigger.