Ha-bridge: Support for Broadlink Rm2/pro

Created on 12 Nov 2016  ·  91Comments  ·  Source: bwssytems/ha-bridge

Anyone know how to get the bridge to talk to a Broadlink IR/RF blaster?

enhancement question

Most helpful comment

All, i am working on bringing this in with a java library i am contributing to, soon.....

All 91 comments

Great, have you got this working fine?

No, sorry to say I just Googled: "Broadlink IR/RF blaster API" and it seemed descent after quickly reading. It allows HTTP calls, which is what you are after.

Yeah I've already read that article, got to the point when I needed an a droid device as a other bridge and stopped reading.

Yeah, even this github project requires an Android intermediary device: https://github.com/beckyricha/Broadlink-RM-SmartThings-Alexa

Sorry for the joykill!

I might have to write something to do this!

If you can read Chinese (or translate) here is the SDK: https://drive.google.com/file/d/0B65vYtefY0h2aE1LdWF5RG9sX00/view

My Chinese is a little rusty.

I spun up an android vm as I don't own an android and ran the bridge in that. The I used rm commander tools to generate the code. My home automation system then runs a batch file that contains the code. So far it works pretty well

Working via Android intermediary device and python broadlink also

anyway to convert https://github.com/mjg59/python-broadlink to java ?

+1 for a 'native bridge' -- the android tasker plugin doesn't work here anyway.... The broadlink is otherwise pretty nice, and very cheap; handles 433Mhz devices too which is quite cool.

@tyjtyj That is the basis of what I am looking into to be able to control a Broad link. The only thing is, what to control and how. It is an IR/RF/SmartPlug/SmartPowerStrip controller.

Add me to the list of users looking for this!

I've used the RM bridge management Page to learn IR device codes
http://rm-bridge.fun2code.de/rm_manage/index.html
Running the RM Bridge on an android TV box I can manually send signals to a device via the https short link however I can't get the HA-Bridge to send these.
Anyone got it working that way?

There are some python scripts kicking about but I haven't had the time to review them all yet. This should be possible.

It seems overkill to need an android running tasker for this to work.

currently I am using broadlink-mqtt (https://github.com/eschava/broadlink-mqtt), another excellent project based on the python-broadlink.
since HA-Bridge also has support for mqtt, everything works nicely.

Farhanito,

Can you give us any more detailed information on this?

I've never used mqtt before. Do I need something running a mqtt broker?

Alexa > Habridge > Mqtt broker > Broadlink ?

hi @merlin051,

yes, I'm running an mqtt broker (mosquitto) on the same machine (RaspberryPi) as HA-Bridge.
and then run the broadlink-mqtt script to make RM device subscribed to certain topics.

after that you can tell Alexa to publish commands to that topic via HA-Bridge

@farhanito

I think I'm missing something, and i think I've misunderstood what MQTT(Mosquitto) does.

I've got mosquitto installed and running as a service on my windows box( same machine running HA Bridge)

I was expecting some sort of interface where i can map devices/commands?

I've got python installed, i use it for my Orvibo s20 control scripts, not sure how I can feed the broadlink script you pointed out into my environment?

any guidance much appreciated.

Not sure if the new version of the HA-Bridge helped but I can now send the links for IR signals to the RM Bridge ( https://play.google.com/store/apps/details?id=de.fun2code.android.rmbridge)
Alexa now turns on/off my TV

@tuicemen i really want to try and avoid setting up an adroid bridge to act as a middleman in an already complicated setup.

@merlin051 As would I, but setting up another server using MQTT(Mosquitto) is even more complicated I feel.
Since I already had an Android TV box for streaming this was the best solution for me (for now).

@merlin051
if you already have mosquitto running, then just run the broadlink-mqtt.
make sure you already installed the required python modules (paho-mqtt and broadlink)

here's my broadlink-mqtt config:

Type of device. Valid options are 'lookup', 'rm', 'sp1', 'sp2', 'a1'

device_type = 'rm' # I use rm

lookup parameters

lookup_timeout = 20

local_address = '127.0.0.1'

parameters for direct connection

device_host = '192.168.31.108' # rm ip address
device_mac = 'B4:43:0D:xx:xx:xx' # rm mac

MQTT connection parameters

mqtt_broker = 'localhost' # default: 'localhost'
mqtt_port = 1883 # default: 1883
mqtt_clientid = 'broadlink'
mqtt_username = ''
mqtt_password = ''
mqtt_topic_prefix = 'rm3/'`

after that, you can try publishing an mqtt message for example

topic = rm3/tv/samsung/ON
content = record

this will make your rm goes into learning mode, ready to copy your remote button.
when finished, it will automatically save the code in a file (named ON) inside this directory

../broadlink-mqtt/commands/tv/samsung/ON

to execute the command, publish this message

topic = rm3/tv/samsung/ON
content = replay

good luck,

@farhanito thank you for your help.

I now have everything up and running. although I couldn't get the MQTT native stuff to work in HA Bridge. so I've just used a custom execution and [mosquitto_pub.exe] like this as a command:

C:\Program Files (x86)\mosquitto\mosquitto_pub.exe -t rm/soundbar/HDMI2 -m auto

any chance you can screenshot one of your devices config pages for me?

@farhanito sounds like you have mastered it!

a screenshot of your settings would be great! i've been racking my brain how to integrate my RM PRO also. i'm using FIBARO HC2 and everyone i have communicated with, said id have to install home assistant as "another" bridge just get this thing communicating with my two google home's...

@farhanito are you talking about this python module "eclipse/paho.mqtt.python" or this one "eclipse/paho.mqtt.java"?

@Matt8119 since I installed it using pip it's got to be paho.mqtt.pyhton I think.

hi all,

I am using just python code below


# file send_rf.py
import time
import sys
import broadlink

def senddatahex( hex_data ):
    #print hex_data
    #count zero padding
    pad_len = 32 - (len(hex_data) - 24) % 32
    hex_data = hex_data + "".ljust(pad_len, '0')
    #print hex_data
    myrm2.send_data(hex_data.decode('hex'))
    #print "Success"
    time.sleep(0.5)
    return

def get_rm2():
    myrm2 = broadlink.discover(1)
    myrm2 = devices[0]

    #or you can hard code it 
    #myrm2 = broadlink.rm(host=("192.168.1.10",80), mac=bytearray.fromhex("b4 43 00 00 00 00"))
    myrm2.auth()
    return myrm2

#Begin 
command = sys.argv[1].lower()
if sys.argv[2:]:
   btnOnOff = sys.argv[2].lower()

myrm2 = get_rm2()

if command == 'raw':
    senddatahex(btnOnOff)
    exit()

based on https://github.com/mjg59/python-broadlink

Under HA
Select Script Program
On URL
X:\python-2.7.12.amd64\python.exe X:\2broadlink\send_rf.py raw 260058000001289313121212143513121411131114111411133614361311133613361336143514361312131212371311141114111435133614351435141212371336133614101411140005260001264913000c4f0001274814000d05

Above is On code for LG tv.

Hope this helped

@merlin051 @Matt8119

sorry I'm on mobile right now, can't give you proper screenshots.

first, don't forget to add your broker settings in the HA-Bridge config
http://i.imgur.com/TBBPAAy.png

after that, you can go to the MQTT Messages tab and add your topics and content (auto or replay).
http://i.imgur.com/oSf8SK4.png

pressing "Build publish Message" button will open the Device creation page. Modify the device name as needed, and review the On/Off items rows. and finally, press the "Add Bridge Device" button.

What do the 433mhz playback files look like?

I can't get mine to record the signal for the boiler so looking at an arduino to record and playback on the Broadlink, I just need to get it in right format..

There is already java api for broadlink

just need some java expert for integration

https://github.com/mob41/broadlink-java-api

that would be awesome to have "one" bridge. it looks very promising! this is just way over my head... i wouldn't mind testing it when its almost ready.

What do the 433mhz playback files look like?

I can't get mine to record the signal for the boiler so looking at an arduino to record and playback on the Broadlink, I just need to get it in right format..

Guys,
I have had this working with ha bridge ages ago and it works flawlessly with Alexa. And it's much simpler. Just install jeedom server. Log in and get broad link plugin. Then make sure advanced mode or something's on. Go in the plugon, register the code and copy the command URL. Then add that in manual add in ha bridge. If you want a more detailed instructions just ask!
Hope this helps
PS use chrome with its built in translator to translate French jeedom into English
Jev

The amazing thing about HA-Bridge is it's simplicity. I had a look at most of the current HA solutions and I still don't have a use case that HA-Bridge cannot cover.

@jevtheboss ive found the french site with the jeedom server info, but the directions show doing it from scratch. can this run on the same PI that the ha bridge is running on?

@Matt8119 Yes unfortunately. You can use it on the same pi the ha bridge is on, but the easiest way is to start from scratch, get the jeedom pi image, flash iT and it will setup MySQL and jedom and everything. You can then install ha bridge. I believe you can install it without flashing the image but it's a lot harder, the jeedom image automatically does a load of pre built scripts on first boot.
Just flash it, plug it in to ether net, turn it on , go to its IP address on your computer and watch the magic happen! It takes a while though😠 just be patient
Jev

@jevtheboss i was watching a few jeedom videos on youtube concerning plugins. now i guess my question is; is the plugin for the broadlink self contained, meaning it has its own discover button, and settings? also one last question, when after i activate the plugin, in the video i watched they used an RFXCOM as an example. he selected the port to use it on, now the broadlink plugin isnt using a physical port, what do you point it to?

I would also like to see HA-Bridge fully support the BroadlinkRM Pro and eliminate the need for an Android device to run RM bridge.

@Matt8119 yes it is self contained. No need for an Android device! Anyway, I not sure what you mean about the port thing but you just put the plugin in discovery mode and it finds the broad link. Click it and press learn a code. Use rm or rf . Then press the settings cog and then right click and copy the URL that's there.
Also, I had to assign a static IP from my router to my broadlink as it kept giving it a different IP and so heeding couldn't find it. I'll do a guide when I get round to it of you want
Thanks
Jev

@jevtheboss I'll be sure to remember those things! It's seems quite straight forward with a friendly UI compared to command prompts. A tutorial wouldn't hurt! When you get the chance.. thanks!

Matt

What a pain ... I was searching for the plugin on github but wasn't able to find anything. So I installed Jeedom using docker which was quite simple and straight forward as described in the docs.

When switching the UI to any other language nothing happend. So I had to use a translator ... uhm. Indeed the plugin is available in the store but also this is only french. I had a look at the code - it has a Python based daemon to communicate with the Broadlink and a mixture of PHP/JS for the web-parts.

Since the plugin is delivered under the GNU v2 license it could be re-used for other projects as well. I pushed the current version to github to start playing with it once I have the RM pro.

UPDATE: The plugin is available here - no idea why wasn't able to find it

@tyjtyj Unfortunately, that java library is incomplete. Commands are not yet defined.

Ok Guys and @Matt8119
So this is what I did to use my broadlink with HA bridge. I figured this out (it took me ages) and requires some patience and common sense. THIS METHOD DOES NOT REQUIRE AN ANDROID DEVICE
I ran all this on the very first model raspberry pi (very old but works fine)but i assume you could use this on any
Anyway,

  1. Download the jeedom iso here. Click the one that has the words raspberry pi in it.
  2. extract it and flash the image onto an sd card using etcher or win32diskimager
  3. plug it into ethernet (you can set it up for wifi later but theres a delay when using commands with Alexa) and then plug in the power
  4. Find the ip adress of the pi and go to it in aweb browser
  5. You should see a whole setup-download script happening, it takes about an hour so sit back and have a coffee
  6. Then eventually you'll see a jeedom login page. At this point you want to set your raspberry pi with a static ip adress. If you dont know how go here
  7. Also, you need to assign a static ip adress to the broadlink as many routers change ip adresses for connected things on reboot, and then you would need to manually change it in the jeedom settings so it can talk to the broadlink. This varies between routers but look for something like DHCP Reservation as you cant set a static ip in the broadlink app as far as I know.
  8. Then load up the new static ip of the rpi (preferably in chrome because it has built in translation) and login with admin as username and password
  9. also, you cant change the language of the jeedom for some reason
  10. Then you want to press the person icon in the top right and tick mode expert or expert mode
  11. reboot your pi using putty. The shh username is root and password is Mjeedom96
  12. Then press the settings cog and press configuration (top one)
  13. Then press network configuration and type in the ip adress of your pi and port 80 in the field internel access and external access.
  14. Scroll down and press save.
  15. Then press plugins -> plugin magagement and press the cart
  16. search for broadlink and press install
  17. Then go into plugins > plugin management again and press broadlink.
  18. I dont remember exactly but press a button that says something like download or activate or something and wait for that to finish. It should say status ok and configuration ok
  19. then press plugins -> protocole domotiqe and then broadlink
  20. click mode inclusion. Wait a while and your broadlink device should appear under Mes équipements broadlink or my broadlink equipment
  21. Click on it and press learning an order
  22. Point your ir or rf remote at it and press it once and it should detectet it. If not try a few methods. Then you should be redirected to a page. Under the name column, the box opposite icon, give a name for the code it just learned. Press save.
  23. At this point, install, ha bridge using putty username is root and password is Mjeedom96. I had a few tries to get it working. Also, add it to startup script so ha bridge automaticly starts every boot (here) and make sure you set it to start on a different port ( i use 8080)
  24. Go back to the command grid and press test to see if its working. if it isnt, learn the code again
  25. If it is, press the cog and right click where it says url and copy the link adress.
  26. Go to your ip adress and : then the port you set for ha bridge
  27. Press Add/Edit
  28. Type a name for the device you are controlling, and in device type, select custom
  29. Then go to on items. Paste the link to turn on the device in target item. If you want it to execute multiple commands, press add at the end and paste another url and for some reason, you need to press add and leave a blank entry under your others and make the delay 1000 for your second command
  30. repeat for the off commands and scroll backup and press add bridge device.
  31. Now just say alexa, discover devices and it should say its found 1 smart home device.
  32. Now say alexa, turn on/off (device name) and it should do it!
  33. Sucess 👍
    Hope this helps,
    Any questions, just ask
    Jev

@jevtheboss perfect, these are extremely detailed!!! i already went ahead and ordered a second PI3 from modmypi.com in the UK just so if i run into any issues on my main PI that the Ha-bridge is running on, incase of any issues i may run into or just format the SD card if need be... not sure if you have yours up and running yet, but could you post a few examples of what your commands look like?

much appreciated!

matt

I used this https://github.com/davorf/BlackBeanControl which is a much lighter approach

I read the readme.File and didn't see anything about the discovery process... Do you have any experience using it?

All of the groundwork is done using https://github.com/mjg59/python-broadlink - can already be installed using pip install broadlink. Getting your devices ... yeah, that part is missing from the BlackBeanControl.

You can use search-bl.sh listed here https://wiki.fhem.de/wiki/Broadlink - of course you could use all the scripts there but the BlackBeanControl is more user friendly.

Extracting existing codes also works using this https://github.com/NightRang3r/Broadlink-e-control-db-dump

Having to install four different java files, On top of all the separate command line needed, seems a bit much just to control an ir/rf plug etc... I appreciate the input, but I'll stick with jeedom. Being, it's one program with only a separate plugin and the UI is just way more friendly vs all those command lines id need and jumping back and forth between Java files. I can just see something going wrong and not knowing how to remedy it, without to just start all over again....

I'm using the broadlink mqtt setup and couldn't be happier.

Simple mqtt client running and it just works, also windows friendly.

On 20 Mar 2017 10:59 p.m., "Matt8119" notifications@github.com wrote:

Having to install four different java files, On top of all the separate
command line needed, seems a bit much just to control an ir/rf plug etc...
I appreciate the input, but I'll stick with jeedom. Being, it's one program
with only a separate plugin and the UI is just way more friendly vs all
those command lines id need and jumping back and forth between Java files.
I can just see something going wrong and not knowing how to remedy it,
without to just start all over again....


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/bwssytems/ha-bridge/issues/236#issuecomment-287924581,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACkXzax72PokMljoDCY3s_kSNNxVyRzkks5rnwTagaJpZM4KwOgk
.

All, i am working on bringing this in with a java library i am contributing to, soon.....

@Matt8119 Hi,
Sorry for the long reply, ive been super busy! Anyway, the method I have come up with is probably the simplist way to go at the moment. Yes I have mine up and running and it works flawlessly. I love it and its very handy. And it didnt cost much too. Think of jeedom being the android bridge for the other methods, then the commands from that go to ha bridge, but its all on the same pi.
Anyway, when you say, but could you post a few examples of what your commands look like, do you mean the ha bridge ones or the jeedom code ones. Or the code that installed jeedom. Also, the method to make ha bridge start wouldnt work with me, I had to tweak the script thing a bit. Ill post the jeedom and ha bridge codes anyway, If you want different ones, just ask me
jeedom
ha bridge
ha bridge multiple

If you just wanted to know about creating the ha bridge device, its very simple, all you do is paste the link you copied into the call like I did in the picture. Thats it. You dont have to select anything for the type.
Anyway, thanks,
Jev

@jevtheboss - Awesome, except I can't work out how to install ha bridge from the jeedom root. So i currently have a pi running jeedom and a pi running ha bridge.
Can anyone help ?
@bwssytems - your work is amazing = big thanks !!
Regards - Neil

@N3ilG Okay sure. So basically, download putty and open it. Type in the ip of your pi and put in the user name root and the password Mjeedom96. Then, you have the terminal to your pi. Then, just run the same commands as you did to get ha bridge running on your other pi. For more help go here and use those commands.

fyi, domoticz also has plugin for broadlink.
http://www.domoticz.com/wiki/Plugins/BroadlinkRM2.html

and ha-bridge has great domoticz support.

@farhanito oh yeah, didn't see that. I discovered the jeedom way before the domoticz plugin was released. I tried domoticz first but yeah, seems like it works now.
So if you want, yes you can use domoticz. It's a lot easier to install and its English.
Jev

@jevtheboss - thanks for your help [again]. I think I installed it, but how do I access it - do I need to change a port ?
Sorry I'm so dim !!
Neil

@farhanito - is there an idiot's [me] guide to installing the Broadlink plug in for Domoticz ?

Regards - Neil

@bwssytems Any news you can share with us on the progress of the java library for this?

Hi @N3ilG
Sorry for the late response. Anyway, yes you do need to change the port of ha bridge. Jeedom automatically installs to port 80 which is the default port and you don't need to type port 80, so you can access it at 192.168.x.xx. when the port is anything other than 80, you need to type it into the web address, so in the guide I pointed you to, it shows you how to run ha bridge on a different port somewhere. Change it to a port like 8080.Add that to your startup script and reboot. Now you should be able to access ha bridge from 192.168.x.x:8080.
Hope this helps,
Jev

Fixing bugs currently....

Not sure if anybody is watching this but Broadlink have released a new app IHC and it provides integration between the Amazon Echo and the Broadlink unit.

You have to enable the skill in the Alexa app and then you can discover the devices on the app..
https://www.youtube.com/watch?v=9zJajWNpgMA

I've run this but the skill only works for AV IR IHC will learn RF but the skill currently won't do them.
TVs are the only things the skill works with properly but you can perform a work around so it finds other IR devices. to do this you have to tell IHC to add a TV then go through the Add process until you get to custom. Once done you can rename it DVD/SAT/Reciever.....

@bwssystem
Great work on the bridge, any word on the progress for adding the broadlink to your bridge?

Nothing yet, still working on 5.0.0 issues

So, I am still having a moment here on whether this fits in this space. The ha-bridge wants to be able to find and call concrete things. In the RM2/3 world, you have to build these through learning and saving the ir packets. The ha-bridge is not a device level controller as many home auto systems already support device level.

I don't think the Bridge needs to learn and save there are any number of programs one can use to find the IR or RF packets.
The end user can place those in a on/off send.
From what I understand a uid needs to be sent with the commands or the RM will ignore the call.

@bwssytems FYI these Broadlink devices use the QUIC protocol https://en.wikipedia.org/wiki/QUIC

"Not sure if anybody is watching this but Broadlink have released a new app IHC and it provides integration between the Amazon Echo and the Broadlink unit."

As has been mentioned, this only works for InfraRed devices, so if the HA bridge could handle it with RF, that would be awesome.

Cheers!

So, OpenHAB supports Broadlink/RM2 and I have started the OpenHAB implementation. Since this is device level, I will leave that up to OpenHAB.

So we'll only see this if we use OpenHAB?

Yes. I'm trying to have the bridge be a bridge between it's Hue API and other Home Automation systems.

Other automation systems meaning OpenHAB, or nothing else? That's disappointing.

I guess it's time to look at the RM bridge, because after trying OpenHAB, I don't think it's anywhere near polished enough to consider switching to.

Just my opinion, of course, and thanks for your work.

OpenHAB as I understand it has its own hue interface so I'm not sure why OpenHAB users would need special HA-Bridge interfacing. Add me to the disappointed list.

I don't think most users were expecting the Bridge to learn and save IR and or RF codes we ( I ) just wanted to be able to send codes already found to the Broadlink directly with out requiring another server.

The unfortunate thing is there are a dozen different types of devices that everyone one wants and the work is already done in other systems. Just trying to get the most bang for the buck in additions. I'll keep this on the list and will look at putting this in.

@bwssytems

I'll keep this on the list and will look at putting this in.

Thanks for that!
The way I see it the Broadlink is no different then the Harmony, Vera, or Hue hubs other Software systems have support for those and most likely pulled the code for HA-Bridge.

You done a great job on HA-Bridge and I don't think you should be improving someone else's work!
Adding support for a software is not what you should be doing!(sorry just my opinion) those softwares should be adding support for the HA-Bridge.
It isn't hard to add support for the HA-Bridge to a software if the developer is serious enough.
I and a few others have done it.
HA-Bridge will just get bloated with code that over 60% of users don't need or use if you keep adding support for other programs. I'm not sure why a user would stick with HA-Bridge if another system had the options they wanted.
Sorry If it sounds like I'm coming down hard on you and all your hard work that's not my intention.

There is a complete broadlink package for java already. https://github.com/mob41/broadlink-java-api

This will be in v5.2.0. The next release candidate of 5.2.0RC6 will include it for testing.

Awesome!! You just made my day, week, month, & year!

I've switched to using hass.io and emulated_hue which still works with my Echos. I've got a friend with Google home and local hue traffic is now disabled, it's all cloud based.

@bwssytems when will RC6 be available?
I can't wait to test!

New Jar is out in thread #863

OK Have the new jar but unsure how the Broadlink is supported.
Don't tell me I need another server app :(

Tuicemen any progress wrt testing this jar?

I've not been able to do to much as I've been busy with other things.
Since I've now about got them cleaned up I 'll spend more time on this. I have to look at port forwarding options for the Broadlink.

@quadhammer Have you tried the RC test jar yet? Want the vocal members of this request to test the implementation.

Everyone who posted to this thread should be testing the RC build.
Currently it looks like only two of us are interested in its implementation. :(

If that's the case bwssystems might as well stop trying to implement it.

Ill have a look at testing it tonight after work

@bwssytems Yes, I've tested it with no luck. I'll respond on https://github.com/bwssytems/ha-bridge/issues/863

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haymaan picture haymaan  ·  124Comments

painkillerde picture painkillerde  ·  46Comments

Ulisus picture Ulisus  ·  52Comments

pickeld picture pickeld  ·  61Comments

emiliosic picture emiliosic  ·  36Comments