Broadlink RM-PRO and A1 sensor

To install two switches;

switch 1:
  platform: broadlink
  host: IP_ADDRESS1
  mac: 'MAC_ADDRESS2'
  switches:
    reciever:
      command_on: 'switch_packet on'
      command_off: 'switch_packet off'

switch 2:
  platform: broadlink
  host: IP_ADDRESS2
  mac: 'MAC_ADDRESS2'
  switches:
    reciever:
      command_on: 'switch_packet on'
      command_off: 'switch_packet off'

There seems to be a bug in the broadlink repo: https://github.com/mjg59/python-broadlink/issues/24
So until that is fixed, you have to manually install crypto

@akshitgupta1695 : What is your config?

How to?

I did this

pi@raspberrypi:~ $ pip install pycrypto
Requirement already satisfied (use --upgrade to upgrade): pycrypto in /usr/local/lib/python2.7/dist-packages
Cleaning up…
pi@raspberrypi:~ $

I installed it by using…

sudo pip install pycrypto

You should install it for python 3 not 2.7

It depends of how you have installed hass.
If you have a virtual environment, enable it first and then run pip3 install pycrypto
It should be a bit similar to how you upgrade hass.

yes virtual environemnt AIO installer on Pi3. Trying now

switch:

  • platform: broadlink
    host: 192.168.1.60
    mac: “b4:43:0d:aa:81:42”
    switches:
    rahulfrontlights:
    friendly_name: Room Front Lights
    command_on: ‘6UsyAA8NBwoGCwoGCgYLBgYKBwsKBgoHBwoHCgsGBwoHCgcKBgoHCQcKBgoHCgsGBwoLBgcLAAAAAAAA=’
    command_off: ‘6UsyAA8NBwoGCwoGCgYLBgYKBwsKBgoHBwoHCgsGBwoHCgcKBgoHCQcKBgoHCgsGBwoLBgcLAAAAAAAA=’
    rahulsidelights:
    friendly_name: Room Side Lights
    command_on: ‘6UsyAA8OBwsHCgsGCwYLBgcKBwoKBwoGBgoHCgsGBwoHCgcKBgoGCgsGBwoKBwYKBwoHCgcLAAAAAAAA=’
    command_off: ‘6UsyAA8OBwsHCgsGCwYLBgcKBwoKBwoGBgoHCgsGBwoHCgcKBgoGCgsGBwoKBwYKBwoHCgcLAAAAAAAA=’
    rahulthemelights:
    friendly_name: Room theme Lights
    command_on: ‘6QSEAwYKBgoLBQkGCQcFCgYK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Bw0PBQoGCgkGCgYJBgYKBwgKBgoGBwgGCgkHBQoGCQcJBgoGCQoGBgkKBgoHCAYKBgsGDQ0GDAQKCQgIBgoGBQoGCgkHCgUGCgUKCgYGCQYKBgsECgYKCgYFCgkHCQYLBQkGCgYODgYKBwgKBgkICAYGCQYMCAYJCAUJBgkKBgYKBgkGCgYJBgoKBgYJCgYJBwkGCgYJBw4OBQsFCgkGCgcIBgYKBgkKBgoGBQoGCwgIBAsFCgYJBgoGCgkGBgsIBgoGCQYKBgoGDwwHCwYICwYIBgoHBAoGCgoGCQcFCgULCQcFCgcIBgoFCgYLCAYGCgoGCQYKBgkHCQAF3AAAAAA=’

And none of the switch commands are working? Have you tried to install crypto?

Why do the Air Quality, Noise and Light status now are showed as “0” or “1” instead of Excelent, Normal and Dark?
Have you noticed that as well?

And my switches seems not be working as well. Worked just one time, and than nothing anymore… Trying to reboot HA now.

my config:

switch:
  platform: broadlink
  host: 192.168.1.153
  mac: 'b4:43:0d:XX:XX:XX' 
  switches:
    reciever:
      command_on: 'JgBUAFATExQnEyYUJxMUEyYUFBMnExQTExQTExQAAx5NFBIVJhQmFCcTFBMnExMUJxMTFBMTExQUAAMeTRQSFCcTJxQnExMUJhQSFSYUExMTFBQTFAANBQAAAAA='
      command_off: 'JgBUAFATJxMmFCcTJxQSFCgTEhQnExMUFBMTFBMAAw5OEycUJhMnFCcTExQnExMTJxQUExIUExQUAAMNTRQnEycTJxQmFBMUJhQTFCcTExQTExQTFAANBQAAAAA='
      friendly_name: 'TV Sala'
    recievera:
      command_on: '1xU0ABQrMg8RLTEPES4xDxEuMQ8RLTEPES0xEBEtMQ8QLzAPES4RLhEuES4RLhEuMQ8xEBEAAdkAAAAA'
      command_off: '1xU0ABQrMg8RLTEPES4xDxEuMQ8RLTEPES0xEBEtMQ8QLzAPES4RLhEuES4RLhEuMQ8xEBEAAdkAAAAA'
      friendly_name: 'Luzes Natal'

I decided that number is better than text, because then you will get a graph. If you want text, you can make a template sensor

1 Like

Agreed!!!

But the switches are not working here!
They work just once on each HA reboot.

I followed instructions
"How to obtain IR/RF packets?

Choose Call Service from the Developer Tools. Choose the service broadlink/learn_command from the list of Available services: and hit CALL SERVICE. Press the button on your remote with in 20 seconds. The packet will be printed in the log and as a persistent notification."

where is the packet??? Which log?

@oliverdog: Any errors in the log?

@anon35356645: In home assistant log or as a persistent notification on the frontpage of hass

in the home assistant log I can’t find it (EDIT what do I look for?)

Yes I see it in the persistent log, but I can’t copy it (beside I don’t see it all

To get it in the log you should enable homeassistant.components.switch.broadlink: info
For the persistent message please report it as a bug here: https://github.com/home-assistant/home-assistant/issues/new

“To get it in the log you should enable homeassistant.components.switch.broadlink: info”

it should go in configuration yaml?

I get this in log
16-12-18 20:12:39 homeassistant.loader: Unable to find component homeassistant.components.switch.broadlink

try double click on the code so that it is selected. then just right click and copy.

I wish I could, I restarted home assistant, now the call service is not working. Lots of errors in the log

16-12-18 20:20:02 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1050, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/switch/broadlink.py”, line 66, in _learn_command
yield from hass.loop.run_in_executor(None, broadlink_device.auth)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/hass/.homeassistant/deps/broadlink/init.py”, line 169, in auth
response = self.send_packet(0x65, payload)
File “/home/hass/.homeassistant/deps/broadlink/init.py”, line 214, in send_packet
aes = AES.new(bytes(self.key), AES.MODE_CBC, bytes(self.iv))
File “/srv/hass/hass_venv/lib/python3.4/site-packages/Crypto/Cipher/AES.py”, line 95, in new
return AESCipher(key, *args, **kwargs)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/Crypto/Cipher/AES.py”, line 59, in init
blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/Crypto/Cipher/blockalgo.py”, line 141, in init
self._cipher = factory.new(key, *args, **kwargs)
ValueError: AES key must be either 16, 24, or 32 bytes long

nothing in the log, not even if set for info mode.

I think the problem is with RF command repeated for on and off, trying again with command_on only

Update:
An old RF package was causing the problem…
I relearned the RF code and now everything working with the new package