LG Netcast component not working

Hi,

Im trying to get the LG Netcast support to work with my tv.

TV Info
Model: 55LM620T-ZE
Software: 04.62.10
SDK: 02.08
Netcast platform ver: 0003.0005.0000

My media player config looks like this:

media_player:
  - platform: kodi
    host: http://192.168.1.79
    port: 8080
    name: Kodi
    user: kodi
    password: xxxxxx
  - platform: lg_netcast
    host: 192.168.1.144
  - platform: plex
  - platform: cast

It doesn’t matter if i don’t have the access_token row there at all, have it there but leave it blank or if i use the actual access token (got it with the LGTV remote android app).

The component always gives the following errors:

ERROR:homeassistant.components.media_player:Error while setting up platform lg_netcast
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 109, in _setup_platform
discovery_info)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/lg_netcast.py", line 48, in setup_platform
client = LgNetCastClient(config[CONF_HOST], config[CONF_ACCESS_TOKEN])
KeyError: 'access_token'

and after that:

ERROR:homeassistant.components.media_player:Error while setting up platform lg_netcast
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 109, in _setup_platform
discovery_info)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/lg_netcast.py", line 49, in setup_platform
add_devices([LgTVDevice(client, config[CONF_NAME])])
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/lg_netcast.py", line 71, in __init__
self.update()
File "/usr/local/lib/python3.4/dist-packages/homeassistant/util/__init__.py", line 289, in wrapper
result = method(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/util/__init__.py", line 289, in wrapper
result = method(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/lg_netcast.py", line 104, in update
c in channel_list]
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/lg_netcast.py", line 104, in <listcomp>
c in channel_list]
AttributeError: 'NoneType' object has no attribute 'text'

Have i missed something or has anyone else experienced this and fixed it or might there be a bug? Any help is appreciated! :slight_smile:

Very same issue. Reverted back to my temp solution untill this is fixed.

Hi,

This problem slipped through my tests - sorry. A fix is on its way - the pull request is already on github.

As a workaround you can configure the platform with an invalid access_token to get the token of your TV displayed on the TV screen. For instance:

media_player:
  platform: lg_netcast
  host: 192.168.1.144
  access_token: 0

After that just replace zero by the displayed access_token and restart HA. This method to display the access_token is not documented by LG, at least I could’t find anything. But it works reliably with my LG TV. Hope this works also for you.

hello @wokar still no love. It’s not working with your temp solution.

Hi,

I have the same problem reported on first post with last version 0.30.2. Never tested before.

Do someone know how to fix it or if there is a fix for this problem?

16-10-16 20:13:50 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/core.py",
 line 1224, in job_handler
    func(*args)
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py",
 line 229, in _update_entity_states
    entity.update_ha_state(True)
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity.py",
 line 166, in update_ha_state
    self.update()
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py",
 line 296, in wrapper
    result = method(*args, **kwargs)
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/util/__init__.py",
 line 296, in wrapper
    result = method(*args, **kwargs)
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/lg_netcast.py",
 line 107, in update
    c in channel_list]
  File 
"/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/lg_netcast.py",
 line 107, in <listcomp>
    c in channel_list]
AttributeError: 'NoneType' object has no attribute 'text'

Thanks,

Hello guys!

I am too unable to set this component right, I get this error message:

2017-08-31 20:02:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.tv_quarto fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/lg_netcast.py", line 104, in update
    channel_list = client.query_data('channel_list')
  File "/usr/lib/python3.6/site-packages/pylgnetcast/pylgnetcast.py", line 151, in query_data
    tree = ElementTree.XML(data)
  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
    parser.feed(text)
  File "<string>", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 311

Here is my configuration.yaml:

media_player:
  - platform: lg_netcast
    host: 192.168.2.32
    name: TV Quarto
    access_token: "976339"

I’ve tried to set the token information with nothing, with ’ and ", no luck.

Can anyone help?

Thanks a lot!

Hello guys! Still not able to get netcast to work… Anyone? Thanks!

I found that when I put the name: sometimes HA cannot load. So my configuration I just put
media_player:

  • platform: lg_netcast
    host: 192.168.2.32
    access_token: “976339”

And my LG is on wifi not lan so I cannot turn on directly from the media player.

1 Like

Thanks a lot for your answer @Sunonline! I will try. Does the access token requires “”? Is your component working now? Thanks again!

Sorry, still not working…

Log Details (ERROR)
Wed Jan 03 2018 11:09:08 GMT-0200 (Horário brasileiro de verão)

Update for media_player.lg_tv_remote fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 306, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/lg_netcast.py", line 98, in update
    channel_info = client.query_data('cur_channel')
  File "/usr/lib/python3.6/site-packages/pylgnetcast/pylgnetcast.py", line 151, in query_data
    tree = ElementTree.XML(data)
  File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
    parser.feed(text)
  File "<string>", line None
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 308

My config:

  - platform: lg_netcast
    host: 192.168.2.33
    access_token: 459689

this is my config. working fine. I cannot turn on but I can turn off because I didn’t use wake on lan. I use wifi and setup my lg tv with static ip. I use latest HA and try with raspbian and hassbian. Furthermore, check the share setting from your LG TV. Once shares you can actually see the device in your network from computer.

  - platform: lg_netcast
    host: !secret lg_ip
    access_token: !secret lg_access_token

That´s really odd… Mine just does not work.

I can see the token displayed on the screen, so my HA is trying to communicate with the TV.

My token is correct but on the log it says is not:

It is plugged with a LAN cable. I just want to turn it off, get state and display notifications on it.

Any other idea?

Does your token has " or '? Is it just like my config?

Thanks a lot!

This is from my lg tv and computer network.





I cannot upload pictures. I put the access_token in secret file so I didn’t put any " or ’ in the config file.

1 Like

Thanks a lot my friend! I will give it a try again ASAP. Have a great one!

Yes! It works!!!

image

I’ve just changed a couple of configs on TV and it works!

Thanks a lot my friend!

1 Like

congratulation my friend ^^ and Happy New Year.

1 Like

Hi everyone, sorry to hijack this. I have a LG 55LE5500, which does have netcast, but I believe that this is a 2010 model. There is an RJ45 jack, and netcast programs.

When I install the LG Netcast component, the card appears on the main Home Assistant page, but there are no controls present (or even on/off). It’s non-functional, and no key ever appears on my TV for pairing either.

Does anyone have any idea what is happening?

I just started fiddling with this as well.

Adding the config to homeassistant didn’t get a response from my TV as well.
After I installed the LG TV remote app and did a scan, finally a popup showed up. (make sure you are just watching TV).
However the pairing key was blank :frowning_face:
Changed the IP settings to manual, then a pairing key showed up (6 letters)
Entered it into the app, and it works.
Entered it into home-assistant configuration file without quotes, no luck…

For who use wake on lan (connect to LG with lan cable) you would probably be able to turn on and off using the media_player.

To check if your lg tv is possible to control. Go to network from your computer, you should see that lg tv is also in the network. If you don’t see, try config from your lg tv to ENABLE The SHARE so can be seen on network. Once can be seen on network then you can add in HA. If possible please fix your LG TV IP ADDRESS. So it can be found easily.

LG Netcast enable you to turn on (via lan) and turn off (lan or wifi) and display what you are watching.