Broadlink RM-PRO and TC2 switch

@reua It has already been discussed here, You should multiply the code until it works

First, make sure it is working for you with the sendCode.py script

Try sending the code one time:

e90a4200df0909161609160909160916091609160916160909160916091609160916091609161609091609160916160916090916091609160916091616091609160909160916

If it is not working try to duplicate it twice:

e90a4200df0909161609160909160916091609160916160909160916091609160916091609161609091609160916160916090916091609160916091616091609160909160916e90a4200df0909161609160909160916091609160916160909160916091609160916091609161609091609160916160916090916091609160916091616091609160909160916

If not working keep going 3,4,5,6 time until it works with the script and then encode it to base64, It will still won’t work with HA until you make changes to HA source as discussed here:

You do not need to change the code. Just convert the key to the correct format https://home-assistant.io/components/switch.broadlink/#using-e-control-remotes

Hello Daniel,

i did this but the tool gives me a 100digit (input= hex) or a 200digit (input= hex+hex) and then i get the error my string can not be divided by 16. should i then continue like NightRanger said Input= hex+hex+hex … until i get the right number of digits?

I have just written some code to validate the received data: https://github.com/home-assistant/home-assistant/compare/broadlink?expand=1

I do not have any problems with invalid data here, so I hope someone can help me test this.
Any suggestions for more tests, to make sure the data are valid is welcome.

Another thing that could be helpful, is if you could add a print(payload) here: https://github.com/mjg59/python-broadlink/blob/master/broadlink/init.py#L421
And see if there is anything different with the payload for invalid data.

Hi,
I hope it’s okay to jump in…
I have 5 SP2 switches at home.

This is what I put in for one of the switches:
switch 2:
platform: broadlink
host: 192.168.2.43
mac: ‘B4:43:0D:EF:73:5C’
timeout: 5
type: sp2

When I start Hass, it hangs for quite a while on at:
INFO:homeassistant.util.package:Attempting install of broadlink==0.3

When running a python console using import broadlink I can find all SP2s
I can find the ip-address from the SP2s and I can turn them on and off so I know they are connected and running.

Any suggestions of how to find out why it doesn’t find them in Home Assistant?

Btw, first time here…

// Tommy

Try to manually install broadlink.
pip install broadlink==0.3

It installed both the broadlink 0.3 and pycrypto 2.6.1 but it still hangs with the same message in Hass.
Is it trying to install broadlink 0.3 despite it is already installed?

// T

No, it should only install it if it is missing.
Do you use a virtual environment? Did you enable that before you installed broadlink?

The problem is more bigger after the last update to version 0.38.3. Today I have restarted the application 3 times and it happens again after some time.
I’m nooby in this area. My version is the current version. I do not understand much about tests and modifications in the files.

Of course I do, I followed the installtions instruction line by line…
and of course I didn’t…
Gah!
That did also explain why my Home Assistant never updated…

That you very much for your help!

// T

Code matching occasionally fails,can you add repeat of parameters,This problem can be solved。

What do you mean with repeat of parameters?

Number of times to send the code. Values 0 or 1 will not repeat the code. Value 2 means send the code 2 times.

I still don’t understand what you want to achieve

thank you 

switch:
platform: broadlink
host: IP_ADDRESS
mac: ‘MAC_ADDRESS’
switches:
reciever:
command_on: ‘switch_packet on’
command_off: ‘switch_packet off’
repeat:3
send the code 3 times.

You can solve that with a script.

I am now using the automation.

My switch accept code sometimes fails, so i need to send it repeatedly.
And my switch can not know the state.
For example, my switch is open,But in the homeassistant its state is off.
I want to turn off the switch.need to send code several times.
Because state has not changed,Script will not execute.

Use a script with delay to decide the time between each transmitted signal.