Python Plugin: Broadlink RM2

Python and python framework

Moderator: leecollings

zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

@macben44

maybe by copying broadlink to the right folder ;-)

" sudo cp -r /usr/local/lib/python3.4/dist-packages/Crypto/ /usr/lib/python3.4/
and
sudo cp -r /usr/local/lib/python3.4/dist-packages/broadlink /usr/lib/python3.4/
"

you need to adapt that to your installation.
macben44
Posts: 4
Joined: Thursday 26 October 2017 9:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by macben44 »

I don't have repository dist-packages in /usr/local/lib/python3.5...

I had already done :

Code: Select all

sudo cp -r /usr/local/lib/python3.5/site-packages/Crypto/ /usr/lib/python3.5/
sudo cp -r /usr/local/lib/python3.5/site-packages/broadlink /usr/lib/python3.5/
same probleme but... OK I'have found ! With

Code: Select all

sudo cp -r /usr/local/lib/python3.5/site-packages/Crypto/ /usr/local/lib/python3.5/
sudo cp -r /usr/local/lib/python3.5/site-packages/broadlink /usr/local/lib/python3.5/
it's okey ! I continue...

Tks a lot !
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

I have done all that but also get:
2017-11-12 16:22:06.084 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/broadlink/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2017-11-12 16:22:06.084 Error: (Bean) Module Import failed, exception: 'ImportError'
2017-11-12 16:22:06.084 Error: (Bean) Module Import failed: ' Name: pyaes'
Is it dist-packages or site-packages. I have done it like this:

sudo cp -r /usr/local/lib/python3.5/dist-packages/broadlink/ /usr/lib/python3.5/
sudo cp -r /usr/local/lib/python3.5/dist-packages/crypto/ /usr/lib/python3.5/


Dont no what else to try.
macben44
Posts: 4
Joined: Thursday 26 October 2017 9:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by macben44 »

Hello,

Try :

sudo cp -r /usr/local/lib/python3.5/dist-packages/broadlink/ /usr/local/lib/python3.5/
sudo cp -r /usr/local/lib/python3.5/dist-packages/crypto/ /usr/local/lib/python3.5/
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

Nope, the same :(
2017-11-12 19:24:41.481 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/broadlink/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2017-11-12 19:24:41.481 Error: (Bean) Module Import failed, exception: 'ImportError'
2017-11-12 19:24:41.481 Error: (Bean) Module Import failed: ' Name: pyaes'
macben44
Posts: 4
Joined: Thursday 26 October 2017 9:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by macben44 »

Which is the result for :

ls -lrt /usr/local/lib/python3.5/dist-packages/broadlink/
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

Here:
pi@raspberrypi:~ $ ls -lrt /usr/local/lib/python3.5/dist-packages/broadlink/
total 24
-rw-r--r-- 1 root staff 16621 Stu 12 15:55 __init__.py
drwxr-sr-x 2 root staff 4096 Stu 12 15:55 __pycache__
pi@raspberrypi:~ $
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

I try it all over again and always the same. Any help appreciated.

Thanks
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

@Kruu
problem look like pyaes is missing.
try : sudo pip3 install pyaes
and copy it under /usr/lib/python3.5
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

Thanks allot that helped, but now I am on another error :

Code: Select all

2017-11-19 14:57:40.789 Error: (Bean) Error Connecting to Broadlink device....
2017-11-19 14:57:40.795 Error: (Bean) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-11-19 14:57:40.795 Error: (Bean) ----> Line 158 in /home/domoticz/domoticz/plugins/broadlink/plugin.py, function onCommand
2017-11-19 14:57:40.795 Error: (Bean) ----> Line 417 in /home/domoticz/domoticz/plugins/broadlink/plugin.py, function learn
2017-11-19 14:57:40.795 Error: (Bean) ----> Line 487 in /usr/lib/python3.5/broadlink/__init__.py, function enter_learning
2017-11-19 14:57:40.795 Error: (Bean) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-11-19 14:57:40.795 Error: (Bean) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes
2017-11-19 14:57:57.326 Error: (Bean) ini file not found: /home/pi/domoticz/BroadlinkRM2/BroadlinkRM2-22-254.ini
I have Broadlink Bean, but I followed all the steps for RM2 because I cant finde nothing specific for Broadlink Bean.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

unfortunately, broadlink still require pycrypto.
Do the same for it (pip3), take care that folder name could be Crypto
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

I installed it allready:

Code: Select all

pi@raspberrypi:~ $ sudo pip3 install Crypto
Requirement already satisfied: Crypto in /usr/local/lib/python3.5/dist-packages
Requirement already satisfied: shellescape in /usr/local/lib/python3.5/dist-packages (from Crypto)
Requirement already satisfied: Naked in /usr/local/lib/python3.5/dist-packages (from Crypto)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from Naked->Crypto)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.5/dist-packages (from Naked->Crypto)
I have it in folders

Code: Select all

/usr/local/lib/python3.5/dist-packages/Crypto
/usr/local/lib/python3.5/Crypto
/usr/lib/python3.5/Crypto

zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

Some problem with Crypto&pyaes, depend of configuration.
Have been able to reproduce the case and by removing all entry related to pyaes looks like resolved the problem.
so.. uninstall pyaes and just keep Crypto.

this is what i have on my test machine :

root@test-virtual-machine:/# find . -name 'pyaes' -print
root@test-virtual-machine:/# find . -name 'Crypto' -print
./usr/lib/python3.5/Crypto
./usr/lib/python2.7/dist-packages/Crypto
./usr/local/lib/python3.5/dist-packages/Crypto
root@test-virtual-machine:/#
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

Removed it and now:

Code: Select all

2017-11-20 18:55:26.800 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/domoticz/domoticz/plugins/broadlink/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2017-11-20 18:55:26.800 Error: (bean) Module Import failed, exception: 'ImportError'
2017-11-20 18:55:26.800 Error: (bean) Module Import failed: ' Name: pyaes'
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

do the full search on your device and show result.
Kruu
Posts: 49
Joined: Tuesday 17 January 2017 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Broadlink RM2

Post by Kruu »

Result: No such file or directory
davidrq78
Posts: 5
Joined: Sunday 26 November 2017 12:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by davidrq78 »

Hi guys. Can you help me to solve this problem? What should i do ?
Image
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2

Post by zak45 »

@davidrq78
you need to adapt plugin_http.sh to your env.
in your case, this should be :
nohup python3 /home/pi/domoticz/plugins/BroadlinkRM2/plugin_http.py $1 $2 $3 &

do not forget to give +x
davidrq78
Posts: 5
Joined: Sunday 26 November 2017 12:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by davidrq78 »

zak45 wrote: Sunday 26 November 2017 23:48 do not forget to give +x
What do you mean ? Where should i give +x?
blacksn0w
Posts: 99
Joined: Friday 10 March 2017 22:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Germany
Contact:

Re: Python Plugin: Broadlink RM2

Post by blacksn0w »

davidrq78 wrote: Monday 27 November 2017 10:16
zak45 wrote: Sunday 26 November 2017 23:48 do not forget to give +x
What do you mean ? Where should i give +x?
Execute permissions.
chmod +x plugin_http.py
Migration done, hello Home Assistant.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest