Broadlink RM-PRO and A1 sensor

It’s also explained here https://github.com/home-assistant/home-assistant.github.io/pull/1485/files

Thanks, will try it later in the day

Hi , where you able to upload component. Can you please share for sensor as well A1. Does it read Humidity, Noise Leve, Temprature etc.

Yes, the sensor reads everything from A1.

About the files:

I think there is no way to download them, just copy the whole file and copy into a new file with the same name on your pc.
(did not try yet)

Hope I am not jumping the gun but the mini 3 is very affordable even as a temperature sensor… I have ordered 2… I am really hoping the switch changes go in as well this will very affordably kill two birds with one stone on my wish list.

1 Like

Did not get success in sniffing packets…
Tried running from terminal (OSX) locally and with remote connection to pi, using both places ‘python3.5 packet.py’
and got those messages on both:

Traceback (most recent call last):
  File "packet.py", line 186, in <module>
    main()
  File "packet.py", line 174, in main
    device.auth()
  File "packet.py", line 39, in auth
    from Crypto.Cipher import AES
ImportError: No module named 'Crypto'

I think I will need to wait the official update from hass…

And what about the sensor py file? where can I download or get its content?
Thanks

you need to install pycrypto
do:
pip install pycrypto

in my case (on a syno nas) i need to downlad the sensor to my python 3.5 site/package
to find your site package folder
do :
python
import site; site.getsitepackages()
then + to leave the python interpreter
then go inside the folder site-package/site-packages/homeassistant/components/sensor#
and do wget https://raw.githubusercontent.com/skyval/home-assistant/aa74c3bf58d42d6b360388af5e2032acc1b9c962/homeassistant/components/sensor/broadlink.py

ex:
root@syno:/volume1/homeassistant# python
Python 2.7.12 (default, Aug 17 2016, 05:16:16)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import site; site.getsitepackages()
[‘/usr/lib/python2.7/site-packages’, ‘/usr/lib/site-python’]

root@syno:volume1/homeassistant#cd /usr/lib/python2.7/site-packages/homeassistant/components/sensor
root@syno:microserver:/opt/lib/python3.5/site-packages/homeassistant/components/sensor# wget https://raw.githubusercontent.com/skyval/home-assistant/aa74c3bf58d42d6b360388af5e2032acc1b9c962/homeassistant/components/sensor/broadlink.py

then restart home-assistant
let my know if you need help

1 Like

oliverdog
see my prev messages

1 Like

Is it possible to use the SCENE of the Broadlink? I mean, for example, for one command to send IR1 RF IR2 commands?

Or makes no sense, and better do a scene inside HA??

No.

This is my understanding of Broadlink products:

  • Nothing is written on the hardware. Everything we create and teach the RM-PRO is written into the E-control APP. When you install E-Control in another device, you must import all previous coded devices from cloud…

This HASS setup has nothing to do with the e-control. It just communicate with the hardware RM-PRO, so we either discover a command using the learning script which returns the code, or use a already discovered code by another person.

Once we just give the order to replicate a previous known command, we could build a online Broadlink Database.
That would be fantastic, just find your device’s brand, and get the list with all IR codes translated into Broadlink language.

you need to create a script on the configuration file.

I have two examples in my configuration:

script:
  turn_lights_on_pause:
    sequence:
      - service: input_boolean.toggle
        data:        
          entity_id: input_boolean.sofa
      - delay:
          seconds: 10
      - service: input_boolean.toggle
        data:        
          entity_id: input_boolean.sala
  lights_all_off:
    sequence:
      - service: input_boolean.toggle
        data:
          entity_id:
            - input_boolean.alla
            - input_boolean.allb
            - input_boolean.allc
      - delay:
          seconds: 2
      - service: input_boolean.toggle
        data:
          entity_id:
            - input_boolean.alla
            - input_boolean.allb
            - input_boolean.allc
1 Like

Yes, I need some help…
I can’t find the homeassistant components folder!!!

tried this:

pi@pi:/ $ python
Python 2.7.9 (default, Mar 8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
import site; site.getsitepackages()
[’/usr/local/lib/python2.7/dist-packages’, ‘/usr/lib/python2.7/dist-packages’]

when try dist-package/homeassistant/components/sensor — folder does not exist…

tried search for components folder all over the microSD and nothing…

tried doing using hass account as well, and nothing…

I have the .homeassistant folder in /home/hass/.homeassistant, where I have my yaml file, but there is no component folder inside it.

I can’t locate the component folder!!!

By the way, I have the all-in-one HASS installed on a RPI2

Thanks.

it’s a raspberry pi ?

what installation process do you follow to install home assistant?
i think you need to do
mkdir -p /home/hass/.homeassistant/custom_components/sensor
cd /home/hass/.homeassistant/custom_components/sensor
wget https://raw.githubusercontent.com/skyval/home-assistant/aa74c3bf58d42d6b360388af5e2032acc1b9c962/homeassistant/components/sensor/broadlink.py

this exemple is for the sensor (broadlink A1)
i hav not already test the brodlink Pro (if needed i can help for the broadlink A1)
try and let my know

for the all-in-one raspberry install do the following:

sudo su -s /bin/bash hass
source /srv/hass/hass_venv/bin/activate
pip install pycrypto
cd /srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor
wget https://raw.githubusercontent.com/skyval/home-assistant/aa74c3bf58d42d6b360388af5e2032acc1b9c962/homeassistant/components/sensor/broadlink.py
2 Likes

First, thanks to skyval for doing the sensor/switch integration :slight_smile: I have RM Pro controlling rf sockets, ir air con., ir light switches and now it finally works with iOS 10 homekit/home app.

The only problem I’m having is - RM Pro temperature sensors gives random error/reading of 249 degrees centigrade (the value is always the same 249.00). Any idea how to fix this?

Yes, I got the components folder… and finally working all RM-PRO and A1 sensors… GREAT.
wowowowow… really really awesome!!! Thank very much…

But the python3.5 packet.py still did not work

Installed pycrypto on both pi and hass users and got the
same message:

Traceback (most recent call last):
  File "packet.py", line 186, in <module>
    main()
  File "packet.py", line 174, in main
    device.auth()
  File "packet.py", line 39, in auth
    from Crypto.Cipher import AES
ImportError: No module named 'Crypto'

Thanks @keiser1080… I got the way @mcs said.
All sensors working now… A1 and RM-PRO… Great !!!

Next step is the “switch” part…

Sorry folks, but I need to celebrate again …

Connecting the Broadlink sensors to an automation controller is something I’ve been trying “to do” for 4 years.

It’s very exciting to finally see it working.

Thank you very much!!!

2 Likes

There are many way to solve your library problem

You can install pycrypto global or create a python virtual environment.

But we need more information about your distro?
If it Debian based do
sudo - s
apt-cache search python | grep crypto

See if you find something like python-pycrypto
If yes
Do
apt-get install python-pycrypto

Or you can use the virtual environment from your home assistant installation

To do that just do

source /srv/hass/hass_venv/bin/activate
Then launch the script doing python script name.py

got those:

libhogweed2 - low level cryptographic library (public-key cryptos)
libnettle4 - low level cryptographic library (symmetric and one-way cryptos)
nettle-bin - low level cryptographic library (binary tools)
nettle-dbg - low level cryptographic library (debugging symbols)
nettle-dev - low level cryptographic library (development files)
python-crypto - cryptographic algorithms and protocols for Python
python-crypto-dbg - cryptographic algorithms and protocols for Python (debug extension)
python-crypto-doc - cryptographic algorithms and protocols for Python (documentation)
python-cryptography - Python library exposing cryptographic recipes and primitives (Python 2)
python-cryptography-doc - Python library exposing cryptographic recipes and primitives (documentation)
python-cryptography-vectors - Test vectors for python-cryptography (Python 2)
python-ecdsa - ECDSA cryptographic signature library (Python 2)
python-ecryptfs - ecryptfs cryptographic filesystem (python)
python-keyczar - toolkit for safe and simple cryptography for Python
python-m2crypto - a crypto and SSL toolkit for Python
python-pycryptopp - Python wrappers for the Crypto++ library
python-pycryptopp-dbg - Python wrappers for the Crypto++ library (debug extension)
python3-crypto - cryptographic algorithms and protocols for Python 3
python3-crypto-dbg - cryptographic algorithms and protocols for Python 3 (debug extension)
python3-cryptography - Python library exposing cryptographic recipes and primitives (Python 3)
python3-cryptography-vectors - Test vectors for python-cryptography (Python 3)
python3-ecdsa - ECDSA cryptographic signature library (Python 3)

I’m trying now install the python-pycryptopp…

Installed and the same problem…

Now trying the HASS user activation…

OK… that is it… Worked under the virtual environment.

Is the IR code very long??? something like 900 characters???