Broadlink RM-PRO and A1 sensor

Try to run hass --script check_config

there is an indentation error under “projector”

oh yeah, could that slow all down? Rebooting now

and my friendly_names are declared with ‘’

If start using hass --script check_config you do not have to reboot all the time…

thanks guys, now seems to work.

I guess a combination of old firmware, bad indent, missing " … was making it work intemittently

mmhh I don’t understand …

I usually restart with thuis
sudo systemctl restart home-assistant.service

but it was getting stuck all the time tonight, so had to sudo reboot

If you enable your virtual dreiemoment and then run hass --script check_config you will get an output telling you if something is wrong with your config,

now is all working,

but the learn command does not put the broadlink in learning mode (led not turning on)

pi@raspberrypi:~ $ sudo su -s /bin/bash hass
hass@raspberrypi:/home/pi$ source /srv/hass/hass_venv/bin/activate
(hass_venv) hass@raspberrypi:/home/pi$ hass --script check_config
INFO:homeassistant.util.package:Attempting install of colorlog>2.1,<3
Testing configuration at /home/hass/.homeassistant
(hass_venv) hass@raspberrypi:/home/pi$

That means your config is fine now

the learn_command

is a hit or miss.

I rebooted everything, and is not working …

As always: Check your log!

now it’s enormous. I took out the logger, but it logs everything.

Definetely something is not working, when I put it in learning mode is not working, and then I have to sudo reboot

after I launch learn_command it does not work, and the switch stop working. I can;'t restart HASS I need to reboot

16-12-18 23:43:22 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:22 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:22 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_left to 192.168.1.52 (auth: False)
16-12-18 23:43:22 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_right to 192.168.1.52 (auth: False)
16-12-18 23:43:24 homeassistant.components.device_tracker.nmap_tracker: Scanning...
16-12-18 23:43:26 homeassistant.components.http: Serving /description.xml to 192.168.1.12 (auth: False)
16-12-18 23:43:26 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:26 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:27 homeassistant.components.http: Serving /api/services/broadlink/learn_command to 192.168.1.52 (auth: True)
16-12-18 23:43:27 homeassistant.core: Bus:Handling <Event call_service[L]: service=learn_command, service_data=, domain=broadlink, service_call_id=1977434096-15>
16-12-18 23:43:27 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 71, in _learn_command
    broadlink_device.enter_learning)
  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 381, in enter_learning
    self.send_packet(0x6a, packet)
  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
16-12-18 23:43:29 homeassistant.components.device_tracker.nmap_tracker: nmap scan successful
16-12-18 23:43:29 homeassistant.components.http: Serving /description.xml to 192.168.1.12 (auth: False)
16-12-18 23:43:30 plexapi: GET http://192.168.1.12:32400/clients?X-Plex-Token=6poGYJSmQg81sjpGaGxW
16-12-18 23:43:30 plexapi: GET http://192.168.1.12:32400/clients?X-Plex-Token=6poGYJSmQg81sjpGaGxW
16-12-18 23:43:30 plexapi: GET http://192.168.1.12:32400/clients?X-Plex-Token=6poGYJSmQg81sjpGaGxW
16-12-18 23:43:30 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=<state sun.sun=below_horizon; next_setting=2016-12-19T15:40:28+00:00, next_rising=2016-12-19T06:33:23+00:00, friendly_name=Sun, azimuth=343.01, elevation=-70.77 @ 2016-12-18T23:37:05.030352+01:00>, entity_id=sun.sun, new_state=<state sun.sun=below_horizon; next_setting=2016-12-19T15:40:28+00:00, next_rising=2016-12-19T06:33:23+00:00, friendly_name=Sun, azimuth=343.69, elevation=-70.82 @ 2016-12-18T23:37:05.030352+01:00>>
16-12-18 23:43:32 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:32 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:32 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_left to 192.168.1.52 (auth: False)
16-12-18 23:43:32 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_right to 192.168.1.52 (auth: False)
16-12-18 23:43:36 homeassistant.components.device_tracker.nmap_tracker: Scanning...
16-12-18 23:43:36 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:36 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:41 homeassistant.components.device_tracker.nmap_tracker: nmap scan successful
16-12-18 23:43:42 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:42 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:42 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_left to 192.168.1.52 (auth: False)
16-12-18 23:43:42 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_right to 192.168.1.52 (auth: False)
16-12-18 23:43:45 homeassistant.components.http: Serving /description.xml to 192.168.1.12 (auth: False)
16-12-18 23:43:46 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:46 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:48 homeassistant.components.device_tracker.nmap_tracker: Scanning...
16-12-18 23:43:52 homeassistant.components.http: Serving /api/camera_proxy/camera.giardino_da_ufficio to 192.168.1.52 (auth: False)
16-12-18 23:43:52 homeassistant.components.http: Serving /api/camera_proxy/camera.office_garden to 192.168.1.52 (auth: False)
16-12-18 23:43:52 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_left to 192.168.1.52 (auth: False)
16-12-18 23:43:52 homeassistant.components.http: Serving /api/camera_proxy/camera.rear_right to 192.168.1.52 (auth: False)
16-12-18 23:43:53 homeassistant.components.device_tracker.nmap_tracker: nmap scan successful

with " or '?

I was getting those messages when first started trying the learning script from Raspberry Pi general, than from Virtual Environment and than from my Mac.

All the times it was caused by something missing on installation, and most times was pycrypt.
You must install the pycrypto into the Virtual Environment if your HA was installed by AIO.

Did you try the python script.py ? Try it first from the virtual environment, or from your computer.

I got the same problems you are many times until got it working.
My difficult in entering learning mode made it stopped working as well until reboot the RM-Pro

All my broadlink related config are with ’

The virtual environment is asking for a password, which I don’t remember (I could swear was the same as pi password but is not)… How to get or change this password?

I’m getting this error as well:

ValueError: AES key must be either 16, 24, or 32 bytes long

I had everything working perfectly fine. I was able to learn RF and IR commands, and had them working. Then all of a sudden it doesn’t work at all anymore.

Has anyone been able to resolve this yet?

Edit - I do have pcrpto installed and working. My first attempt failed because it wasn’t installed. Once I installed it, I was able to learn and control with the broadlink. But now this error happens.