Control universal remote control Broadlink by Openhab
Control all your IR enabled devices with Broadlink rm3 mini through Openhab
Based on Cato_Sognen bindings and tutorial
https://github.com/mgwoj/org.openhab.binding.broadlink
https://community.openhab.org/t/broadlink-binding-for-rmx-a1-spx-and-mp-any-interest/22768/56?u=x-ray181
Go to Paper UI in the Add-ons->Transformation install Map Transformation if you dont have it yet.
Download broadlink bindings. You can grab the latest here or search through the openhab community link from the top.
Move the jar file into openhab\addons\
Search in PaperUI->Inbox for Broadlink (if binding is not visible try restart openhab service)
New thing should appear in the Inbox. Add it as a Thing.
Now thing configuration:
“For each device you are required to enter a common Authentication Key and IV parameter.
These were obtained and shared by someone who reversed engineered the protocol and such due to legal reason I cannot post these two items here.
If you do not have these two then Google is your friend.
Both need to be entered in hex string format by omitting the 0x.
For example, if the key is something like 0x09, 0x76, 0x28… you will enter this as 097628… Once done, you should have two hex strings, each with a length of 32 characters.”
link for the Key and IV parameter
in here also insert the broadlink.map this will be file holding all your IR codes.
create new item in your items file (openhab\items\default.items)
String name_of_your_item "Shown_name" (group_if_wanted) { channel="your_thing _channel:command" }
here is where you get your thing channel
example:
String IR_CONTROL "IR Control" (IR_Control_group) { channel="broadlink:rm3:78-0f-77-5a-c7-04:command" }
Now we can start learning the codes and adding them into the broadlink.map file (openhab\transform\broadlink.map)
first install android application (RM Bridge) which will create bridge to network where your broadlink remote is. here
go to http://rm-bridge.fun2code.de/rm_manage/code_learning.html
insert IP and port shown in the RM Bridge Android app.
For RM3 mini you have to use workaround:
Fill in a name (whatever), the MAC address of the RM mini 3, specify RM2 as type and press the Add Manually button. (you can see MAC address in the PaperUI, Configuration -> Things -> Edit -> Broadlink RM3 -> Show more)
Then choose your remote from Device list.
Now click learn code. On the RM3 mini led light will start blinking.
Point remote control to RM3 and push button which you want to learn.
on the page you will see something like this:
{“api_id”:1004,“command”:“send_code”,“mac”:“B4:43:0D:38:FA:9D”,“data”:“260068000001289314101312143513121411131213111411133613361510143614351336143614351411133615101411131213111313131014361412123712361436133615351435140005230001274815000c4d0001284a12000c4d0001284915000c4b00012a4814000d05”}
copy only the part in the last quotes and inset it into the broadlink.map file. Where TV_POWER_ON is the command name you will use from sitemap or rules.
TV_POWER_ON = 260068000001289314101312143513121411131213111411133613361510143614351336143614351411133615101411131213111313131014361412123712361436133615351435140005230001274815000c4d0001284a12000c4d0001284915000c4b00012a4814000d05
here is example of my broadlink.map:
TV_POWER_ON = 2600580000012991151014101535141015101410151014101436143515101435153514361436143515101410141114101410151014101510143515351436143515351436143515351400051e0001294814000c490001294814000d05 TV_POWER_OFF = 2600500000012991150f151014351510151014101411141014351535150f153515351435153515351410151014101535141015101410150f153515351435151015341535153515351400051e0001294715000d050000000000000000 PROJECTOR_ON = 2600b00100012b90163515351510151016101510151015351535161015351510153516101535151015101511151015101535151015111535153515351535163515101535153516101500052500012c90153515361510151015101510161015351535151015351610153515101535151115101510151015101535161015101535153515351635153515101535163515101500052500012c90153516351510151015101510161015351535151015351610153515101535151115101510151015101635151015101535153516351535153515101536153515101500052500012c90153615351510151015101610151015351535151115351510153515101536151015101510151015111535151015101535163515351535153515101635153515101500052500012c90153516351510151015101510161015351535151015351610153515101535151115101510151015101536151015101535153516351535153515101535163515101500052500012b911535153515101610151015101510153516351510153515101536151015351510151015111510151015351510161015351535153515351635151015351535151115000d050000000000000000 PROJECTOR_OFF = 2600f80100012c90153516351510151015101511151015351535151016351510153515101536151015351510151015111535151015101535161015351535153515111535153515101500052600012b91153515351510151115101510151015351536151015351510153516101535151015351511151015101535151015111535151015351535163515101535153515111500052500012b91153515351610151015101510151115351535151015351610153515101535151115351510151015101635151015101535151115351535153515101536153515101500052600012b90153516351510151015101511151015351535151015361510153515101535151115351510151015101536151015101535151015361535153515101535163515101500052500012b91153515351511151015101510151015351635151015351510153516101535151015351511151015101535151015111535151015351535153615101535153515101500052600012b90163515351510151015111510151015351535151115351510153515101535161015351510151015111535151015101535151016351535153515101535153615101500052500012b911535153515111510151015101510153516351510153515101535161015351510153515111510151015351510151115351510153515351535161015351535151015000d05 SCREEN_UP = 2600c6002b0d2a0d2a0d2b0d11261028112710270f280f292a0d11270f282b0d11262b0d280f2a0e0f282a0e2a0d2a0d11272a0d290f10272a0e0f282b0d0f2811272a0003d92c0c2a0d2b0d2a0d112710270f290f280f2910272a0d11270f292a0d0f28290f290e290f0f28290f280f290f0f28290f280f0f29280f0f29280f0f281028290003db2a0e280f290e290f0f280f290f280f290f280f29280f0f290f28290f0f28290f280f290e0f29280f290f280f0f29280f290e1028290e0f29290e0f290f2829000d050000 SCREEN_DOWN = 260084002b0d2a0d2a0d2b0d112611271126112711262b0d1126112711262b0d11262b0d2a0d2b0d2a0d11272a0d2a0d2b0d11262b0d2a0d0f2911262b0d112611272a0003d92c0c2b0c290f2a0d112711260f2911260f292a0d112711260f29290e0f29290e290f280f290f0f28290f280f290f0f28290f280f0f290f28290e10280f2928000d0500000000 SCREEN_STOP = 260084002c0d2a0d2a0d2b0d11261127112611271126112711262b0d11262b0d11262b0d2a0d2b0d112611272a0d2b0c1127112710272b0c2b0d2a0d2b0d11261127110003fa2b0d2a0d2b0c2b0d1126112711260f2911260f290f28290f0f28290f0f28290f280f290f0f280f29280f290e0f290f280f29290e290f280f290f0f280f2810000d0500000000 SETOBOX_OFF = 26007200573b2c060f0718120d070f060f070f060f070f060f0610060f0610060f070f060f0610060f0718120d060f070f0619112c070f060f110e0009da583b2c06100618120d070f060f070f060f070f070e070f060f070f060f070f060f070f060f0718120d0610060f0619112c0724120d000d05000000000000 SETOBOX_CH3 = 2600ae00553d15090b0a0c0817140b0a0b090b0a0b0a0b090b0a0b0a0b090b0a0b0a0b090b0a150a0a0a0b0a0b140b0a161416151614150a0b140b0009dd573d140a0b0a0b0916150b090b0a0b0a0b090c080c0a0b090c080c0a0c080a0c0a0a15090c080c0a0c130b0a16141713161515090b150c0009dc543d150a0b090b0a16150a0a0b0a0b090c090b0a0b090b0a0c080c090b0a0b0a0c08150a0c080b0a0b150b09161615141615140a0c140a000d0500000000000000000000 AVR_ON = 260088004f131313131327132614261327132613131413131313131327132613141313000293501313131313271326142613271326131314131313131313271326131413130002934f13131314132613271326132713261314131313131313142613261413131300029350131313131327132613271326142613131314131313131327132613141313000d05 AVR_OFF = 26008800501128121313281215112911141313131313151213131313261427131413130002b44f1327141313261413132713141313131313131314131313261426141313140002b44e1326141313271314132614131313131413131313131313271426141511130002b450132614131327131413281213131313131314131313131327132714131313000d05 AVR_1 = 260084004f121313271426141313261413131413131313131313141326141313131314132614131326141313140001ef50131313271327131413261413131313141313131313131327131413131313132713141326141313130001f04e13131326142614131328121512151115111512141215112812151115121511281215112812151215000d0500000000 AVR_2 = 260088004e1326142614131313141313131313131413131313131313271426141313270002b4501326142614131313141313131313131314131313131313271327141313270002b44f1227132713141313131313131314131313131313131413261426141313270002b54f132614271313141313131313131413131313131313141326142614131327000d05 AVR_3 = 260088004f131313131327132614261327132613131413131313131327132613141313000293501313131313271326142613271326131314131313131313271326131413130002934f13131314132613271326132713261314131313131313142613261413131300029350131313131327132613271326142613131314131313131327132613141313000d05 AVR_PRESET3 = 2600cc0051111612291216112a112a11161229121611161216111612291229121611160002ad51111612291216112a12291215122a11161215121612151229122a111612150002ad511215122a1116122912291216112a1215121611161216112a112a121512160002ad501216112a1215122a112a11161229121611161216111612291229121611160002ad51111612291216112a12291215122a11161215121612151229122a111612150002ad511216112a111612291229121612291215121612151216112a122912151216000d05000000000000000000000000 AVR_PRESET2 = 26008800511229121612151229122a11161229121611161216111612291229121611160002ad51112a12151216112a12291216112a1116121611161215122a112a111612160002ac5112291216111612291229121612291215121612151216112a1229121512160002ad51112a11161216112a112a1215122912161215121611161229122912161215000d05 SETOBOX_ON = 26007c00553d140a0c0a0b0c13140c090b0b0b0b0a0b0b0a0b0b0c0b090c0a0a0b0b0b0a0b0b0b0a0b0b0b0b14140c090b0b0b0a1513150a0b0b0b0a0b130c0009dd553e140a0c0a0c0a14140c0b090b0b0a0b0b0b0a0b0b0b0a0b0b0b0a0b0b0b0a0b0b0c0b090b0b0c13140c090b0b0b0a1414150a0b0a0b0b0b130c000d05000000000000000000000000 SETOBOX_ON1 = 26006200573c621200015312571258120d0009d8573c621200015312581257120d0009d8573c621200015412571257120d0009d8573c621200015412571257120d0009d8573c621200015412571257120d000941573c62125712eb12571218122d120d000d05000000000000 SETOBOX_ON2 = 26005000573d621200015312571258110e0009d7573c631200015312571258110e0009d7573d621200015312571258120d0009d7583c621200015312581158120dc0573c63115812ea12571218122d120e000d050000000000000000 SETOBOX_ON3 = 26005000573c631200015312571258110e0009d7573d621200015312571258110e0009d7573d621200015312571258120d0009d8573c621200015411581257120dc0573d62125712ea12581119112e120d000d050000000000000000 SETOBOX_ON4 = 26003201553e160a0b0a0b0a16140b0a0b0a0b0a0b0b0b090b0a0c090c090c090c0a0b0a0b0a0b0a0b0a0b0a16140b0a0b0a0b0a1614160a0b0a0b0a0b140b0009db553e160a0b0a0b0a16140b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a16150a0a0b0a0b0b1614160a0b0a0b0a0b140b0009da553e160a0b0a0b0a16140b0a0b0a0b0a0b0b0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a16140b0a0b0a0b0a1614160a0b0a0b0a0b140b0009da553e160a0b0a0b0a16150b090c090c090b0b0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a16140b0a0b0a0b0a1614160a0b0a0b0a0b150a0007bf553e160a0b0a0b0a16140b0a0b0a0b0a17140b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a0b0a16140b0a0b0a0b0a16141614160a0b140b000d05000000000000
Now in the sitemap you can control your devices like this:
Switch item=IR_CONTROL label="TV[]" icon="screen" mappings=[TV_POWER_ON="ON", TV_POWER_OFF="OFF"]
Some devices as a settopbox require double IR signals to work properly. Learn the code from one button more than once (everytime it was different IR code from same button for me). save it in the broadlink.map under different codes (in my case power button: SETOBOX_ON3 and SETOBOX_ON4).
Then i created rule file as this (openhab/rules/IR.rules):
rule "rIRsetobox" when Item SETOBOX received command then logInfo("rIRsetobox", "command "+receivedCommand) switch (receivedCommand) { case ON : { IR_CONTROL.sendCommand("SETOBOX_ON3") IR_CONTROL.sendCommand("SETOBOX_ON4") } case OFF :{ IR_CONTROL.sendCommand("SETOBOX_ON3") IR_CONTROL.sendCommand("SETOBOX_ON4") } } end
items:
Switch SETOBOX "Settopbox" (IR_Control_group)
sitemap:
Switch item=SETOBOX label="Set Top Box[]" icon="player" mappings=[ON="ON", OFF="OFF"]
“Move the jar file into openhab\addons\” – how do we do this? SSH into raspberry pi? I can only find openhab2 folder inside.
If you already set up Openhab share it is openhab2-addons
the full path of mine is here
/usr/share/openhab2/addons
you can find more in the Openhab documantation
https://www.openhab.org/docs/installation/linux.html#file-locations
VERY IMPORTANT: make sure you’ve installed the Map transformation add-on (it’s a separate element to the Broadlink binding and needs to be explicitly installed);
in PaperUI: Add-ons -> Transformations -> Map Transformation
Absolutely, by the way it is almoust first line in the article