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

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.

:slight_smile: yeah, this is how I’ve it right now, but I would like to have all in config files.

@pmknowles, btw your powerConsumption is working for SP3s ?

Best Regards,

I now have both versions in the addons folder. The dates/times are from my downloads last night but I’ve noticed the sizes are also different to yours.

[Edit: situation resolved by re-downloading the files from github. I also changed the ownership to match yours but I don’t think that was it.]

I’m just starting to set up this binding for a BG1 socket. I initially discovered the device but I’ve since deleted it and replaced it with a .thing file using the format you showed above and it appears in the UI.

It’s showing a “can’t authenticate” error, which isn’t surprising since so far I haven’t given it any authentication details. I can’t see how to do that in either the UI or in the file.

You can’t give it auth key and IV anymore in the binding. I committed a PR to remove that a while ago as the key and IV were the same in all the broadlink devices and made the config confusing for new users.

If you know what the device IV and key are for that device then let us know; those changes for the BG1 should have a PR opened against Johns repo for inclusion, that way the IV and key can be included too.

I saw that those two parameters had been removed from the config part of the code but I didn’t realise different devices need to have different keys embedded in the binding.

There is a post here that looks like the key. Not sure if the iv is common to all devices.

Where ? Can you show me a screenshot?

Best Regards,

This is my .thing entry:

Thing broadlink:bg1:LoungeSocket "Lounge Socket" [ mac="24-df-xx-xx-xx-xx", staticIp=true, ipAddress="192.168.1.xxx", port=80, pollingInterval=30 ]

This is what I see in Settings → Things

And this is the thing itself

does anyone know how to get the code from the broadlink rm 4 mini remote control without using pyton-broadlink? I could not configure the remote via the long pyton-broadlink and mqtt-broadlink instructions. I don’t have the knowledge to do that. I want to use binding for broadlink and write the remote control codes to the broadlink.map file. Is there an easy way to get the codes from the RM4 mini remote? I found on this forum how you can get codes from the remote RM1/2 using the bridge, but this does not work with the RM4 mini

Just to be sure - to get the codes for the remote you don’t need both python-broadlink and broadlink-mqtt - you only need the first one. From this tutorial, you would only need to follow:

  • Install python-broadlink
  • Teach remote codesClick to teach via python-broadlink
    • You can stop after the command print(packet.hex()) - that provides the string you’ll need for the map file

Hello Tell me please. I’m trying to get the code via Teach via python-broadlink.

print(devices)
answer-[broadlink.remote.rm4mini((‘192.168.0.102’, 80), mac=b’$\xdf\xa7Oq\x98’, devtype=25278, timeout=10, name=‘智能遥控’, model=‘RM4C mini’, manufacturer=‘Broadlink’, is_locked=True)]
devices[0].auth()
answer-Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.7/dist-packages/broadlink-0.17.0-py3.7.egg/broadlink/device.py”, line 187, in auth
check_error(response[0x22:0x24])
File “/usr/local/lib/python3.7/dist-packages/broadlink-0.17.0-py3.7.egg/broadlink/exceptions.py”, line 151, in check_error
raise exception(error_code)
broadlink.exceptions.AuthenticationError: [Errno -1] Authentication failed
What am I doing wrong why doesn’t it return me True?

Probably because of this:

is_locked=True

Your devices are paired with the cloud, which locks the devices and means nothing else can communicate with them.

You have a number of ways of unpairing. You will need to fully reset your device. Two methods for connecting your device to WiFi but not too the broadlink servers are described in the tutorial in the section Connect RM4C Mini to wifi