LG TV with Govee TV Backlights

I created a simple automation where when I turn On the LG OLED TV using the LG WebOS TV integration, the Govee backlights turn On as well using the MQTT integraion. I created the same for when the LG TV is turned Off as well. I don’t know what I’m doing wrong because the Govee Lights do not turn On when the TV is turned On. Has someone created a similar automation using these types of devices?

Without the automations shown here it will be hard to say what is wrong.

Here is a screenshot of the automation. I didn’t think we needed a condition, correct?

Hi,

Why is the Sony device a trigger in this scenario?
Why not build a trigger with LG OLED media status?

description: ""
mode: single
triggers:
  - trigger: state
    entity_id:
      - media_player.lg_tv
    from:
      - "on"
    id: lg_oled_on
  - trigger: state
    entity_id:
      - media_player.lg_tv
    id: lg_oled_off
    to:
      - "off"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - lg_oled_on
        sequence: []
      - conditions:
          - condition: trigger
            id:
              - lg_oled_off
        sequence: []

I’m trying to do the same on both a Sony TV as well as an LG TV. I finally got the Sony TV and Govee to work. I had to use “BRAVIA XBR-43X800D” rather than Sony. I also had to use “Sony Govee Power Switch” rather than just Sony Govee to get it to work. I will try the LG next.

The LG with Govee automations is not working when doing the same as I did with the Sony TV that worked. Here is a screenshot of the LG automation:

Any thought of what might be the reason it won’t work? Maybe someone that has an LG TV with automations working.

You should be able to view it as YAML by clicking the three dots in the upper right corner.
It is easier for us to read the YAML than a screen shot of the GUI.

Hi,

@s795723 please don’t ignore what Wally is trying to tell you. You will get more effective help on this forum when you post your automation in .yaml format.

In your Home Assistant automation, you can navigate via the below route to the .yaml code of the automation. Copy (ctrl+c) the code.

On this forum when you’re typing a new post, use the below option to paste (ctrl+v) the .yaml code.

afbeelding

Here is the YAML code:

alias: Turn On Govee H6199
description: ""
triggers:
  - device_id: d3fad877e68a1c68fbf2f8f6ba0248f1
    domain: media_player
    entity_id: c3dbb7a8fd2d102c29f25743d90db8c2
    type: turned_on
    trigger: device
conditions: []
actions:
  - type: turn_on
    device_id: 365dc5c814616bf09b23a4764422e78b
    entity_id: 6a288bcaa1f7870ec7f536f826a4e3ef
    domain: switch
mode: single

It seems to be more because of the LG TV using the LG WebOS TV integration more than because of the MQTT code.

First you should replace those device IDs with entity IDs.
Read this to get the long explanation for it:

Secondly I am unsure of your trigger.
I would probably use a state trigger instead and react to the state on, which is what my LG TV report when it is on.

Not sure what a “state trigger” is but I left everything the same except adding the entity name and it seems to be working now. I’ll test for a couple of days. I did notice that the LG TV is indicating “unavailable” on the Home Assistant app even though I have it set with a static IP. Anyone know what might be causing the “unavailable” issue?

“Unavailable” is the new “Off” since a few months :stuck_out_tongue:
I had to update all my lg tv automations and templates because of this change.

When you turn your TV off, the state of the lg oled mediaplayer will change to “off” or “unavailable”" or will first show “off” and a few moments later “unavailable”.


I wasn’t sure if I should start a new thread or continue with this one, but the issue is the same where the automation using LG TV keeps stopping to work. I recently noticed that there are two devices listed on the Home Assistant website for the LG TV. One is “LG WebOS TV” and the other is “Google Cast”. I have been using the Google Cast version for the automation since it appears first on the list. Should I be using the LG WebOS TV version instead?


You should start a new thread instead.

But in your case you should use the LG WebOS TV.
The Google Cast is only for the cast feature in your TV.

As someone suggested in an earlier post on this thread, I changed it to a “State” and it’s working so far. Hopefully, it continues to work this time:

alias: Turn On Govee H6672
description: ""
triggers:
  - trigger: state
    entity_id:
      - media_player.lg_webos_tv_oled88z2pua_2
    from:
      - "off"
    to:
      - "on"
    for:
      hours: 0
      minutes: 0
      seconds: 10
conditions: []
actions:
  - type: turn_on
    device_id: 5072573574b4a3b8a1764bd84872feab
    entity_id: 5590c2d28ddb03fb4fe7f288a2afdaf1
    domain: switch
mode: single

You should also look into using entity IDs instead of device IDs.
See my post earlier in this thread.

In the example above, the code has entity_id for both LG and Govee devices.

Is there something wrong with this code? The lights will turn On for a short time and then later in the day or the following day, the automation will not work.

alias: Turn On Govee H6672
description: ""
triggers:
  - trigger: state
    entity_id:
      - media_player.lg_webos_tv_oled88z2pua_2
    from:
      - "off"
    to:
      - "on"
    for:
      hours: 0
      minutes: 0
      seconds: 5
  - trigger: state
    entity_id:
      - media_player.lg_webos_tv_oled88z2pua
    from:
      - "off"
    to:
      - "on"
    for:
      hours: 0
      minutes: 0
      seconds: 5
conditions: []
actions:
  - type: turn_on
    device_id: 5072573574b4a3b8a1764bd84872feab
    entity_id: light.h6672
    domain: switch
mode: single

The TV will often stay in the off state a few minutes and will then shut down completely and the state will change to unavailable.
Your automation only works in those few minutes after it has been turned off, because it is not set to trigger when switching from unavailable to on.