I recorded the IR codes from my Samsung TV remote a while back to control it from Home Assistant. I was always a bit annoyed that the remote only sent the power toggle via IR, and then had some kind of proprietary bluetooth connection to the TV for all the other commands…which I could not record!

It didn’t much matter as I only had my media PC plugged into the TV and didn’t need to change channels or inputs* basically ever. I don’t even use the speakers as the media PC outputs to HiFi speakers directly. The TV isn’t connected to the network either; my media PC is plenty smart, my TV can be thick as pig shit as long as it displays a picture.

However, it still annoyed me a little bit that picture adjustments etc would need me to find the remote control.

Anyway, I came across the information that Samsung TV’s could be spoken to via RS232 (Can’t remember where, possibly Hacker News), which is essentially a serial connection. Additionally, Samsung TV’s often come with an EX-Link port to receive the serial commands. My initial thought was if I could build an ESP32 device to convert commands to serial and output to the EX-Link port. Then I got all excited when I found the PUSR Ethernet to serial converters - I could even power it with a POE dongle that would split out a barrel jack!

It’s super geeky, but I really loved the idea of using home assistant to communicate with my TV via a technology introduced according to wikipedia in 1960!

Where it all fell apart…sort of

So I didn’t want to just spend money on the equipment and not check my TV first. The wife and I got it off the wall and…no EX-Link port.

Arse!

Not to worry, some of the Samsung documentation suggested that it will work via a USB port. I could just use a db9 serial to usb cable instead. I wanted to check if this was possible in the secret engineering service menu. However, with the newer samsung “smart” remotes, we didn’t have very many buttons to work with. We spent 20mins trying to get that to show up, even plugging in a spare usb keyboard to type numbers. Nothing worked.

Arse!

Not to worry, one random blog post suggested getting an old Samsung TV remote that had the requisite buttons. Hang on, does that mean the TV will understand the right IR codes if I sent them from my IR blaster from Home Assistant? So this and this were found and tested.

Turns out the HDMI codes work just fine to switch input. As do the Menu, Smart and other navigation buttons. All the codes were there for me to recreate the remote in Home Assistant!

A disappointing victory

So the thing I wanted to do all along was actually possible and quickly added to Home Assistant for a remote. I should be really pleased. I’m not. I wanted to arse about with a new bit of tech and use a near 70 year old technology to control my TV!

Anyway, I’m pretty sure the IR stuff that was recently added to Home Assistant probably would have solved this anyway if I’d bothered to look.

The relevant section of my broadlink codes file in home assistant (config/.storage/broadlink_remote_codes) is this:

    "television": {
      "power": "JgCMAJOTEzcTOBI4EhMSExMTEhQSExI4EzcUNxITEhMTFBMTEhMSFBI4EzgTEhMTEjgTNxM4EjgTExITEjgTOBMSEhQTEhIABeiSlBM4EjgSORITExITExMSExMSOBM4EjgSFBITEhMTExITEhQTNxM4EhMSExM4EjgTOBM3ExMSExI4EzgSExMTEhMTAA0F",
      "mute": "JgBGAJGWEDoQOhA6EBUQFREUEBURFBA6ETkRORITERQRFBEUEBURORE5ETkROREUERQTEhEUEBYPFhAVEBUQOg87EDoQOg8ADQUAAA==",
      "menu": "JgBGAJKVEDoRORE5ERQQFREUERQRFBE5ETkQOhEUERQQFRAVERQRFBA6ERQRORA6ERQQFRAVETkQFRE5EBUQFRA6EDoROREADQUAAA==",
      "smart": "JgBGAJGWDzsPOxA6EBUQFRAVEBUQFRA6ETkQOhAVEBUQFREUEBURORAVERQRORA6ETkROREUERQRORA6ERQQFRITEBUROREADQUAAA==",
      "back": "JgBGAJKWDzsQOhA6EBUPFhAVEBUQFQ87EDoSOBAVEBUPFhITEBUQFREUERQQOhA6EBUQOhAVEDoQOhA6ERQQFRE5EBUPOxEADQUAAA==",
      "return": "JgCMAJOUETgSNxI3EhMSExETEhMSEhI4ETgSNxITERMSExITERMSExISEhMSNxI3EhMSNxITEjcSNxI4ERMSExI3EhMROBIABfuTkxI3EjgSNxITERMSExISEhMSNxI3EjgRExITEhMRExITEhISExITETgSNxITETgSExE4EjcSNxITEhMROBETEjcSAA0FAAAAAAAAAAAAAAAA",
      "up": "JgBGAJGWEDwNOw88DxQQFg8WDxYPFg86ETkROw8VEBYPFQ8XEBUOFhEVDhYPFhEVDzoROBEVDzsQOw86EDkROhAWDhYPPA4ADQUAAA==",
      "down": "JgBGAJSTEjgSOBI4EhMSExITEhMSExI4EjgSOBITEhMSExITEhMSOBITEhMSExITEjgSOBITEhMSOBI4EjgSOBITEhMSOBIABaQNBQ==",
      "left": "JgBGAJSTEjgSOBI4EhMSExITEhMSExI4EjgSOBITEhMSExITEhMSOBITEjgSExITEjgSOBITEhMSOBITEjgSOBITEhMSOBIABaQNBQ==",      
      "right": "JgBGAJSTEjgSOBI4EhMSExITEhMSExI4EjgSOBITEhMSExITEhMSExI4EhMSExITEjgSOBITEjgSExI4EjgSOBITEhMSOBIABaQNBQ==",
      "ok": "JgBGAJGXDzwMPQ49DhUQFg8WDxYQFBE6ETkPOhAWEBUPFg8WDxYQFQ8WEBYOOhAWDzsSOA8WDzsQOxA4ERUPOxAVDxYQOg8ADQUAAA==",
      "hdmi": "JgBGAJGWETkRORI4ERQRFBAVERQRFBE5ETkROREUEBURFBEUERQQOxA6EBUPOw8WDxYQFRA6DxYQFRA6EBUPOxA6ETkRFBEADQUAAA==",
      "hdmi1": "JgBGAJKVETkRORE5ERQQFRAVERQQFRE5ETkROREUERQRFBEUERQRORAVERUPOxAVDzsQOhA6EBUQOhA6EBUQOhAVEBUPFhAADQUAAA==",
      "hdmi2": "JgBGAJOUETkRORA6ERQQFRAVERQRFBA6ETkROhAVDxYQFQ8WEBUQFQ87EDoRORA6DzsQFRA6DzsPFhAVDxYQFRAVEDoQFRAADQUAAA==",
      "hdmi3": "JgBGAJOUEDoRORE5ERQRFRAUERQRFBE5EDsQOhAVEBUPFg8WDxYPFhA6EBUPFg8WEBUROQ87EDoQFQ87EDoQOhA6EBUPFhAADQUAAA==",
      "hdmi4": "JgBGAJOVETgRORE6DxYQFQ8WDxYPFhA6EDoQOhAVDxYQFQ8WDxYPOw8WEDoQFRAVDxYPOxA6EBUQOhAVEDoQOhA6EBUPFhAADQUAAA=="
    },

*Not a lot of free to air TV for me to watch in a language I would understand anyway in Hong Kong!