All credits go to http://rm-bridge.fun2code.de/index.html This is just another code mirror for this great tool.
RM Brige provides an API to access BroadLink RM1/RM2 devices. You can either install the app from Google Play or download the APK directly from this page. This page also includes the RM Bridge API documentation along with a sample Code Management implementation, which also can be downloaded for offline usage.