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

I’ve migrated to 2022.02 my WebOS TVs without issues.
Both methods are working for me (automation via platform: webostv.turn_on and automation via UI [platform: device]).
Only Visual Code server complains of platform: webostv.turn_on: Value is not accepted. Valid values: “numeric state”

1 Like

Hello,

Same issue as @IVictor on my end. After a restart, the button to turn it on is not there anymore. Seems like a bug. I restarted the container the hard way (docker restart) and it’s back.

1 Like

Hello. There’s currently a bug where if you add/remove/reload integrations while the device is off it stops supporting the turn_on action. The fix is already merged and should come up soon.

amazing job, I just added n automation to turn on the tv and was working on adding a button to run it when I found this.

2 Likes

Any new updates on this? Even with the blueprint, the connection is lost from time to time. A HA restart fixes the issue, but not permanently. Thanks!

I tried it and its nice. it turns the TV off but can’t turn it on for some reason

Thank you good sir! Works like a charm!

1 Like

fadysedik do you have Wake On Lan added to configuration.yaml.

1 Like

is it right, that the only option to turn on my projector (webOS 6.0) is WOL? Turn off it of via “media player turn off” is working fine - but waking up isn’t

@carlos.vroque

i added WOL “broadcast_address” to your blue print.
i need that, because my projector is in a different subnet.

blueprint:
  name: LG webOS Smart TV - Turn On Action
  description: |

    ## LG webOS Smart TV - Turn On Action for 2022.2+

    This blueprint will run anytime the user turns the media player on through Home Assistant (UI or service).

    Adding this blueprint will allow the user to turn on the LG webOS TV through the UI after updating to HA 2022.2, without this blueprint or similar automation the Turn On button won't be displayed due to a breaking change. This is basically a shortcut to manually adding the automation described in the [official documentation][1].

    The default action is to send a Wake On Lan magic packet in order to turn the TV on. Aditionally you can also setup custom actions for alternate solutions such as: using an IR remote, turning a smart socket on or calling an script. This is also useful for TV models connected through Wireless that have issues with Wake on Lan.


    ### Requirements:
    - [LG webOS Smart TV][2] integration
    - [Wake On Lan][3] added to configuration.yaml

    ### Changelog:
    - 2022.02.03 - First release
    - 2022.02.06 - Custom actions added


    [1]: https://www.home-assistant.io/integrations/webostv/#turn-on-action
    [2]: https://www.home-assistant.io/integrations/webostv/
    [3]: https://www.home-assistant.io/integrations/wake_on_lan/

  domain: automation
  source_url: https://gist.github.com/cvroque/6780ca0869ef781e9de3b506fd501f78#file-webostv_turn_on-yaml
  input:
    webostv:
      name: LG webOS TV
      description: Select your media player entity
      selector:
        entity:
          domain: media_player
          integration: webostv
    webostv_mac:
      name: LG webOS TV MAC address
      description: The MAC address of the selected TV. You can get this information on your TV network settings or through your router.
      default: AA-BB-CC-DD-EE-FF
    webostv_broadcast:
      name: LG webOS TV Broadcast IP
      description: The IP of your Device.
      default: 192.168.1.1
    select_action:
      name: Enable Custom Actions?
      description: When turned Off the default action is to send a magic packet, when turned On only the custom actions will run.
      default: false
      selector:
        boolean: {}
    custom_action:
      name: Custom Actions (Optional)
      description: When custom actions are enabled this automation will only perform the actions added here. Useful for TVs being turned on through an IR remote, script or similar.
      default: []
      selector:
        action: {}
variables:
  select_action: !input 'select_action'
trigger:
  - platform: webostv.turn_on
    entity_id: !input webostv
action:
  - choose:
    - conditions:
      - '{{ select_action }}'
      sequence: !input 'custom_action'
    default:
      - service: wake_on_lan.send_magic_packet
        data:
          mac: !input webostv_mac
          broadcast_address: !input webostv_broadcast
mode: queued
max_exceeded: silent

1 Like

I’m back to using the remote control to turn the TV on - I have absolutely no idea what’s happening with this integration, and find it pretty poor how dismissive the dev is of the inability of the Integration to turn the TV on natively without having to use an Automation or Template Switch.

It doesn’t seem like I’m the only person with this issue either - pretty disappointing.

Kudos to Carlos, but unfortunately this solution isn’t functional for me :frowning:

Update: Pre-2022 builds, it was quite happy turning the TV on and off via the hard wired MAC address, now it won’t do that. I’ve just gone and unplugged the hard wired 1 gbps connection to the TV, and it will once again turn on and off via the automation, but for how long I’m not sure, as it was also working last night when hard wired…

The TV firmware hasn’t updated recently, yet the Integration has.

Update 2 - Potential Fix for Hard Wired WoL - I think I may have identified a fix for WoL via a hardired connection - at some stage, it looks like LG have enabled a function called Quick Start+, whereby the TV goes into a standby state, rather than powering off. In their infinite wisdom, LG have disabled WoL via Ethernet, and only left it enabled via Wireless.

It works beautifully using wakeonlan from a Linux server, but not consistently via HA…

To turn it off Quick Start+, the setting is under TV Management:
Settings → All Settings → General → Devices → TV Management

2 Likes

I think this is now fixed in 2022.3.0, I noticed a pull in the code for webostv to reenable the feature…

Still testing with the TV hard wired, but so far so good, with Quick Start on and off

Hi,

Thanks for sharing the Blueprint. I finally got it working, and I’d like to share my experience.

Although the Blueprint marks the broadcast address as optional, I have to set it to the IP address of my LG TV. I found the following error from logs when leaving the broadcast address empty:

2022-03-05 11:15:46 ERROR (MainThread) [homeassistant.components.automation.lg_webos_smart_tv_turn_on_action] LG webOS Smart TV - Turn On Action: Choose at step 1: default: Error executing script. Invalid data for call_service at pos 1: value should be a string for dictionary value @ data['broadcast_address']
2022-03-05 11:15:46 ERROR (MainThread) [homeassistant.components.automation.lg_webos_smart_tv_turn_on_action] LG webOS Smart TV - Turn On Action: Error executing script. Invalid data for choose at pos 1: value should be a string for dictionary value @ data['broadcast_address']
2022-03-05 11:15:46 ERROR (MainThread) [homeassistant.components.automation.lg_webos_smart_tv_turn_on_action] Error while executing automation automation.lg_webos_smart_tv_turn_on_action: value should be a string for dictionary value @ data['broadcast_address']

I’m not sure whether it’s caused by the default value of it is []: https://gist.github.com/cvroque/6780ca0869ef781e9de3b506fd501f78#file-webostv_turn_on-yaml-L42-L45
It seems it’s a new option introduced recently, so maybe that’s why no one reported before me :slight_smile:

I have tried to set it to the IP address of my router, but it didn’t work. It seems I have to set it to the IP address of the LG TV, so I need to assign a fix IP to the TV in the router configuration to make sure it won’t change.

And it seems the Power On button not always displayed in the UI, especially when I’m accessing the dashboard with a new device. Restarting HA solves it though.

1 Like

Hello, thanks for the report!

The blueprint is fixed now, delete and import again (no need to delete the automation)

As for the power on disappearing, I recommend opening an issue.

Edit: Reverted previous changes. WOL doesn’t work reliably when sending empty broadcast address.

If you need broadcast address due to different subnets, please enable custom actions and add the service wake_on_lan.send_magic_packet manually.

Hello. Looks like the problem persists. The turn on button disappears from time to time. The only solution to this is to turn off and turn back on the trigger automation.

Yes, there’s an open issue here: LG webOS TV automations need reloading · Issue #65771 · home-assistant/core · GitHub

You can click to subscribe and get an email when it’s fixed.

Curious if it’s possible to use 1 automation with the blueprint to turn the TV on and if it’s already ON turn it back off. Trying to setup 1 button to be a on/off switch

sorry but how to install Wake on LAN

See the description of the blueprint.

Note the Requirements. There is a link to what you need.

add

wake_on_lan:

to your configuration.yaml