Teach Your BroadLink Remote

In my apartment, I have control over fifteen devices. Twelve of them are controlled via RF Outlets. I used some dot stickers on the back of my outlets to number them. With that, I paired each outlet with a remote and made a table. I used  different remotes for different uses. One for the living room, one for the bedroom, and a third was used for my fish tank and Christmas Tree. I programmed them this way so I can use the remotes as a backup, in the off chance the system is down.

Aukey Outlet Legend
# Device Remote Button
1 Bedroom Lamp 3 3
2 Bedroom Fan 3 2
3 Bedroom Speaker 3 4
4 Heater (Tank) 2 3
5 Lamp 1 1
6 Entry Lamp 1 2
7 Entry Fan 1 3
8 Living Room Fan 1 4
9 Fish Tank Light 2 1
10 Window Fan 3 1
11 Fish Tank Filter 2 2
12 Christmas Tree 2 4
  • After the outlets have been paired with the remotes, you can teach the button codes to the BroadLink.
  • Inside the Services section in the Developer Tools area, you will be able to find the “broadlink” domain and the “learn command” service.
  • Calling this service will activate the BroadLink’s learning function.

Screen Shot 2017-09-10 at 8.54.43 AM

  • The orange light should pop on, this means it’s waiting for a signal.
  • Push your remote’s button.
  • It doesn’t always catch the code on the first go, it may take a couple of tries.
  • When the code has been learned, the orange light will shut off.


  • Go to your Home Assistant’s States tab and there should be a new card with a long string of numbers and letters. You’ll use this string in the configuration file.
  • Double click to select the code, then copy it.
  • The code I captured is for turning my living room lamp on.

Screen Shot 2017-09-10 at 11.31.46 AMOpen the configuration.yaml file.

Screen Shot 2017-09-10 at 11.39.45 AM

  • Add the code to your configuration file.
  • Repeat this process to capture the “off” function as well.
  • When finished, the switch should be set up like this.
  • Remember to save!
  • Now check the configuration, if it comes back valid, restart Home Assistant.
  • You’ve just configured your first switch!

Screen Shot 2017-09-10 at 11.46.47 AM

  • The process works the same way for IR commands.
  • The RF and IR commands will look different.

Now comes the task of inputting all of your remote functions. It’s going to be annoying. It just is. Put on some good music, maybe have a snack easily accessible, and just start plugging away.

Tips for Adding Codes

  • Check your configuration and restart after each addition. This will prevent a terrible headache if any of your codes is bad.
  • A bad code can cause the Switches card in the front end to disappear.
  • You can find out which code is bad by using your “on” code in both the “command_on” and “command_off” places
    • If, after a config check and restart, the Switches card is back, recapture your “off”code.
    • If the Switches card does not come back, it is probably your “on” code causing the problem. Recapture and try again.
  • On and Off codes both seem to be required to have a valid configuration. I have some “Off” codes that are never used.
  • Everything inputted this way will look like a switch. These entities can be changed or hidden later.
  • Sometimes long IR codes can cause issues. It seems people have success by adding one or two “=” at the end of the problem code.
  • The RF codes that seem to work best are shorter in length. All of my RF codes are this size: ‘sgk0AAsdCx0eCgsdHgoeCgsdCx0LHQsdCx0eCgsdCx0LHR4KCx0LHQsdCx0eCh4KHgoeCgsAAToAAAAA’
  • You can leave comments in YAML files with hashtags #.

Screen Shot 2017-09-10 at 1.15.07 PM.png

Once you’ve got all of your devices configured, you should have a States screen similar to this.

Screen Shot 2017-09-10 at 12.55.52 PM

Congrats! You can now control your devices from you computer or phone! It can be reached at http://hassio.local:8123/ or use your Raspberry Pi’s IP number http://YOURIPNUMBER:8123/ Most of the hard work is finished at this point. It will only be accessible from your home network for now. You can add remote access later. After this you will want to organize your devices into groups, then you can make them controllable via the Echo Dot.

Now you’ve got some control of your devices! What devices did you connect to? What devices will be most convenient for you to use this way?

If these guides have been helpful to you , please share them! If you have any questions, please reach out to me in the comments. Thanks for visiting!


13 thoughts on “Teach Your BroadLink Remote

    1. If just the connection is lost, unplug the broadlink and restart home assistant (or the Raspberry Pi).
      If the switches card has disappeared from your set up completely, then one of the codes you used is a bad code.
      Look at this part from the Tips section above:
      -A bad code can cause the Switches card in the front end to disappear.
      -You can find out which code is bad by using your “on” code in both the “command_on” and “command_off” places
      –If, after a config check and restart, the Switches card is back, recapture your “off”code.
      –If the Switches card does not come back, it is probably your “on” code causing the problem. Recapture and try again.


  1. Hey, do you know which command i could use if i want to add an RGB Led Strip via Broadlink to my hassio?
    Switch only turns them on and off…


  2. I’ve got an Rm3Pro and an Rm3ProPlus. Any idea what the difference is between these two models?

    Also – have you found any good way to define your IR and RF commands just once (in home assistant) – and then use them from both RMPro’s?

    For example – I have two Kodi boxes – one upstairs and one downstairs. I also have one RMPro upstairs and one downstairs. For now – I’ve had to define all of the IR codes twice – once for each RMPro. I’d like to find a way to only define each code once and then be able to send it from either of the RMPro’s. So far, the only way i’ve thought of to do this is via the secrets file. I could add a line that says “androidtvon = ‘‘ and then in each switch, I could use “command_on = !secret androidtvon”. I haven’t tried it – but I think it would work. However – even if it does work – I don’t really want to clutter up my secrets file with IR codes if there’s a better way. Thoughts?


      1. Hey Tenly,
        I checked out Broadlink’s website and what I think the difference is, is the Plus also can do 315mhz RF commands. If you scroll down to the specs section on each page, that is the only difference I can see. It also could have wider range. I know between the 2015 and 2017 model, the range was increased. http://www.ibroadlink.com/rmPro/ http://www.ibroadlink.com/rmPro+/

        That might be the only way to define once since splitting the config can’t be chained. Or maybe having the name defined then the on and off commands can both be sectioned off to secrets together.


  3. You never have to add random = signs to make the captured code work.

    You should NOT use the method you describe for copying the code from the Persistent notification. When you double-click – it does not select any trailing = signs. A better mechanism is to click at the start of the code and drag down to capture the entire line (including all of the trailing = signs) or to copy and paste the code from your Home assistant log file. It would be better/easier if the home assistant notification displayed the entire string via word wraps or scroll bars – but for now, it is what it is I guess.


    1. I was having trouble getting the broadlink component set up, finally tracked it down to an error with the IR packet. As of .80 you definitely need the packet to be divisible by 4, mine was 123 characters, added a single = (which is what the output of the capture packet service was, so I think hassio is aware of the issue) and everything was great.


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 )

Facebook photo

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

Connecting to %s