Samsung TV "failed to connect"

The integration shows up as “Discovered” when starting HASS (and keeps showing up after it fails to configure), but when I try to configure, I get the error:

Aborted
failed to connect

This is a model EU55NU7475. Hass is on a different VLAN than TV, but I have set up mdns, in case that’s that’s important (it was for a few other things I tried to get into HASS). I have also punched a hole in the firewall, so the TV can communicate with HASS (which, I guess is why it shows up as “Discovered”).

I was looking at the TV while trying to set up (well, a few of the times, but it fails less than a second after I press submit)

In my logs (set log level to debug for homeassistant.components.samsungtv), I see:

2021-09-02 22:16:11 DEBUG (MainThread) [homeassistant.components.samsungtv] Samsung device found via ZEROCONF: {'host': '10.0.20.161', 'port': 49387, 'hostname': 'Samsung.local.', 'type': '_airplay._tcp.local.', 'name': 'Samsung 7 Series (55)._airplay._tcp.local.', 'properties': {'_raw': {'acl': b'0', 'deviceid': b'REDACTED', 'features': b'0x7F8AD0,0x38BCB46', 'rsf': b'0x3', 'fv': b'p20.0.1', 'flags': b'0x244', 'model': b'UNU74A0', 'manufacturer': b'Samsung', 'serialNumber': b'REDACTED', 'protovers': b'1.1', 'srcvers': b'377.17.24.6', 'pi': b'E8:DE:DB:DC:ED:04', 'psi': b'REDACTED', 'gid': b'REDACTED', 'gcgl': b'0', 'pk': b'REDACTED'}, 'acl': '0', 'deviceid': 'REDACTED', 'features': '0x7F8AD0,0x38BCB46', 'rsf': '0x3', 'fv': 'p20.0.1', 'flags': '0x244', 'model': 'UNU74A0', 'manufacturer': 'Samsung', 'serialNumber': 'REDACTED', 'protovers': '1.1', 'srcvers': '377.17.24.6', 'pi': 'E8:DE:DB:DC:ED:04', 'psi': 'REDACTED', 'gid': 'REDACTED', 'gcgl': '0', 'pk': 'REDACTED'}}
2021-09-02 22:16:11 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Create SamsungTVWSBridge for name (10.0.20.161)
2021-09-02 22:18:17 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '10.0.20.161', 'method': 'legacy', 'port': None, 'timeout': 31}
2021-09-02 22:18:17 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'description': 'HomeAssistant', 'id': 'ha.component.samsung', 'host': '10.0.20.161', 'method': 'legacy', 'port': None, 'timeout': 31}, error: [Errno 111] Connection refused
2021-09-02 22:18:17 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '10.0.20.161', 'method': 'websocket', 'port': 8002, 'timeout': 31}
2021-09-02 22:18:17 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'host': '10.0.20.161', 'method': 'websocket', 'port': 8002, 'timeout': 31}, error: {'event': 'ms.channel.timeOut'}
2021-09-02 22:18:17 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Try config: {'name': 'HomeAssistant', 'host': '10.0.20.161', 'method': 'websocket', 'port': 8001, 'timeout': 31}
2021-09-02 22:18:18 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] Failing config: {'name': 'HomeAssistant', 'host': '10.0.20.161', 'method': 'websocket', 'port': 8001, 'timeout': 31}, error: {'event': 'ms.channel.unauthorized'}
2021-09-02 22:18:18 DEBUG (SyncWorker_0) [homeassistant.components.samsungtv] No working config found

Any suggestions or ideas?

[EDIT] - I did note that it seemed very similar to this and this (as well as a few posts below), but there was no reply. So I thought instead of reviving those threads (that were started about something else), I’d post a new.

In my instance this issue is becuase my TV is on a different VLAN to HA. I use a ubiquiti UDM Pro, but sadly it doesn’t have an mDNS repeater only a mDNS reflector, and consequently it doesn’t work. So it’s not just a case of punching holes in your firewall, you also need that mDNS communication to be repeated between your VLANs.

Weird, I already have set up an mDNS repeater because I have Chromecasts on the same VLAN as the TVs, and it works fine for those Chromecasts.

Well, maybe I missed something, but if so, I’m not really sure what. I’ll dig around the settings and see if I come up with anything. But… suggestions are still welcome…

FYI, it’s an Ubiquiti Edgerouter X.

You are getting an unauthorized message, you can see it tries legacy with no port, then 8001 and finally settles on 8002 (which is one of the ports you will need open, there are others based on some of the upnp stuff that goes on so I’d perhaps start by disabling any firewall blocking between the vlans you are working with), try checking your device discovery settings on your TV. I had mine set to prompt on the first time a device is connected. Change the password or remove it in the same settings area of the TV. I think it’s around the smart hub device manager or something.

Im having the same issue with 2020 qe75 samsung tv

It worked fine until new year or so, then it just broke and im experiencing this error

3rd party integrations doesnt work also

So frustrating

Did you manage to find a solution to that? I can’t get the integration to work for some reason.

Same issue here with both My kids TVs

samsung ue32n5300ak

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Try config: {‘name’: ‘HomeAssistant’, ‘description’: ‘HomeAssistant’, ‘id’: ‘ha.component.samsung’, ‘host’: ‘192.168.5.75’, ‘method’: ‘legacy’, ‘port’: None, ‘timeout’: 31}

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Failing config: {‘name’: ‘HomeAssistant’, ‘description’: ‘HomeAssistant’, ‘id’: ‘ha.component.samsung’, ‘host’: ‘192.168.5.75’, ‘method’: ‘legacy’, ‘port’: None, ‘timeout’: 31}, error: [Errno 111] Connection refused

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Try config: {‘name’: ‘HomeAssistant’, ‘host’: ‘192.168.5.75’, ‘method’: ‘websocket’, ‘port’: 8002, ‘timeout’: 31}

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Failing config: {‘name’: ‘HomeAssistant’, ‘host’: ‘192.168.5.75’, ‘method’: ‘websocket’, ‘port’: 8002, ‘timeout’: 31}, error: {‘event’: ‘ms.channel.timeOut’}

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Try config: {‘name’: ‘HomeAssistant’, ‘host’: ‘192.168.5.75’, ‘method’: ‘websocket’, ‘port’: 8001, ‘timeout’: 31}

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] Failing config: {‘name’: ‘HomeAssistant’, ‘host’: ‘192.168.5.75’, ‘method’: ‘websocket’, ‘port’: 8001, ‘timeout’: 31}, error: {‘event’: ‘ms.channel.unauthorized’}

2021-11-06 12:58:00 DEBUG (SyncWorker_2) [homeassistant.components.samsungtv] No working config found

Anyone found a solution for this yet?

Did you try @mcinnes01’s suggestion (post #4)? I haven’t gotten around to it, but if you do, please report whether it works for you.

The fix, at least if you have a UDM-Pro with an untrusted VLAN, is here:

worked for me! IMO you should use /32 not /24 for the source and dest IPs.

401 unauthorized from WAN ( public IP )

I am getting 401 unauthorized from public IP address on /dmr page with port 9197, I have no problem with local (LAN) address.
Is there any way to enable it from WAN?