LG WebOS TV Controlling Turn On/Off State through HomeKit and Home Assistant

I have an LG OLED 48A16LA which I want to control fully through Home Assistant.

I can add the TV via Apple Home Kit Home app and I can control the TV on/off state and the inputs, however, I have removed the TV from Home Kit, and then re-added it via Home Kit Controller in Home Assistant and the TV, successfully connects, however within Home Assistant I don’t seem to have the ability to control the on/off state of the TV to be able to set up automations within home assistant which I want to do as I don’t really want a mix of some stuff being controlled through Apple Home and some being controlled through Home Assistant.

When I try and apply a scene for example, when the TV is Off I only get the following, which doesn’t give me any option to be able to turn the TV on.

When the TV is on, I then get the option to select the inputs of the TV, but there is no option to turn it off as shown below:

Is this something that is not possible with LG TVs and Home Assistant, I assumed it would work as its still home kit, not just via apple home app?

I have figured out a way. I used a blueprint that I found at LG webOS Smart TV - Enable Turn On Action for HA 2022.2+ using wake_on_lan.

It seems strange though that this has to be done in this way and it doesn’t act like a normal homekit device, my understanding is, if you add a homekit device to home assistant it should act the same with the same functionality as if the tv was added to apple native home kit. Is this not correct and the blueprint is the only way to accomplish this?

3 Likes

Indeed!
And this workaround only allows for turn on, we still need a way to turn off.

Just found another solution:

This is how I turn mine off:

alias: Turn off Living Room TV
description: ""
trigger: []
condition: []
action:
  - service: media_player.turn_off
    data: {}
    target:
      entity_id: media_player.lg_webos_smart_tv
mode: single
2 Likes

Hi stevenmann,
could you please tell us where to insert your code?
Both the configuration.yaml and the scripts editor said syntax error.
Thank you

Hi,

It’s an automation with no trigger.

1 Like

First, go to Developer Tools → states and find the entity name for your LG television. This assumes that you have added the “LG webOS Smart TV” integration.

Next, go to System → Automations.
Click on “Create Automation”, then “Create New Automation”.
Next, click on the meatball (3-dots) menu and select: “Edit in YAML”.

This is where you paste the code above, but using the entity name for your LG TV.

You can also do it by editing automations.yaml, but the risk of screwing up some other automation is too great. You could also do it in the GUI (Visual Editor), but just inserting the code in YAML is quicker.

2 Likes

Thank you so much for your detailed instructions! They work flawlessly!

Until now, my automation solution was to cut the power to the TV/projector via a smart plug and turn it back on using auto power-on, but I guess that’s not the best solution for the hardware in the long run, as a non-graceful shutdown could potentially cause damage over time.

Now, with your solution, it works without any headaches, and I’ve also learned something valuable about YAML-based automation creation. Thanks again!

Tag the solution, please.

Unfortunately, I can’t since I’m not OP, but I think this solution could work for you as well @boardy