[SOLVED] LG WebOS TV (Wired) found but fails to connect

Something weird happening with the LG integration in latest version of HA.

Upon connecting my TV up via an ethernet cable to my network HA discovers it

Has anyone else faced this problem ? HA and the Tv are on the same subnet

No Logs? ?

I would look at IPs are they being released for renewal? Are they all used up. Check your DHCP server.

The documentation says to first “enable LG Connect Apps feature in Network settings of the TV”. I never found that setting on my model, but you might want to check if yours has it. I would go into the network settings on the TV and take note of the IP address it’s using, then ignore the auto-discovery prompt and try to manually add the integration using the same IP address.

To answer @lordwizzard … i can ping the TV

To answer @mightybosstone … i can connect to the TV using an app on my iPhone so i am assuming LG Connect Apps is enabled

And @nickrout the only logs i can find are below, maybe need to change some setting to get more detailed logs ?

2023-01-15 20:58:48.666 INFO (SyncWorker_4) [homeassistant.loader] Loaded webostv from homeassistant.components.webostv

Thanks

Andrew

Firmware changes to WebOS involved some work to be done

ok @checking12 that makes sense, however there is a number of commands that need run;

pip uninstall aiowebostv -y
git clone --branch ssl-fallback https://github.com/home-assistant-libs/aiowebostv.git
cd aiowebostv

# replace 10.0.0.186 with TV IP (or edit examples/basic.py)
sed -i 's/192.168.1.39/10.0.0.186/g' examples/basic.py 

pip install --upgrade .
python examples/basic.py

So am i connecting directly to my HASS install via SSH and running these as its not clear in the comments ?

Thanks

I think it easier to wait for ha .5 release, should be soon enough. ( First fix was also within 48 hours to prod built)

I am also experiencing the same issue.

I don’t think it has been introduced by a WebOs update but it has been broken by 2023.1 release of HA. In fact, I rolled back to 2022.12.8 and it’s functioning again. Actually waiting for the next fixed release.

which 2023.1 release?.. the 23.1.4 did have adjustments, so then it still is related to that change.

Just as an FYI … i rolled back to 2022.12.8 and i get the same problem

Though another twist … it connected ok to the smaller Tv in my bedroom no problem.

What model and firmware?

@checking12 The TV that connects ok is

Model: 43LK5900PLA (Wi-Fi)
webOS TV Version: 4.4.2-10
Software Version 05.50.10

The TV that does not connect is

Model: 65UF950V-ZA (Wired)
webOS TV Version: 2.2.3-352
Software Version 04.06.30

NOTE: 65UF950V-ZA was working when on the wi-fi but once i changed that to wired it stopped working, i removed the integration and tried to do from scratch and got the error above. Disconnecting the wired connection and trying again on wi-fi no longer works either

Dont recall which one, I think it was the latest out there, 23.1.4. I then rolled back to 22.12.8 and it’s working again. But it keeps asking to accept the pairing everytime I switch TV on.

I am running 2023.1.4 and it is working fine.

86NANO90VNA
Firmware: 04.40.70

I am at work, but HA tells me that someone turned it on at 9:35 am and is watching Netflix.

@nickrout at least your at work earning the money to pay for netflix :laughing:

I canf find the webos or version info on this. Seems there is some logic to versions and working stuff but i dont see it.
So the whole thing that got these changes moving is that for newer models, LG forced WSS to be required and for older firmwares its still unsecure WS.
In next HA 23.1.5 the integration chooses seammingless so that should make all tvs behave again.
For the sake of checking upfront, there is https://raw.githubusercontent.com/thecode/home-assistant-custom-components/main/test.py (save and/ change IP, run it in python) to check if you tv is connecting at all or not. This would also help identifying other problems if either connect method is not working.

it shoudl look like this:
OLD WEBOS:

D:\>python test25.py
D:\test25.py:21: DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.
  ssl_context = ssl.SSLContext()
D:\test25.py:21: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
  ssl_context = ssl.SSLContext()
2023-01-13 23:09:32,104.104 INFO (MainThread) [__main__] Connect without SSL start
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] = connection is CONNECTING
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > GET / HTTP/1.1
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Host: 192.168.1.25:3000
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Upgrade: websocket
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Connection: Upgrade
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Key: INfeir8R4Dj5MQRzgUlEuw==
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Version: 13
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2023-01-13 23:09:32,107.107 DEBUG (MainThread) [websockets.client] > User-Agent: Python/3.10 websockets/10.4
2023-01-13 23:09:32,118.118 DEBUG (MainThread) [websockets.client] < HTTP/1.1 101 Switching Protocols
2023-01-13 23:09:32,118.118 DEBUG (MainThread) [websockets.client] < Upgrade: websocket
2023-01-13 23:09:32,118.118 DEBUG (MainThread) [websockets.client] < Connection: Upgrade
2023-01-13 23:09:32,118.118 DEBUG (MainThread) [websockets.client] < Sec-WebSocket-Accept: 1uzUjXob5xOUSgrMODFi8x+qnTU=
2023-01-13 23:09:32,118.118 DEBUG (MainThread) [websockets.client] = connection is OPEN
D:\test25.py:38: RuntimeWarning: coroutine 'WebSocketCommonProtocol.close' was never awaited
  ws.close()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2023-01-13 23:09:32,164.164 INFO (MainThread) [__main__] Connect without SSL end
2023-01-13 23:09:32,166.166 INFO (MainThread) [__main__] Connect using SSL start
2023-01-13 23:09:32,168.168 DEBUG (MainThread) [websockets.client] = connection is CONNECTING
2023-01-13 23:09:32,202.202 ERROR (MainThread) [__main__] Connect using SSL error: ConnectionResetError()
2023-01-13 23:09:32,202.202 INFO (MainThread) [__main__] Connect using SSL end
2023-01-13 23:09:34,210.210 DEBUG (MainThread) [websockets.client] ! timed out waiting for TCP close
2023-01-13 23:09:34,210.210 DEBUG (MainThread) [websockets.client] x half-closing TCP connection
2023-01-13 23:09:34,210.210 DEBUG (MainThread) [websockets.client] = connection is CLOSED

new webos:

D:\>python test200.py
D:\test200.py:21: DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.
  ssl_context = ssl.SSLContext()
D:\test200.py:21: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
  ssl_context = ssl.SSLContext()
2023-01-13 23:09:55,375.375 INFO (MainThread) [__main__] Connect without SSL start
2023-01-13 23:09:55,470.470 DEBUG (MainThread) [websockets.client] = connection is CONNECTING
2023-01-13 23:09:55,470.470 DEBUG (MainThread) [websockets.client] > GET / HTTP/1.1
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Host: 192.168.1.200:3000
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Upgrade: websocket
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Connection: Upgrade
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Key: 6RDXclTnnS09GplPMrT5cA==
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Version: 13
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2023-01-13 23:09:55,485.485 DEBUG (MainThread) [websockets.client] > User-Agent: Python/3.10 websockets/10.4
2023-01-13 23:09:55,502.502 DEBUG (MainThread) [websockets.client] = connection is CLOSED
2023-01-13 23:09:55,502.502 DEBUG (MainThread) [websockets.client] ! failing connection with code 1006
2023-01-13 23:09:55,502.502 DEBUG (MainThread) [websockets.client] x half-closing TCP connection
2023-01-13 23:09:55,502.502 ERROR (MainThread) [__main__] Connect without SSL error: InvalidMessage('did not receive a valid HTTP response')
2023-01-13 23:09:55,502.502 INFO (MainThread) [__main__] Connect without SSL end
2023-01-13 23:09:55,502.502 INFO (MainThread) [__main__] Connect using SSL start
2023-01-13 23:09:55,517.517 DEBUG (MainThread) [websockets.client] = connection is CONNECTING
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > GET / HTTP/1.1
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > Host: 192.168.1.200:3001
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > Upgrade: websocket
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > Connection: Upgrade
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Key: X7ipTvqN8luA0yBL3RU1mw==
2023-01-13 23:09:55,786.786 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Version: 13
2023-01-13 23:09:55,802.802 DEBUG (MainThread) [websockets.client] > Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
2023-01-13 23:09:55,802.802 DEBUG (MainThread) [websockets.client] > User-Agent: Python/3.10 websockets/10.4
2023-01-13 23:09:55,805.805 DEBUG (MainThread) [websockets.client] < HTTP/1.1 101 Switching Protocols
2023-01-13 23:09:55,805.805 DEBUG (MainThread) [websockets.client] < Upgrade: websocket
2023-01-13 23:09:55,805.805 DEBUG (MainThread) [websockets.client] < Connection: Upgrade
2023-01-13 23:09:55,819.819 DEBUG (MainThread) [websockets.client] < Sec-WebSocket-Accept: vYCEEjN0XpCz744AZqZ1L+lj7gU=
2023-01-13 23:09:55,820.820 DEBUG (MainThread) [websockets.client] = connection is OPEN
2023-01-13 23:09:55,820.820 INFO (MainThread) [__main__] Connect using SSL end
D:\test200.py:61: RuntimeWarning: coroutine 'WebSocketCommonProtocol.close' was never awaited
  ws1.close()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2023-01-13 23:09:57,881.881 DEBUG (MainThread) [websockets.client] ! timed out waiting for TCP close
2023-01-13 23:09:57,881.881 DEBUG (MainThread) [websockets.client] x closing TCP connection
2023-01-13 23:09:57,896.896 DEBUG (MainThread) [websockets.client] = connection is CLOSED>

today the HA .5 release made both TV types working for me (the newer and the older way). Suggest to upgrade and see what is the situation for you. If there is still errors, maybe a debug log of webos integration would help out finding any other issue.

@checking12 I can confirm the release today has resolved my problem, only thing left to sort out is the ability to turn it on from HA