How to Extract All Your Custom IR Hex Codes from a Broadlink RM Mini 3 for Homebridge

The homebridge-broadlink-rm plugin for homebridge allows you to automate your devices which have an IR (infrared) remote by emitting those button codes from a Broadlink RM Mini3. You can add individual “buttons” that exist in the RM Mini’s iPhone app (e-Control), by adding the button’s hex code to homebridge’s configuration file (~/.homebridge/config.json).

The homebridge plugin provides a way to obtain these codes, one-at-a-time, by using the “Learn” button it adds to your Home app. You tap the Learn button, then point your remote at the RM Mini3 and hit the button you want to be able to control. The hex code can then be retrieved from the homebridge log file.

However, if you have numerous remotes with numerous buttons already programmed into the RM Mini3, and some remotes in a drawer, some without batteries, this can be a quite long and tedious process. I personally had 238 individual codes programmed into my RM Mini3 and some of my remotes took coin batteries that were dead and I had no replacements on hand. So I wanted a way to grab all of the codes at once without having to manually re-record all of the button presses. I worked out the process to do this last night, and googling this stuff was rather laborious, so I am posting what I learned here.

Here is my setup:

  1. Broadlink RM Mini3
  2. MacBook running Catalina 10.15.6
  3. iPhone running iOS 13.6
  4. Homebridge running on a Raspberry Pi B3

I will not be reviewing how to get homebridge or the Broadlink plugin working.

  1. Download and install iExplorer on your Mac
  2. Connect your iPhone to your Mac using a USB/Lightning cable
  3. Click the iPhone in a Finder window’s left pane (Note: iPhone Synching has moved from the old iTunes app to the Finder)
  4. Click “Trust” on the Finder window to trust your iPhone
  5. Unlock your iPhone and tap “Trust” when the dialog appears prompting you to trust your computer
  6. Launch iExplorer (Click the “Demo” mode button). It may take some time for the app to process the data on your phone.
  7. Click “Backup” and then “Backup Explorer” in the left pane
  8. Expand the “Apps” selection
  9. Drag the folder named “cn.com.broadlink.e-Control” to a location in the Finder (e.g. your desktop)
  10. Download, install, and launch an app called DB Browser for SQLite
  11. In the “cn.com.broadlink.e-Control” folder you saved on your computer, locate and drag the e-Control database file “cn.com.broadlink.e-Control/Documents/BroadLinkDeviceList.sqlite” onto the DB Browser for SQLite app
  12. Click the “Execute SQL” tab
  13. In the top left text area, paste the following SQL query (without the quotes): “select s.name, b.name, c.buttonID, c.codeID, hex(c.code) from broadlink_subir as s left join broadlink_button as b using(subirID) left join broadlink_code as c using(buttonID)
  14. Click in the resulting table in the pane below and copy its contents (e.g. command-a to select all and command-c to copy)
  15. Paste the results into a text file (e.g. using Text Edit.app) or excel document
  16. Use the hex codes in the last column to add accessories to your homebridge config file. (The columns are Remote name, Button Name, Button ID, Code ID, and Hex Code. Note, if you created any combo buttons that send a series of codes, there will be repeated hex codes and Button IDs.)

Here’s an example of what you will get:

TV Power 171 177 26003C00211A3E1A20000B97201A211A3E1A201A211A201A211A201A2037201A3F1A20000B962119211A3E1A211A201A201A211A201A2136211A3E1A20000D05000000000000000000000000
TV Source 172 178 26004E00211A3E1A211A201A211A201A2037201A211A3E1A211A20000B96211A3E1A201A211A201A211A2036211A201A3F1A201A20000B97201A3F19211A201A211A201A2037201A211A3E1A211A20000D0500000000000000000000

And here’s an example of an accessory entry in the config.json file:

            {
                "name":"TV",
                "type":"outlet",
                "data":{
                    "on":"26004e002119211a3e1a211a201a2119211a201a2136211a3e1a21000b96201a211a3e1a201a211a201a211a201a213621193f1a20000b96201a211a3e1a201a211a201a211a201a2136201a3f1a20000d0500000000000000000000",
                    "off":"26004e002119211a3e1a211a201a2119211a201a2136211a3e1a21000b96201a211a3e1a201a211a201a211a201a213621193f1a20000b96201a211a3e1a201a211a201a211a201a2136201a3f1a20000d0500000000000000000000"
                }
            },

You will have to restart homebridge after adding accessories so that the new controls show up in your Home app on your iPhone.

10 thoughts on “How to Extract All Your Custom IR Hex Codes from a Broadlink RM Mini 3 for Homebridge

  1. Hi, thanks for posting this guide as I was having problems getting my homebridge to learn the power on for my TV. I have an earlier model of Broadlink, a RM2 and I get this error message when I run the SQL command:
    Execution finished with errors.

    — At line 1:
    select s.name, b.name, c.buttonID, c.codeID, hex(c.code) from broadlink_subir as s left join broadlink_button as b using(subirID) left join broadlink_code as c using(buttonID)
    — Result: no such table: broadlink_subir

    Any suggestions of how to fix this?

    Like

  2. Hello

    Great article and got me so close to what I needed to achieve… 🙂

    I have the RM4 and latest app but could not find the sqlite file you mentioned and the only one that i ddid find had a completely different table structure to your SQL query.

    Is it possible they have updated everything in their lates app? I am only trying to get four HEX codes but they could not be more elusive!

    Any advice on how to get the codes out of the current app would be much appreciated.

    Like

    1. I’m happy to help if I can. If you could provide information about your setup, versions, and at what specific step you encounter an issue – and provide any error messages or screenshots you encounter, I’ll approve the comment and respond.

      Like

      1. The current directory are different not the same as e-control. Broadlink has changed their app to broadlink…. most of the directory table starts with BL_devicelist

        Like

  3. Unfortunately, I don’t have that setup. I don’t auto-update my apps, so this is a good warning for anyone else. This blog post is just for my specific use case. If you do not have the same versions of the hardware or software involved as I used in my case, you may not be able to use the procedure I worked out, but hopefully it can give you some idea to work through the issues in your setup. Good luck, and if you do work out how to overcome the differences, sharing your experiences here is more than welcome. I’ll even link out to any blog post you create to document your experience.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s