Broadlink RM-PRO and TC2 switch

@masterkenobi First, Try using python broadlink to see if it works

You can use this script (python 2.7): https://github.com/NightRang3r/Broadlink-e-control-db-dump/blob/master/sendCode.py

Just change RM IP , MAC and code data (in hex, the format you get from getBroadlinkSharedData.py), First send it as is, if you get the “input strings must be a multiple of 16 in length” error duplicate the code, if still same error triple it until it’s in the right length.

Let me know if it works this way and let’s deal with HA support later.

OK. I manage to make some progress here.

After I duplicate the hex code for 6th time, the light turn on!

However, it has this error…

Connecting to Broadlink device....
Connected....
Traceback (most recent call last):
  File "sendCode.py", line 21, in <module>
    device.send_data(codeData.decode('hex'))
  File "D:\Python27\lib\site-packages\broadlink-0.3-py2.7.egg\broadlink\__init__.py", line 455, in send_data
    self.send_packet(0x6a, packet)
  File "D:\Python27\lib\site-packages\broadlink-0.3-py2.7.egg\broadlink\__init__.py", line 250, in send_packet
    response = self.cs.recvfrom(1024)
socket.timeout: timed out

@masterkenobi Awesome, I think that is something related to the broadlink python library.

Now take this working code length convet it to base 64 and send it using HA.

Let me know if it works.

Now it works in HA!

3 Likes

:slight_smile:

Thanks @NightRanger and good night!

I am wondering is it every TC2 needs to duplicate the code 6 times or is it only on mine?

Hi… I can’t duplicate an air conditionate code… It’s bigger Than then others and don’t have the = at the end… HA says that is not correct… How i can solve this issue? Thanks. Ps using the e-control broadlink app the AC works great

try to press the IR button for very short (in learn command mode)

I bought another 3 TC2s today and all 3 are using hex code x 6.

I have around 10 TC2 switches and I need to duplicate the code only twice.

this is the code learned by my A/C:

JgCSAAABKJIWEhYSFhEWNhYSFRIWEhYRFjYWEhUSFjYVEhYSFhEWEhYSFRIWEhUSFhIWNRY2FhIVEhYSFhEWEhY2FRIWNhYRFhIXNRYRFgACjxcQFxEXERYRFxEXEBcRFxAXERcQFxEXEBcRFz
UXEBcRFxAXERcRFhEXERcQFxEXEBcRFxAXERcRFjUXERc0FzUXAA0FAAAAAAAA

what can i do?

ps. i’ve the rm mini

@Danielhiversen, I have updated HA to 0.36 and my TC2 is no longer working. I have to edit the /usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/broadlink.py file again to make it works. This time the line to edit is line 183; self._device.send_data(binascii.unhexlify(packet)). Can you fix this for the future version? Thanks.

That will break the component for everyone else, so I can not do that.

So you should find a way to convert it to the correct format. Something like this should work:

packet = binascii.unhexlify(packet)
packet = b64encode(packet).decode('utf8')
1 Like

ok thanks. i got it to work with your suggestion.

Good.

It would be great if you could add a description on how to use @NightRanger code to the Broadlink documentation (Broadlink - Home Assistant).

Here is a describtion of how to edit the documentation

Hi @Danielhiversen

I have some issues with the broadlink A1 sensor and the broadlink SP2 power plug

for the broadlink A1 sensor:

It works but after awhile it gives unrealistic values

after restarting HA it backs to normal but then after a while it getting messed up again.

here is a screenshot of my log:

For the SP2:

It is working fine for awhile as well but then it gets time outs

Any idea why ?

btw: everything else is working fine (ir and rf switches)

1 Like

@masterkenobi

wonder if the crazy values are hardware or software related

The unrealistic values are probably some hardware issue, and I am not sure how much we can do with it. We could implement a filter that reject the value if it is unrealistic. A pull request to fix that is welcome.

The other issue seams to be related to some network problem. But it should not stop HA or be of any big problem, they will just delay the update of the device. You can try to increase the timeout from the config.

1 Like

Thanks, I’ll look into that