I got obsessed with universal remotes. I know “good home automation” is automatic and not remote controlled or voice controlled. Not everything can be automatic though until AI can read our minds. I currently have at least 4 remotes and a ton of wireless buttons connected to Home assistant. Most use “Keyboard Remote” as the integration method. A few are also standard RF 433 remotes when I need to do something from a LONG distance. I’ll put useful links at the bottom. I may also update this top post with new stuff as I change things around.
Infrared remotes:
- Use the FLIRC IR dongle and any IR remote can connect to Home Assistant like it was a keyboard.
Bluetooth:
- HA is basically just Linux so in this instance I just used Linux commands to pair my remote. Here is what you need to know to get a Bluetooth remote paired to HA. I specifically address the Sofabaton but it may be useful for other Bluetooth devices as well. Look in the useful links if you don’t know how to access the terminal.
Put your Sofatbaton(or other remote) into BT Keyboard pairing mode.
Go into HA terminal(see useful links) then use the following commands.
bluetoothctl
scan on
Then find the sofatbaton and pair it by typing the following command and the BT MAC address of your remote. I’ll use “00:00:00:00:00:00” as an example but you will need to use the MAC of your remote.
pair 00:00:00:00:00:00
trust 00:00:00:00:00:00
Now use the exit command to get out of Bluetooth scanning and pairing mode.
exit
I was having the Sofabaton disconnect and not connect again. Connections seem to be working better after I use the trust command now listed above as part of the pairing process. The command below can be used to force a connect again if you have a problem.
connect 00:00:00:00:00:00
I also added the following to my configuration so I can use an action to reconnect but since it’s no longer disconnecting this has not been tested. It could be used in an automation. Just like the other commands you need to replace the MAC address with your own remotes MAC. A similar action could be made to find and connect a new remote if someone were so inclined.
shell_command:
connect_sofatbaton: bluetoothctl connect 00:00:00:00:00:00
Other Options:
- I used a Raspberry PI to connect my first wireless remote to HA. Using an RPI or ESP32 may still be useful if your HA box isn’t in a good place for reception. It also may be useful for some with Docker installations having an issue passing the commands through to HA. They can send the commands back to HA via MQTT or via web hooks like I did. I’ll put useful links below.
Keyboard Remote
- Most remotes will use keyboard_remote: as a way to interact with Home Assistant after you connect them. That means Bluetooth remotes, infrared remotes that use the FLIRC adapter, remotes with wireless dongle, and wired remotes like a USB keyboard.
Range:
- The range can be TERRIBLE in some cases. Usually it’s because you have devices too close together or devices are plugged directly into the USB 3.0 port of a RPI. I significantly increased range and reliability of some remotes with simple USB extension cables. This is a common thing we see with Zigbee as well. That’s why Nabu Casa ships their radio dongle with a USB cable. It can also be helpful to use wired internet on your HA server if you can’t get the dongle far enough away. It may also be useful to get one of the long range BT dongles suggested by Home Assistant. Look in useful links for a list.
Turning a PC on and off with a remote.
- This is slightly off topic but if you want to use a remote with a PC this is useful. You can buy Infrared and RF power buttons for PCs. They augment or replace the built in power button. Great for PC turned home entertainment system. Turning a PC off can be accomplished remotely in a number of ways but sometimes it’s more difficult to turn them back on remotely. More info in the useful links.
Useful Links:
Terminal: Useful for setting up Bluetooth remotes and keyboards.
Video showing how to set up keyboard_remote. It’s useful for many types of remotes.
High performance BT dongles recommended by the HA team.
IR/RF controlled PC power buttons:
Other options:
key reassignment:
I had to reassign a few keys in the Sofabaton app to make the remote work with Home Assistant properly. For some reason the standard channel_up and channel_down both return key code 240. That’s a key I find typically implies an error decoding the key. Other keys return no code at all. Mapping as below seems to fix this with no issues.
- Information - a
- Whatever the arrow in the square box is - b
- Channel up - F1
- Channel down - F2
- Dash Button - F3
Experiments:
-
Voice remote - I have one wireless remote with a built in microphone. The mic shows up in HA as a USB microphone but I have not got that working yet. I hope to eventually be able to push the microphone button and talk directly to HA assist. I’ll put more here if I get that feature working.
-
Blueprints and scripts - I’m currently working on a universal Blueprint that will intercept remote events and translate those events into key presses. The key presses then go to scripts for processing. It’s all working but everything is ugly right now. I’m currently controlling lights, HVAC, media players, and TV’s. Controlling a TV might not sound interesting but it becomes much more useful when you connect it to ADB in the case of Android and FireTV devices. Then you can launch apps directly with a single push. It’s also possible on Roku using their API.
ESPresense 2024-08-19:
- The Sofabaton remote can be detected by ESPresense so we can use location to determine what actions HA will perform on key presses. It might also be useful just so we know where we left the remote.
BTproxy 2024-08-19:
- BTproxy detects the SofaBaton in the logs but it does not show up as a new device.