How I finally managed to learn IR codes to Broadlink RM Pro

Hi,
I only recently discovered HA and I’ve spent hours looking for instructions for learning Broadlink RM Pro IR codes without success. I was only founding instructions that most possibly apply to earlier versions of HA (never found the “States page with the persistent notification” that is mentioned in several guides!) or involving complicated steps installing other apps etc.
Here’s how it can be done very easily from HA

Step 1
Add your Broadlink to configuration.yaml with it’s IP and mac address and restart HA

# Broadlink
remote:
 - platform: broadlink
   host: 192.168.1.12
   mac: 34:xx:xx:xx:xx:xx

Step 2
In developer tools call remote.learn_command with the following data. Once service is called, Broadlink lights the orange led and waits for the remote button to be pressed. Once you press the button broadlink learns the command and the light goes off (sometimes broadlink cannot learn on the first try so you can repeat this step as many times as needed). You can change the command in service data and call the service again to learn a different code.

Step 3
HA creates automatically a json file in the directory .storage with the name broadlink_remote_xxxxxxxxxxxx_codes (where xx… is broadlink’s mac address) that contains all the codes(this is the piece of information that I didn’t find anywhere and took me hours to figure out!)

Step 4
You add the following to configuration.yaml copying the codes from the json file from the previous step. Restart HA and you are done. You should now be able to find the new switch

switch:
 - platform: broadlink
   host: 192.168.1.12
   mac: 34:xx:xx:xx:xx
   switches:
     alarm:
       friendly_name: "Home Alarm"
       command_on: 'shg0ACgOKQ4OKCkOKA4OKCkOKA4OKCkOKQ4OKCkODikoDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
       command_off: 'sho0ACkNKg0PJykNKQ0PKCoNKg0Pxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

Hope that the post helps. I’m very new to HA so any corrections are welcome

9 Likes

Thanks for sharing, very cool. There are more people struggling with the Broadlink integration, especially the location of the file where the command are stored. I made a pull request to add that file location to the documentation, perhaps it will be of use to more people.

1 Like

well not at all, when I press call service, nothings happens

Just to add to what you’ve said there- it’s not actually essential to add the codes to switches. Once you’ve learned the command through the remote.learn_command service, it can be called with the remote.send_command service, supplying device and command data.

Also while the documentation advises that you don’t manually edit the codes file, it’s standard JSON and can be edited safely as long as you follow JSON formatting. I was able to paste in codes I’d previously scraped using Broadlink Manager on my PC.

Okay, I got my new Broadlink RM mini 3, and I cannot get my Broadlink to learn commands. When I use developer tools to use that learn_command, I get that notification that says press remote button and my Broadlink lights up a led, but it’s not orange, it’s white? Anyway, I press remote but that white led on Broadlink just goes away after timeout (I set that to 15 seconds), and no json file was created under .storage folder. I have tried this several times, what’s the problem?

Broadlink device itself works, as earlier I connected it to older Broadlink software and I could control my TV with it, and I also managed to learn one command from my remote to Broadlink successfully. I did remove the device and reset Broadlink etc and it does show up on my router and all, but it does not learn any commands :confused:

Did you ever solve this issue?

In the end, no. After several tries I managed to get my Broadlink RM mini 3 to learn commands, but that device got somehow broken in the process, as it doesn’t stay online more than 2 minutes anymore, before restarting itself. And my other mini 3 that I bought (just in case) I never managed to learn commands at all. After trying and failing enough times with these, I decided to ditch them in a closet and continue using my Harmony Hub as that at least work somehow. Still, that is not perfect either, as my Hub loses connection every now and then, so ultimately the only 100% reliable way to control my devices is still the plain old IR remotes :confused:

Luckily I can mostly control my devices using device platforms and media players and HDMI-CEC, but some commands are missing and my blu-ray player does not work that way.

Maybe some day either broadlink or Harmony Hub integrations will improve, or some other device comes along that can handle IR devices without hassle…

I know this post is very old but have any of you seen an issue where the remote learns the command ok. But it just wont work?

My remote is a Universal AC remote. The command learned is super long when looking at the code. I’m wondering if it’s because it’s a universal remote, it just spits out every code till something works? And HA does not know how to differentiate, between the different codes that the universal remote somehow does.

Any ideas would be great :slight_smile:

Have anyone had issues with, its ‘learning’ different codes for the same button ?

I have a kitchen extraction fan, and control with automations depending on if the cooking top is on or off.
But recently stopped working, and so I tried relearning the commands…and I get different codes each time ?

      "up3": "JgBQAAABHpESNhAUEhESExAUEhESEhE3EhIRNxI3EBMSEhE3ETgQExA4ERMQOBETEBQQFBETEDcSExA3EhIRNxI2EDgRNxIREgAFRgABHUoRAA0F",
      "up4": "JgCIAAABH5ASNxATEhIRFBATERMRFBA3EBUQNxA4EBQQExI3EDgQExE4EBMROBATEBQSERITEDcSExA3EhMQNxI3ETYRNxISEQAFRQABIEgRAAwEAAEeSg8ADAQAASBIEQAMAwABH0kRAAwDAAEfSg8ADAQAASBIEQAMAwABH0kQAAwDAAEgSBEADQU=",
      "up5": "JgBQAAABHZIRNhEUERMREhEUERMREhE4ERIRNxI3ERIRExE3ETcSEhE3EhIRNxISERMRExISETcSEhE3EhESNxI2EDcSNxESEgAFRQABH0kRAA0F",

these are learned in the same session, just setting a new command name and doing it 3 times…

I have the same issue !
When I learn the code for my toshiba tv the “on” button, I get different codes at each try.

I am very confused…

That’s called a rolling code. No idea, how to get around it…

Thanks for the ideas. The service appears to work but I can’t seem to find the “storage” folder/file. I am using Studio Code Server to scan for it.

I found use this docker way easier :slight_smile:

Got this working with this video, finally … Hope it helps.

@ CyborgLtd
The name of the folder is “.storage”, not “storage”. There is a little dot ‘.’ at the beginning… And the filename starts with “Broadlink”.
You will not be able to edit it. The only way is via the remote learn command service.

Thanks a lot for this! Never know this functions even existed!

1 Like