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

This is the best option, waiting for the “Off” state on these TVs is not reliable.

I am still struggling, and hoping one of you bright folks will help me out!

I followed all the documentation and the multiple topics on the issue, but once again it doesn’t work. Here is my code (in the automations.yaml file). I am running on Raspberry Pi, Docker container:

- id: '*************'
  alias: Turn On Living Room TV with WakeOnLan
  description: ''
  trigger:
  - platform: webostv.turn_on
    entity_id: media_player.lg_webos_smart_tv
  action:
  - service: wake_on_lan.send_magic_packet
    data:
      mac: "AA:BB:CC:DD:EE:FF" #redacted 
      broadcast_address: "192.168.4.255"

I can see the button to turn on the TV from the Off state, but it won’t actually turn it on. What am I doing wrong?

  • container is set up to work on the same network as the host

  • The TV is running LG WebOS 4.1.5

  • Connected on ethernet, confirmed broadcast address

  • LG Connect Apps enabled in Network Menu

  • Option for “Mobile On” does not exist in General Settings on the TV

You need to add your TV MAC address.

I have done that already

I had the same issue. Installing the LG app on android and connecting, it seemed to turn on the WOL settings of the TV. Now it works flawless. You can delete the app afterward.

I am using this, and added it in the configuration.yaml.
No need for scripts or automations.

wake_on_lan: #enabling the WOL functionality 

switch:
  - platform: template
    switches:
      lg_tv:
        friendly_name: "Television"
        value_template: "{{ is_state('media_player.lg_yourtv', 'on') }}"
        turn_on:
          - service: wake_on_lan.send_magic_packet
            data:
              mac: 12-34-56-78-90-12 #your mac address
        turn_off:
          - service: media_player.turn_off
            data:
              entity_id: media_player.lg_yourtv
        icon_template: >-
          {% if is_state('media_player.lg_yourtv', 'on') %}
            mdi:television
          {% else %}
            mdi:television-off
          {% endif %}
5 Likes

The blueprint is working perfect for me. The TV turns on instantly when pressing the button on HA. However, HA doesn’t report the TV being on until much later (like 15 or 20s later).
I understand that this is more an issue with the integration and not the blueprint, but does anyone had the same? Any solution? It happens similar when going off. It responds to the input quick, but HA doesn’t report the state change till much later. Command inputs when On work pretty fast.

I am trying to set up an automation when the TV goes on.

Yeah, there is this delay because when the TV is starting it’s actually not responsive, so HA waits for the “heads up”.

I recommend updating the blueprint, there’s a space for actions to run after the TV wakes up properly

works great - thanks!

1 Like

Hi, I have a problem that is drawing me crazy, my LG TV do not maintains the network connection when in standby for sometime. I’m using the blueprint and works perfectly. if I turn off the tv and then on all works great but some hours later I try again and does not work. I look in my router and the tv is gone form my network. I try everything and nothings seems to work, wired, WiFi, all settings in my tv, factory reset tv and router… I do not know what more can I do. The lg app do not turn on the tv either, obviously if is not conected to the network. How can keep the tv connected to the network when is off?. I usually used Alexa and always works perfect now I move to home assistant and I have this problem. Sure is something I miss

Any help wlll be appreciated.

After updating HA the blueprint always breaks. If I duplicate the automation it works again.

Here is the error:

Logger: homeassistant.components.automation
Source: components/automation/config.py:100
Integration: Automatisierung (documentation, issues)
First occurred: 15:06:24 (1 occurrences)
Last logged: 15:06:24

Blueprint 'LG webOS Smart TV - Turn On Action' generated invalid automation with inputs {'webostv_mac': 'XXXXXXXXXXX', 'webostv': 'media_player.tv', 'select_action': False, 'custom_action': []}: Integration 'webostv' does not provide trigger support. Got {'variables': <homeassistant.helpers.script_variables.ScriptVariables object at 0x12f69a690>, 'trigger': [{'platform': 'webostv.turn_on', 'entity_id': 'media_player.tv'}], 'action': [{'choose': [{'conditions': [{'value_template': Template<template=({{ select_action }}) renders=0>, 'condition': 'template'}], 'sequence': []}], 'default': [{'service': 'wake_on_lan.send_magic_packet', 'data': {'mac': 'XXXXXX'}}]}, {'wait_for_trigger': [{'platform': 'state', 'entity_id': 'media_player.t...

Can this be fixed?

I do have this behavior occasionally after restarting the router or updating HA.

However, please check your automation if the icon is red. This happens to me in my previous post.

Hello, have you tried redownloading the blueprint?

Hey there, the important thing is to set the LG connect/mobile app settings to keep the TV awake.

Sadly, for some reason, some models just fail to receive WOL commands reliably, I actually had to get an IR blaster to work around this.

I will try that and report if it still fails.

Thanks

Yes it still fails. I need to duplicate the automation in order to make it work again.

That is weird, I never seen this issue before and it’s quite inconvenient.

All right, first of all I recommend you to delete your automation and create a new one from the blueprint. If the issue keeps happening, then please send the full error log.

Thanks, I already have removed and created the automation when I reinstalled the blueprint.

The log above is complete, I don’t get more when downloading the full log.

Let me know if/how I can get more logs from that.

I think I found something:

When I first start HA after installation and edit the automation while HA still is starting up, I get this error:
Message malformed: Integration 'webostv' does not provide trigger support

After HA is up I can edit the automation without an error.

My guess is that HA marks the automation as defective at first startup.

Note: this only happens when installing HA from scratch, it does not happen from upgrading. I now upgrade HA instead of reinstalling it.

The reason you might be getting this error during installation is because the integration might not be available/configured yet.

I was unable to reproduce your issue over here, so I updated the blueprint to use a different trigger method. Try it out:
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.