Broadlink/Bestcon RM4C Mini via MQTT

the access point that says “broadlinkprov”? I see it, can connect to it, but what next?

Then continue with the next step:

  1. Once connected, in a terminal on your computer, start the python console by typing python3 and hitting enter.

I am connecting my laptop to the broadlink RMPRO. where do I type python3? do I ssh into my openhab ubuntu ?My OH resides in a ubuntu VM in my esxi server

I see.

You’re currently following steps to connect your Broadlink device to your wifi. This has nothing to do with openHAB (yet!). You must follow the instructions using the device which you’ve connected to the Broadlink AP (so your laptop - hopefully you installed python-broadlink onto your laptop?).

Once the Broadlink device has connected to your wifi network you can SSH into your device which runs openHAB, and continue from there. This should become clear when you get to the Install broadlink-mqtt step.

However, you’ve now mentioned an RMPro - @mjeshurun was not successful in using this tutorial with his RM4 Pro - you can see the results just a few posts above when you first joined!

Thank you . It looks like I have to put a wifi adapter and pass it through to my OH vm. And even so, it may not work for the RMPro.

Really? Why? Surely your OH VM is connected to your home network?

Quite. Have you tried using the broadlink binding?

yes, the OH VM is connected to my home network. But I only connect to it via putty, whilst I connect the the RMPRO with either my laptop or my phone to the “Broadlinkprov” wifi - but I have so far failed to connect this way.

I have not tried the broadlink binding as I was attracked to this method which does not call or connect to the Broadlink servers

The broadlink binding does not connect to the broadlink servers either.

I will try the Broadlink binding

I dunno why but even with the newest Broadlink app, I could not connect the RMPro to my wifi network -which I managed to a year ago before i removed it and put it in cold storage.

Hi @hafniumzinc ,
I may have found the reason why I couldn’t learn the RF codes, and I hope you might be able to assist me in solving it.

At one of the posts relating to “device storage is full” @eschava asked me this question:
“What is the value of the device_type parameter in the mqtt.conf or custom.conf files?”

His question made me realize I might have missed a step while trying to use the python-broadlink and broadlink-mqtt solutions you described in your guide.

In both solutions described in your guide, I did not fill my device_type parameters in any file.

For example, this is my device type output I got by using the python-broadlink method, but I didn’t notice I needed to save the device_type data into a special file located in the broadlink_cli folder.

pi@raspberrypi:~/python-broadlink/cli $ ./broadlink_discovery --timeout 10 --dst-ip 192.168.1.6
Discovering...
###########################################
RM4
# broadlink_cli --type 0x61a2 --host 192.168.1.6 --mac 24dfa7b9c689
Device file data (to be used with --device @filename in broadlink_cli) : 
0x61a2 192.168.1.6 24dfa7b9c689
temperature = 0.0

I did the same mistake with the broadlink-mqtt solution. which means I didn’t fill my device type info into the custom.conf file.

It looks like the python-broadlink solution might be easier for noobs like me.
Could I trouble you, @hafniumzinc , to please explain how I should save the device_type info into the python-broadlink broadlink_cli folder, or to add the info into the custom.conf file under broadlink-mqtt?

Sorry in advance for such a noob request :pray::pray:

The device_type parameter in mqtt.conf (or custom.conf) is by default set to lookup, which presumably means that broadlink-mqtt uses whatever python-broadlink discovers automatically as your device type. The extract you give:

pi@raspberrypi:~/python-broadlink/cli $ ./broadlink_discovery --timeout 10 --dst-ip 192.168.1.6
Discovering...
###########################################
RM4

means python-broadlink seems to correctly discover your device type (RM4), and presumably broadlink-mqtt uses that.

I have not changed the device_type parameter in my own broadlink-mqtt configuration files - it’s been left at the default.

1 Like

Thank you for taking the time to check.
Then I really don’t know causes the “device storage is full”. :dizzy_face:

Hi @hafniumzinc

Just wanted to let you know, that with the help of kind people on this thread I now know how to learn commands from RF remotes :))

To make a long story short, I was instructed to use this terminal command in order to start RF learning:
python3 broadlink_cli --device "0x61a2 192.168.1.6 24dfa7b9c689" --rfscanlearn

Could it be the learn command you mentioned in your guide for the python-broadlink method was for IR learning only? devices[0].enter_learning()

1 Like

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: https://github.com/mjg59/python-broadlink/issues/404

  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 192.168.1.6 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 broadlink.map 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:

2 Likes