Broadlink binding for RMx, A1, SPx and MP. Any interest?

Dear all,

I am looking for a way to turn on my subwoofer from OpenHab, which has an IR remote.
I tried LIRC on Raspberry Pi and have sunk a huge amount of time into it. In particular because the subwoofer’s IR code is not to be found in any database online and I failed trying to read/learn it from the remote control itself.

I am now looking to buy an IR bridge, which will easily let me learn IR codes/commands from my remote and then control it from OpenHab. The Broadlink devices seem like a good bang for the buck.

Some questions regarding them:

  1. Will these let me read the IR commands? Is this easy to set up with OpenHab?
  2. If so: Are the IR commands stored on the device itself? I ask, because I have seen that there is an Android App for setup. Is this interoperable with OpenHab, so that I can set things up with the App and then control things from OpenHab?
  3. Does anyone have experience with the RM4 Pro and its 433Mhz remote control functionality? If so: Is this easily trainable/configurable?

Thanks and best,
Michael

Can anyone tell me if you can use the remote learning channel for RF- not just IR?

@michaelmell

1.) Yes, you will be able to read the IR commands. I would say it is not easy to setup. The biggest challenge for me was to get all the IR- and RF-commands. I managed doing this via “Python broadlink”; but this is definitely not easy.
2. You have to retrieve the IR- and RF-commands and store them in a text file. This textfile has to be copied to your OpenHAB and the broadlink binding will read the commands from this file.
3. Yes, I control my roller shutters this way. As said before: The biggest challenge was getting the RF-Commands.

1 Like

Hi, I bought the Broadlink RM4 TV Mate, it works great and I hope you will consider including it between the supported.
The identification code is this:

Device identifying itself as '21001' (0x5209) is not currently supported.

Sorry for my stupid question, but could someone give me directions on how to install the binding to OH3?

@Mokamobile You download latest build from here Releases · themillhousegroup/openhab2-addons · GitHub. The jar file you downloaded should be copied to shared folder
\\<openhab-hostname>\openHAB-addons\
e.g. through Windows Explorer.
You wrote you use OH3, so please make sure you find latest build for your version 3.0, 3.1 or 3.2b. Latest 3.2b1 should also work with 3.1.
Then access OpenHAB’s Things section, add new Thing with “+”, select “Broadlink” binding, use “Scan” to auto-detect your device.

2 Likes

Thanks, all clear, but still unsuccessful. Tried 2 versions ( org.openhab.binding.broadlink-3.2.0-SNAPSHOT.jar, as well as 3.1.0) - no binding found when adding things… may it be due to my openhabian installation? file owner setting?

Any way, grateful for your help

@Mokamobile openhabian is not an issue, but a good precondition for a reliable openHAB deployment. I use it successfully. Some more hints:

  1. The jar file /srv/openhab-addons/org.openhab.binding.broadlink-3.2.0-SNAPSHOT_b1.jar is running under openhabian:openhab ownerhip, chmod 664.
  2. I hope you know how to log into sudo openhab-cli console? What’s the output of bundle:list | grep "TP-Link"? The binding should be reported.
  3. Try to install from console, instead of copying jar file (make sure you 1st delete it from the shared folder): install https://github.com/themillhousegroup/openhab2-addons/releases/download/BROADLINK_3.2.beta1/org.openhab.binding.broadlink-3.2.0-SNAPSHOT.jar. Then find it listed with (#2) above. Maybe it requires start <id> to activate?

Hello and thanks for binding. Is there a way to add MCB1 relay to OH with this binding? I’ve tried to add it as SP1 thing, but OH only shows it’s online, doesn’t switch nor read it’s status.

Hello,

Is there a way to enqueue a series of infrared commands in a sequence handled automatically by the broadlink binding?

I noticed that whenever I send a sequence of IR commands, I need to use a sleep command of 300-1500 miliseconds, otherwise some of the commands are not interpreted correctly by the receiver (therefore are skipped). I came up with these values after a series of trial-and-error attempts.

If I run the same sequence with the eschava/broadlink-mqtt daemon (written in python), all commands are queued nicely, regardless of the thread::sleep duration between two consecutive commands - it can be zero!

I have an old 5.1 speaker system which I am controlling via a Broadlink RM2 Pro device.
In order to re-create the preferred audio settings (bass, treble, volume level on each speaker), I am running a sequence of infrared commands captured from the original remote.

I have created a “virtual item” called v_microlab which I am using together with a rule to run the sequence at every power on.
I always start the speaker by powering up a smart plug, then I execute the IR sequence (I do this because I noticed the main unit’s radiator is always warm even when the speaker is in stand by so I prefer to power off the mains instead of putting the speaker system in stand-by).

Here is the rule sequence:

rule "big speaker macro ON"
when
        Item v_microlab received command ON
then
logInfo("big speaker macro","Running big speaker macro; command ON; sequence START...")
gosund_p1_1_Power2.sendCommand(ON)
Thread::sleep(1500)
BroadlinkRM2100099_Command.sendCommand("audio_microlab_power")
Thread::sleep(800)
BroadlinkRM2100099_Command.sendCommand("audio_microlab_source")
Thread::sleep(400)
for(var i=1; i<6; i++) {
        logInfo("big speaker macro","===================iteration #" + i)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_treble_up")
        Thread::sleep(300)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_bass_up")
        Thread::sleep(300)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_sw_up")
        Thread::sleep(300)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_front_up")
        Thread::sleep(300)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_vol_up")
        Thread::sleep(300)
        BroadlinkRM2100099_Command.sendCommand("audio_microlab_vol_up")
        Thread::sleep(300)
}
logInfo("big speaker macro","Running big speaker macro; command ON; sequence END.")
end

rule "big speaker macro OFF"
when
        Item v_microlab received command OFF
then
        logInfo("big_speaker.rules","big speaker power OFF")
        gosund_p1_1_Power2.sendCommand(OFF)
end

Is it possible to implement a “queue management” algorithm that would allow sending a batch of IR commands without having to insert a thread.sleep(x) instruction between every 2 IR commands?

Thanks in advance

Hi,

I have trouble installing the newest binding in my new set up OH3.1 installation with Openhabian.
I put the binding into the addons folder, but on system restart I get the following error:

2021-12-13 15:24:11.595 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.broadlink-3.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.broadlink [29]
  Unresolved requirement: Import-Package: org.openhab.core

What can I do to get it running?
Looking into the Main-UI the binding is not there.

@tlc you could use a state machine to walk through the delays. For example, see Washing Machine State Machine. Instead of relying on conditions to go from one state to the next, you could have timers. Then detect the state transitions in another rule and send the appropriate command on each transition. In the end I don’t know that it will be much better than what you have, but it would avoid the sleeps. I’m sure there are other better ways that someone will suggest.

Thanks for your suggestion, @jswim788.
For me, the current setup works fine as is now, with thread::sleep commands.
The issue is more a design one to me. Considering that any IR sending device and its corresponding receiver should itself be capable of enqueing, sending and interpreting successive IR commands (the same as you would hold your finger on Volume Up on your IR remote to do a significant volume increase and expect the receiver to act accordingly), I would expect the binding to have this capability as well.
This issue is not at all posing any problem (to me), but I would rather think of this enhancement as a “nice to have” feature that would simplify a lot any configuration that implies running a sequence of IR commands in a row.
Don’t get me wrong, I really appreciate the effort of the developer and I would say that this binding is a huge asset to everyone using OH and Broadlink devices together.

@themillhousegroup Will this binding be part of the next OpenHAB release 3.2?

Edit: Now that OH 3.2 is released, I see that the answer is “no”…

3 Likes

Hi John,
I waited a bit on this because I know you’ve been busy with a lot of other devices. I had a look in the Python library and I think my device is a BG1. That doesn’t appear as an option in the binding currently. Any chance that it could please?

You might need to make the binding “Active”:

  1. Log into your openhab console
  2. Type bundle:list | grep "Broadlink" and review the output. If the output contains Installed rather than Active, then
  3. Type bundle:start followed by the number that was listed in the command above, in my case the bundle number was 342, so my command was bundle:start 342
  4. Go back to your openHAB webUI and into your inbox, click the “+” to add a new thing and the option to pick a Broadlink thing should be present.

Can anybody help me to get the rf codes with my rm4pro? tried so many things but nothing worked

perhaps share what you have tried to save going over things unnecessarily

I have installed pip with python3 after that, you can follow this: GitHub - mjg59/python-broadlink: Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs