Python Plugin: Broadlink RM2 V3

Python and python framework

Moderator: leecollings

User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Phantom »

I did some more testing and found out something interesting.

Because i saw this error

Code: Select all

-- OPENSSL_LIBRARIES: /usr/lib/arm-linux-gnueabihf/libssl.a;/usr/lib/arm-linux-gnueabihf/libcrypto.a
CMake Warning at /usr/share/cmake-3.7/Modules/FindBoost.cmake:761 (message):
  Imported targets not available for Boost version 106501
i updated Cmake from version 3.7 to 3.9 and i don't have the error anymore but then i have to old bug again that as soon as i activate the broadlink plugin i get the segmentation fault.

here is how i upgraded to version 3.9

Code: Select all

wget http://ftp.us.debian.org/debian/pool/main/c/cmake/cmake-data_3.9.5-1_all.deb
wget http://ftp.us.debian.org/debian/pool/main/c/cmake/cmake_3.9.5-1_armhf.deb

sudo apt-get install librhash0
sudo dpkg -i cmake_3.9.5-1_armhf.deb cmake-data_3.9.5-1_all.deb
I also switched to my libssl
sudo apt-get remove libssl-dev
sudo apt-get install libssl1.0-dev

Removing libssl1.0-dev and installing libssl-dev again gives the same result when trying to start domoticz (gives segmentation fault)
So it looks like cmake 3.9 is causing the problem.
r3wt3d
Posts: 7
Joined: Friday 10 November 2017 4:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by r3wt3d »

Hello

I am trying to learn RF signal with this but I can't.
In learning mode it wont finish learning.

I can learn the same RF transmitter with Homebridge learn mode using Broadlink plugin.

https://www.npmjs.com/package/homebridg ... sory-types

There seems to be a ScanFrequency option ...

I can send the code when I learn with homebridge and add a dummy RF switch with learn button on domoticz and replace the code.

Any help?
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by gizmocuz »

Yes, but when they used the prebuild versions it should work
Quality outlives Quantity!
User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Phantom »

gizmocuz wrote: Wednesday 15 November 2017 9:10 Yes, but when they used the prebuild versions it should work
Not sure if it was ment for me.
For the stable version this is correct but i assume the beta version is being made with the most resent boost and cmake version and then Domoticz is not running anymore with this plugin.
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by gizmocuz »

That i do not know. Yes we always try to use the latest library versions.
Maybe you can update the script
Quality outlives Quantity!
User avatar
Phantom
Posts: 87
Joined: Saturday 31 December 2016 14:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11652
Location: The Netherlands
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Phantom »

Hopefully zak45 can take a look at it then as i have no developing skills at all.
sirjohn78
Posts: 5
Joined: Friday 01 December 2017 17:17
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by sirjohn78 »

Please help ....

I am using domoticz on a Freenas system for a while just for 2 WOL switches integrated to Google Home (via IFTTT) to turn on my home computers using my voice... It is working flawlessly...

Now I bought a Broadlink RM Pro (V3) but could not install the plugin successfully.

What I did step by step :

I create a new Jail on Freenas GUİ (domoticz_2) (I didn't want to mess with the working Domoticz Jail)

I connected the jail with SSH (jexec 9 tcsh)

pkg update
pkg upgrade
pkg install domoticz
(It installs 3.8153 Stable)

pkg install python36
pkg install py36-pip
git clone https://github.com/mjg59/python-broadlink
python3.6 -m pip install pyaes
cp -r /usr/local/lib/python3.6/site-packages/pyaes/ /usr/lib/python3.6/
pip-3.6 install python-broadlink/
cp -r /usr/local/lib/python3.6/site-packages/broadlink/ /usr/lib/python3.6/

After these, I couldn't find any directory named BroadlinkRM2 under /usr/local/domoticz/plugins/
So, I created the directory. Copy 4 files in it. ( plugin.py , plugin_http.py , plugin_http.sh , plugin_send.py )

I restart domoticz service.

But there is no BroadlinkRM2 in the hardware list...

What am I doing wrong ? or is there anything right I'm doing :) Because, I don't have any linux knowledge and I am just following the info I found on the Domoticz forums.

One more thing,

The plugin_http.sh file is as below:

nohup python /Domoticz/plugins/BroadlinkRM2/plugin_http.py $1 $2 $3 &

I assume it should be as below in my situation:

nohup python usr/local/domoticz/plugins/BroadlinkRM2/plugin_http.py $1 $2 $3 &

Actually I tried both ways but there is no change...

Thanks in advance....
r3wt3d
Posts: 7
Joined: Friday 10 November 2017 4:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by r3wt3d »

Did u install Crypto?

sudo pip3 install Crypto
sirjohn78
Posts: 5
Joined: Friday 01 December 2017 17:17
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by sirjohn78 »

First of all, thank you for a quick respond.

I did not install Crypto.
I read something like either pyaes or crypto needed. Not both of them.

I'll try...
sirjohn78
Posts: 5
Joined: Friday 01 December 2017 17:17
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by sirjohn78 »

root@domoticz_1:/ # pip-3.6 install crypto
Collecting crypto
Downloading crypto-1.4.1-py2.py3-none-any.whl
Collecting Naked (from crypto)
Downloading Naked-0.1.31-py2.py3-none-any.whl (590kB)
100% |████████████████████████████████| 593kB 1.5MB/s
Collecting shellescape (from crypto)
Downloading shellescape-3.4.1-py2.py3-none-any.whl
Collecting requests (from Naked->crypto)
Downloading requests-2.18.4-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 2.8MB/s
Collecting pyyaml (from Naked->crypto)
Downloading PyYAML-3.12.tar.gz (253kB)
100% |████████████████████████████████| 256kB 2.3MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests->Naked->crypto)
Downloading chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |████████████████████████████████| 143kB 2.9MB/s
Collecting certifi>=2017.4.17 (from requests->Naked->crypto)
Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
100% |████████████████████████████████| 337kB 2.3MB/s
Collecting urllib3<1.23,>=1.21.1 (from requests->Naked->crypto)
Downloading urllib3-1.22-py2.py3-none-any.whl (132kB)
100% |████████████████████████████████| 133kB 3.4MB/s
Collecting idna<2.7,>=2.5 (from requests->Naked->crypto)
Downloading idna-2.6-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 4.3MB/s
Installing collected packages: chardet, certifi, urllib3, idna, requests, pyyaml, Naked, shellescape, crypto
Running setup.py install for pyyaml ... done
Successfully installed Naked-0.1.31 certifi-2017.11.5 chardet-3.0.4 crypto-1.4.1 idna-2.6 pyyaml-3.12 requests-2.18.4 shellescape-3.4.1 urllib3-1.22
root@domoticz_1:/ # cp -r /usr/local/lib/python3.6/site-packages/crypto/ /usr/lib/python3.6/
root@domoticz_1:/ # service domoticz restart
Stopping domoticz.
Waiting for PIDS: 61007.
Starting domoticz.
2017-12-01 20:06:21.308 Domoticz V3.8153 (c)2012-2017 GizMoCuz
2017-12-01 20:06:21.308 Build Hash: 3.8153, Date: 2017-07-30 15:03:11
2017-12-01 20:06:21.308 Startup Path: /usr/local/domoticz/
domoticz: Domoticz is starting up....



Nothing changed... :(
No Broadlink option in hardware list....
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 »

@sirjohn78
show us Domoticz log file ( from start )
vchecco
Posts: 4
Joined: Friday 22 September 2017 6:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by vchecco »

good morning guys,
sorry for my english.
i'm italian (ignorant) :lol:

raspberry pi 3 rasbian

I have a problem:

I added the hardware but I do not see any devices.

I did this procedure:

1)through ssh I installed: pip3 install broadlink
Schermata 2017-12-02 alle 16.23.44.png
Schermata 2017-12-02 alle 16.23.44.png (25.02 KiB) Viewed 3457 times
2) then I created the "broadlink" folder in /home/pi/domoticz/plugins /
and added the files I downloaded from the wiki
Schermata 2017-12-02 alle 16.40.21.png
Schermata 2017-12-02 alle 16.40.21.png (133.02 KiB) Viewed 3457 times
3) restart domoticz
(pi@raspberrypi:~ $ sudo service domoticz restart)

4) added the hardware, but I do not see any devices
Schermata 2017-12-02 alle 16.34.19.png
Schermata 2017-12-02 alle 16.34.19.png (115.09 KiB) Viewed 3457 times

(I tried with real ip and real mac of broadlink rm pro; and also with ip 127.0.0.1 and mac 000000000000 to search for the device automatically, but I see nothing.

this is the error

Code: Select all

2017-12-03 09:33:35.529 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/pi/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-12-03 09:33:35.529 Error: (test 4) Module Import failed, exception: 'ImportError'
2017-12-03 09:33:35.529 Error: (test 4) Module Import failed: ' Name: broadlink'

where am I wrong?

sorry always for my English
thank you all
User avatar
Sjonnie2017
Posts: 361
Joined: Wednesday 02 August 2017 19:43
Target OS: Linux
Domoticz version: Latest ß
Location: The Netherlands
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Sjonnie2017 »

Hi vchecco,

Try this for the folder to store ini files: /home/pi/domoticz/broadlink_ini

There is no C:/BroadlinkRM2 folder on a Pi ;)

HTH

Greetz,

Sjonnie
ConBee II - TRÅDFRI lights + switches, loads of ChingLing dimmers and switches, Heiman and Xiaomi sensors
SolarEdge SE4000H (with active modbus_tcp)
YouLess Energy meter
Shelly 2.5 in roller shutter mode
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 »

@vchecco

you need also to copy module broadlink under one of these directories:

'/home/pi/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'.

I would do it under /usr/lib/python3.5 but it's up to you ;)
Dam59
Posts: 1
Joined: Sunday 03 December 2017 17:52
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Dam59 »

Hi Zak,

Just a post to thank you for your great work, it works very well !
Keep up the good work !

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

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 »

Dam59 wrote: Sunday 03 December 2017 18:06 Hi Zak,

Just a post to thank you for your great work, it works very well !
Keep up the good work !

Dam
thanks, appreciate :P
vchecco
Posts: 4
Joined: Friday 22 September 2017 6:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by vchecco »

zak45 wrote: Sunday 03 December 2017 12:45 @vchecco

you need also to copy module broadlink under one of these directories:

'/home/pi/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'.

I would do it under /usr/lib/python3.5 but it's up to you ;)
hi zac, thank you very much for your help
I do not understand why "Crypto" ("C" uppercase) was put in / user / lib / python3.
so I made the copy from this dir and everything worked properly.
I wanted to ask you, if I wanted to send a series of codes, (for example tv channel 876), how can I do? is there an alternative method to creating scenes?

sorry for my English
good job.

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

Re: Python Plugin: Broadlink RM2 V3

Post by zak45 »

@vchecco

each code generate a device.
Once you have all your devices, just use the scene/group feature built-in domoticz ;-)
hrushchov
Posts: 1
Joined: Wednesday 06 December 2017 20:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by hrushchov »

@zak45
I installed the plugin but it cannot connect to RM Pro. Could you please look through my log file:

Code: Select all

2017-12-06 19:53:53.221 Domoticz V3.8153 (c)2012-2017 GizMoCuz
2017-12-06 19:53:53.221 Build Hash: 494fff7, Date: 2017-07-30 10:19:41
2017-12-06 19:53:53.221 Startup Path: /home/pi/domoticz/
2017-12-06 19:53:53.370 PluginSystem: Started, Python version '3.5.3'.
2017-12-06 19:53:53.377 Active notification Subsystems: gcm, http (2/12)
2017-12-06 19:53:53.378 WebServer(HTTP) started on address: :: with port 8080
2017-12-06 19:53:53.383 WebServer(SSL) started on address: :: with port 443
2017-12-06 19:53:53.384 Proxymanager started.
2017-12-06 19:53:53.385 Starting shared server on: :::6144
2017-12-06 19:53:53.385 TCPServer: shared server started...
2017-12-06 19:53:53.386 RxQueue: queue worker started...
2017-12-06 19:53:53.406 Incoming connection from: 192.168.1.70
2017-12-06 19:53:55.386 EventSystem: reset all events...
2017-12-06 19:53:55.387 EventSystem: reset all device statuses...
2017-12-06 19:53:55.626 Python EventSystem: Module not found - Trying to initialize.
2017-12-06 19:53:55.627 Python EventSystem: Initalizing event module.
2017-12-06 19:53:55.627 EventSystem: Started
2017-12-06 19:53:55.750 PluginSystem: Entering work loop.
2017-12-06 19:53:56.004 (Broadlink) Initialized version 3.0.0, author 'zak45'
2017-12-06 19:53:56.057 (Broadlink) Debug log level set to: 'true'.
2017-12-06 19:53:56.057 (Broadlink) 'Address':'192.168.1.74'
2017-12-06 19:53:56.057 (Broadlink) 'Mode3':'yes'
2017-12-06 19:53:56.057 (Broadlink) 'Mode2':'/home/pi/domoticz/broadlink_ini'
2017-12-06 19:53:56.057 (Broadlink) 'Mode4':'yes'
2017-12-06 19:53:56.057 (Broadlink) 'HardwareID':'2'
2017-12-06 19:53:56.057 (Broadlink) 'Name':'Broadlink'
2017-12-06 19:53:56.057 (Broadlink) 'Version':'3.0.0'
2017-12-06 19:53:56.057 (Broadlink) 'Mode6':'Debug'
2017-12-06 19:53:56.057 (Broadlink) 'Mode5':'9000'
2017-12-06 19:53:56.057 (Broadlink) 'Port':'0'
2017-12-06 19:53:56.057 (Broadlink) 'Mode1':'34ea348a629a'
2017-12-06 19:53:56.057 (Broadlink) 'Author':'zak45'
2017-12-06 19:53:56.057 (Broadlink) 'Key':'BroadlinkRM2'
2017-12-06 19:53:56.057 (Broadlink) 'HomeFolder':'/home/pi/domoticz/plugins/BroadlinkRM2/'
2017-12-06 19:53:56.057 (Broadlink) Device count: 4
2017-12-06 19:53:56.057 (Broadlink) Device: 1 - ID: 1, Name: 'Broadlink - Command', nValue: 0, sValue: 'Off'
2017-12-06 19:53:56.057 (Broadlink) Device ID: '1'
2017-12-06 19:53:56.057 (Broadlink) Device Name: 'Broadlink - Command'
2017-12-06 19:53:56.057 (Broadlink) Device nValue: 0
2017-12-06 19:53:56.057 (Broadlink) Device sValue: 'Off'
2017-12-06 19:53:56.057 (Broadlink) Device LastLevel: 0
2017-12-06 19:53:56.057 (Broadlink) Device: 2 - ID: 2, Name: 'Broadlink - Temp', nValue: 0, sValue: ''
2017-12-06 19:53:56.057 (Broadlink) Device ID: '2'
2017-12-06 19:53:56.057 (Broadlink) Device Name: 'Broadlink - Temp'
2017-12-06 19:53:56.057 (Broadlink) Device nValue: 0
2017-12-06 19:53:56.057 (Broadlink) Device sValue: ''
2017-12-06 19:53:56.057 (Broadlink) Device LastLevel: 0
2017-12-06 19:53:56.057 (Broadlink) Device: 254 - ID: 3, Name: 'Broadlink - Remote', nValue: 0, sValue: ''
2017-12-06 19:53:56.057 (Broadlink) Device ID: '3'
2017-12-06 19:53:56.057 (Broadlink) Device Name: 'Broadlink - Remote'
2017-12-06 19:53:56.057 (Broadlink) Device nValue: 0
2017-12-06 19:53:56.057 (Broadlink) Device sValue: ''
2017-12-06 19:53:56.058 (Broadlink) Device LastLevel: 0
2017-12-06 19:53:56.058 (Broadlink) Device: 255 - ID: 4, Name: 'Broadlink - Import', nValue: 0, sValue: 'Off'
2017-12-06 19:53:56.058 (Broadlink) Device ID: '4'
2017-12-06 19:53:56.058 (Broadlink) Device Name: 'Broadlink - Import'
2017-12-06 19:53:56.058 (Broadlink) Device nValue: 0
2017-12-06 19:53:56.058 (Broadlink) Device sValue: 'Off'
2017-12-06 19:53:56.058 (Broadlink) Device LastLevel: 0
2017-12-06 19:53:56.058 (Broadlink) Connecting to: 192.168.1.74:34ea348a629a
2017-12-06 19:53:56.064 Error: (Broadlink) Error Connecting to Broadlink device....
2017-12-06 19:53:56.064 (Broadlink) Device Number begin to : 2
2017-12-06 19:53:56.082 (Broadlink) No ini file :/home/pi/domoticz/broadlink_ini/remote/plugin_remote_2.ini
2017-12-06 19:53:56.082 (Broadlink) Custom Commands for Remote not managed
2017-12-06 19:53:56.082 (Broadlink) Heartbeat interval set to: 30.
2017-12-06 19:54:05.553 (Broadlink) Calling message handler 'onHeartbeat'.
2017-12-06 19:54:05.566 Error: (Broadlink) Error Connecting to Broadlink device....
What can be the reason of the error?
vchecco
Posts: 4
Joined: Friday 22 September 2017 6:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by vchecco »

zak45 wrote: Monday 04 December 2017 12:40 @vchecco

each code generate a device.
Once you have all your devices, just use the scene/group feature built-in domoticz ;-)
Hi Zac, thank you so much.
everything is working good, well done .

I have a question, there is a guide to check everything through "google-assistant" even when I'm away from home?
I would like to controll everything with the voice

(for iphone I managed to do everything with homebridge, now I should integrate the android system)

thank you very much. I am sorry for my English
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest