Configuration - Broadlink RM Pro

To start working with the Broadlink RM2 Pro controller, it must be connected to a wireless network.

To do this, first install the official e-Control application on your mobile device on Android or iOS.

The connection sequence is very simple:

  • Turn on the controller Broadlink RM2 Pro, while it should be in the network search mode (blinking blue LED).
  • Launch the e-Control application installed on the mobile device.
  • Specify the wireless access point and password and click the Start button.

If you can not connect, use the reset button on the device and repeat the sequence.

The next step is to prepare the software on the Raspberry Pi computer for interaction with the Broadlink RM2 Pro controller. For this, we will write several scripts in the Python programming language using plug-in libraries.

Install the necessary packages.

$ sudo apt-get install python-setuptools python-dev

Create working directories.

$ sudo mkdir /opt/broadlink
$ sudo mkdir /opt/broadlink/code
$ cd /opt/broadlink

We install the plug-in libraries.

$ sudo easy_install broadlink
$ sudo easy_install pycrypto

We will create a script for obtaining the readings of the built-in temperature sensor of the Broadlink RM2 Pro controller.

$ sudo nano temp.py
#!/usr/bin/python
import broadlink
devices = broadlink.rm(host=("10.0.1.30",80), mac=bytearray.fromhex("B4430DEEED15"))
devices.auth()
print devices.check_temperature()

Save the script and make it executable.

$ sudo chmod +x temp.py

Try to execute the script.

$ ./temp.py

If successful, we will see the temperature value.

Create a script to get the control codes.

$ sudo nano learn.py
#!/usr/bin/python
import broadlink
import time
import sys
device = broadlink.rm(host=("10.0.1.30",80), mac=bytearray.fromhex("B4430DEEED15"))
device.auth()
codeName = raw_input("Enter name of code: ")
time.sleep(1)
print "Press the button on the remote control for 5 seconds."
device.host
device.enter_learning()
time.sleep(5)
ir_packet = device.check_data()
myhex = str(ir_packet).encode('hex'); 
if ir_packet == None:
   print "The button code is not read. Try again."
   sys.exit()
else:
   f = open("code/"+ codeName +".txt",'w')
f.write(myhex)
f.close()
print "The code is read and saved in a file " + codeName + ".txt"

Save the script and make it executable.

$ sudo chmod +x learn.py

Run the script. After starting the script will ask you to enter the file name to save the code, for example, enter rm_a . After pressing the Enter key, the controller will enter the learning mode for 5 seconds (the orange LED will light up), at this time it is necessary to press the remote control button (in our case, the button "A" of the Livolo remote). If the button code is successfully read, the controller exits the learning mode and the code is saved to the code/rm_a.txt file

Now we need a script to send the control codes.

$ sudo nano send.py
#!/usr/bin/python
import broadlink
import time
import sys
try:
    fileName = sys.argv[1]
except IndexError:
    fileName = 'null'
if fileName == 'null':
   sys.exit()
else:
   device = broadlink.rm(host=("10.0.1.30",80), mac=bytearray.fromhex("B4430DEEED15"))

device.auth()
device.host
file = open(fileName, 'r')
myhex = file.read()
device.send_data(myhex.decode('hex'))

If the button code is already bound to the switch, we can test the script.

# ./send.py code/rm_a.txt 

Mobile wallpapers!  |  Linux certification!

You can copy information from this site for personal, noncommercial use only. Copying and use of information from this site for any other purpose is prohibited.  |  All trademarks are the property of their respective owners.
© 1998-2022 Sameak. All rights reserved.