Creating a custom remote for IR
If your device has an IR blaster, for example Samsung and HTC devices, then you can create a custom remote for controlling TVs, sound systems, or other devices that can be controlled using IR.
Find the example remotes
The latest version of Unified Remote Server comes with some basic custom remote examples, including an example of a custom remote for keyboard shortcuts. We will use that has a starting point. It is located here:
- Windows: C:\ProgramData\Unified Remote\Remotes\Bundled\Examples
- Mac: ~/Library/Application Support/Unified Remote/Remotes/Bundled/Examples
- Linux: ~/opt/urserver/remotes/bundled/examples
Make a copy of it
Start by creating a copy of the IR example remote. Copy the "IR" folder and give it a name. For example, let's create a custom remote for a "Samsung TV".
Check the files
Open the folder, and you should see four files.
- The layout file defines how your remote should look,
- The meta file describes the name/author etc.
- The remote file contains the keyboard shortcuts code for each button.
- The icon is what's shown as the icon in the app.
Modify the meta file
Start by opening the meta file in a text editor. Give it a fitting name, author, and description. You must give it a new name (two remotes can't have the same name). Once you're done, save and close the file.
Modify the layout
Next, have a look at the layout file, also in a text editor. Layouts typically include some rows, and each row has one or more buttons.
- The "text" attribute gives it a name
- The "ontap" tells the remote which action to run (we'll get to that later).
You can add/rename the buttons, or close the file for now.
Modify the remote file
Now open the remote file in a text editor. This file defines what IR code to send for each action (i.e when you press a button).
Now for the tricky part. How do we know what IR codes to send? Most devices (TVs, sound systems, etc) use different codes - typically different for each model. One of the best places to find codes is http://www.remotecentral.com and Google.
For example let's search for "samsung ir hex codes". Ideally you should include a model name/number. The second result looks promising.
This looks promising. Notice that the codes have the same format as the ones in the example. That's what we want to look for.
Now lets copy the code for "Power" and put it into the remote file for our remote. Let's also rename the command to "power". Don't forget to change it in the layout file as well!
Before we add any more buttons, let's make sure we test this one. IR codes are trial and error. Make sure all your files are saved. Then go to the manager and restart the server: http://localhost:9510/web
You may also want to check the log to make sure your remote loaded without any errors: http://localhost:9510/web/#/log
Test it!
Finally, open the remote on your device, and test the button. If it works, great! Go ahead and add more buttons. If not, try and finding better codes. Good luck!
IR codes without a server
If you'd like to use your remote control without being connected to your server, then you need to use the inline action format instead. Basically, you should enter the IR codes in the layout file, instead of the remote file.