Broadlink RM-PRO and TC2 switch

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

With the latest HASS (v0.36), SP2 switch are supported:

- platform: broadlink
  host: 192.168.0.123
  mac: "B4:48:0D:FA:B6:C1"
  type: sp2
  switches:
    switch1:
      friendly_name: BlaBlop
1 Like

switch 1:
platform: broadlink
host: 10.0.0.12
mac: ‘b4:43:00:00:00:00’
type: sp2
friendly_name: “Lamp”

works for me

I am completely lost, can somebody point me in the right direction. I got a RM Pro the other day, I am running HA 36.1 as a docker in unraid. I followed the config instructions and put this in my yaml

switch:
platform: broadlink
host: 192.168.0.155
mac: ‘xx-xx-xx-xx-xx’
switches:
reciever:
command_on: ‘switch_packet on’
command_off: ‘switch_packet off’

Just to see how it works. according to the instructions it says I should be able to see this

Choose Call Service from the Developer Tools. Choose the service broadlink/learn_command from the list of Available services: and hit CALL SERVICE.

I don’t see that option anywhere in the list or even broadlink listed anywhere. any idea as to what I am doing wrong?

Thanks

@chepnut
https://home-assistant.io/getting-started/troubleshooting-configuration/#my-component-does-not-show-up

I will check out that link, I have only had HA installed for about 1 week and havent had a lot of time to really dig into it.

Thanks

I restarted HA and watched the logs as it started and it looks like its bombing out at this part

e[32m17-01-20 15:24:41 INFO (MainThread) [homeassistant.loader] Loaded switch.broadlink from homeassistant.components.switch.broadlinke[0m
e[32m17-01-20 15:24:41 INFO (MainThread) [homeassistant.bootstrap] Setting up switche[0m
e[32m17-01-20 15:24:41 INFO (MainThread) [homeassistant.components.switch] Setting up switch.broadlinke[0m
e[31m17-01-20 15:24:41 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlinke[0m

Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “uvloop/future.pyx”, line 230, in iter (uvloop/loop.c:110600)
File “uvloop/future.pyx”, line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980)
File “uvloop/future.pyx”, line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File “/usr/local/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/components/switch/broadlink.py”, line 65, in setup_platform
config.get(CONF_MAC).encode().replace(b’:’, b’’))
binascii.Error: Odd-length stringe[0m

I sorted out my error message, I had dashes instead of colons, whoops :slight_smile: Now to delve deeper down the rabbit hole

Hey everyone - I’m considering buying this TC2 switch because I hear that it can communicate its state back to the original eControl app (meaning, if you turn off the switch manually, you will see it updated to off in the app)
My question is - will this state be read by HA?

No, it doesn’t.

Thanks for the fast reply :slight_smile: do you know of any similar switches that will be supported better?