Broadlink RM-PRO and A1 sensor

Update of the incorrent padding error, apparently this only happen on some remote control, the code it learn just doesn’t work and break the code, but other remote works ok.

I have another problem, don’t know if any other have similar issue.

I have tested the e-control app, rm bridge and broadlink tasker plugin, they all works perfectly with the same remote, however, that same remote doesn’t work in HA for some reason, I have tried to learn the code from another rm pro which can turn on/off from e-control without problem, but it just doesn’t work in HA, I have tried day and night for the last 2 days and about the give up, just wondering if I can get the rf code from other source (e-control app, rm bridge and broadlink tasker plugin) and insert it in HA?

I assume rm bridge and tasker plugin also use the same broadlink library, so they should work the same, right?

i saw instruction somewhere on the site, but is a little complicated.

Just re-learn the code 2-3 times until it gets right.

EDIT: another way is to get the HTTP command from RM Tasker, and use it in command_line

I had rm bridge setup and using command_line switch before, since ha now support broadlink so I am trying to migrate all the remotes from rm bridge to ha broadlink so I don’t need an active android device all the time.

I just find some python script to extract code from e-control rmt.db database. Lets see if it works.

UPDATE: I extracted the code from e-control database, but it doesn’t work when I paste it in HA, I guess the HA broadlink use different format to send the signal.

e-control code: b20b34000a0001310a1d0b1d0b1d1e0a1e0a0b1d1e0a1e0a0b1d0a1d1e0a1e0a1e0a1e0a1e0a1e0a0a1d1e0a1e0a1e0a0b1d0b1d1e0a1e0b00000000

HA broadlink code: sgw0AAkAATEKHgoeCh0eCh0KCx0eCh4LCh4KHR4KHQoeCh4KHgoeCgodHgodCx0KCx0eCh4KHQwAAAAA

@kenshin Look at this thread:

Start couple of messages above this one and read till the end, it may help you:

Broadlink RM-PRO and TC2 switch

I got this error “homeassistant.components.switch.broadlink: Failed to connect to device.” what is the problem?

Something wrong with your network or your configuration

Hi guys, I just realized something awesome.

Maybe you have already done this before but I just notice a Search Button on the top right of E-CONTROL app (when adding a new remote), witch can load a plenty of cloud saved remote controls all over the world. You just type Livolo, and get many saved remotes to use, without learning… that is fantastic, once we do not need owning a hardware remote to use it.

Now you should familiarize with the script created for decoding packages from the e-control app on a rooted android phone… Have anyone tried it before? If yes, could you give me the directions? I can’t even remember where I have seen it, but I know it exists…

Thanks

UPDATE: found it here

Thanks, that looks promising, will try that soon, cheers.

ping work I use ubiquity Unifi AP i dont see any problem in network…

Have tried to increase the timeout?

I try to 100 but not work the network is ok see pcap from the h

ost to the rm.

@NightRanger

I got those lines from your script (getBroadlinkShareData.py)

Button Name: 1 | Button ID: 359 | Code: e91934000d210d210d210d210d210d210e210d21230b0d210d210d210d00015a0f200e20240a240a0e20240b240a240b230b0d210d210d2100000000
Button Name: 2 | Button ID: 360 | Code: e91234000d210d210d210d21240a0d210d210d00015a0e1f0f1f250a240b0d21240a240a240b240b0d210d210d210d210d210d210d210d2100000000
Button Name: 3 | Button ID: 361 | Code: e91334000d210d210e210d210d21240a230b0d210d210d00015a0f200e20240a250a0d21240b230b240b240b0d220d210d210d210d210d2100000000
Button Name: 4 | Button ID: 362 | Code: e90c3400240b230b230b230c0c210d210d210d200e210d210d210d210d210d210d210d210d21240b0d210d00015a0e210e20240a240b0e2000000000
Button Name: 5 | Button ID: 363 | Code: e9193400240b0d21240a0d210d00015a0f200e20250a240a0e21240b230b230b230b0d220c220d210d210d210d210d210d210d210d210d2100000000
Button Name: 6 | Button ID: 364 | Code: e91534000e200e20240b240a0d21240b230b240a230b0d210d210d210d210d210d210d210d210d210d210d210d21240b240b0d210d00015b00000000
Button Name: 7 | Button ID: 365 | Code: e91134000e200e20240b230b0d21240a240a240b230b0d220d210d210c220d220d210d210d210d210d210d21240b230b230b0c220d00015b00000000
Button Name: 8 | Button ID: 366 | Code: e9163400230b0c220d210d210d210d210d210d210d210d210e210e200d210d210e21240b0d00015b0f200e20250a240a0d21230b230b230c00000000
Button Name: 9 | Button ID: 367 | Code: e90734000d21240b240b230b230b0c220c220d220c220c220c220d220d210d210c210d21240b0c210d21230b0c00015c0e200e20240b240b00000000

how can I use it with HA?
just convert to base64 and will it work?

like this:
from:
e91934000d210d210d210d210d210d210e210d21230b0d210d210d210d00015a0f200e20240a240a0e20240b240a240b230b0d210d210d2100000000
to:
6RY0ACMLDCINIQ0hDSENIQ0hDSENIQ0hDiEOIA0hDSEOISQLDQABWw8gDiAlCiQKDSEjCyMLIwwAAAAA

@masterkenobi could you explain how you made it work with ha?

UPDATE: So just to verify, the code extracted from e-control then convert to base64encode works fine in HA broadlink, so the problem narrow down to just the learn function of the HA broadlink, it learn the code but doesn’t work when send (no error shows in log)

@oliverdog It depends,

Basically you should convert the code to base64

base64code = base64.b64encode("e91934000d210d210d210d210d210d210e210d21230b0d210d210d210d00015a0f200e20240a240a0e20240b240a240b230b0d210d210d2100000000")

print base64code

But first use this script to test that the code is working with RM (in hex format)

If it doesn’t work directly with the RM and you get an error like this: ValueError: Input strings must be a multiple of 16 in length then you should duplicate the code until it is in the right length 1 time 2 times and so on…, after that encode it to base 64 and try with HA.

If it doesn’t work with HA you probably will need to edit:

home-assistant/homeassistant/components/switch/broadlink.py

Line 183:

self._device.send_data(packet)

to

self._device.send_data(binascii.unhexlify(packet))

Will it affect the other RF and IR commands that I have already configured and are working fine?

I don’t know, you will have to test it, you can always remove the line if it breaks something.

GREAT… worked without changing anything…

AWESOME… now I can get every remote control from Broadlink Cloud DataBase working on HASS…

And no rooted phone is necessary…

Hi, can you recap what to do to have this function, kind of comfusing in the thread (to me at least)

Thanks!