Configuration of Broadlink IR Device and getting the right IR codes

Put the Broadlink into learning mode then blast from the SURE app.

Hi there,
I’ve now successfully converted the HEX code to a Pronto HEX code and followed your steps to try and generate a usable code (such as “JgBGAJKVETkRORA6…AAA==”).

I’m running Windows 10 and when I call the Python script I get this syntax error:

Line 52 of my broadlink.py file is: ‘print base64.b64encode(packet)’

Any ideas please?

Also tagging @rutberg who I believe had the same issue. Thanks

On the site repl.it you can run Python scripts online. Also you can pick previous Python versions to run against. From memory, I think v2.7 worked for me.

Thanks @Emphyrio. I’ve found how to run scripts using Python 2.7 in repl.it and tried the following (and tried a number of variations):

To the experienced eye, it’s probably obvious what I’ve done wrong, but as I’m not a developer any guidance is welcome!

I’m not at my computer atm, so I’m unable to try for you. I would try different versions of Python on that site.

Thanks again @Emphyrio, but I tried running the command against every Python version/type on repl.it and they all complained about Line 1 of the script, e.g:

Python v2.7 error is: ‘File “”, line 1’
Python v3.7.4 error is: ‘ImportError: No module named binascii on line 1’

Just checked and Line 1 is: ‘import binascii’.

For completeness, this is the command I’m trying:
python main.py “0000 006C 0000 0022 00AD 00AD 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 06FB”

I have a working script on my pc. Just can’t reach it right now. I can help you in a week. Or just look for a different script, I think it was called broadlink.py.

Or if someone else can jump in?

For the interested, I have developed a bridge and and add-on so you can just use the Pronto hex codes directly: https://github.com/lbschenkel/hass-addon-broadlink-bridge/tree/master/broadlink-bridge

For the more technically inclined, the bridge can be used with IrScrutinizer so you can play with the IR codes and send them directly to the Broadlink devices from the app itself.

1 Like

oh that sounds good, will check it out thanks!

I don’t mean to hijack this thread, though, so feel free to continue on a dedicated topic I created for this purpose: HTTP/MQTT/LIRC bridge for Broadlink devices, supports Pronto hex codes. I just wanted to share this with others with similar struggles, because I was just sick of dealing with the damn Broadlink codes. I hope it’ll be useful to you too.

Your code. Did run the script on a linux machine:
JgBGAJOTEjcSNxI3EhISEhISEhISEhI3EjcSNxISEhISEhISEhISNxISEhISEhISEjcSNxISEhISNxI3EjcSNxISEhISNxIABfgNBQ==

Thank @ReneR. It seems that I can’t get the Python script to run properly online or when using a Windows machine. Will try on a Linux machine at some point. Appreciate your help here, thanks

anybody still struggling: https://github.com/elupus/irgen available as pip install irgen

1 Like

I don’t know if this thread is already closed, but if anyone needs it this is how I have solved the problem with the Pioneer receiver VSX-324 part of HTP-072 Home theatre system, which when learning on Broadlink rm mini had quite long codes that worked fine, but when I would convert the pronto discrete codes that I needed for just ON or just OFF (no toggle) I would get short codes that didn’t work. I think I have tried all the conversion variations i found online, but in the process of a few days of different variations no solution worked for me. I use a homebridge / hoobs but I assume the same code goes into the homeassitent as long as you use a broadlink device as an ir blaster. These are the steps that worked for me, so I hope someone might find it helpful:

First I found the pronto discrete codes I needed, there are several good resources on the internet to find, and these are some of them:

Remotecentral, Global Cache

Then I put those codes into the IrScrutiniser app.

In the application, click on Paste & Scrutinize and in the export settings set the Pronto Hex Oneshot format and be sure to put # repeats on 5, click on export and copy the resulting code.

The code you got with the export you need to clean from spaces. One way to clean the code is find and replace in some text editor or go to:

http://tomeko.net/online_tools/hex_to_base64.php?lang=en and convert to Cleaned input, we are not interested in base64 but we copy the cleaned code.

Put the copied cleaned code into this phyton script: https://www.jdoodle.com/embed/v0/eBD , the code you get after execution is the code you put in your bridge that you use.

Hope someone will find this helpful.

1 Like

Hello, anyone know how to convert Base64 codes to RAW?
Es para convertir BroadLink to XIAOMI

Thanks !

This worked so great, thank you!

  1. Install the package

pip install git+https://github.com/elupus/irgen.git#egg=irgen

  1. Find the device on http://irdb.tk/find/
  2. Select ‘Raw’
  3. Use in the terminal like

python3 -m irgen -i raw -d +9024 -4512 +564 -1692 +564 -1692 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -564 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -564 +564 -564 +564 -564 +564 -564 +564 -1692 +564 -1692 +564 -1692 +564 -40884 -o broadlink_base64
  1. Get perfect output like this:
    JgBIAAABKJQTOBM4EzgTExMTExMTExM4EzgTExM4ExMTExMTEzgTExMTEzgTOBM4EzgTExMTExMTOBMTExMTExMTEzgTOBM4EwAFPw==
  2. Simply use in Home Assistant
- platform: broadlink
  mac: 24:DF:A7:7A:8E:51
  switches:
    projector:
      friendly_name: Projector
      command_on: JgBIAAABKJQTOBM4EzgTExMTExMTExM4EzgTExM4ExMTExMTEzgTExM4ExMTOBM4EzgTExMTExMTExM4ExMTExMTEzgTOBM4EwAFPw==
      command_off: JgBIAAABKJQTOBM4EzgTExMTExMTExM4EzgTExM4ExMTExMTEzgTExMTEzgTOBM4EzgTExMTExMTOBMTExMTExMTEzgTOBM4EwAFPw==

I have a Panasonic UN75J6300. I am having an awful time trying to find a working device id for the Broadlink RM4 Pro to use in home assistant. Can anyone confirm a working device id?

Edit: ya, this was a dumb question. I thought from looking at dev tools/services that the device field was a code you typically need for universal remotes (device Device ID to send command to 32756745). After playing around I figured out it is a free form field. Hopefully this saves someone else from pulling their hair out :wink:

Also, I am using the app as well as able to learn and use codes through HAss. Most of the stuff on the web is very outdated since broadlink became an official integration!!!

hi…

can you send me this two codes (just ON and just OFF - no toggle) in base64?
[email protected]

thank you very much…

2022 update…

I found pronto format codes and wanted them in Broadlink base64 format. IRGen conversions here worked fine in Pytthon 3.8.

python -m irgen -i pronto -o broadlink_base64 -d 0000 006d

1 Like

Hi there!

I’ve been using broadlind and home assistant for some time. I managed to discover the codes corresponding to my Panasonic TV during a period of time when I had an Android phone.

Today I tried capturing the corresponding codes to my Cambridge CXA61 amplifier and after trying multiple options, I managed to sniff the “mute” command using the Node-Red option: Broadlink - Home Assistant

This is what the sniffed code looks like:

38,0,48,0,27,31,58,59,56,31,28,30,27,31,29,30,27,32,27,58,28,31,57,60,27,0,11,123,31,28,56,59,59,30,28,30,28,29,29,29,29,30,29,59,28,30,56,60,29,0,13,5,0,0,0,0,0,0,0,0

I tried converting it to broadlink_base64 using irgen but I did not succeed. Whichever input type that I tried, resulted in an error.

Also, at some point I read that an HA add-on was available but I did not manage to find it in the list of available add-ons after including the repo in my setup: Home Assistant repo added but add-on not found · Issue #66 · t0mer/broadlinkmanager-docker · GitHub

Could somebody help me understand what sort of code format did I sniff, and how I could include it in my configuration.yaml?

Note that by using node-red I managed to sniff the code and I also managed to verify it works using the guidance in the documentation:

I thank you in advance