Page 3 of 16

Re: Python Plugin: Broadlink RM2 V3

Posted: Saturday 01 July 2017 15:27
by NomenNescio
Using Rafal's method I manage to get the Broadlink RM2 with Kodi remote in Domoticz.
I can see the temp of the Broadlink RM2 but however I can switch the learning mode on nothing happens after putting the receiver on (with remote).
The according folder is created in Windows (C:\BroadlinkRM2 with the two subfolders, but it stays empty.

I'm on windows home server 2011.
Domoticz version: 3.8025
Build Hash: 37b51336
Compile Date: 2017-06-28 06:32:47

Broadlink is working fine with e-Control on android
Domoticz works fine with milights.

Re: Python Plugin: Broadlink RM2 V3

Posted: Saturday 01 July 2017 17:22
by Andree
rafal wrote:
Andree wrote:i'm becoming crazy.
Install same package and configuration of Rafal and now i have same problem of your previus post!

error: Unable to find vcvarsall.bat

----------------------------------------
Cleaning up...
Command C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\andre\\AppData\\Local\\Temp\\pip_build_andre\\pycrypto\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\andre\AppData\Local\Temp\pip-swj86p1y-record\install-record.txt --single-version-externally-managed --compile failed with error code 1 in C:\Users\andre\AppData\Local\Temp\pip_build_andre\pycrypto
Storing debug log for failure in C:\Users\andre\pip\pip.log

Hi

Uninstall ALL version of python, then restart windows and with admin right install python 3.4.0 then with admin right pycrypto and setup. If dosen't work try do the same configuration on different windows or machine
If install Python 3.4.0 install of Pycrypto fail with
Capture.JPG
Capture.JPG (97.83 KiB) Viewed 4229 times

Re: Python Plugin: Broadlink RM2 V3

Posted: Saturday 01 July 2017 19:57
by Phantom
i don't know why it keeps failing for me, i uninstalled all 3 plugins (crypto, broadlink and pyaes) and also deleted the directory's.
Then installed all 3 again:

Code: Select all

pi@raspberrypi:~ $ sudo pip3 install Crypto
Collecting Crypto
  Using cached crypto-1.4.1-py2.py3-none-any.whl
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: pyyaml in /usr/local/lib/python3.5/dist-packages (from Naked->Crypto)
Requirement already satisfied: requests in /usr/local/lib/python3.5/dist-packages (from Naked->Crypto)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests->Naked->Crypto)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests->Naked->Crypto)
Requirement already satisfied: urllib3<1.22,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests->Naked->Crypto)
Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests->Naked->Crypto)
Installing collected packages: Crypto
Successfully installed Crypto-1.4.1
pi@raspberrypi:~ $ sudo pip3 install broadlink
Collecting broadlink
Collecting pyaes==1.6.0 (from broadlink)
Installing collected packages: pyaes, broadlink
Successfully installed broadlink-0.5 pyaes-1.6.0
pi@raspberrypi:~ $ sudo pip3 install pyaes
Requirement already satisfied: pyaes in /usr/local/lib/python3.5/dist-packages
pi@raspberrypi:~ $ sudo cp -r /usr/local/lib/python3.5/dist-packages/crypto/ /usr/lib/python3.5/
pi@raspberrypi:~ $ sudo cp -r /usr/local/lib/python3.5/dist-packages/broadlink /usr/lib/python3.5/
pi@raspberrypi:~ $ sudo service domoticz restart
pi@raspberrypi:~ $ sudo cp -r /usr/local/lib/python3.5/dist-packages/pyaes /usr/lib/python3.5/
pi@raspberrypi:~ $ sudo service domoticz restart
pi@raspberrypi:~ $

pi@raspberrypi:~ $ sudo pip3 show broadlink
Name: broadlink
Version: 0.5
Summary: Python API for controlling Broadlink IR controllers
Home-page: http://github.com/mjg59/python-broadlink
Author: Matthew Garrett
Author-email: [email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.5/dist-packages
Requires: pyaes
i even re-installed python3.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 17:14
by Phantom
Strange thing is.
when i run the discover with the RM3 mini off i get no fault message:

2017-07-02 17:08:57.735 User: Admin initiated a switch command (126/RM3 mini - Discover/On)
2017-07-02 17:08:57.740 (RM3 mini) Calling message handler 'onCommand'.
2017-07-02 17:08:57.740 (RM3 mini) onCommand called for Unit 1: Parameter 'On', Level: 0 , Connected : False
2017-07-02 17:08:57.740 (RM3 mini) All plugin system is on pause for 5s...
2017-07-02 17:09:02.748 (RM3 mini) Found 0 broadlink devices
2017-07-02 17:09:02.748 (RM3 mini - Discover) Updating device from 0:'Off' to have values 1:'Found : 0 device'.
2017-07-02 17:09:03.096 (RM3 mini) Update 1:'Found : 0 device' (RM3 mini - Discover)
2017-07-02 17:09:07.253 (RM3 mini) Calling message handler 'onHeartbeat'.
2017-07-02 17:09:37.301 (RM3 mini) Calling message handler 'onHeartbeat'.

Only when the RM3 is on:

2017-07-02 17:08:39.123 User: Admin initiated a switch command (126/RM3 mini - Discover/On)
2017-07-02 17:08:39.146 (RM3 mini) Calling message handler 'onCommand'.
2017-07-02 17:08:39.146 (RM3 mini) onCommand called for Unit 1: Parameter 'On', Level: 0 , Connected : False
2017-07-02 17:08:39.147 (RM3 mini) All plugin system is on pause for 5s...
2017-07-02 17:08:44.154 (RM3 mini) Found 1 broadlink devices
2017-07-02 17:08:44.167 Error: (RM3 mini) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 210 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 397 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function Discover
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 203 in /usr/lib/python3.5/broadlink/__init__.py, function auth
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 18:03
by zak45
Phantom wrote:Strange thing is.
2017-07-02 17:08:44.154 (RM3 mini) Found 1 broadlink devices
2017-07-02 17:08:44.167 Error: (RM3 mini) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 210 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 397 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function Discover
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 203 in /usr/lib/python3.5/broadlink/__init__.py, function auth
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes
Try by removing pyaes. Looks like problem with it, just keep Crypto.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 18:07
by zak45
@andree
try 3.5.3 x86 and pycrypto-2.6.1-cp35-none-win32.whl on dropbox.
had worked for me.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 18:08
by zak45
NomenNescio wrote:Using Rafal's method I manage to get the Broadlink RM2 with Kodi remote in Domoticz.
I can see the temp of the Broadlink RM2 but however I can switch the learning mode on nothing happens after putting the receiver on (with remote).
The according folder is created in Windows (C:\BroadlinkRM2 with the two subfolders, but it stays empty.

I'm on windows home server 2011.
Domoticz version: 3.8025
Build Hash: 37b51336
Compile Date: 2017-06-28 06:32:47

Broadlink is working fine with e-Control on android
Domoticz works fine with milights.
post your log.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 18:35
by Phantom
zak45 wrote:
Phantom wrote:Strange thing is.
2017-07-02 17:08:44.154 (RM3 mini) Found 1 broadlink devices
2017-07-02 17:08:44.167 Error: (RM3 mini) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 210 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 397 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function Discover
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 203 in /usr/lib/python3.5/broadlink/__init__.py, function auth
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-07-02 17:08:44.167 Error: (RM3 mini) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes
Try by removing pyaes. Looks like problem with it, just keep Crypto.
i used pip3 to uninstall pyaes and also removed the directory, but then i get this message:

2017-07-02 18:32:23.729 User: Admin initiated a switch command (126/RM3 mini - Discover/On)
2017-07-02 18:32:30.718 Error: RM3 mini hardware (9) thread seems to have ended unexpectedly
What pyaes version are you using?

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 19:07
by Andree
zak45 wrote:@andree
try 3.5.3 x86 and pycrypto-2.6.1-cp35-none-win32.whl on dropbox.
had worked for me.
Same Zak...in domoticz log persist
2017-07-02 19:05:50.975 EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 19:51
by ToneStrife
I couldn't see in the wiki. Is it possible to have several remotes? MAybe adding several hardwares with the same broadlink.

And the most important, I've tried everything I read in the wiki for the remote, I have added the ini and everything. And still in Off. I have a raspi and the broadlink is workin. Any hint?

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 22:28
by zak45
ToneStrife wrote:I couldn't see in the wiki. Is it possible to have several remotes? MAybe adding several hardwares with the same broadlink.

And the most important, I've tried everything I read in the wiki for the remote, I have added the ini and everything. And still in Off. I have a raspi and the broadlink is workin. Any hint?
yes, multiple hw should works.
Have you clicked on the remote to put it 'On' ???

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 22:34
by zak45
Phantom wrote: i used pip3 to uninstall pyaes and also removed the directory, but then i get this message:

2017-07-02 18:32:23.729 User: Admin initiated a switch command (126/RM3 mini - Discover/On)
2017-07-02 18:32:30.718 Error: RM3 mini hardware (9) thread seems to have ended unexpectedly
What pyaes version are you using?
I do not have pyaes. these are my modules:
zz.txt
(574 Bytes) Downloaded 181 times

Re: Python Plugin: Broadlink RM2 V3

Posted: Sunday 02 July 2017 23:48
by zak45
@Phantom

looks like this is related to your problem :
https://github.com/mjg59/python-broadlink/issues/107

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 03 July 2017 0:00
by Phantom
zak45 wrote:@Phantom

looks like this is related to your problem :
https://github.com/mjg59/python-broadlink/issues/107
Thanks i will go trough it tomorrow and try some things out.

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 03 July 2017 1:36
by Phantom
i was just to curious to see.
I have manged to get it to work, i really want thank you a lot for your assistance. This plugin is awesome.

So this is what i did.
when i installed broadlink again and also crypo and copied both to the /usr/lib/python3.5 i noticed that the one in the 3.5 has no capitol C for Crypto
i tried to rename it but that did not work.
Then i looked in the folder /usr/lib/python3/dist-packages/ and there is saw Crypto with a lot more files then in the 3.5 one.
So i copied that one "sudo cp -r /usr/lib/python3/dist-packages/Crypto/ /usr/lib/python3.5/" restarted Domoticz and everything works.
Image
Image

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 03 July 2017 8:35
by zak45
@Phantom
great.nice to see this work for you know.

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 03 July 2017 10:49
by ToneStrife
zak45 wrote:
ToneStrife wrote:I couldn't see in the wiki. Is it possible to have several remotes? MAybe adding several hardwares with the same broadlink.

And the most important, I've tried everything I read in the wiki for the remote, I have added the ini and everything. And still in Off. I have a raspi and the broadlink is workin. Any hint?
yes, multiple hw should works.
Have you clicked on the remote to put it 'On' ???
Off option is not possible. I have added a .ini file with the number (idx) of the remote control created by broadlink. Probably I made something worng, but I can't find what is it.
The ini file is plugin_remote_38.ini
( 38 Broadlink 000800FE 254 Broadlink - Remote)
The code inside is :

Code: Select all

[Custom]

command = 37,36
37 and 36 are the idx of broadlink switches.

Re: Python Plugin: Broadlink RM2 V3

Posted: Monday 03 July 2017 12:23
by zak45
@ToneStrife
if I have understand well, you have give the wrong idx.
this should be the Hardware Id provided by Domoticz for the RM2 plugin e.g
Capture.JPG
Capture.JPG (39.95 KiB) Viewed 4054 times

Re: Python Plugin: Broadlink RM2 V3

Posted: Friday 07 July 2017 11:00
by Andree
Hi,i'm here!
Domoticz 3.8x - Python 3.4 setup.exe not work
Domoticz 3.8x- Python 3.5.3 setup.exe work but don't see HW in Domoticz and in Log "EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform."
Domoticz 3.8x - Python 3.6.1 setup.exe non work but in Domoticz "PluginSystem: Started, Python version '3.6.1'."

and now update..

Domoticz 3.8x - Python 3.5.3 and 3.6.1 installed (both with all user sure) - Setup Work , In Log " PluginSystem: Started, Python version '3.6.1'." and in HW i see HW Broadlink with Kodi Remote but if configure it no device appears and in LOG

Code: Select all

" 2017-07-07 10:06:57.550 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was 'C:\Program Files (x86)\Domoticz\plugins\BroadlinkRM2\;C:\Program Files (x86)\Python36-32\python36.zip;C:\Program Files (x86)\Python36-32\Lib\;C:\Program Files (x86)\Python36-32\DLLs\;C:\Program Files (x86)\Domoticz'. 
2017-07-07 10:06:57.550 Error: (Broadlink Sala) Module Import failed, exception: 'ModuleNotFoundError' 
2017-07-07 10:06:57.551 Error: (Broadlink Sala) Module Import failed: ' Name: broadlink' "

Re: Python Plugin: Broadlink RM2 V3

Posted: Friday 07 July 2017 12:51
by zak45
@Andree
try:
open cmd as Administrator
execute : pip install broadlink