Connecting LG TV Remote to Home Assistant

A side effect of my Living Room TV being connected to a surround sound system via optical cable, is that the volume buttons on the remote have never worked. One of the great things about rooting my TV is I’ve been able to remap the buttons on the remote to call out to Home Assistant, and control the Surround Sound via an IR blaster.

This guide is only for rooted LG TVs. I am unsure if similar is possible on other TV models.

Check Remote button presses can be detected

On one of my TVs, button presses on the remote were not detected, so it’s best to check first.

  1. Open the Homebrew Channel.

  2. Install and open the “LG Input Hook” app.

  3. It is usually easier at this point to move to use a browser on a laptop. The instructions for this are displayed at the top of the screen.

  4. Check that LG Input Hook can detect button presses on your remote. To do this, scroll down to the “View logs” select dropdown. There is guidance for each option. Select the correct option, and test it by pressing a button on the remote. The key number should appear in the logs.

    Example logs for the LG Magic Remote

Configure Home Assistant

In order to trigger Home Assistant actions from the remote, we are going to use the REST API:

  1. In Home Assistant, click you username in the bottom left, or click the button below:

    Open your Home Assistant instance and show your Home Assistant users profile.

  2. Click the “Security” tab.

  3. Go to “Long-lived access tokens” at the .

  4. Create a new token, and make a note of it.

Setup a Key Bind

  1. Back in LG Input Hook, click the “Add Keybind” button.

  2. Set the ID of the button. This should appear in the logs you viewed before as id => 0/1.

  3. Set the Action to Execute.

  4. Set the Command to call the Home Assistant API. You will need to customise the command based on the service you want to call. Full details of the API are available on the Home Assistant documentation.

    curl --request POST -H "Authorization: Bearer <token>" -H "application/json" -d '{"entity_id": "remote.living_room_remote", "device": "surround_sound", "command": "mute"}' http://homeassistant.local:8123/api/services/remote/send_command
    

    In the above, device and command are parameters of the remote.send_command action in Home Assistant.

  5. Click “Save changes”.

  6. Test the key binding.

Example of a configured key binding

Bonus: Remap Service Buttons

The LG remotes, like many I expect, include buttons for specific streaming services. I expect services have paid a lot of money to be included on the remotes. If you don’t have these services, then they just become useless buttons on the remote, or buttons you might accidentally press causing the TV to open the app store.

You can use LG Input Hook to either disable these buttons, or remap them to a different app. For example, I have remapped one to open the Jellyfin app instead, and another for YouTube ad free. Just use a different Action for the key bind instead of “Execute” as above.