In this post I’m going to talk about two features I’ve added to the lirc_web project. lirc_web is a NodeJS app I wrote that provides a web interface and JSON based API for controlling LIRC, an open source project that lets you control IR devices from the command line. I built lirc_web to run on a RaspberryPi along with an expansion board I designed so that anyone could build their own fully customizable universal remote that is controllable via a web interface from any web connected device (phone, tablet, laptop, smart watch, etc).
If you’d like additional context about the project, you may be interested in:
- Open Source Univeral Remote
- Open Source Universal Remote - Parts & Pictures
- RaspberryPi IR Schematic for LIRC
- Controlling LIRC From the Web
In v0.0.8 I’ve added two new features - macros and repeaters.
Macros
Macros allowing you to execute multiple IR commands in rapid succession from a single button tap or HTTP request. The use case for this would be when you need multiple devices to be turned on and set to a certain mode to perform an activity (say, playing a video game or watching a movie). An example macro might be:
- Turn TV on
- Set TV to input 3
- Turn receiver on
- Set receiver input HDMI2
- Turn game console on
Macros make performing common multi-step tasks simpler. In addition, Macros are exposed via the API, which means you can execute macros by sending an HTTP request from a growing number of internet of things or web connected devices. For example, you could adjust the volume of the TV from your Pebble watch or change the TV channel by waving your arm while wearing a Myo armband.
Macros are defined in a JSON configuration file (config.json
) that lirc_web
expects to find in the root of the project. Here’s an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
The macros
key is an object of keys (labels) that are set to arrays of [remote, command]
pairs. The remote
and command
strings should match what is defined in the LIRC configuration file. A small delay is introduced between each command to ensure they are all received.
After you create or change anything in config.json
, you will have to restart lirc_web
. Afterwards, you’ll see your macros listed at the bottom of the user interface.
Macros are also available via the API. You can execute them by creating a POST request to a url like so:
1
|
|
Repeaters
Repeaters are a type of button that repeatedly send it’s command as long as it is held down. The use case for a repeater would be a volume button that should continue to change the volume as long as it’s pressed - rather than needing to tap it many times.
Repeaters are also specified in the configuration file. Here’s an example:
1 2 3 4 5 6 7 8 |
|
Similar to macros, the name of the remote
and command
must match the names you gave these commands in the LIRC configuration file. If you want to change the name of a button, update the LIRC configuration file and restart LIRC / lirc_web.
Enjoy
I’ve found these two features make the Open Source Universal Remote significantly more useful for common tasks. If you have any suggestions for new features or ideas on how to improve the project, please share your ideas in the comments.