[RELEASE] Generic TV Remote Device Handler using Broadlink RM Pro and Mini with Alexa Support

dth_remotes
requires_server
project_av

(Enis Hoca) #1

This is a pretty stupid DH as far as DH’s go but gets the job done, not proud of it; but hey. And there is something to be said about getting something working in under an hour. Figured someone may find it useful so sharing. Don’t beat me up on code quality etc. Would have liked a prettier screen and more feedback on buttons, but it would take more work. This doesn’t have to be strictly a TV remote and can be used as a multi-media remote, with buttons programmed for different devices.

I have RM Pro 2 and Mini 3 works with both -

Pre-Requisite

Broadlink RM devices are cheap, if you have one you already know that the only way to talk to them is either via HA-Bridge or Android. There are 2 different mechanisms for Android - RM Lite plugin for tasker, costs $4.99, and RM Bridge (linked above). There are other DHs that use both or even support HA-Bridge. I chose RM Bridge because I find HA-Bridge quite heavy and hard to install, I have an instance running on my Pi but too much to figure out. Although I have a subscription to RM Lite plugin, and use it for Alexa integration, but I have read that it leaks info outside the network. Don’t know the details on what it leaks. I decided to keep it simple and go with RM Bridge

Features

  • This is based on the TV template that is included in the IDE
  • Clicking on the main button in the Things list allows you turn On/Off all devices with one click (3 devices are supported, TV, Sound & STB)
  • Allows you to associate a single command with each button.
  • Level command is supported and tied to Volume commands so external devices can set volue - tested with Alexa, may work with Google Home
  • Multiple commands are not supported
  • Authentication is not supported - although RM Bridge has basic authentication I don’t support it, its in my home lan so dont see a point for me especially for a TV remote.

A note on Volume level control
The volume up and down works as expected - they will fire a Volume up or down command when pressed.
Volume controls also work with Alexa - and will respond as expected to commands like:
Alexa set or make TV higher
Alexa turn up TV
Alexa set or make TV lower
Alexa turn down TV

However, is a just since we fire and are not really connected to the real device, Discrete volume level controls like sliders work a little funny. For example Alexa app has a level UI and as you change level it will only lower or raise the volume only once or twice. And behaviour will be dependent on slider implementation if you connect this to another smartapp or external control.

What Volume does is that every time it receives a level higher or equal to current level it sends to Volume Up button twice otherwise it sends Volume Down button. So in case of Alexa even after internally reaching 100% the volume control still responds to ‘make higher’ command and keeps firing Volume Up button code, it does the same thing at 0% for ‘make lower’ and keeps firing the Volume Down command,

RM Bridge Installation
Download and install RM Bridge on an android device and run it. It will show the device IP address and port.
Links to Google Play store or apk are all here: http://rm-bridge.fun2code.de/ . I would assign a static IP to the android device by setting it in your DHCP server. You will need this baby to stick one address.

Please note you don’t need the Broadlink e-remote software after initial installation and adding your remote control device on the network. That software is nothing to write home about, and I wouldn’t trust it on my primary phone. I installed it on a burner and use it to only to initialize new devices, resetting etc. I have accepted NSA snooping as a fact of life, but letting PLA in my house is a bit much (though who knows what RM Bridge is doing)


Setting up remote codes

  • Run the RM Bridge web app
    You can either go click on ‘Manage Code’ link on the RM Bridge’s web site (direct link http://rm-bridge.fun2code.de/rm_manage/index.html) and manage the codes from there
    or
    Download the zip file from clicking on ‘Manage Codes Offline Version’ - If you use the offline version it will download a zip file unzip it and open index.html.
    Please note: This app did not work for me remotely on Chrome for mac, worked on Safari and Firefox fine
    It should look like this :

    Click on ‘Create new codes’ - it should go the learning page

  • Enter the IP address and port in Step 1 section for the Android device and hit Load Device.
    It usually takes a few retries for this to work the first time around. You may have to hit load devices several times.
    If it doesn’t find the device enter it Manually - just use RM for as the device type.
    Please note: Mini 3 is not recognized by the javascript on this page. You can either enter the mac address manually - or get the download version of the app and find the section in learn.js where devices are listed and just add “RMMini” to the list

  • Then select the Device from the devices drop-down in Step 2 section

  • Now comes the important part enter the code name in Step 3 section this is code name is important this is what you will use in the ST Device configuration later. For example: I have chosen to call this button TV and will use to turn the TV on and off

  • Click on learn code - and point the remote towards the Broadlink device and press the key for your device - you may want to test the code before moving on

  • Do the previous 2 step for all the keys you want to teach the remote.

Please note: don’t put spaces or other special characters in the names, like I said its a dumb app, and these names are only read by machines, so no need to make them pretty

SmartThings Device Handler

Install the Device handler and a create a new device for your TV in the usual way here is the code for the DH

App Settings

  • Now start the SmartThings app, open the detail page for your device and click on the gear icon
  • Enter the IP address and the port as shown in the RM Bridge Android app
  • Enter ‘Code name’ from the the RM Bridge pro that you created earlier when you captured the remote code in this example tv. Please note that the code name must match *exactly* what you put in the RM Bridge code learning page. This is case sensitive. If you forgot what you put in you can go to the ‘Manage Codes’ area in the RM Bridge web app and get a list.

Do this for every button you want to map - button names are fairly self-evident.


That’s all folks - hopefully someone else will find it useful. Otherwise documentation for myself


[RELEASE] Generic Mini-Split AC Remote Device Handler using Broadlink RM Pro and Mini
(Graeme) #2

Thank you - Do you know if this will work with the Broadlink RM Pro+ as well as the original RM Pro? As I understand it, the RM Pro+ has reduced functionality and is not compatible with most 3rd party implementations by design from Broadlink. Unfortunately, the RM Pro does not appear to be available any more and when you order one, you get the RM Pro+


(Enis Hoca) #3

Sorry don’t know - I have a RM Pro 2 I bought it only few months ago. If RM Bridge supports it, it may work. BTW I have RM Mini V3 and the RM Bridge management tools don’t discover it out of the box but what found was by changing the javascript on the management code to include the name RMMini it worked. It also worked if if you added it manually as RM. If you have RM Pro, try it.

BTW I just updated this to all support for Alexa to change volume


(Enis Hoca) #4

Did some digging and it appears that this solution will work - although as I said in the previous message it will not be discoverable out of the box in RM Bridge, you will need to just add it manually in the code discovery page - or a very minor change in js code that you can download from the site

the API specs for RM bridge clearly indicate that support was add for RM Pro+
http://rm-bridge.fun2code.de/downloads/RMBridge-APIDocumentation.pdf


#5

@enis any tips on how to use the offline version of their code? I try to just open the .html files but get weird things in double curly brackets all over, not sure I’m doing it right.

@zimguy any luck getting this to work?


(Graeme) #6

Still not working!

I have installed the RM Bridge app and have it running. I set up the port forwarding on my router. I then go to “Create New Codes” (http://rm-bridge.fun2code.de/rm_manage/code_learning.html) and put in my IP and port, then click on “Load Devices”.
It finds my RM Pro+ on the network and automatically sets it as "RMPROPLUS-42-D5-6F (XX:XX:XX:XX:XX:XX) "
Then I click “Learn Code” in step 3 and get "Error learning code: mac:XX:XX:XX:XX:XX:XX not rm2"
I tried adding it manually, but it will not add it unless I set the type to RM2, but then I get the same error as above when I click “Learn Code"
After looking through the js, I also tried setting the type to 10026, which is the type of the RMPro+, and then I get the error: " mac:XX:XX:XX:XX:XX:XX not Rmpro+”

If I go to Export Codes, I get: ERROR: HTTP/404

My device is an RM Pro+ with a serial number starting RM3322. In IHC, the firmware is listed as v52


(Enis Hoca) #7

It didn’t work for me on chrome worked fine on Safari and Firefox on mac. I just unzipped the file and clicked on index.htm


(Enis Hoca) #8

I would send the RM Bridge guys an email and see if they respond.

I added mini 3 a couple of different ways and it worked both ways. 1. I told the web that it was RM, that ended up creating an extra device internally but let me send it commands, 2. I cleaned up and added making js changes.

But either way when I went to learn the commands it worked. I am work, will try to play later today or over the weekend and get you some direct urls to use, RM bridge is just an API to get to the real device - so even though their PDF says it, it may not be compatible.
Wonder if there is a version difference in what they have in the store and the APK on their web site. where did you install it from?


(Graeme) #9

I installed the app from the Play store on Android. I have emailed the app developer to see if I get a response back. I have seen though that there are other people saying that their RM Pro+ is not working with it.
I suspect that Broadlink have made some changes to the device - possibly to specifically stop 3rd party integration, and there are actually 2 variations on the RM Pro+. Unfortunately, I think that this latest one is the only model of the Broadlink RM Pro that you can get now (unless there are old stocks), even if you specifically order the RM Pro (without the plus).

I did also email Broadlink support and was told the following:

Dear Customer,
Thanks for your interesting of BroadLink products!

Pls kindly note the device of RM pro+ can help work with Alexa on TV control through the IHC app, but not support the e-control app with it, and the RM Bridge is not from BroadLink, so we don’t how to use it, thanks!

*We will support the Alexa to work with the AC and RF code in the future, now i also don’t have the datetime, but once the skill is okay, we will publish to you, so pls just waiting, thanks!


#10

I got mine a couple months ago, probably the same time frame as @enis. I can’t really tell which RM pro mine is; on the back I see “Model: RM pro” and “S/N: RM092003XXXX” Does that tell me anything?

Whatever model I have, it works swimmingly with the HomeBridge plugin. So I can actually get the hex data for commands from that, I’m trying to figure out how, if nothing else, I can input codes manually to RM Bridge or skip it entirely and interface with the Broadlink in whatever way HomeBridge does. I’ll contact the writer of the plugin.

I should also see if I can get my mini working with RM Bridge as a starting point.


(Enis Hoca) #11

I have no more knowledge on model numbers than you do - pretty much a bio when it comes to RM

Does homebridge provid get style URL’s that you can calll for commands - if so I can make a change so you can enter the full http command - well almost full. This guys just navigates to a URL to fire commands. I just hard-coded parts of the path to make it easier for RM brigde - it will be a pretty minor change, let me know


(Enis Hoca) #12

That is unfortunate - they are going in the opposite direction to where the rest of the market is heading; stupid things companies do To kill their market share - like they can become the next harmony. Let’s face it, if I had the budget to buy 3 Harmony remotes, I wouldn’t be messing with suspect Chinese and German companies with no names. As it is, I have them isolated in a subnet with just a burner phone and only connect to it via a proxy, so they can’t sit on my network and send data to Chinese hackers or military - the only thing they can steal are my Amazon and Netflix passwords


(Enis Hoca) #13

Just looked at the homebridge code or rather the library home bridge is using and there is hope - it has a device type RM3 pro plus in it. Hopefully by the weekend I can put together a list of things for you to try. Also loooking at this code I think, with a little more time I may be able to eliminate the rm bridge dependency, but that is a big maybe at this time


#14

Yeah I contacted the guy who made the homebridge plugin, his response:

“It’s generally a case of looking at the raw data going over Wi-Fi but I had a big head start thanks to this basic interface: https://github.com/momodalo/broadlinkjs

I’m then adding newer devices as they come out in a fork of it: https://github.com/lprhodes/broadlinkjs-rm

There’ll be a big update out today which should include the latest RM Pro.“

Seems most github repos I’ve found either use RM Bridge or the same method as the Homebridge plugin, often citing it as their source. I saw this project meant to help connect Broadlink to IFTTT, which would be an acceptable workaround for me: https://github.com/jor3l/broadlinkrm-ifttt/

RM Bridge does have the advantage of the short code names and a simple app-based webserver, but certainly isn’t the only way to do this.


#15

Thanks for your help!!!


(Enis Hoca) #16

Yeah I have been looking at the same code today. Until today I didn’t know about the homebridge implementation. Thanks for sharing that - it’s quite straight forward code. Unfortunately ST doesn’t allow udp, so we will need some sort of a bridge, but I think I can make a very simple one for St like he has for homebridge and open it up for other devices. I am still learning the ST ecosystem but it would be great to do code learning and discovery straight from ST


#17

No problem, seems like a lot of people utilize the homebridge plugin as a reference. I don’t mind running some kind of server, I have the homebridge one running, and am planning on getting SmartThings Node Proxy working so I can use Amazon Dash Buttons as smart buttons. I just need some way to connect SmartThings to Broadlink devices without RM Bridge, which appears to be kind of dated now. So if you know more about network interfaces and whatnot (I know almost nothing about servers and all that) and can somehow connect the method that HomeBridge plugin uses to SmartThings I’d be stoked.

I think for now I’ll try to get the Broadlink-IFTTT method working with ngrok as a workaround.


(Enis Hoca) #18

Have you played with Node-Red? I am thinking of using that as the backend - you have to write very little code and it’s all graphical. I am already using it for X-10 devices. BTW if you are thinking of dash buttons, I just put that in a couple of weeks ago, and a couple of data points-

  1. Dash buttons are really really slow. 5 secs after the button press to activate and after each push wait another 10 before the button can be used again. The family hates them, and on top of that they are not very reliable. I am switching back to X-10 remotes. They are ugly but fast and reliable.

  2. Discovery and setup using the Dash app with the nodejs takes time and you have to enter the MAC address of each device on the phone and the server config, if you are doing a couple it’s fine, but if you are doing 11 like I was, it was couple of hrs end to end.


#19

That is highly unfortunate. I had kind of heard they’re a bit dodgy, I’ll make sure to restrict their use to things where I can keep those factors in mind. Thanks!

I haven’t used Node-Red, honestly smart home stuff is my first exposure to using servers and such. I’m pretty technically inclined and know tons of code etc but just haven’t dabbled much in it yet. I’ll check it out, especially if you implement it in a solution to the SmartThings-Broadlink connect.

I was checking out some npm options, not sure if any are good for this applications (the homebridge plugin is on npm), but if you have gitlab I was curious about this one…https://www.npmjs.com/package/broadlink I need to make a gitlab account, but have to call it for tonight.


(Enis Hoca) #20

Went through all the npm ones and GitHub branches and the one from the homebridge guy seems most current for IR devices. The code he based it on is about a year old at this point and all others look experimental except one other one, but their focus is broadlink outlets