BroadLink - Setting up IR codes for RM4 Mini

I have a pair of BroadLink RM4 Minis set up in my house. (Both in the same room, due to the placement of devices they control.) I set them up in the BroadLink app to test them and make sure things work and that all the devices are responding to the IR controllers.

I’m at the point where I have to set them up with HA now. I’ve seen different posts, spread out over a few years, about setting up the IR codes/commands within HA for the BroadLink controllers. Of course, I’m aware of this page that shows how to do the setup through scripts - which means revising the script for each button on each remote. (For 6 remotes in our house, 6 more in our barn/guest house, and I’m still trying to find a source for IR codes for my Nintendo Switch - just for on/off, since the RM4 doesn’t seem able to learn that one.)

From what I see, apparently Broadlink stores the data on their server, other than, maybe, codes I have to program in directly. (I’ve looked through the data directory of the BroadLink app with iExplore and checked out the DB in there.) Part of my reasoning for this is noticing how, on rural internet, how long it can take to load the icons for some controls on user defined devices.

At this point, is there a consensus on any other ways to program IR codes? I have found Molexx, but haven’t tried it out yet. I have seen other discussions on shortcuts that replace programming every button on a remote into HA one by one, but I’m wondering if there is a known or preferred way to do import or set up at least the more well known remote codes.

If you have the codes in the Broadlink app (cloud, not in app/phone) then you can set HA to learn and use the app to fire the command from the same Broadlink device to learn it in HA.
I suggest using the remote, not switch, switch based remote commands is easy to use and find but they take up a lot of space in the entity list.

I have a broadlink DONT us the APP

I gave a static IP address add to the Integration

and YES the HARD learning all the IR yes a pain in the ass but you only have to do it once

image

then goto

then hit the “call service”

the broadlink should have a orange light on pres the remote you want to lean

this will creat a file in the .storage folder open that file and get the IR code

then in the swtiches bit add it the platform: broadlink

now in lovelace

now I can turn on/off the gas heater

I use SmartIR with my Broadlink remotes, I have a mix of different models.

It is suitable for some applications although I find building the code files when one does not already exist in the SmartIR database can be tedious.

I used the app because that’s the only way I could tell the RM4 to use my SSID and the password. After that, I use the app to test it out. That’s when I found out I can’t put in one RM4 to reach the projector, the screen, and everything in the entertainment center. I needed to order a 2nd one for that room. I’ll probably do the same for the barn, so it won’t matter if people are walking around, in the way of the IR signal.

I don’t like the app at all for a number of reasons. One is the significant propagation delay from pressing the button until it works. Another is that it seems to need to get the codes from the BroadLink server whenever I change to a new device. We can’t count on always having a good internet connection.

But it was useful to add the RM4 to my LAN and while I was just testing communications between it and my devices.

Once it was on my LAN, I went to my DHCP server, checked the leases, found the MAC address, and set up a lease for it with a static IP and I gave it a hostname. With HA, whenever it asks for a device address, I give it the hostname and my LAN’s FQDN info so I won’t have issues if the IP address changes for some reason.

Well, yeah - IF this is the last time I do this. I’ve gone through the learning process with something like 3 universal remotes in the past. (And, as much as I disrespect Logitech, at least the Harmony series makes it easy to add most remotes to the system without having to train it.)

Thanks! That’s a good one for me to look into. I’ve seen it mentioned, but I’ve seen several systems mentioned and I didn’t know what’s still considered good and what’s outdated.

I know on the BroadLink app (did I mention it sucks? - it can’t even sort the company and device names alphabetically for easy searching) had most of my devices on it, so I assume they’re in easily accessible databases. My projector screen, HDMI switcher, Sonos AMP, and Nintendo Switch were not listed there. I’m betting those may be hard to find in SmartIR or anything else, too. (I know Harmony has them in their database, but that’s not a public database.) But, from what I saw, I’m betting most of my controls are in public databases. The four items I listed do not use many codes or have many functions to teach to a system. If SmartIR knows all my other remotes, I’ll be happy to be able to skip configuring the other remotes.

if you have used remote.learn_command then you don’t need the switches.
That is the whole point of remote.

Switches is the “old” way of doing it, you could use both as you do, but you only need one of them, either remote or switch.

This sends the command I have learned using the remote service to turn on the kitchen TV.

good points

as long as HA is doing her job control my house I dont care which way is old/new way

I used Broadlink Manager [1] and [2] to capture IR codes with RM4C mini.
Then I defined bunch of scripts for different buttons, e.g.:

sharp_tv_volume_up_ir:
  alias: 'Sharp TV IR volume up'
  sequence:
    service: remote.send_command
    target:
      entity_id: remote.rm4c_remote
    data:
      command: b64:JgCoAAkZCRgJGQgZCBoIGQg7CBoJOggaCBoIGQc8CRkHAAYQCToJGQkZCRgIGQg8CToIGgk6CRkJOgk7CDsJGQg7CgAFhAk7CBkJGAgaCRkIGAgaCToIGgg8CBkJGQgZCDsIGggABhwJOwgZCRgIGgkZBzwJOgkZCDsJGQg7CTsJOgkZCToIAAWTBzwJGQgZCBkJGQgaCBkIPAgZBz0IGQcaCRkJOgkZCQANBQAAAAAAAAAAAAAAAAAA=

[1] https://en.techblog.co.il/2020/06/24/installing-broadlinkmanager-on-raspberry-pi/
[2] Broadlink Manager - Nicer way to Learn and Send IR/RF commands

2 Likes

In this case, the reason I’m asking and trying to find out what is being used for learning codes now is because I figured the newer methods (like SmartIR) might download the codes from a DB so I don’t have to train the system for 11 different remotes. In terms of what’s behind the scenes, that I don’t have to interact with directly, I’m not as concerned. (Other than with issues of what could be obsolete or out of development and unsupported.)

As long as you learn one code for each remote then you can easily fill in the rest in the JSON file manually by copy paste.
Just make sure what you did is correct JSON.
Google JSON verify/check online and make sure it’s correct before you save.

Posting here not to create another thread. I have successfully added Broadlink RM4 Mini. I have managed to make it learn 3 codes. Today I wanted to add additional codes, but it does not read any codes sent from remote. I tried to debug it with python-broadlink and the only error I can find is the one saying that storage is full (see below). Integration is reinstalled, but still no luck. It works ok for the codes I have already in _codes file, but I am unable to add any new codes through learning. Any hints?

>>> packet = device.check_data()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\marci\anaconda3\lib\site-packages\broadlink\remote.py", line 37, in check_data
    return self._send(0x4)
  File "C:\Users\marci\anaconda3\lib\site-packages\broadlink\remote.py", line 82, in _send
    e.check_error(resp[0x22:0x24])
  File "C:\Users\marci\anaconda3\lib\site-packages\broadlink\exceptions.py", line 152, in check_error
    raise exception(error_code)
broadlink.exceptions.StorageError: [Errno -5] The device storage is full

You (and I) are probably better off if you post that on a separate thread. While it’s under the broad topic of what I asked, it’s quite different in terms of the answers it requires and there’s a good chance you won’t get the answers you want because people looking through the forum will see the title and probably scan the first post to see what it’s about rather than jump to your post and see it’s a second question requiring different answers.

Sure, will post a new topic. Thanks for your suggestion.

That you found this thread tells me you were doing your research - trying to find your problem already being discussed and if there was a solution. As long as you’ve checked and found no clear obvious answer, don’t worry about starting another thread - it helps keep things sorted for others when they’re searching in the future. (And, even when I’ve found an obvious answer, there are still times I’ve had questions about the situation - like how a detail should be handled or something like that - and just had to start a new thread. But I also would say, “I see this has a solution, here , but that raises a few questions” and that shows I’ve done my research and why there are still questions.)