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

UPDATE: A new version of this article was just published, as the procedure in this article no longer works using BroadLink’s new app…

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:
    1. Catalina 10.15.6
    2. iExplorer
  3. iPhone running iOS 13.6 with:
    1. e-Control app
  4. Raspberry Pi B3 running:
    1. Homebridge

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

  1. Connect your iPhone to your Mac using a USB/Lightning cable
  2. Click the iPhone in a Finder window’s left pane (Note: iPhone Synching has moved from the old iTunes app to the Finder)
  3. Click “Trust” on the Finder window to trust your iPhone
  4. Unlock your iPhone and tap “Trust” when the dialog appears prompting you to trust your computer
  5. Launch iExplorer (Click the “Demo” mode button). It may take some time for the app to process the data on your phone.
  6. Click “Backup” and then “Backup Explorer” in the left pane
  7. Expand the “Apps” selection
  8. Drag the folder named “cn.com.broadlink.e-Control” to a location in the Finder (e.g. your desktop)
  9. Download, install, and launch an app called DB Browser for SQLite
  10. 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
  11. Click the “Execute SQL” tab
  12. 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)
  13. 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)
  14. Paste the results into a text file (e.g. using Text Edit.app) or excel document
  15. 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.

29 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

  4. Putting together what I’m seeing now (10/21/21) and what some have said, it appears that at some point BroadLink got rid of the eControl directory. (I just got my RM devices, so I don’t have a choice of an older app.) The current .sqlite file has several tables, but none that seem to contain the IR codes. I’ve used iExplorer to see if any of the other DBs in the app’s folder and subfolders could have IR codes and I can’t find any.

    I’m wondering if, with the RM4 series, the data is now stored in the device instead of in the phone. I have Home Assistant and would rather be able to take whatever codes BroadLink already has and, if needed, write a script to dump them into .yaml files for Home Assistant than to try to program all the buttons myself. (Also, I have a few devices that are harder to deal with. Apple TV and Sonos do not use IR controllers. I’ll have to teach those codes “2nd hand” from my Logitech Harmony remote. Those remotes are RF, but they respond to IR.)

    While searching, I did see a REST interface for BroadLink and I don’t see how that could work if the codes were not stored on the RM4 devices instead of in the phone. Finding anything to explore the RM4 devices (the Pro and Mini) is not so easy – I haven’t been able to find it at all yet. I also have not yet tried copying or duplicating devices in one entertainment center in one room to my 2nd room. I’ve read one indication that only the codes you have to teach are stored locally. If so, that’s bad news for people like me, who are stuck on unreliable rural internet.

    Like

      1. No, the one I’m using has a stylized B logo as the image. I’ll check into the one you’re talking about. Today is a busy day, so it may be sometime tomorrow evening or later before I can check on it.

        Like

    1. I’m a little concerned that if all your codes are in the other broadlink app, they may not be accessible in the e-Control app. I’d be surprised if the 2 apps share that data, but if you do install e-Control, let me know how it goes. If the database doesn’t exist, I wonder if adding a remote button manually will create it, which would mean that anyone else still using e-Control could still use the method I posted.

      Like

      1. I downloaded during lunch. It wants a password and email address. I believe I signed into the original with Google or Apple or some verification method like that. So I think you’re right.

        I was surprised at some of the devices that were NOT included in the app I have. For instance NO Sony DVD/BD players – none at all! I went to the Unofficial repository there to get one. (They have Official/Unofficial/Mine as device collections or groups.)

        My goal is to get the codes in HA (Home Assistant) without having to program in each button on each remote and to include ones that don’t normally use IR remotes, like Sonos and AppleTV. Also, I’m trying to find somewhere that has codes for Nintendo. I could get my Harmony to turn on my Switch, but it doesn’t include an on/off button to use.

        I see two ways to do that. 1) Use Broadlink, which has many of the remotes pre-defined, or 2) Download from the IRDB or from LIRC. So I’m looking over all methods. Also, it’ll be interesting to see if the E-Control app is easier to use than the other BroadLink app that is kind of awkward. For example, it controls volume, but I can’t hold a button and have it raise or lower the volume continuously. I have to SLOWLY press the button over and over – it actually has a delayed response!

        Like

    2. e-Control is not pretty, but I find it highly functional. You can’t hold a button down but you can tap it repeatedly as fast as you want. It may skip a tap or 2 though. But you can also program sequences. I have some button presses set to repeat like 5 times on a single tap.

      Like

      1. One issue I’ve found, which is not something everyone will deal with, is that I need a delay. We use a projection TV in one setting. The screen is in a wooden “shelf” that extends from the chimney, which is stonework. We had to put that in place before I had final positioning worked out for everything. It’s a shorter viewing distance than is ideal, so I didn’t want the image on the screen to be too high up. (The projection TV is on a shelf coming down from the kitchen ceiling – it’s all one big space.) The screen can’t be all the way down for viewing, so we have to start it down and stop it when it’s in the right position.

        I know in Home Assistant I can add a delay so it starts lowering the screen, then send the stop command after X seconds. (It might be more accurate to lower it all the way and raise it for Y seconds – much shorter interval and less chance for it to vary due to heat or humidity or other issues.) I don’t see, at least on the BroadLink app I’ve had time to explore, a way to add in a delay. Supposedly there’s a screw I can use to adjust where the screen stops, but there isn’t.

        Like

  5. I am becoming more and more unimpressed with Broadlink. I went on and set up an account and it wouldn’t accept my email address. (It’s a gTLD – there are hundreds of them, like .actor, .realtor, .wtf, .toys, .digital, and so on.) Since I don’t have a .com or .edu or a domain that ends in a country abbreviation, they wouldn’t accept my email. My experience is that tech companies that have that issue (only a few do) are generally not keeping up with other things, either.

    I used an older email address and then I tried to configure my devices. The app asked for my wifi SSID and password. (I copied and pasted in the pw to be sure it was accurate.) It took the device minutes to scan my network and then tell me it couldn’t find any devices. (I know there are two on the LAN.) Apparently neither app is able to recognize a device that’s already set up! It told me if I have one, to reset it and start from scratch.

    I don’t want to do that and lose what I programmed in the other app.

    I know this isn’t something you can help with – I’m just updating you about what I’ve found.

    Like

  6. I was hoping I’d have good news for you.

    The next day I was going to do something to permanently position my RM4 Mini and was suddenly having trouble with it controlling several of my devices. For some reason, it would not work in the original position. I did find if I put it in my entertainment center, it’d control everything in it. That left my Nintendo switch, the projector, and screen. I decided to put the RM4 Mini in there and get a second one that would go on the shelf next to the projector, where I found an RM4 could control the remaining devices.

    My plan was to try to use the E Control app to set up the new (secondary) RM4 Mini and see if I could get codes from it.

    From the start it’s not working. It can’t find my existing RM4 Mini on my LAN, even when on the LAN. I tried using it for my new RM4 Mini. It told me to use my phone and join BroadLinkAP, instead of BroadLink_WiFi_Device. The newer devices apparently do not use that SSID anymore and only the BroadLink_WiFi_Device SSID. I joined the BroadLink_WiFi_Device and my phone could not find the new device.

    So it’s just a guess, but I tried multiple ways to connect using E Connect and it just wouldn’t happen. It may be that the E Control does not work on the newer controllers.

    Like

    1. Ugh. That sucks. Last week I spent all weekend getting my garage door working on homebridge again. Broke just about everything and now node red doesn’t start up automatically anymore. Haven’t fixed that yet.

      Like

      1. I hate it when things like that happen. I’ve seen too many times when something works perfectly and then you do something that shouldn’t change things and it just stops working. For me, it was having the controller in one spot on Wednesday and finding it wouldn’t work in exactly the same spot on Thursday. Things like that make no sense and are exasperating!

        Homebridge – I remember dealing with that. I had a used Mercedes SLK that was a lot of fun to drive (but kept needing to go into the shop over and over) and used Homebridge so the built-in garage door opener in the car could control the opener in the garage. I remember it was really finicky and tough to get working.

        Like

  7. Incidentally, I have a new method for extracting the hex codes since the old method I posted about above no longer works. I haven’t gotten around to creating a blog post about it yet. PM me if you want my raw notes.

    Like

    1. I would be incredible interested in the new way to extract hex codes. Currently I have an RM4 pro that won’t connect to e-control so I have been digging through the new app databases and I cannot find the codes anywhere.

      Any help you have would be awesome. Thank you so much!!!

      Like

Leave a comment