I found your problem
In the previous post i see your are using python 2.7
So you need to do
apt-get install python3 python3-pip
Then
pip3 search crypto
Then check if the pycrypto is listed
Then
Install it using pip3 install pycrypto
To start the script use python3 nameofthescript.py
but did not work yet out of the virtual environment!
But I got it working partially into the Hass virtual environment. I think something is wrong because I am getting the packet without pressing nothing on the remotes…
Learning mode… Please press the key on the remote controls.
if you use this script => http://pastebin.com/gFB66sVM
the packet is encoded in base64
and folowing runtime you can use the packet in your configuration file.
to use the global python
you can replace the shebang (first line in the script “#!/usr/bin/python”)with the python3 location
do
pi@pi:~ $ which python3
/usr/bin/python3
then replace in the file “#!/usr/bin/python” by “#!/usr/bin/python3”
then
pi@pi:~ $chmod +x nameofscript.py
then start tge script like this:
my last try was doing in the global python.
I have changed the location on the file to
/usr/local/bin/python3
Installed the pycrypto using
pip3 install pycrypto
chmod done
and tried starting the script like this:
pi@pi:~ $ ./packet.py
and got:
Traceback (most recent call last):
File “./packet.py”, line 186, in
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’
Under the HASS virtual environment I got it working with
(hass_venv) hass@pi:/home/pi$ python3 packet.py
but the script stops on the
Learning mode… Please press the key on the remote control.
and nothing happens when I press remote buttons…
sometimes it gives me that long code after nothing pressed…
when I press Ctrl+C I get
Learning mode… Please press the key on the remote control.
^CTraceback (most recent call last):
File “packet.py”, line 186, in
main()
File “packet.py”, line 180, in main
packet=device.check_data()
File “packet.py”, line 163, in check_data
err = response[0x22] | (response[0x23] << 8)
KeyboardInterrupt
(hass_venv) hass@pi:/home/pi$
thanks for the hint about encoding in base64, but did not work.
Now we know the codes generated with the Android RM-Bridge can’t be used here, even if encoded…
I also tried on my Mac, but got the same error messages.
I am doing something wrong for sure, because I get the same error messages on all three ways…
Doing from my Mac now, sometimes I get this error:
Learning mode... Please press the key on the remote control.
Traceback (most recent call last):
File "packet.py", line 139, in send_packet
response = self.sock.recvfrom(1024)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "packet.py", line 186, in <module>
main()
File "packet.py", line 180, in main
packet=device.check_data()
File "packet.py", line 162, in check_data
response = self.send_packet(0x6a, packet)
File "packet.py", line 141, in send_packet
_LOGGER.error("Socket timeout...")
NameError: name '_LOGGER' is not defined
Update.
I have another RMPro and it worked with it.
So I got the packets from the working one and set up the other with the packets and it worked as well.
Another info is the portability of the packets…
We do could create an online database which could be feeded by everyone, couldn’t we?
FYI for anyone else overly excited, the mini 3 is IR/WIFI only, no sensors and no RF… Some of the online descriptions for it appear to be cut and past from the RM pro devices.
Well it will still do what I need if the IR part works out.
I thing the Broadlink devices use a different codification for talking between hardware and E-control APP / Hass plugin, which, therefore, prevents us from using that database, at least the way it is there.
We could use phone’s IR blaster and Remote APP to create every code for most common devices through the script and RM-PRO or Mini3 and share them online.
And remembering that our purpose should be just simple actions that would link IR devices in automation sequences, for example turning off a TV when everyone leaves.
Sony TVs Power on and off codes (got them from Android Remote APP, once the original remote button is toggle)
Yes it is, however I do regret not paying a little more for the RM PRO 2… I should note as well that my mini 3s did not come with power supplies just USB cables.