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

I followed the link below. I used the Method 1 that he listed for Configuration and the the python-broadlink method for learning the IR codes. I also set it up with the MQTT method as a backup but I do not currently use it because I would have had to create a directory structure to match the MQTT messages. For my specific setup that would have created 2 or so hours of folder creation and a single text file for every IR code I needed to use. Using this method to capture the IR codes is the easiest way IMO. I was able to quickly and efficiently learn and toss all my IR codes into a broadlink.map file by repeating the same three quick commands.

https://community.openhab.org/t/broadlink-bestcon-rm4c-mini-via-mqtt/98268

From that point I ended up creating my own personal widget for the remote based off of the weather widget tutorial and several posts in the page below to help with understanding oh-links and badges.

https://community.openhab.org/t/building-pages-in-the-oh3-ui-documentation-draft-2-3/104392/263

1 Like

to learn codes - the best way is to use this utility Broadlink Manager download | SourceForge.net
But what is the best way connect this codes in OH3 i don’t know. Year ago on OH2.5 i do this manual but that was complicated , you must wright many text files. I really interested how can we do this from OH3 interface, with his new abilities

Best way for OH3 is via the Broadlink binding. Install the binding Broadlink 3.1 which is a few posts above. The ActionCommand that I have called CABLE_SELECT(or CABLE_POWER depending on what photo you look at) is the command that correlates to what is in the broadlink.map file.

1 Like

Thx for the help, I instal broadlink bunding, it work, but can you pls do a more open tutorial. Something like how to add custom RF/IR code and shoot it from oh3, in a step by step way:

  • where you put map file
  • what you write in map file
  • how you create the property links like in your picture
  • how you shoot this property from “Model” (for example I do relay control from this menu can I add here “custom code” and shot it from here?)

Hello.Tell me please. I have broadlink rm4c mini.I can’t read the codes from the remote for the file broadlink.map.I tried the bridge broadlink but it is only suitable for RM1/2.Tell me please how to read codse. perhaps there are other ways.

Have a look here.
I also got a RM4C Mini in production controlling my TV and Mibox.
The guide should enable you to record your IR commands.
You can then use them in openHAB/MQTT as you need to.

The broadlink.map file goes into /etc/openhab/transform and you write in the .map file the commands like:

start=IRCODE

You can then use the “start” command to execute the IR code via openHAB via the broadlink command channel.
There should be enough information in this thread to configure openHAB by now.
Have a read through it and let us know if you need further information.

I tried this manual but I could not get the codes for broadlink.map.tell me please in detail how did you get the codes?

I used the method outlined in linked thread via Teach Remote Codes leveraging broadlink-mqtt, whereas also used python-broadlink. Both worked, just follow the instructions of said thread or their respective github repos.

I have a Broadlink RM 4 mini on Openhab 2.5. I got a few IR codes that I learned with the Python library and it worked a couple of times. However now nothing happens when setting something in PaperUI and in addition the following shows up in the logs:

2021-03-13 21:38:04.592 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:cfbc4452[v]: Authentication failed: 
2021-03-13 21:38:04.595 [ERROR] [handler.BroadlinkRemoteModel4Handler] - Broadlink Exception: 
java.net.ProtocolException: Response from device is not valid. (0x22=0xFF,0x23=0xFF,0x24=0xFF)
        at org.openhab.binding.broadlink.internal.BroadlinkProtocol.decodePacket(BroadlinkProtocol.java:195) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.decodeDevicePacket(BroadlinkBaseThingHandler.java:180) ~[bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.authenticate(BroadlinkBaseThingHandler.java:140) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.transitionToOnline(BroadlinkBaseThingHandler.java:263) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler.updateItemStatus(BroadlinkBaseThingHandler.java:216) [bundleFile:?]
        at org.openhab.binding.broadlink.handler.BroadlinkBaseThingHandler$1.run(BroadlinkBaseThingHandler.java:104) [bundleFile:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_152]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_152]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_152]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_152]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
2021-03-13 21:38:04.603 [ERROR] [handler.BroadlinkRemoteModel4Handler] - rm4:cfbc4452[v]: Attempting to authenticate prior to getting device status FAILED. Will mark as offline
2021-03-13 21:38:04.607 [WARN ] [handler.BroadlinkRemoteModel4Handler] - rm4:cfbc4452[v]: Online -> Offline due to: Couldn't authenticate

It does show as online in PaperUI.
Any suggestions, what I could do?

Currently controlling a BG socket via Alexa so keen to test this out. Is there a ready compiled .jar for this anywhere please?

I think this is this the one that you need.

I had some issues with it so have stopped using it for now. It would work to start with and then stop getting updates. I need to add some more logging but it seems like the auth starts to fial

My knowledge of Python is limited but I think what is happening is:

checksum = sum(packet[0x08:], 0xC0AD) & 0xFFFF

As you say, sum up all of the bytes from 0x08 onwards and add 0xC0AD.
Bitwise AND with 0xFFFF to leave just the 16 least significant bits (throw away the large part of the sum)

packet[0x06] = checksum & 0xFF

Bitwise AND the checksum with 0xFF to leave just the 8 least significant bits (that fit into the least significant byte of the two byte checksum at position 0x06 of the packet array)

packet[0x07] = checksum >> 8

The >>8 shifts the 16 bit checksum 8 bits to the right, leaving the most significant byte of the original checksum as a single byte, which is then put into the most significant byte of the checksum at position 0x07 in the packet array.

So overall, it’s summing up all of the numbers, finding the least significant 16 bit part of the sum and splitting it into 2x 8 bit bytes to go in the 2 bytes of checksum in the packet.

Can anyone share a .thing updated? In old version It can be like this:

Thing broadlink:sp2:xx-xx-xx-xx-xx-xx                           "socket"    [ authorizationKey="auth_key", staticIp=true, ipAddress="192.168.1.64", port=80, pollingInterval=30, iv="iv_key", mac="mac_address"  ]

For the OH3 version, what changes?

I’ve put that in my addons folder and it isn’t showing up. I’ve tried rebooting but no luck.

Also tried: (BroadlinkOH3/target/org.openhab.binding.broadlink-3.1.0-SNAPSHOT.jar at main · RobPope/BroadlinkOH3 · GitHub)

That’s what I believe I’ve covered here

I had some trouble to start with to. I now have both versions sitting in /usr/share/openhab/addons

Looks like it, assuming the bit shifting function works the same. I thought you were looking for an explanation of what it does.

I replaced one with the other. I’ll try it with both.

Easiest to add the device from the Settings>Things section in the OH3 UI. You can then link the Thing with your items

Hi,

I know, but I’ve all configurations in config files, and this is the only one that I have in json, and I like to put it in config file again.

Best Regards,
Fernando Gomes

I have all my configurations in Items files etc too but, for Things, it’s far easier to use the OH3 Things to stop spurious items appearing in the Inbox.