Broadlink RM-PRO and TC2 switch

In my case, restart of HA solved the learning issue.

Hi guys

Thankful to every one who can point me in the right direction.
I have been trying to connect the TC2 from broadlink via HA.
Unfortunately I had no luck.
The broadlink component could not learn the necessary code. It either learned something that did not work or nothing at all.
I have a bunch of other IR switches set up and all work fine.
The TC2 is RF and I could not set it up.
I read and tried everything on the forum.
Here is what I did as a last resource.
I backed up the data inside the android econtrol application, than downloaded the json file: jsonIrCode file.
Inside I could find a bunch of codes from which I think the last once could be those for the TC2.
Unfortunately they have been written in another code than the one HA is accepting.
I have got these lines
[38,0,54,0,-18,-107,-23,111,113,109,46,-114,-104,11,11,9,38,-88,-57,14,52,71,66,0,1,9,36,0,1,41,17,0,1,56,14,0,1,63,11,0,1,58,8,0,1,64,13,0,1,56,13,0,1,63,12,0,13,5,0,0],“delay”:0,“order”:0,“name”:""},{“buttonId”:5,“id”:5,“code”:[38,0,30,0,16,77,12,8,15,0,1,-35,10,0,1,73,8,-61,21,9,12,50,16,61,27,120,15,0,5,19,6,0,13,5,0,0,0,0,0,0,0,0,0,0],“delay”:0,“order”:0,“name”:""},{“buttonId”:6,“id”:6,“code”:[-23,20,70,0,-33,9,9,22,22,9,9,22,9,22,9,22,22,9,9,22,9,22,22,9,22,9,22,9,22,9,22,9,9,22,22,9,9,22,22,9,22,9,22,9,9,22,9,22,22,9,9,22,9,22,9,22,9,22,9,22,22,9,9,22,22,9,9,22,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:7,“id”:7,“code”:[-23,20,70,0,-33,9,22,9,22,9,22,9,9,22,22,9,22,9,22,9,9,22,9,22,9,22,9,22,9,22,9,22,9,22,9,22,22,9,22,9,22,9,22,9,9,22,9,22,22,9,9,22,22,9,9,22,22,9,22,9,22,9,22,9,9,22,9,22,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:8,“id”:8,“code”:[-23,20,70,0,-33,9,22,9,22,9,9,22,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,22,9,22,9,22,9,9,22,9,22,22,9,9,22,9,22,9,22,22,9,9,22,22,9,22,9,22,9,9,22,22,9,9,22,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:9,“id”:9,“code”:[-23,20,70,0,-33,9,22,9,9,22,9,22,22,9,22,9,9,22,22,9,22,9,22,9,22,9,22,9,9,22,9,22,9,22,22,9,9,22,9,22,9,22,9,22,22,9,9,22,9,22,9,22,22,9,9,22,9,22,9,22,22,9,9,22,22,9,9,22,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:10,“id”:10,“code”:[-23,20,70,0,-33,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,22,9,9,22,22,9,9,22,22,9,22,9,22,9,9,22,22,9,9,22,22,9,22,9,22,9,9,22,9,22,22,9,9,22,9,22,22,9,9,22,22,9,9,22,9,22,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:11,“id”:11,“code”:[-23,20,70,0,-33,9,9,22,9,22,9,22,9,22,22,9,9,22,22,9,22,9,22,9,9,22,22,9,22,9,22,9,22,9,9,22,22,9,9,22,22,9,22,9,9,22,22,9,9,22,22,9,22,9,22,9,22,9,9,22,9,22,9,22,22,9,22,9,9,22,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:12,“id”:12,“code”:[-23,20,70,0,-33,9,9,22,9,22,22,9,9,22,9,22,22,9,9,22,22,9,9,22,22,9,9,22,9,22,9,22,22,9,9,22,22,9,9,22,22,9,22,9,9,22,22,9,22,9,22,9,9,22,9,22,9,22,22,9,22,9,22,9,22,9,9,22,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:13,“id”:13,“code”:[-23,20,70,0,-33,9,22,9,9,22,9,22,9,22,22,9,22,9,22,9,9,22,22,9,22,9,9,22,22,9,22,9,22,9,9,22,9,22,9,22,22,9,9,22,22,9,22,9,9,22,22,9,9,22,9,22,22,9,22,9,9,22,9,22,9,22,9,22,9,22,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:14,“id”:14,“code”:[-23,20,70,0,-33,9,9,22,9,22,22,9,9,22,22,9,9,22,9,22,22,9,9,22,22,9,22,9,9,22,22,9,9,22,22,9,9,22,22,9,9,22,22,9,22,9,22,9,22,9,22,9,9,22,22,9,22,9,22,9,9,22,9,22,22,9,22,9,9,22,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:15,“id”:15,“code”:[-23,20,70,0,-33,9,9,22,9,22,22,9,9,22,9,22,22,9,22,9,22,9,9,22,22,9,22,9,22,9,9,22,22,9,22,9,9,22,22,9,22,9,22,9,22,9,9,22,22,9,22,9,9,22,22,9,9,22,9,22,9,22,9,22,9,22,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:16,“id”:16,“code”:[-41,10,70,0,-33,9,9,22,9,22,9,22,22,9,9,22,22,9,9,22,9,22,22,9,9,22,22,9,22,9,22,9,22,9,22,9,9,22,9,22,9,22,22,9,22,9,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,22,9,22,9,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:17,“id”:17,“code”:[-41,10,70,0,-33,9,22,9,9,22,9,22,22,9,22,9,9,22,9,22,9,22,9,22,22,9,9,22,9,22,9,22,9,22,22,9,9,22,22,9,22,9,22,9,22,9,9,22,9,22,22,9,22,9,9,22,22,9,9,22,22,9,9,22,22,9,9,22,9,22,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:18,“id”:18,“code”:[-23,20,70,0,-33,9,22,9,22,9,22,9,22,9,22,9,22,9,22,9,22,9,22,9,9,22,9,22,22,9,9,22,22,9,22,9,9,22,22,9,22,9,22,9,22,9,9,22,9,22,9,22,9,22,22,9,22,9,22,9,9,22,22,9,22,9,22,9,9,22,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:19,“id”:19,“code”:[-23,20,70,0,-33,9,22,9,9,22,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,9,22,9,22,22,9,9,22,9,22,9,22,22,9,22,9,22,9,22,9,9,22,9,22,22,9,9,22,22,9,9,22,22,9,9,22,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:20,“id”:20,“code”:[-23,20,70,0,-33,9,9,22,22,9,22,9,9,22,9,22,22,9,22,9,22,9,22,9,9,22,9,22,9,22,9,22,22,9,9,22,9,22,9,22,22,9,9,22,9,22,9,22,9,22,9,22,22,9,22,9,9,22,9,22,22,9,9,22,9,22,9,22,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""},{“buttonId”:21,“id”:21,“code”:[-23,20,70,0,-33,9,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,22,9,22,9,9,22,22,9,22,9,9,22,22,9,22,9,9,22,22,9,9,22,22,9,9,22,22,9,22,9,9,0,1,72],“delay”:0,“order”:0,“name”:""}]

Would some one be so kind and could point me to a internet page which can convert those codes into something the HA can work with.
Or give me any other advice on how I could get the TC2 to work.

Thank you in advance

You chose tc1 or tc2?

And you have the RM Pro?

Hi claudio
My setup is.
Raspberry pi 3
Hasbian 0,47
Broadlink rm pro
Switch tc2 1 gang.
In the econtrol app I did choose tc2.
Any idea

Did you follow the broadlink component instructions?
If you follow it carefully it should work

You have to download 3 files and use a script, check the instructions

Hi claudio

I went through the instruction from the broadlink component,USING E-CONTROL REMOTES, but run into some trouble.
Hopefully you can help me out.
The requirement for the script to work is python 2,7. I am running 3.x.
Because I did not want to mess with my installation, I did not changed the python version.
Instead I only tried to take the code from the jsonIrCode file and by using the tool from step 11 of the guide tried to convert the json file code into base 64.
It looked like this:
code from jsonIrCode file:
-23,20,70,0,-33,9,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,9,22,22,9,9,22,9,22,9,22,9,22,22,9,22,9,22,9,9,22,22,9,22,9,9,22,22,9,22,9,9,22,22,9,9,22,22,9,9,22,22,9,22,9,9,0,1,72
I had to add a 0 at the end or copied it twice, so not to get the error message that the length of the code is odd
The tool spilled out this code:
IyBwAzmSKSIimSIimSKSKSKSIimSIimSKSKSKSIikikimSIikimSIikimSIimSIimSIikimQFyA=

By copying it into my configuration yalm I had hopped it would work, but it did not.

The switch shows up in the front end, but you can not click on the lightning , you can but nothing happens.
The RMpro does not even blink.
This is strange, because it should be the code that the econtrol is using and when turning the switch from within the app everything works just fine,
When trying to do it from HA nothing.
I am at the end with my mathematics. Do not know what I am doing wrong.
Could you sent me an example of your code which you have in your yalm , that works for the tc2.
Or if it would not be too much to ask, to try to convert my code which I got from the jsonIrCode file into something that HA can understand.
Thank you

did you follow steps from 1 to 11?

at point 5 it states it works for python 2.7, but should work in python 3.x … I think

No no no, it will not work, it needs to be converted to hex first look at my original script code and you will see how it converts this code

you are converting a wrong code

Hi Claudio

I finally got it working. It was a big pain in the a…
Following all the steps from the broadlink component,e-control remote, carefully did got me close but not completely to the desired outcome.
The decisive step was hidden in the link in step one in the script page.
Only after I followed the advice for TC2 and copied the code 6 times. I got it working.
Also, I had to use two codes. One for on and one for off.
In the beginning I thought one code would cover bought commands.
Thank you for your help

Yes is almost always 6 times, but it can be less.

And on off are different codes which is a very good thing. You can’t have the state but you are sure that if you press off is or goes to off

Hi there, is there any way to capture the codes from eControl for the TC2 switches without an Android phone?

I see there is a process to export these from eControl on an Android phone, but I’m quite remote and getting hold of an Android phone over an i-phone is problematic.

thanks

You can easily use an android emulator. Bignox works(not all emulators work) with e-control app and it’s free.

that worked perfect! thank you so much.

Hello Every one i am making ios app by using rm pro and tc2 switch but i am unable to communicate them so any one who work on this tell me

Hello Every one i am making ios app by using rm pro and tc2 switch but i am unable to communicate them so any one who work on this tell me thanks in advace

I use https://codebeautify.org/base64-decode to decode base64 and this for encode https://codebeautify.org/base64-encode

The getBroadlinkSharedData.py script now outputs codes in home assistant’s format and supports code duplication

run:

~# python getBroadlinkSharedData.py

or duplicate code by number

~# python getBroadlinkSharedData.py 5

1 Like

I have this problem on a TC2. Launching the sendCode.py, I receive this error

pi@raspberrypi:~/Broadlink $ sudo python sendCode6.py
Connecting to Broadlink device....
Connected....
Traceback (most recent call last):
  File "sendCode6.py", line 19, in <module>
    device.send_data(codeData.decode('hex'))
  File "/usr/local/lib/python2.7/dist-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 455, in send_data
    self.send_packet(0x6a, packet)
  File "/usr/local/lib/python2.7/dist-packages/broadlink-0.3-py2.7.egg/broadlink/__init__.py", line 250, in send_packet
    response = self.cs.recvfrom(1024)
socket.timeout: timed out
pi@raspberrypi:~/Broadlink $