Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to WebOS TV #102259

Closed
8bitjoey opened this issue Oct 18, 2023 · 11 comments
Closed

Can't connect to WebOS TV #102259

8bitjoey opened this issue Oct 18, 2023 · 11 comments
Assignees

Comments

@8bitjoey
Copy link

The problem

Cannot setup LG WebOS integration. Device is auto-discovered, but when I try to proceed it says "Failed to connect" and also that i should ensure the TV is on and IP address is entered correctly. TV is on. IP address was auto-discovered, but manual entering doesn't help either.

What version of Home Assistant Core has the issue?

core-2023.10.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

webostv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/webostv

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I wish I could provide any logs to diagnose this, but nothing appears in the log file. Also, I'm not sure how to enable additional logging for this integration. Please guide me here.

Additional information

I use a clean setup of HAOS 11.0 (using VMWare ova image).
It sees a number of devices and some of them do connect (e.g. a printer or an AV receiver)
However, I can't connect to my LG TV.
webOS TV Version is 8.2.0-705
Software Version is 03.20.14
TV model is OLED77G3

I heard about "LG Connected Apps" feature, but I don't see such option. However, in Support -> IP Control Settings I enabled SDDP, WOL, and Network IP Control feature. Btw, the latter generates some code (see a photo) which I think I should enter somewhere, but webostv integration doesn't offer a field for that. So... maybe this is unrelated. However, I tried switching this off too. No difference.

IMG_4242

@home-assistant
Copy link

Hey there @thecode, mind taking a look at this issue as it has been labeled with an integration (webostv) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of webostv can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign webostv Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


webostv documentation
webostv source
(message by IssueLinks)

@mbak77
Copy link

mbak77 commented Dec 10, 2023

I have the exact same issue, however on the newest HA release (I guess it's 2023.12.2 - I'm trying to configure it for the first time, so don't know if it works on other versions). I've tried the same options as mentioned in the main post. Pinging the IP works fine, however HA doesn't even detect my TV, neither does LG ThinQ app (I'll try to contact with support about that). I've tried adding different configurations to configuration.yaml file and also using LG's integration creator, but none of this options worked. TV is connected via LAN/WLAN. HA is working on HAOS which is setup up on QNAP's virtual machine.

@b00tsie
Copy link

b00tsie commented Dec 15, 2023

I would suggest set fixed ip address on LG tv, turn-on pairing and then add via the LG integration the TV by ip-address. I have 3 LG (webos) tv's and they are all working fine ( must say since i ensured fixed ip-address )

@8bitjoey
Copy link
Author

@b00tsie I don't have an option to specify static IP in TV settings, however, I made it static in router settings. So my TV always gets the same IP address. Still, no difference.
LG ThinQ app works fine for me though (and always did). HA integration is the only problem.

@klada
Copy link
Contributor

klada commented Dec 19, 2023

Same issue with Home Assistant 2023.12 and a LG G3 TV. It looks like the 2023 models need special handling.

@thecode
Copy link
Member

thecode commented Jan 30, 2024

Please add the following to configuration.yaml, restart home assistant, try to add the TV by IP and attach the log.

logger:
  default: info
  logs:
    homeassistant.components.webostv: debug
    aiowebostv: debug

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

@8bitjoey
Copy link
Author

@thecode here's what I've got in logs after doing that (attached)
Lines up to 28 were added after HAOS startup. Lines 29 and to the end were added when I attempted to connect to TV.

Also, WebOS was updated since my initial message, so currently I see this:

  • WebOS 8.3.0-15
  • Software Version is 03.30.70

home-assistant.log

@klada
Copy link
Contributor

klada commented Feb 14, 2024

Now I have made a few observations regarding this. There are a couple of open source control tools out there for WebOS and I have tried quite a few of them. None of them were able to connect to my LG G3!

So I looked at the source and it seems like most tools try to connect to port 3000. So I tried to connect to the port through IPv4:

$ telnet 192.168.20.24 3000
Connection refused.

Connection refused. Bam! This obviously cannot work. This means it's not the integration's fault as the integration obviously cannot connect to port 3000.

After this I have messed with the settings on my TV and did a few things (unfortunately I did multiple things at once):

  • toggled IPv6 off and on again in network settings, set IPv4 address manually (no DHCPv4)
  • installed LG ThinkQ app on my Android phone

Guess what? ThinQ was able to find my TV and could control it remotely.

And what's even stranger: After pairing my TV with my phone through ThinQ the TV accepted connections on port 3000:

telnet 192.168.20.24 3000
Trying 192.168.20.24...
Connected to 192.168.20.24.
Escape character is '^]'.
Connection closed by foreign host.

Yay. So the TV finally does not refuse connections any more.

Now I am also able to connect to the TV through Home Assistant. 🎉

In order to get this sorted out (and maybe fix the docs) it would be nice if someone could try things more methodically (one step at a time). Before doing anything, could you please state the following:

  • What is your TV model and firmware version? (I am on a LG G3, FW 03.20.17)
  • What is your WebOS version? (Settings -> Support -> TV information) (I am on 8.2.0-710)
  • Could you please provide the output of telnet <your_tv_ip> 3000?
  • For 2023 models: Have you enabled IP control in Support -> IP control? (for older models there is a different option)

Now go ahead and do one thing at a time (I did it wrong because I was desperate):

  • Install the LG ThinkQ app and check if it finds your TV. If it does, try to pair it.
  • Now check the output of telnet <your_tv_ip> 3000 again.
  • If it's accepting connections now, try connecting through Home Assistant

If the telnet command still gives you a Connection refused message, go to your TV's network settings:

  • If IPv4 is on DHCP, set an IP address manually/statically.
  • Try turning IPv6 off (just for testing)
  • Now check the output of telnet <your_tv_ip> 3000 again.
  • If it's accepting connections now, try connecting through Home Assistant

Note: Don't forget to enable IPv6 again as you don't want to stick with legacy IP only.

@8bitjoey
Copy link
Author

8bitjoey commented Feb 14, 2024

  • What is your TV model and firmware version? (I am on a LG G3, FW 03.20.17)
    LG G3, 03.30.70
  • What is your WebOS version? (Settings -> Support -> TV information) (I am on 8.2.0-710)
    8.3.0-15
  • Could you please provide the output of telnet <your_tv_ip> 3000?
    Connection to 192.168.xxx.xxx port 3000 [udp/hbci] succeeded!
    Note: it's important to connect using UDP: nc -vu 192.168.xxx.xxx 3000 as TCP connection cannot be established.
    Note 2: WebSockets use TCP connection though and as far as I understand, aiowebostv uses websockets to connect to 3000 port.
  • For 2023 models: Have you enabled IP control in Support -> IP control? (for older models there is a different option)
    yes

Install the LG ThinkQ app and check if it finds your TV. If it does, try to pair it.
Now check the output of telnet <your_tv_ip> 3000 again.

LG ThinQ always worked fine

Try turning IPv6 off (just for testing)

it was off already

If IPv4 is on DHCP, set an IP address manually/statically.

Doesn't make any difference since the IP address was made static on a router side, but tried that too. No difference.

If it's accepting connections now, try connecting through Home Assistant

Nope :( HA logs has the same:

2024-02-15 00:14:54.744 DEBUG (MainThread) [aiowebostv] connect(192.168.xxx.xxx): uri: ws://192.168.xxx.xxx:3000
2024-02-15 00:14:56.745 DEBUG (MainThread) [aiowebostv] exception(192.168.xxx.xxx): TimeoutError()

@klada
Copy link
Contributor

klada commented Feb 15, 2024

  • Note: it's important to connect using UDP: nc -vu 192.168.xxx.xxx 3000 as TCP connection cannot be established.

If TCP connection to port 3000/3001 cannot be established then that's the problem. As I said I was also facing this until I messed around with the TV's network settings and the ThinQ app.

If Telnet gives you a connection refused then my guess is that the Home Assistant integration cannot do anything about it. You may try bscpylgtv and check if the connection to your WebOS TV succeeds with it. If not, then that's the issue.

Note 2: WebSockets use TCP connection though and as far as I understand, aiowebostv uses websockets to connect to 3000 port.

Yeah, aiowebostv uses TCP. AFAIK UDP is for WebRTC. The Python websocket library, which aiowebostv uses, opens the socket in TCP mode and aiowebostv does not change this.

Since we are both using the same TV (with slightly different FW) I think you should somehow be able to work this out. Maybe reset/reinstall the ThinQ app again, pair again and check the status of TCP port 3000 directly after pairing with ThinQ. You may also try to toggle the IP control setting.

As a last resort you could also try to factory reset your TV. I was about to do that with my TV before I got this to work.

@8bitjoey
Copy link
Author

There was WebOS upgrade today (0.30.71) and finally tcp connection succeeds

nc -v 192.168.xxx.xxx 3000
Connection to 192.168.xxx.xxx port 3000 [tcp/hbci] succeeded!

So maybe there was a problem with the previous version. However, HA still cannot connect with the same error 🤔

2024-02-19 11:42:33.337 DEBUG (MainThread) [aiowebostv] connect(192.168.xxx.xxx): uri: ws://192.168.xxx.xxx:3000
2024-02-19 11:42:35.338 DEBUG (MainThread) [aiowebostv] exception(192.168.xxx.xxx): TimeoutError()

UPD: I solved the problem. HA and TV were in different subnetworks 192.168.AAA.xxx and 192.168.BBB.yyy. There's no routing problem, both networks have full access to each other, but apparently, TV banned connection from "non-native" subnetwork. I changed HA's IP and it finally works.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants