Using Broadlink RM with Homebridge

Last update: 9 February, 2019

In this complete guide, we’ll walk you through everything you need to know to get started with using Broadlink RM with Homebridge. Whether you’re new to Homebridge or an experienced user, this guide will provide you with all the information you need to seamlessly integrate your Broadlink RM device and control your home appliances with ease. So let’s get started!

We all have many devices in our homes that operate under infrared, as it is a cheap and very easy-to-install technology. The TV, air conditioning, some fans or lights are some of them. That’s why I’ve decided to centralize all control in the Broadlink RM device. Let me explain how.

There are various devices that function as infrared emitters-receivers, and I personally have chosen Broadlink RM, which has a fairly affordable price and there is a plugin that allows us to integrate it with Homebridge. However, there are other options such as Xiaomi IR Remote.

Initial device setup

I personally recommend reading the manufacturer’s instructions for installation, but I’ll summarize it for you:

  1. Connect the device to the power supply and make sure the LED light is flashing. This means that it is in configuration mode.
  2. Connect our phone to a 2.4 GHz network. This is essential, as this particular version only supports this band.
  3. Download the Broadlink e-Control app from the App Store..
  4. Add a new Broadlink RM device. The application automatically detects the device and configures it with our home network.
  5. To check that the device is connected, I recommend using a program that allows us to see the devices connected to our network.

Once this is done, the emitter will be ready to connect to Homekit. Configuring Homebridge to support the Broadlink device

Configuring Homebridge to Support the Broadlink Device

Like any Homebridge device, this one requires the installation of a plugin. We go to the terminal of our HUB and write the following:


npm install -g homebridge-broadlink-rm

With this, we already have the plugin installed and we must move on to the configuration of the JSON file. For most installations, the path to the file is as follows: /root/.homebridge/config.json. So we write:


nano /root/.homebridge/config.json

We edit the necessary parameters so that it stays with a structure similar to this. Remember that the config.json file varies depending on the devices you have configured with Homebridge.


{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    
    "description": "This is an example configuration file.",

    "accessories": [
        
    ],

    "platforms": [
        {
            "platform":"BroadlinkRM",
            "name":"Broadlink RM",
            "accessories":[
              {
               
              }
            ]
          }
    ]
}

As you can see, this is an example of the format. Although it is fully functional, it will only allow us to verify if Homebridge works correctly with the new device. We will come back to it later. Execute:


homebridge

If everything went well, Homebridge should start correctly and display a message on the terminal indicating that the device has been recognized correctly with its corresponding IP.


[2019-2-8 11:26:29] [Broadlink RM] [INFO] Discovered Broadlink RM Mini (2737) at 192.168.0.154 (77:0f:78:18:37:df)

Recording infrared codes

Although it is working, the device currently does nothing, nor is it capable of controlling any device. To do this, we need to tell the device which infrared codes we want it to emit when we perform an action in the Home app.

Interruptor learn en la app home
Learn Switch in the Home app

To do this, the plugin developer has provided us with a couple of accessories that will now appear in our Home app (if we already have the Homebridge hub configured) and that will allow us to record the infrared codes that the remotes we want to duplicate emit.

The recording process is done as follows. It is necessary to be watching the Homebridge log and the process takes about 3 seconds, so get ready:

  • Step 1: Press the Learn switch.
  • Step 2: Wait for the following line to appear in the log:

[2019-2-8 11:55:46] [Broadlink RM] Learn Code (ready)
  • Step 3: Immediately press the button on the remote control that we want to configure. Make sure you point it at the Broadlink RM device. We will see something like this in the log, where the string of numbers is the infrared code we just captured.

[2019-2-8 11:55:48] [Broadlink RM] [RESULT] Learn Code (learned hex code: 26005e019496113911391139111412131213121312131238123911391114111411141114111411141139111411141114121312131213123813121239113911391139113911391100060e9496113912381238121312141114111411141139113911391114111411141213121312131238121411141114111411141114113911141139113911391238123812381200060d9596113911391139111411141114111411141139123812381213121312141114111411141139111411141114111411141114123812131238123812381239113911391100060e9496113911391139111411141213121312131238123812381214111411141114111411141139111411141114111411141114123812131238123812391139113911391100060e94961139113911391213121312131213121312391139113911141114111411141114111412381213121312131213121411141139111411391139113911391238123812000d0500000000000000000000)
[2019-2-8 11:55:48] [Broadlink RM] [INFO] Learn Code (complete)
  • Step 4: Wait for a line like this to appear in the log. The process will have finished.

[2019-2-8 11:55:48] [Broadlink RM] [INFO] Learn Code (stopped)
  • Step 5: Repeat this with each button you want to register.

Once this is done, we will have the string of numbers that we need to put in our JSON file so that Homebridge can send the infrared pulse through the Broadlink RM device.

JSON File set up

Before editing the JSON file, I recommend that you review the plugin documentation, where it lists in detail the types of Home accessories that the plugin supports. Select the one that most closely resembles the actual physical device you want to control. In my case, I’m going to select a switch to turn the television on and off.

As stated in the example, I’m going to edit my JSON file to look like this.


{
   "bridge": {
       "name": "Homebridge",
       "username": "CC:22:3D:E3:CE:30",
       "port": 51826,
       "pin": "031-45-154"
   },
  
   "description": "This is an example configuration file.",

   "accessories": [
      
   ],

   "platforms": [
       {
           "platform":"BroadlinkRM",
           "name":"Broadlink RM",
           "accessories":[
             {
               "name":"TV On/Off",
               "type":"switch",
               "data":{
                 "on":"PEGA_AQUI_TU_CODIGO_LEIDO",
                 "off":"PEGA_AQUI_TU_CODIGO_LEIDO"
               }
             }
           ]
         }
   ]
}

Note that I have indicated where you should put the string of numbers with the phrase “PASTE_YOUR_READ_CODE_HERE”.

Save the JSON file and restart Homebridge. Now, the log should show that it has successfully found the TV On/Off accessory. If everything has gone well, pressing the TV On/Off button that now appears in the Home app should turn the TV on and off.

Before finishing, I’d like you to keep in mind some considerations.

  • Obviously, you need the device mentioned at the beginning of the video for all this to work.
  • If you don’t have permissions to execute the necessary commands, use the word “sudo” in front of the instruction.
  • It’s possible that in the infrared reading, some codes may come with a sign in front. It’s part of the code, don’t ignore it.
  • The emitter device must be in the same room as the receiver device. Ideally, with no obstacles between them.

The possibilities that this device offers are numerous. I encourage you to carefully read the documentation and try to include new devices. Here are some examples that I have done.

dispositivos broadlink rm funcionando
Multiple devices working on the Home app

That’s all from me. If you have any questions or suggestions, please don’t hesitate to contact me through the contact methods I have provided.

Contact

Sound like a fit?

Write me to learn more about my services and how we can work to create something similar and exceptional.

Drop me an email