Broadlink/Bestcon RM4C Mini via MQTT

I’ve been following the GitHub thread - well done on persevering, and they were very helpful!

What seems to have happened is that check_data() often produces the device storage is full error, and the python-broadlink project knows this.

As a result, they have added a try...except line for the check_data command in the broadlink_cli script, which basically ignores the device storage is full error if it appears, and carries on with the rest of the learning.

So it appears I need to update my tutorial to not use the low level commands from the python console, but just use the broadlink_cli script instead. :+1:

Possibly, I only have an IR remote! It looks like find_rf_packet() is the low level function, instead of enter_learning(), but I think the way you were instructed on the GitHub thread (using broadlink_cli) is what I’ll implement in the tutorial.

1 Like

It was a long road to find the solution to learning the codes, but it’s great to be behind that step :slight_smile:

By chance, do you happen to know where and how I should save the RF codes so they work with the broadlink binding?

And also, how I should add the buttons to the openhab sitemap?

I’m afraid I don’t know - I don’t use the broadlink binding!

1 Like

OK, thanks anyway :slight_smile:
You really helped me with this issue and I’m very grateful :pray: :pray:

@hafniumzinc , In case you are interested, I figured out how to setup the broadlink binding.
Let me know if you want me to explain the steps I took.

Yes, please share how you setup the broadlink binding
thank you

My steps are relevant for installation on Raspberry Pi OS.

  1. I followed @hafniumzinc 's guide verbatim until the point of learning the RF codes.
    When I tried learning the codes using the two methods @hafniumzinc mentioned (python-broadlink/broadlink-mqtt), both methods failed and returned the “device storage is full” message.

  2. I then followed this thread which focuses on the “device storage is full” issue:

  3. In that thread @felipediel suggested I use the following command in terminal from the /home/pi/python-broadlink/cli folder:
    python3 broadlink_cli --device "0x61a2 24dfa7b9c689" --rfscanlearn
    This command allowed me to learn the RF codes and returned the codes in the terminal (make sure to fill-in your personal RMx device type, IP and MAC address).

  4. After I got all my RF codes, I downloaded the latest broadlink binding jar file here, and copied it into OpenHAB’s addons folder /usr/share/openhab2/addons

  5. Next, I followed this guide to install the Map Transformation in OpenHAB. To build my file, and copy it into the /etc/openhab2/transform folder. And lastly, to add the corresponding control buttons to my sitemap.

That’s it :slight_smile:


Thanks a lot for this guide @hafniumzinc!
It helped me indeed a lot. Just got an RM4C and integrated it with ease into my current mqtt boker.
I am able now to, at least via mqtt commands, control my TV and Xiaomi Mibox. Only got issues with my Samsung AC as somehow the hex codes are always different on each command (i.e. single on/off button push, hex codes is every time different).
Also need to continue integrating this into OH (for now only did the Mibox Power On/Off as example), hence need to think on how to translate i.e. volume up/down etc. into it.

Just want to thank @hafniumzinc for the tutorial; while I use the Broadlink binding rather than MQTT, his instructions, which augmented the python-broadlink docs and made them easier for a Python novice to understand, made it possible for me to use the library to learn the RF codes I needed to provide to the binding to control my ceiling fan via a new, updated RM4 Pro.

Thanks for the great work!

@hafniumzinc Really appreciated it if you can explain in detail step in the Configure OpenHAB until the Sitemap . i dont get what to do after create these 2 text files

I have a separate file which just contains the bridge Thing to my Mosquitto MQTT broker:


Saved into the transform folder:

I need to turn on/off my AC through Openhab 2(or 3) with hour schedule !

You don’t need a Sitemap to do this - you want to start looking at Rules. That’s all beyond the scope of this tutorial, but you might be able to do what you want just with the new UI in OH3.

I have to do it with a RM4 mini so this post is helpful so far but I’m stuck at Configure OH. I got the IR signal record via python-broadlink that i can replay it on python by your step :

This huge string is the code which needs to be saved. To double check that it works, you can send this code through python-broadlink back to your RM4C Mini device, and see whether it has the desired effect (switch things on/off etc):

>>> devices[0].send_data(packet)

We now need to save this huge string so that broadlink-mqtt can use it.

How do i put it together in Openhab and replay that signal through Mqtt topic to Rm4 to just turn the AC on and off ? I’ve setup the Mqtt Broker, Generic Mqtt Thing.

./broadlink_discovery --timeout 10 --dst-ip

The discovery needs to unlock the device before. Unfortunetaly the only way to unlock it was to use the BroadLink App

Presumably your device has previously connected to the Broadlink cloud?

Or are you saying this is a brand new, unboxed device which has never been connected to anything before?

After setup WiFi via BroadLink App I disabled immediatelly Internet access for this device. Maybe this time was sufficent to lock the device.

I only want to share this experience.

I have an issue with running this broadlink-mqtt as a service.

Starting with command
/usr/bin/python3 /home/openhabian/broadlink-mqtt/ Is working normally

Running (active) as a service…no response on mqtt commands.

Anyone with a solution?

Many thx for your help!!

Sorry, was it you at Issue · Issue #109 · eschava/broadlink-mqtt · GitHub?

Yes, I am :slightly_smiling_face: