Home Assistant and Samsung TV Control over EX-Link (RS-232)

Hi everyone,

Just making this post about how I added in my Samsung TV to HA. Didn’t find any documentation on the site so wanted to help out anyone that is thinking of a similar setup. I am able to adjust volume, HDMI, and power easily. The main reason I did this was to make sure my TV stayed off the internet to keep the ads away/data mining.

Things you’ll need:

Samsung TV with Ex-Link. This port looks like a headphone jack (3.5mm) but is indeed RS232.
TCP to RS232. The one I used is similar to this.
RS232 DB9 to 3.5mm jack. This is the one I used.
(optional) Since I have POE on all my switch ports, I also bought a POE splitter here.

The TCP to RS232 that I bought had a default IP of 192.168.0.7 and admin admin for username/password. As I like to keep all my configurations on my PFSense, I switched this to DHCP.

Once everything is hooked up and you can reach your device on the network (default for these devices is that port 80 is open so you can reach it in your browser), you’ll want to make sure that your TCP device is set to TCP server. I used port 22 but you can adjust this if needed. Just make sure to change the port below if you do that (after the IP).

I then added in the following as a command line switch:

switch:
  - platform: command_line
    switches:
      tv:
        command_on: echo -n -e "\x08\x22\x00\x00\x00\x02\xD4" | nc 192.168.40.33 22
        command_off: echo -n -e "\x08\x22\x00\x00\x00\x01\xD5" | nc 192.168.40.33 22

These commands will turn it on and off. Below is a list of items that you can use for commands:

Power on: \x08\x22\x00\x00\x00\x02\xD4
Power off:  \x08\x22\x00\x00\x00\x01\xD5
Volume up: \x08\x22\x01\x00\x01\x00\xD4
Volume down: \x08\x22\x01\x00\x02\x00\xD3
Mute: \x08\x22\x02\x00\x00\x00\xD4

This link is what I used to find all the commands.

Thanks,
David

2 Likes

Interesting approach, I’ll have to check some of my old TV’s with ethernet and see if they can be adapted.

Any idea what the TV Tuner codes are? I’ve been able to change source to TV using [0x08, 0x22, 0x0a, 0x00, 0x00, 0x00, 0xCC] . And send a ‘Channel Up’ using [0x8, 0x22, 0x3, 0x0, 0x1, 0x0, 0xD2]. But I can’t seem directly tune a channel, correctly. I’m trying to directly tune to channel 39-1 [a DTV Cable channel].

I’m currently trying to implement this as well, so I found this thread. I see that we have purchased much of the same equipment :slight_smile:

I found the Samsung PPT that explains the protocol, and that it is 9600 bps.

The powerpoint appears to also have some files embedded, including a test program for windows. Will give it a go later.

Long term I will use the ethernet<->rs232 or a tiny esp32 to send the commands. If someone else reads this, let us know how you did!

@MaverikGoose44 the powerpoint file has an explanation on how to directly tune channels

well this is a bummer. Turns out my TV does not have an ex-link. I have a service port, which is used to control a auto wall mount. My TV (LE52A559) came out in 2008/2009 and I was sure it had a port, but I couldn’t find it now. Oh well, too bad, as I was hoping for an easier way to change directly to the correct hdmi port instead of cycling through all the inputs.

There might be some hidden IR codes to select a specific input, but I will have to do some more research

@daviboi should this work with the Itach flex connected to the ExLink? I am currently using this setup in my ISY sending a binary command on port 4,999 to the iTach Flex. I send 8;34;0;0;0;2;212 in binary to the iTach, the actual looks like "� in the ISY network config.

@jkosharek Not exactly sure with that model but you may have to be sending your codes in hex instead?

I apologize for not getting back to you sooner. I lost access to my email for this account but have restored it now.

I plan to implement this on my TV. I’m waiting for the USR-TCP232-302 converter to be delivered. Any updates, revisions, or tips regarding your original post? Thanks!

Nope, haven’t made any changes since I first implemented.

1 Like

EDIT: Swapped my RX/TX pins on my 3.5mm wire, and it works!

Hey @daviboi , I just got this setup, I can see commands going to the USR-TCP232-302, it gets all 7 bytes. The TV does not respond, using a Samsung PNxxF8500, I tried on and off, but no action. Does the TV need to have ExLink enabled or anything?

I used this to verify my pinouts: https://wiki.samygo.tv/index.php?title=Ex-Link_Cable_for_J/K/M/Q/N/QN_Series

Here is my USR settings:
image

For completeness sake, here is more info on how to test and get more commands.

Can you share your command line config?

I was actually just doing it directly from my PC terminal to test, however I figured it out, swapped my TX/RX wires and it works! At least on/off do!

Thanks so much for posting this, I really wanted to avoid another wifi device (e.g. IR blaster) if I could.

Awesome to hear!