Helping guide you through the never-ending forest of technology, into the open glade of easy to follow posts!
Cheap HomeKit IR Blaster: Homebridge Plugin
Cheap HomeKit IR Blaster: Homebridge Plugin

Cheap HomeKit IR Blaster: Homebridge Plugin

I’m rather a fan of Home Automation, all the lights in my house are Philips Hue—except for the cooker extractor fan. But controlling lights is only the first step of many to an automated household. The next stage in automation for me was dealing with the eternal dilemma of finding the remote—an IR Blaster.

I started researching IR Blasters, but couldn’t find any that supported HomeKit. This meant I’d be looking for something in the Homebridge realm. Here I found three options: The Logitech Harmony Hub, the BroadLink RM, or I could code an ESP2866 as an HTTP IR Blaster. I went with a BroadLink RM Mini 3—a more budget-savvy ~£18(~$24) compared to the ~£75(~$70) Harmony Hub.

The BroadLink was smaller than I’d expected. The design reminds me of Apple’s Dustbin Mac Pros—but the similarities end there, the Broadlink app is rather clunky.

Initial App Setup

When trying to connect the IR Blaster to the internet I had a few teething issues with the app. It refused to discover the BroadLink RM Mini, so I used the alternative connection method. This involved connecting to the BroadLink as a WiFi Network and using that to connect it to my network. I decided I’d see what the Native app offered—in case my Homebridge system ever stopped working. The app was a 4/10 and was missing a few key features, such as the option for separate On/Off commands.

Homebridge Setup

Using the Native App was never the end goal for this project. I needed to expose it to HomeKit. For this section, I’ll assume you are familiar with setting up a Homebridge system. If you’ve not got Homebridge setup check out my post explaining how here. The plugin for getting the Broadlink to work with Homebridge is homebridge-broadlink-rm. To install this type below command:

sudo npm install -g homebridge-broadlink-rm

Once installed you can begin to configure the plugin. The first step is to add the Broadlink Plugin to the config.json file. You will want to add the below code to the file—if you have other platforms add this as an extra:

"platforms": [
{
      "platform":"BroadlinkRM",
      "name":"Broadlink RM",
      "hideScanFrequencyButton": true,
      "hideLearnButton": false,
      "hideWelcomeMessage": true,
      "accessories":[ ]
    }
]

After this, you can save the config and startup Homebridge. There should now be an extra button in your Home App labeled Learn. When you press this button the Broadlink will start listening for input. If you press a button on the remote the IR code will appear in the Homebridge console. You will need to press the learn button again for each IR code.

You’ll need to save each of these commands and make a list of each button and it’s IR code. I’m using PuTTY to connect to my Pi. To copy these codes from PuTTY, hold left click and highlight the IR code. This pastes the code onto the computer as usual. By using this method you can create a list of all the IR codes you want. I recommend turning off the TV/device, otherwise, it will try to do everything you’re recording. To do the inverse and paste into PuTTY right click and it will paste where the text cursor is.

Once you’ve got your list of IR codes written down you can start adding them to the config.json file. The next thing to do is to change “hideLearnButton” to false—you won’t need this again unless you add more remotes. For most of the commands, you add you will follow the simple structure of:

"platforms": [
    {
      "platform":"BroadlinkRM",
      "name":"Broadlink RM",
      "hideScanFrequencyButton": true,
      "hideLearnButton": true,
      "hideWelcomeMessage": true,
      "accessories":[
              {
                "name": "Hi-Fi",
                "type": "switch",
                "data": {
                  "on": "2600c2006e380...(ON_HEX_CODE)",
                  "off": "2600c2006e380...(OFF_HEX_CODE)"
                }
              }
            ]

This will be the structure for most of the remotes you will add to Homebridge. However, I had some special requirements. For my projector, I needed separate on and off commands. On top of this, the projector requires the off button twice to turn off. To do this I looked at the plugins Advanced Hex Structures, here I found the syntax for the repeat commands. For my projector’s functionality I wrote the following:

"name": "Projector",
"type": "switch",
"data": {
    "on": "26004c00de1f2...(ON_HEX_CODE)",
    "off": [
      {
        "data": "26004c00c2204...(OFF_HEX_CODE)",
        "sendCount": 2,
        "interval": 0.3
      }
    ]
  }

Once you’ve added the different IR codes you can then save out the config.json file and start Homebridge. I often end up with one or two small errors in the syntax so recommend putting your config through a parser. I’ve also included my full code for the Broadlink plugin at the bottom of this post.

I also added an AV System button, this turns on both the projector and hi-fi. I made this as a single button, as experienced issues trying to send two IR codes at the same time via a HomeKit scene. For me, this project was to replace my remote controls, but it works with anything IR controlled—such as an air conditioner or desk fan. If you have any questions about the project, I’d be more than happy to answer them!

My Full Broadlink Code

{
             "platform": "BroadlinkRM",
             "name": "Broadlink RM",
             "hideScanFrequencyButton": true,
             "hideLearnButton": true,
             "hideWelcomeMessage": true,
             "accessories": [{
                     "name": "IR - AV System",
                     "type": "switch",
                     "data": {
                         "on": [{
                             "data": "260050...",
                             "sendCount": 2,
                             "interval": 0.5,
                             "pause": 1
                             },{
                             "data": "2600c2..."
                         }],
                         "off": [{
                             "data": "260050...",
                                 "sendCount": 2,
                                 "interval": 0.3
                             },{
                             "data": "2600c2..."
                             }]
                         }
                     },
                     {
                     "name": "IR - Projector",
                     "type": "switch",
                     "data": {
                         "on": "260050...",
                         "off": [{
                                 "data": "260050...",
                                 "sendCount": 2,
                                 "interval": 0.3
                             }]
                         }
                 },
                 {
                     "name": "IR - Hi-Fi",
                     "type": "switch",
                     "data": {
                         "on": "2600c2...",
                         "off": "2600c2..."
                     }
                 },
                 {
                     "name": "IR - Apple TV",
                     "type": "switch",
                     "data": "2600cc..",
                     "enableAutoOff": true,
                     "onDuration": 0.1
                 },
                 {
                     "name": "IR - Steam Link",
                     "type": "switch",
                     "data": "2600cc...",
                     "enableAutoOff": true,
                     "onDuration": 0.1
                 },
                 {
                     "name": "IR - Nintendo Switch",
                     "type": "switch",
                     "data": "2600cc...",
                     "enableAutoOff": true,
                     "onDuration": 0.1
                 },
                 {
                     "name": "IR - PS4",
                     "type": "switch",
                     "data": "2600cc...",
                     "enableAutoOff": true,
                     "onDuration": 0.1
                 },
                 {
                     "name": "IR - Volume Up",
                     "type": "switch",
                     "enableAutoOff": true,
                     "onDuration": 0.9,
                     "data": [{
                             "data": "2600cc...",
                             "sendCount": 3,
                             "interval": 0.3
                         }]
                 },
                 {
                     "name": "IR - Volume Down",
                     "type": "switch",
                     "enableAutoOff": true,
                     "onDuration": 0.9,
                     "data": [{
                             "data": "2600cc...",
                             "sendCount": 3,
                             "interval": 0.3
                         }]
                 }
             ]
         }

Featured Equipment and Gear

As an Amazon Associate, TechTrail earns from qualifying purchases made with some store links.


by Sam Brooks

Sam is the founder and editor for Tech Trail. With a background in Broadcast Engineering, and great enthusiasm for smart home and emerging technologies.

More by Sam →

  • Twitter
  • KoFi
  • Email

Sam Brooks

Sam is the founder and editor for Tech Trail. A Broadcast Engineer with a passion for technology and design. Working on the bleeding edge of technology Sam is exposed to a vast amount of emerging technologies and likes to keep up to date on the latest tech in general.

4 Comments

    1. Sam Brooks

      Cheers dude! Absolutely, the plugin has support for both the RM mini and RM pro! It also work with RF signals, and has a ScanFrequencies button that you can enable to learn the commands.

Leave a Reply

Your email address will not be published.