tavicu / homebridge-samsung-tizen

Homebridge plugin for Samsung TV's with Tizen OS
MIT License
638 stars 86 forks source link

Failed to pair! Make sure TV is online and you click "Allow" on the popup #619

Closed jankais3r closed 1 year ago

jankais3r commented 1 year ago

Hi,

I think I went through all the options (and previously closed issues) before asking for help here, but I wasn't able to solve this issue so far…

Problem: I can't get Homebridge authorized with the TV. That means that I can turn it on via WoL, but no other control works. I get Failed to pair! Make sure TV is online and you click "Allow" on the popup on startup, and Failed to open socket {"event":"ms.channel.unauthorized"} every time I try to perform an action (e.g., turn the TV off).

My theory is that somebody at some point denied Homebridge access when the notification popped up on the TV (I've had the plugin installed for more than a year) and since then the TV remembers the option and refuses to talk to Homebridge. However, in my 2019 QLED TV's settings I don't have the Settings > General > External Device Manager > Device Connection Manager menu where I could review and edit previous IP Remote authorizations… IMG_1821 I tried to disable the IP Remote feature completely and also rest network settings, but that didn't help.

When I ping the TV from my computer (websocat --insecure "wss://192.168.1.90:8002/api/v2/channels/samsung.remote.control?name=U2Ftc3VuZ1R2UmVtb3Rl"), I get the authorization pop-up and after allowing it on the TV I receive the auth token. But the Homebridge plugin never pairs…

What I tried:

Nothing worked, the plug-in still can't talk to the TV. Any ideas what could be causing this, besides factory resetting the TV?

jankais3r commented 1 year ago

Additional data point... From my computer:

curl -X POST -i 'http://192.168.1.90:8001/api/v2/applications/3201512006963'
HTTP/1.1 200 OK
content-type: application/json; charset=utf-8
content-length: 5

true

Launches Plex app.

Running the same command via SSH from my NAS where I run Homebridge:

curl -X POST -i 'http://192.168.1.90:8001/api/v2/applications/3201512006963'
HTTP/1.1 401 Unauthorized
content-type: application/json; charset=utf-8
content-length: 29

Could the TV be IP blocking the NAS?

tavicu commented 1 year ago

Hi @jankais3r,

From my experience I don't think the TV is the one that blocks connection. It may be something from your NAS, especially since the curl command it's just a normal request to http, not even https.

How are you running the Homebridge server on your NAS? If you run it in a docker container, do you use network_mode: host?

jankais3r commented 1 year ago

Hi, thanks for the response.

I think it has to be the TV blocking this, because I run many other plugins in Homebridge and they all work. Even this plugin used to work when I initially set it up. On top of that, the curl command was executed directly from NAS, not from within the Docker container. The docker sits on the same IP as the NAS itself, yes. I would expect either packets to be dropped or to receive some sort of "host is unreachable" message if this was a network issue, instead of a valid 401 reply from the TV's webserver.

tavicu commented 1 year ago

The 401 response indeed suggest that the TV is blocking the request. But from my experience I don't know of such a feature on Samsung TVs for http requests. Even if someone pressed decline when the plugin asked for access that's only for the websocket, the curl command is a plain http request ... I don't know of any feature to block requests from one IP. Are the NAS and TV on the same network and same subnet? Because I know that samsung tvs don't accept requests from other subnets (https://github.com/tavicu/homebridge-samsung-tizen/issues/557#issuecomment-1244493616)

sgraystar commented 1 year ago

In my experience if I change something on the homebridge side that causes the TV to see the change I have to turn the TV on and wait with the remote while restarting homebridge. This is because the on screen popup to "allow" only shows for a few seconds.

guffelman commented 1 year ago

I am having the same issue with a 2022 65" S95B. Same exact issue. API responds from other devices as well. Just can't get homebridge to trigger the popup.

After reading more - my homebridge instance is on a different subnet causing this issue. I'll need to do some sort of router-magic to make this work.

jankais3r commented 1 year ago

While the issue was marked as complete, I have the TV on the same network subnet as my Homebridge instance, so that is not the root cause. Any other ideas how to debug this?

jankais3r commented 8 months ago

I was finally able to resolve the issue…

As part of my debugging process I tried to pair my TV with the SmartThings iOS app, but the pairing process kept failing. The furthest I got was after confirming the pairing request on the TV and entering the PIN on the phone, after which the app asked me to select a Wi-Fi network, even though my TV was connected via a cable. That gave me an idea to try and connect the TV via Wi-Fi. After I did that, the Device Connection Manager menu I reported in my first post as missing, came back. Within the menu, Access Notification was set to Off, which explains why Homebridge kept failing to authenticate and no pop-up was shown. Once approved, I was able to switch the TV back to Ethernet connection and everything works.

Even though this seems to be a 100% Samsung bug, I hope this helps somebody in similar situation.