Re: Python Plugin: Broadlink RM2 V3
Does it work with e-control ?
Open source Home Automation System
https://forum.domoticz.com/
Code: Select all
pi@RPi3:~/domoticz/plugins/BroadlinkRM2/import $ ls -al
total 140
drwxr-xr-x 2 pi pi 4096 Sep 11 19:15 .
drwxr-xr-x 4 pi pi 4096 Sep 11 19:10 ..
-rwxr-xr-x 1 pi pi 28355 Jan 1 1970 jsonButton
-rwxr-xr-x 1 pi pi 99402 Jan 1 1970 jsonIrCode
-rwxr-xr-x 1 pi pi 1057 Jan 1 1970 jsonSubIr
pi@RPi3:~/domoticz/plugins/BroadlinkRM2/import $
Hi Zak,zak45 wrote:@Sjonnie2017
the import folder need to be :
<<Folder to store ini files>>/import
if this is the case, put plugin in debug mode and show us the Domoticz log when you push 'generate'
in fact, this is not related to the plugin...
Hi Zak,
Code: Select all
2017-09-12 19:20:12.987 Error: (Broadlink) Error Connecting to Broadlink device....
Code: Select all
pi@raspberrypi:~ $ pip3 install broadlink
Downloading/unpacking broadlink
Downloading broadlink-0.5.tar.gz
Running setup.py (path:/tmp/pip-build-kjrvrc6j/broadlink/setup.py) egg_info for package broadlink
Downloading/unpacking pycrypto==2.6.1 (from broadlink)
Downloading pycrypto-2.6.1.tar.gz (446kB): 446kB downloaded
Running setup.py (path:/tmp/pip-build-kjrvrc6j/pycrypto/setup.py) egg_info for package pycrypto
Installing collected packages: broadlink, pycrypto
Running setup.py install for broadlink
error: could not create '/usr/local/lib/python3.4/dist-packages/broadlink': Permission denied
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-kjrvrc6j/broadlink/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-kv8mu0ga-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/broadlink
copying broadlink/__init__.py -> build/lib/broadlink
running egg_info
writing broadlink.egg-info/PKG-INFO
writing dependency_links to broadlink.egg-info/dependency_links.txt
writing top-level names to broadlink.egg-info/top_level.txt
writing requirements to broadlink.egg-info/requires.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'broadlink.egg-info/SOURCES.txt'
writing manifest file 'broadlink.egg-info/SOURCES.txt'
running install_lib
creating /usr/local/lib/python3.4/dist-packages/broadlink
error: could not create '/usr/local/lib/python3.4/dist-packages/broadlink': Permission denied
----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-kjrvrc6j/broadlink/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-kv8mu0ga-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-kjrvrc6j/broadlink
Storing debug log for failure in /home/pi/.pip/pip.log
Code: Select all
sudo pip3 install broadlink
Code: Select all
2017-09-13 20:59:35.769 (BroadlinkRM2) Initialized version 3.0.0, author 'zak45'
2017-09-13 20:59:35.775 (BroadlinkRM2) Debug log level set to: 'true'.
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode1':'000000000000'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode2':'/home/pi/domoticz/plugins/BroadlinkRM2'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Port':'0'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Name':'BroadlinkRM2'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'HardwareID':'17'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode4':'yes'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Address':'127.0.0.1'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Key':'BroadlinkRM2'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Author':'zak45'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode3':'yes'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode5':'9000'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Mode6':'Debug'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'Version':'3.0.0'
2017-09-13 20:59:35.776 (BroadlinkRM2) 'HomeFolder':'/home/pi/domoticz/plugins/BroadlinkRM2/'
2017-09-13 20:59:35.776 (BroadlinkRM2) Device count: 4
2017-09-13 20:59:35.777 (BroadlinkRM2) Device: 1 - ID: 252, Name: 'BroadlinkRM2 - Discover', nValue: 0, sValue: 'Off'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device ID: '252'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Discover'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device nValue: 0
2017-09-13 20:59:35.777 (BroadlinkRM2) Device sValue: 'Off'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 20:59:35.777 (BroadlinkRM2) Device: 2 - ID: 253, Name: 'BroadlinkRM2 - Temp', nValue: 0, sValue: ''
2017-09-13 20:59:35.777 (BroadlinkRM2) Device ID: '253'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Temp'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device nValue: 0
2017-09-13 20:59:35.777 (BroadlinkRM2) Device sValue: ''
2017-09-13 20:59:35.777 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 20:59:35.777 (BroadlinkRM2) Device: 254 - ID: 254, Name: 'BroadlinkRM2 - Remote', nValue: 0, sValue: ''
2017-09-13 20:59:35.777 (BroadlinkRM2) Device ID: '254'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Remote'
2017-09-13 20:59:35.777 (BroadlinkRM2) Device nValue: 0
2017-09-13 20:59:35.777 (BroadlinkRM2) Device sValue: ''
2017-09-13 20:59:35.778 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 20:59:35.778 (BroadlinkRM2) Device: 255 - ID: 259, Name: 'BroadlinkRM2 - Import', nValue: 0, sValue: 'Off'
2017-09-13 20:59:35.778 (BroadlinkRM2) Device ID: '259'
2017-09-13 20:59:35.778 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Import'
2017-09-13 20:59:35.778 (BroadlinkRM2) Device nValue: 0
2017-09-13 20:59:35.778 (BroadlinkRM2) Device sValue: 'Off'
2017-09-13 20:59:35.778 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 20:59:35.778 (BroadlinkRM2) Connecting to: 127.0.0.1:000000000000
2017-09-13 20:59:35.791 Error: (BroadlinkRM2) Error Connecting to Broadlink device....
2017-09-13 20:59:35.791 (BroadlinkRM2) Device Number begin to : 2
2017-09-13 20:59:35.797 (BroadlinkRM2) No ini file :/home/pi/domoticz/plugins/BroadlinkRM2/remote/plugin_remote_17.ini
2017-09-13 20:59:35.797 (BroadlinkRM2) Custom Commands for Remote not managed
2017-09-13 20:59:35.798 (BroadlinkRM2) Heartbeat interval set to: 30.
2017-09-13 20:59:45.313 (BroadlinkRM2) Calling message handler 'onHeartbeat'.
Code: Select all
2017-09-13 21:01:44.885 User: Admin initiated a switch command (252/BroadlinkRM2 - Discover/On)
2017-09-13 21:01:44.891 (BroadlinkRM2) Calling message handler 'onCommand'.
2017-09-13 21:01:44.891 (BroadlinkRM2) onCommand called for Unit 1: Parameter 'On', Level: 0 , Connected : False
2017-09-13 21:01:44.891 (BroadlinkRM2) All plugin system is on pause for 5s...
2017-09-13 21:01:49.897 (BroadlinkRM2) Found 1 broadlink devices
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) ----> Line 210 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) ----> Line 397 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function Discover
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) ----> Line 203 in /usr/lib/python3.5/broadlink/__init__.py, function auth
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) ----> Line 258 in /usr/lib/python3.5/broadlink/__init__.py, function send_packet
2017-09-13 21:01:49.909 Error: (BroadlinkRM2) ----> Line 162 in /usr/lib/python3.5/broadlink/__init__.py, function encrypt_pyaes
2017-09-13 21:01:49.960 (BroadlinkRM2) Calling message handler 'onHeartbeat'.
Code: Select all
2017-09-13 21:08:51.625 (BroadlinkRM2) Initialized version 3.0.0, author 'zak45'
2017-09-13 21:08:51.629 (BroadlinkRM2) Debug log level set to: 'true'.
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode1':'b4430de436fe'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode2':'/home/pi/domoticz/plugins/BroadlinkRM2'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Port':'0'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Name':'BroadlinkRM2'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'HardwareID':'17'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode4':'yes'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Address':'192.168.0.39'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Key':'BroadlinkRM2'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Author':'zak45'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode3':'yes'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode5':'9000'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Mode6':'Debug'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'Version':'3.0.0'
2017-09-13 21:08:51.629 (BroadlinkRM2) 'HomeFolder':'/home/pi/domoticz/plugins/BroadlinkRM2/'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device count: 4
2017-09-13 21:08:51.629 (BroadlinkRM2) Device: 1 - ID: 252, Name: 'BroadlinkRM2 - Discover', nValue: 0, sValue: 'Off'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device ID: '252'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Discover'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device nValue: 0
2017-09-13 21:08:51.629 (BroadlinkRM2) Device sValue: 'Off'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 21:08:51.629 (BroadlinkRM2) Device: 2 - ID: 253, Name: 'BroadlinkRM2 - Temp', nValue: 0, sValue: ''
2017-09-13 21:08:51.629 (BroadlinkRM2) Device ID: '253'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Temp'
2017-09-13 21:08:51.629 (BroadlinkRM2) Device nValue: 0
2017-09-13 21:08:51.629 (BroadlinkRM2) Device sValue: ''
2017-09-13 21:08:51.629 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 21:08:51.630 (BroadlinkRM2) Device: 254 - ID: 254, Name: 'BroadlinkRM2 - Remote', nValue: 0, sValue: ''
2017-09-13 21:08:51.630 (BroadlinkRM2) Device ID: '254'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Remote'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device nValue: 0
2017-09-13 21:08:51.630 (BroadlinkRM2) Device sValue: ''
2017-09-13 21:08:51.630 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 21:08:51.630 (BroadlinkRM2) Device: 255 - ID: 259, Name: 'BroadlinkRM2 - Import', nValue: 0, sValue: 'Off'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device ID: '259'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device Name: 'BroadlinkRM2 - Import'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device nValue: 0
2017-09-13 21:08:51.630 (BroadlinkRM2) Device sValue: 'Off'
2017-09-13 21:08:51.630 (BroadlinkRM2) Device LastLevel: 0
2017-09-13 21:08:51.630 (BroadlinkRM2) Connecting to: 192.168.0.39:b4430de436fe
2017-09-13 21:08:51.636 Error: (BroadlinkRM2) Error Connecting to Broadlink device....
2017-09-13 21:08:51.636 (BroadlinkRM2) Device Number begin to : 2
2017-09-13 21:08:51.640 (BroadlinkRM2) No ini file :/home/pi/domoticz/plugins/BroadlinkRM2/remote/plugin_remote_17.ini
2017-09-13 21:08:51.640 (BroadlinkRM2) Custom Commands for Remote not managed
2017-09-13 21:08:51.640 (BroadlinkRM2) Heartbeat interval set to: 30.
2017-09-13 21:09:02.756 (BroadlinkRM2) Calling message handler 'onHeartbeat'.
Code: Select all
.....
plugins/
plugins/examples/
plugins/examples/DenonMarantz.py
plugins/examples/BaseTemplate.py
plugins/examples/HTTP Listener.py
plugins/examples/Kodi.py
plugins/examples/HTTP.py
plugins/examples/UDP Discovery.py
plugins/examples/Dlink DSP-W215.py
plugins/examples/RAVEn.py
plugins/AwoxSMP/
plugins/AwoxSMP/lib/
plugins/AwoxSMP/lib/__init__.py
plugins/AwoxSMP/lib/pySmartPlugSmpB16.py
plugins/AwoxSMP/plugin.py
Restarting Domoticz... (please standby...)
Code: Select all
pi@raspberrypi ~/domoticz/plugins $ ls -al
итого 20
drwxr-xr-x 5 pi pi 4096 сен 9 09:26 .
drwxr-xr-x 7 pi pi 4096 сен 14 16:20 ..
drwxr-xr-x 3 pi pi 4096 сен 9 09:26 AwoxSMP
drwxr-xr-x 2 pi pi 4096 сен 14 09:00 BroadlinkRM2
drwxr-xr-x 2 pi pi 4096 сен 9 09:26 examples
Code: Select all
pi@raspberrypi ~/domoticz/plugins/BroadlinkRM2 $ ls -al
итого 56
drwxr-xr-x 2 pi pi 4096 сен 14 09:00 .
drwxr-xr-x 5 pi pi 4096 сен 9 09:26 ..
-rwxr-xr-x 1 pi pi 11504 сен 14 13:14 plugin_http.py
-rwxr-xr-x 1 pi pi 81 сен 13 11:11 plugin_http.sh
-rwxr-xr-x 1 pi pi 26803 сен 12 22:08 plugin.py
-rwxr-xr-x 1 pi pi 1501 сен 12 22:08 plugin_send.py
Code: Select all
pi@raspberrypi ~ $ python -V
Python 2.7.9
pi@raspberrypi ~ $ python3 -V
Python 3.5.4
pi@raspberrypi ~ $ which python
/usr/bin/python
pi@raspberrypi ~ $ which python3
/usr/local/bin/python3
pi@raspberrypi ~ $ which python3.4
/usr/bin/python3.4
pi@raspberrypi ~ $ which python3.5
/usr/local/bin/python3.5
pi@raspberrypi ~ $ pip3 -V
pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
Code: Select all
lrwxrwxrwx 1 root root 9 сен 12 23:16 python -> python2.7
lrwxrwxrwx 1 root root 9 мар 28 2015 python2 -> python2.7
-rwxr-xr-x 1 root root 3201580 сен 18 2016 python2.7
lrwxrwxrwx 1 root root 36 сен 18 2016 python2.7-config -> arm-linux-gnueabihf-python2.7-config
lrwxrwxrwx 1 root root 16 мар 28 2015 python2-config -> python2.7-config
lrwxrwxrwx 1 root root 9 дек 6 2014 python3 -> python3.4
-rwxr-xr-x 2 root root 3816928 окт 19 2014 python3.4
lrwxrwxrwx 1 root root 36 окт 19 2014 python3.4-config -> arm-linux-gnueabihf-python3.4-config
-rwxr-xr-x 2 root root 3816928 окт 19 2014 python3.4m
lrwxrwxrwx 1 root root 37 окт 19 2014 python3.4m-config -> arm-linux-gnueabihf-python3.4m-config
lrwxrwxrwx 1 root root 16 дек 6 2014 python3-config -> python3.4-config
lrwxrwxrwx 1 root root 10 дек 6 2014 python3m -> python3.4m
lrwxrwxrwx 1 root root 17 дек 6 2014 python3m-config -> python3.4m-config
lrwxrwxrwx 1 root root 16 мар 28 2015 python-config -> python2.7-config
Code: Select all
cd Python-3.5.4
./configure --enable-shared
make
sudo make install
Code: Select all
pi@raspberrypi ~ $ sudo pip3 install Crypto
Requirement already satisfied: Crypto in /usr/local/lib/python3.5/site-packages
Requirement already satisfied: Naked in /usr/local/lib/python3.5/site-packages (from Crypto)
Requirement already satisfied: shellescape in /usr/local/lib/python3.5/site-packages (from Crypto)
Requirement already satisfied: requests in /usr/local/lib/python3.5/site-packages (from Naked->Crypto)
Requirement already satisfied: pyyaml in /usr/local/lib/python3.5/site-packages (from Naked->Crypto)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/site-packages (from requests->Naked->Crypto)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/site-packages (from requests->Naked->Crypto)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.5/site-packages (from requests->Naked->Crypto)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.5/site-packages (from requests->Naked->Crypto)
Code: Select all
pi@raspberrypi ~ $ sudo pip3 install broadlink
Requirement already satisfied: broadlink in /usr/local/lib/python3.5/site-packages/broadlink-0.5-py3.5.egg
Requirement already satisfied: pyaes==1.6.0 in /usr/local/lib/python3.5/site-packages (from broadlink)
Code: Select all
pi@raspberrypi ~ $ sudo pip3 install pyaes
Requirement already satisfied: pyaes in /usr/local/lib/python3.5/site-packages
Code: Select all
pi@raspberrypi $ sudo cp -r /usr/local/lib/python3.5/site-packages/crypto /usr/lib/python3.5/
pi@raspberrypi $ sudo cp -r /usr/local/lib/python3.5/site-packages/broadlink /usr/lib/python3.5/
Code: Select all
EventSystem - Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform.
Code: Select all
pi@raspberrypi ~ $ sudo apt-get install python3-dev
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
Уже установлена самая новая версия python3-dev.
обновлено 0, установлено 0 новых пакетов, для удаления отмечено 0 пакетов, и 9 пакетов не обновлено.
Code: Select all
pi@raspberrypi ~ $ sudo apt-get install libpython3.4
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
Уже установлена самая новая версия libpython3.4.
обновлено 0, установлено 0 новых пакетов, для удаления отмечено 0 пакетов, и 9 пакетов не обновлено.
Code: Select all
pi@raspberrypi ~/domoticz $ dpkg -l | grep libpython3.4
ii libpython3.4:armhf 3.4.2-1 armhf Shared Python runtime library (version 3.4)
ii libpython3.4-dev:armhf 3.4.2-1 armhf Header files and a static library for Python (v3.4)
ii libpython3.4-minimal:armhf 3.4.2-1 armhf Minimal subset of the Python language (version 3.4)
ii libpython3.4-stdlib:armhf 3.4.2-1 armhf Interactive high-level object-oriented language (standard library, version 3.4)
You are right. Thank you. I can see "BroadlinkRM2 with Kodi Remote" in hardware on stable version.
Code: Select all
2017-09-14 20:36:00.592 Error: BroadlinkRM3 hardware (5) thread seems to have ended unexpectedly
2017-09-14 20:36:02.799 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/BroadlinkRM2/:/usr/local/lib/python35.zip:/usr/local/lib/python3.5:/usr/local/lib/python3.5/plat-linux:/usr/local/lib/python3.5/lib-dynload'.
2017-09-14 20:36:02.799 Error: (BroadlinkRM3) Module Import failed, exception: 'ImportError'
2017-09-14 20:36:02.799 Error: (BroadlinkRM3) Module Import failed: ' Name: broadlink'
Hi, Broadlink plugin is one way communication only. No status came back from devices. if you want to set the push button to some other value just change settings on it.x15pa3ck15x wrote: ↑Friday 15 September 2017 2:27 Hello, I´ve installed broadlink plugin, with some one button switch, but when I send command ON, device is going to on, but in domoticz stay OFF status.