LG WebOS - choosing live tv source (DTV vs Satellite)

I have been happily using wake-on-lan to turn on my WebOS TV for that last couple of years. The time has come to start using voice to change channels, and I was intending on using this service:

service: media_player.play_media
data:
  entity_id: media_player.my_tv
  media_content_id: "BBC One HD"
  media_content_type: "channel"

to change the channel to BBC1. But I have hit a snag - my TV has both a satellite and an antenna connection, and BBC ONE HD appears on both. (Actually, to be accurate, “BBC One HD” is on antenna, and “BBC ONE HD” is on satellite.) I want to use the antenna one, but the TV is defaulting to using the satellite feed in all circumstances I have tried, including using channel numbering.

Anyone come across this before, and have any bright ideas?

Bump, bump, bump

I’m astounded you got that far, I cannot get it to do anything useful at all in terms of changing channels. I can turn it off and on. Using Lovelace I can change input source, but by voice e.g. from Google-via-home-assistant I can’t get it to select any input much less a channel within.

And I have three of these TV’s, so would love more fine control. I can’t get it to pause/resume either, for example, or adjust the volume (via Google Assistant).

Mostly replying to implicitly subscribe in case you get this solved!

Well, I rather cheat when it comes to voice control. My method pre-dates Lovelace.

I set up a template switch for on/off control like this:

- platform: template
  switches:
    family_room_lgtv:
      friendly_name: 'Family Room TV'
      entity_id: media_player.family_room_tv
      value_template: "{{ is_state('media_player.family_room_tv', 'playing') }}"
      turn_on:
        service: media_player.turn_on
        entity_id: media_player.family_room_tv
      turn_off:
        service: media_player.turn_off
        entity_id: media_player.family_room_tv

Then I expose that switch to Alexa (my robot slave of choice) as an emulated hue entity, and then set up Alexa to understand “turn the tv on” (or off). Nice and reliable. Only issue is that sometimes the TV goes in to deep sleep and doesn’t respond to the wake-on-lan packet.

Using this sort of method it should be pretty straightforward to say “turn on BBC1” or “channel up” or “volume up” and associate the command with a HA switch which calls the appropriate media_player.play_media or media_player.volume_set service.

If only I could get the media_player.play_media service to work properly :frowning:

Bumpity bump bump

Do you solve it somehow? I have the almost the same problem.

I use:

entity_id: media_player.lg_tv
media_content_id: 1
media_content_type: channel

But it chooses radio on channel 1 instead of DTV on channel 1.

I have also the same problem, I have to use channel name in media_content_id.

I also have no idea how to change channels with voice assistants (Alexa or Google Home). I had a Broadlink RM4 Mini working in cloud mode (not with HA) and i colud do that easily, but I don’t know how to achieve this with webostv integration

Hello @carlos-48 (and @ludvik14ty - apologies, I missed your message)

Yes, I have this working, and it is good. But not especially easy. I solved the issue with the assistance of one of the devs, GitHub issue here

In short, you need to find out the channelId of the tv channel you wish to tune to. And then enter it into a scripts.yaml like this -

'test_change_channel':
  alias: test 
  sequence:
  - data:
      command: tv/openChannel
      payload:
        channelId: 'xxxxxxxxxxxxxx'
    entity_id: media_player.YOUR_ID_HERE
    service: webostv.command

So how to find the channelId? Well, have a look at the thread referenced above. If you can get HA to choose the channel somehow then there is an easy method of seeing it using logger. But if - like me - you can’t then you need to run a small piece of python code as described on the issue linked above in this post

It’s a pain, but works perfectly once it’s set up. I (and, more importantly, my spouse) can now easily change channels using Alexa, a series of scripts like the one above, and an instance of ha-bridge

1 Like

Thanks a lot for your answer.

Now I’m able to change to the exact channel using scripts but iI’m not able to change channels using Alexa or Google voice assistants.

Could you explain in detail how to implement that ha-bridge?

Thanks and best regards

Hello @carlos-48

In outline, the steps are
1 - get a working script to change channel (DONE)
2 - install ha-bridge. Personally, I have it running under Docker, but the link above tells you how to install it
3 - connect ha-bridge to Home Assistant (using a persistent token to log in)
4 - set up a new Hue emulation switch in ha-bridge which, when it turns on, calls the script from step 1 (using the menu at the top of ha-bridge which appears after step 3)
5 - using Alexa, search for new devices. It should find the switch from step 4
6 - in the Alexa app set up a routine where when someone says eg “Alexa, one” it turns on the switch
7 - train your family to use it

(I’m not a Google user, but maybe there is similar functionality there.)

All the steps are a bit more fiddly than they should be, but this should give you a steer on how to do it. Give me a shout if you get stuck anywhere (apart from the last step).

1 Like

I use the Yandex Alice voice assistant to control my TV. To configure channels on LG webOS TV, I use input_number and if - then conditions. Below is my working example of automation that switches channels. I call the channel number, and according to the conditions, the desired TV channel is set.

alias: 'We switch TV channels through the voice assistant Alice'
description: ''
trigger:
  - platform: state
    entity_id: input_number.tv_channels
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.tv_bedroom
    data:
      media_content_type: channel
      media_content_id: >
        {% if is_state('input_number.tv_channels', '1.0') %} S 02
        {% elif is_state('input_number.tv_channels', '2.0') %} S 03
        {% elif is_state('input_number.tv_channels', '3.0') %} S 04
        {% elif is_state('input_number.tv_channels', '4.0') %} S 05
        {% elif is_state('input_number.tv_channels', '5.0') %} S 06
        {% elif is_state('input_number.tv_channels', '6.0') %} S 07
        {% elif is_state('input_number.tv_channels', '7.0') %} S 08
        {% elif is_state('input_number.tv_channels', '8.0') %} S 09
        {% elif is_state('input_number.tv_channels', '9.0') %} S 10
        {% elif is_state('input_number.tv_channels', '10.0') %} C 06
        {% elif is_state('input_number.tv_channels', '11.0') %} C 07
        {% elif is_state('input_number.tv_channels', '12.0') %} C 08
        {% elif is_state('input_number.tv_channels', '13.0') %} C 09
        {% elif is_state('input_number.tv_channels', '14.0') %} C 10
        {% elif is_state('input_number.tv_channels', '15.0') %} C 11
        {% elif is_state('input_number.tv_channels', '16.0') %} C 12
        {% elif is_state('input_number.tv_channels', '17.0') %} S 11
        {% elif is_state('input_number.tv_channels', '18.0') %} S 12
        {% elif is_state('input_number.tv_channels', '19.0') %} S 13
        {% elif is_state('input_number.tv_channels', '20.0') %} S 14
        {% elif is_state('input_number.tv_channels', '21.0') %} S 16
        {% elif is_state('input_number.tv_channels', '22.0') %} S 17
        {% elif is_state('input_number.tv_channels', '23.0') %} S 18
        {% elif is_state('input_number.tv_channels', '24.0') %} S 19
        {% elif is_state('input_number.tv_channels', '25.0') %} S 20
        {% endif %}
mode: single
Текст на русском (Text in Russian)

Я для управления своим телевизором использую голосовой помощник Яндекс Алиса. Для настройки каналов на ТВ LG Web OS я использую input_number и условия если - то. Ниже мой рабочий пример автоматики который переключает каналы. Я называю номер канала, а согласно условиям выставляется нужный тв канал.

alias: 'Переключаем ТВ каналы через голосовой помощник Алиса'
description: ''
trigger:
  - platform: state
    entity_id: input_number.tv_channels
condition: []
action:
  - service: media_player.play_media
    target:
      entity_id: media_player.tv_bedroom
    data:
      media_content_type: channel
      media_content_id: >
        {% if is_state('input_number.tv_channels', '1.0') %} S 02
        {% elif is_state('input_number.tv_channels', '2.0') %} S 03
        {% elif is_state('input_number.tv_channels', '3.0') %} S 04
        {% elif is_state('input_number.tv_channels', '4.0') %} S 05
        {% elif is_state('input_number.tv_channels', '5.0') %} S 06
        {% elif is_state('input_number.tv_channels', '6.0') %} S 07
        {% elif is_state('input_number.tv_channels', '7.0') %} S 08
        {% elif is_state('input_number.tv_channels', '8.0') %} S 09
        {% elif is_state('input_number.tv_channels', '9.0') %} S 10
        {% elif is_state('input_number.tv_channels', '10.0') %} C 06
        {% elif is_state('input_number.tv_channels', '11.0') %} C 07
        {% elif is_state('input_number.tv_channels', '12.0') %} C 08
        {% elif is_state('input_number.tv_channels', '13.0') %} C 09
        {% elif is_state('input_number.tv_channels', '14.0') %} C 10
        {% elif is_state('input_number.tv_channels', '15.0') %} C 11
        {% elif is_state('input_number.tv_channels', '16.0') %} C 12
        {% elif is_state('input_number.tv_channels', '17.0') %} S 11
        {% elif is_state('input_number.tv_channels', '18.0') %} S 12
        {% elif is_state('input_number.tv_channels', '19.0') %} S 13
        {% elif is_state('input_number.tv_channels', '20.0') %} S 14
        {% elif is_state('input_number.tv_channels', '21.0') %} S 16
        {% elif is_state('input_number.tv_channels', '22.0') %} S 17
        {% elif is_state('input_number.tv_channels', '23.0') %} S 18
        {% elif is_state('input_number.tv_channels', '24.0') %} S 19
        {% elif is_state('input_number.tv_channels', '25.0') %} S 20
        {% endif %}
mode: single

Hello. I have this very same problem. It switches to a radio channel instead of DTV channel. Did you solve it? Thank you!

This is a small part of my WebOSTV log:

2024-04-24 10:28:27.796 DEBUG (MainThread) [aiowebostv] recv(192.168.1.79): {"type":"response","id":13,"payload":{"channel":{"channelId":"1_25_7_7_263_751_8572","programId":"1_25_7_7_263_751_8572","signalChannelId":"263_751_8572","chanCode":"UNKNOWN","channelMode":"Terrestrial","channelModeId":0,"channelType":"Terrestrial Digital TV","channelTypeId":1,"channelNumber":"7","majorNumber":7,"minorNumber":7,"channelName":"LA7 HD","skipped":false,"locked":false,"descrambled":true,"scrambled":false,"serviceType":25,"favoriteGroup":[],"imgUrl":"","display":1,"satelliteName":" ","fineTuned":false,"Frequency":506000,"shortCut":0,"Bandwidth":0,"HDTV":true,"Invisible":false,"TV":true,"DTV":true,"ATV":false,"Data":false,"Radio":false,"Numeric":false,"PrimaryCh":true,"specialService":false,"CASystemIDList":{},"CASystemIDListCount":0,"groupIdList":[0,1],"channelGenreCode":"UNKNOWN","favoriteIdxA":250,"favoriteIdxB":250,"favoriteIdxC":250,"favoriteIdxD":250,"imgUrl2":"","channelLogoSize":"UNKNOWN","ipChanServerUrl":"","payChan":false,"IPChannelCode":"UNKNOWN","ipCallNumber":"UNKNOWN","otuFlag":false,"favoriteIdxE":250,"favoriteIdxF":250,"favoriteIdxG":250,"favoriteIdxH":250,"satelliteLcn":false,"waterMarkUrl":"UNKNOWN","channelNameSortKey":"20","ipChanType":"UNKNOWN","adultFlag":0,"ipChanCategory":"UNKNOWN","ipChanInteractive":false,"callSign":"UNKNOWN","adFlag":0,"configured":false,"lastUpdated":"","ipChanCpId":"UNKNOWN","isFreeviewPlay":0,"hasBackward":0,"playerService":"com.webos.service.tv","TSID":263,"SVCID":751},"programList":[]}}

So, I have used this code and it work for me:

  action:
    - service: webostv.command
      data:
        entity_id: media_player.my_tv
        command: tv/openChannel
        payload:
          channelMode: Terrestrial
          channelNumber: "7"

In “payload” you can use any combination of <“field”:“value”> you can see into Log above (field example: “channelId”, “programId”, “channelMode”, “channelType”, “channelTypeId”, “channelNumber”, “channelName”, …) :wink:
Let me know if work for you also.

1 Like

Five years - doesn’t time fly?

I will check and revert if it doesn’t work for me.