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.
-
Open the Homebrew Channel.
-
Install and open the “LG Input Hook” app.
-
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.
-
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.
Configure Home Assistant
In order to trigger Home Assistant actions from the remote, we are going to use the REST API:
-
In Home Assistant, click you username in the bottom left, or click the button below:
-
Click the “Security” tab.
-
Go to “Long-lived access tokens” at the .
-
Create a new token, and make a note of it.
Setup a Key Bind
-
Back in LG Input Hook, click the “Add Keybind” button.
-
Set the ID of the button. This should appear in the logs you viewed before as
id => 0/1
. -
Set the Action to
Execute
. -
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
andcommand
are parameters of theremote.send_command
action in Home Assistant. -
Click “Save changes”.
-
Test the 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.