Christmas I received the Broadlink RM device for controlling IR devices with the intention of using it with Amazon Alexa. It turns out that the service is not available in the UK so the only way to control the device is with the phone App.
After ‘googling’ for options it turns out there are ways to bridge the connection using Android devices, which I don’t have. My next option was to look for ways to control the device through Python and create my own skills in Alexa.
Everything is easier said than done but here goes.
Step 1. make sure your broadlink RM device is on your network and you can see it with the phone App. Just follow the instructions in the box for this bit.
Step 2. I found a library on github to provide some basic API features. Download the API from user mjg59 on github. From this point you can follow the instructions on the README 🙂
or mine below…..
Step 3. I found that my install of Python did not have pyaes installed that is used by the API so ….. sudo pip install pyaes
Step 4. Okay, when I download the code from github I placed the contents of broadlink/__init__.py in to broadlink.py. You will need to do the same if you use the code below to learn one command from your remote and repeat it back out. This will prove you can communicate with the broadlink device and play out a recorded IR code.
import broadlink import time devices = broadlink.discover(timeout=5) print(devices) devices.auth() devices.enter_learning() print("learning") time.sleep(5) ir = devices.check_data() print("wait") time.sleep(10) print("learnt") devices.send_data(ir) print(ir) print("end")
Running the above will give you 5 seconds to learn an IR code (your broadlink should show an amber light) and 10 seconds later the broadlink will reply the command.
This proves you have control of your broadlink. The next stages will be to learn all your IR commands to build a database that Alexa can use.