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

@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.

This post was flagged by the community and is temporarily hidden.

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

i have same isssue - send many commands without “sleep” to my RM3PRO… and it go offline (not responds on ping) but later recovering. To fix that i use sleep 500 between commands (its very bad that broadlink can handle all my commands queue on fast speed). But I noticed if i send infinite ping (ping 192.168.137.x -t) to broadlink, it holds a lot better and not going offline even with sleep 250. Can some one *check this idea?

PS is there a way how i can check in Rule is broadlink sending NOW something or it in Idle?? i want create protection to disable new commands sending when it already sends something

Hi @michnovka were you able to make it work with rm4 mini and openhab 3?
If rm4 mini is connected using the official app, then even a hard reset won’t work for the binding?

Hi Friends,

I’ve been using a Broadlink RM4 Pro for a while now with OpenHAB and the Broadlink Binding to control various devices with RF remotes.

I used Python-Broadlink to learn all of my devices remote RF codes and I’m able to control the devices, most of the time.
There is just one RF remote code that sometime fails to work when I send it as a command with OpenHAB using the Broadlink binding.

This is the code:
b205b004230e230e230e230e230f230e220f220f230e230e0a270a27230e230e230e230f09280a260b27230e0a270a27230e0a28220e0a27230e230e0beb220e240e230e230e220f220f230e230e230e230e230f09270a27230e230e230e230f0a270a270a28220e0a270a27230e0a28220f0a26230f220f0aec220e230e230e230e230e230e230e230e230f220f220e0b260b27220e240e220f230e0a270a270a28220e0b270a27220f0a27230e0a27230e230e0aec220e230e230f220e230e230f230e230e230e230e230e0a270b26230e230f220f220f0a270a270a27230e0a270a27230e0b27220e0b26230e230f0aeb230e230e230e230e230e230e230e230f220e230e230f09270b27220f220e230f220f0a270a270a28220e0a270b26230e0b27220f0a26240e230e0aeb230e230e230e230f220e230f220f220f220f220f230e0a270a27230e230e230f220e0a280a260b27230e0a270a27230e0a28220e0a27230f220f0aec220d240e230e230e230e230e230e230e230e230e230f0a270a26240e220f230e230e0a270a270a28220f0a260b26230f0a27230e0a27230e230e0aeb230e230e230e230e230f220e230e230f220f220f220f0a270a27230e230e230e230e0a270b260b27220e0b270a27230d0b28220e0a27230e230e0beb220e240e230e230e230e230e230e230e230e230e230e0a270b26230e230f220f220e0b270a270a27230e0a270b26230e0b27230d0b26240e230e0aec220e230e230e230e230e230f220e230f220f230e220f0a270a27230e230e230e230e0b270a260b27220f0a270a27230e0a28220e0a27230e230e0beb230e230e230e230e230e230e230f220e230e230e230f0a260b26230f220f230e230e0a270a270a28220e0b260b26230e0b27230e0a26240e230e0aec220e230e230e230e230e230f220f220f220f220f220f0a270a27230e230e230e230e0b260b260b27230d0b270a26240e0a28220e0a27230e230e0beb230d240e230e230e230e230e230e230e230e230e230e0a270a27230e230f220e230f0a270a260b27230e0a270a27230e0a28220e0b27220e230f0aeb230d240e230e230e230e230e230e230e230e230e230e0a270b26230f220e230f220f0a260b270a28220d0b270a27230e0a28220f0a26230e230f0aeb230e230e230e230e230e230e230e230e230e230f220f0a260b27230e230e220f220f0a270a270a28220e0b270a26230e0b27220f0a27230e230e0aec220e230e230e230e230e230f220e240e220f220f230e0a270a27230f220e230e230e0b270a260b27220f0a260b27230e0a27230e0a27230e230e0beb220e230e230e240e230e220f220f230e230e230e220f0a270a27230e230e230e230f09270b260b27220e0b270a27230e0a28220e0b26230e230f0aeb220f230d240e230e230e230e230e230e230e230e230e0a280a27230e230e220f220f0a270a270a28220e0b260b26230e0b27220e0b27230e230d0beb230e230e230e230e230e230f220e230f220f220f220f0a270a26240e230e230e230e0a270a270a28220e0b260b27220f0a27230e0a27230e230e0aec220e230e230e230f220f220e230f230e230e230e230e0a270a27230e230e230f220f0a260b260b27220f0a270a27230d0b28220e0b26230e230e0b0005dc

Has anyone an idea why this command code might fail sometimes?

Hi All,

I have just started the openHAB “journey”.

My first challenge is to get the RM3 working, I have it added as a thing and online. [note" I did see mention of “the original Broadlink-setup-process in the app must not be completed for this to work” but Broadlink Manager worked fine for me]

I got the remote command and put it in broadlink.map

SHD_ON = 2600500000012694133712131237121412371337121312131213113813121337121312131337113813121312131311141213121312371213133712371337123713371237131213371200051F0001274A12000D050000000000000000

I’m completely stumped on how to link a switch item to SHD_ON.

thediyiot.com says like this:

Switch item=SHD_Power label="SHD[]" icon="player" mappings=[SHD_ON="ON", SHD_ON="OFF"]

I’m completely stumped on how to get a switch showing up that sends the code when I toggle it.

I mean with the above switch syntax, that supposedly goes into a sitemap and the mappings connects to the broadlink.map, this is where I come unstuck, I’m not familiar with sitemaps yet… I’m also confused because there is no channel link:

sitemap page_e8003c7ff6 label="New Sitemap" {
    Switch item=IR_CONTROL label="SDH[]" icon="switch" mappings=[SDH_ON="ON",SDH_ON="OFF"]
}

How does the “sitemap” switch know to use the Broadlink RM3 channel?

For example if I create a string or switch item then I can add a link to the Broadlink RM3 channel but the sitemap switch item doesn’t allow me to link a channel?

I’m think I’m missing the glue between the sitemap and the channel, please help.

Thanks.
Richard

I think you are missing somewhere the link to the “Thing” as well as the reference to the broadlink.map file (also make sure you installed the map transformation!).
I am not using txt files to create items though anymore (only GUI), hence not 100% sure on the syntax.

EDIT:
Does the normal switch work (without sitemap)?
Your item is called “SHD_Power” correct?
Maybe show us more of your config.

EDIT2:

How does the “sitemap” switch know to use the Broadlink RM3 channel?

The sitemap “knows” it by your item link, in this case SHD_Power (if this is your item)

1 Like

Thanks @chrismast!

Map transformation is installed.

I would rather use the UI :grinning:

With the RMx, say I have a working thing and a single entry (its a toggle) for on/off in broadlink.map, what do I create in the UI to be able to switch the system on/off via the RMx?

I keep “iterating” the config, trying something and then starting that bit again, I cant get it to switch no matter what I do.

The switch item has the channel setup but for the life of me I can’t see a way to bind the switch to the SHD_ON entry in the broadlink.map (the sitemap switch config seems to allow SHD_ON to be referenced using “mappings” but I can’t see that in a switch item)?

I’m probably doing something silly as I’m so new to all of this.

I got an RM4C, but the logic should be the same, below my config that you maybe can copy:

Thing and Channel:


Example - Power Switch:



The broadlink.map is then similar from what you posted command and IR code.

2 Likes