Turn LG Screen off when i select a certain channel i.e Music

Hi all very new to home assistant and just started to get my head around in what can actually be done, but i am stuck on a particular bug, i have set a [ Trigger } timer to run periodically every 15 minutes to turn screen off and [ Action ] to complete it but i am stuck now and tried for days to figure it out and its beaten me, i am trying to get the AND, OR, IF to recognise that if tv state is on a particular channel i.e music in my case channel 728 that it turns screen of but i cant find a way around this to TRIGGER ( TIMER ), CONFIRM (TV IS ON CHANNEL 728 ) and run ACTION ( SCREEN OFF) .

Thanks if you can help me figure this out…

alias: 15 Minute Periodic Timer To Check Channel 728 Is On TV To Turn Screen OFF
description: “”
trigger:

  platform: time_pattern
minutes: “15”
condition:
  condition: state
entity_id: media_player.lg_webos_tv_up75006lf
state: “on”
action:
  service: webostv.command
metadata: {}
data:
entity_id: media_player.lg_webos_tv_up75006lf
command: com.webos.service.tvpower/power/turnOffScreen
mode: single

Sorry Guys…

Welcome to HA… Please post your code correctly so folks can assist. See #11 here…

hi…

the trigger will depend on what the status is of your tv. put your tv on the channel you want. go to your dev-tools → states page, find your tv there… grab the info and paste it here. find the one that has the attributes on the right that specifies the channel info and everything. if it contains the exact channel info, then you can trigger off of it. warning that it’s possilbe it doesn’t give you the right info to trigger on tho…

one thing that also helps is then to switch it to another channel and take another snapshot so that you can see what changed, which helps you figure out what to trigger on.

i also have an lgtv… see my example below:

and also, please do use the instructions @LiQuid_cOOled put on how to paste in code. it’s very difficult to read if you don’t.

1 Like

Thanks for the response guys,

Not sure what i’m looking for though,

Thanks again

only thing i can see is media_title has changed from Heat to Absolute Radio,

Thanks

The attribute named Source tells you what source the current picture is coming from.
The attribute media_title tells you info about that source. On the Live TV source it is usually the channel name, which should be the one you could use.

1 Like

Thank you so much,works a treat now… :grinning: :grinning:

Here is the code if it helps someone else.

finally i can sleep now. LOL

alias: 15 Minute Periodic Timer To Check Channel Heart Is On TV To Turn Screen OFF
description: ""
trigger:
  - platform: time_pattern
    minutes: "15"
    enabled: true
condition:
  - condition: state
    entity_id: media_player.lg_webos_tv_up75006lf
    state: "on"
  - condition: state
    entity_id: media_player.lg_webos_tv_up75006lf
    state: Heart
    attribute: media_title
action:
  - service: webostv.command
    metadata: {}
    data:
      entity_id: media_player.lg_webos_tv_up75006lf
      command: com.webos.service.tvpower/power/turnOffScreen
    enabled: true
mode: single

1 Like