Python Plugin : Broadlink RM2 V4

Python and python framework

Moderator: leecollings

yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

Help another newbie please?

I have been trying to install broadlink into my working domoticz/mochad for 1 week. Being off work I probably have 80 hours into this and cannot get it!

I can install broadlink and see it in hardware of domoticz -IF I UPGRADE PYTHON3 from 3.5.3 to 3.6 or 3.7 -- the problem here is then it refuses to load plugin.py - it is definitely not pointing to new 3.6 or 3.7 and the 3.5 is not valid, so domoticz fails to load it per log and so it does not build a 'switch' to use...

Reason I tried newer python3 is with python 3.5 it fails to even install broadlink or Crypto or pyaes! This is the fault on ANY of the installs -- SSL faults:

**HELP PLEASE!!!**

sudo pip3 install broadlink
Collecting broadlink
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
chunked=chunked)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 350, in _make_request
self._validate_conn(conn)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 837, in _validate_conn
conn.connect()
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 323, in connect
ssl_context=context)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
context.load_verify_locations(ca_certs, ca_cert_dir)
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 392, in load_verify_locations
self._ctx.load_verify_locations(cafile, capath)
File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 525, in load_verify_locations
_raise_current_error()
File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 48, in exception_from_error_queue
raise exception_type(errors)
OpenSSL.SSL.Error: []
pi@raspberrypi:~ $

HELP!!!
yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

I appear to have an openSSL fault that I have no clue how to get around?
Flest
Posts: 2
Joined: Saturday 13 October 2018 15:21
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Flest »

who can help?
I can't make it work.

orangePi PC2 debian
pyton 3.53
yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

I gave up trying to get past SSL fault in pyuthon3.5 and again (8th try) installed python 3.6.6. I can now install with sudo python3.6 -m pip install broadlink
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by kalinkamaen »

Windows 10
Domoticz Beta 4.10064
Python 3.3.6

Trying to install Setup.exe, but gets Plugin.py error.
Please help.
Spoiler: show
Found existing installation: broadlink 0.8
Uninstalling broadlink-0.8:
Successfully uninstalled broadlink-0.8
Running setup.py install for broadlink ... done
Successfully installed broadlink-0.8
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
File not found - plugin.py
0 File(s) copied
""
"ERROR: copy plugin error"
Windows 10, Domoticz 14784
kalinkamaen
Posts: 52
Joined: Sunday 04 January 2015 15:57
Target OS: Windows
Domoticz version: 2022.2
Location: Norway
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by kalinkamaen »

kalinkamaen wrote: Monday 15 October 2018 21:21 Windows 10
Domoticz Beta 4.10064
Python 3.3.6

Trying to install Setup.exe, but gets Plugin.py error.
Please help.
Spoiler: show
Found existing installation: broadlink 0.8
Uninstalling broadlink-0.8:
Successfully uninstalled broadlink-0.8
Running setup.py install for broadlink ... done
Successfully installed broadlink-0.8
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
File not found - plugin.py
0 File(s) copied
""
"ERROR: copy plugin error"
This was fixed by making a new plugins\BroadlinkRM2 folder. And copying Plugin.py in to BroadlinkRM2 folder.
C:\Program Files (x86)\Domoticz\plugins\BroadlinkRM2\Plugin.py

Running Setup.exe in admin mode still made an error. Error was plugin already installed. But after reboot Broalink plugin was avaiable.
Windows 10, Domoticz 14784
Flest
Posts: 2
Joined: Saturday 13 October 2018 15:21
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Flest »

any help?

Can anyone have instructions on how to put this on debian?
it is easy to install on windows, but debian ...
fvdp80
Posts: 69
Joined: Tuesday 14 August 2018 8:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10303
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by fvdp80 »

@Flest

take a look at my instructions on page 15 regarding Stretch for the RPI. Maybe it will work for your Debia install.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by febalci »

Rpi3, Raspbian Jessie, Python 3.4.2. Domoticz 4.9700 Stable

Installed broadlink 0.9 and pyaes with pip3. Removed pycrypto files. Copied v4 files to plugins folder. I create a device based on broadlink, however Domoticz crashes instantly. Not even a single line of error on log... Is it because i use Python 3.4.2 or jessie?? Thanks...
fvdp80
Posts: 69
Joined: Tuesday 14 August 2018 8:22
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10303
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by fvdp80 »

@Febalci, @Flest
fvdp80 wrote: Friday 31 August 2018 21:48 After a lot of trial and error I got the RM mini up and running. Here's how I did it:

I started with a fresh install of Stretch on my RPI.
After that:

Code: Select all

sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libssl-dev
Then i installed Domoticz Beta.

Code: Select all

curl -L install.domoticz.com | sudo bash
cd domoticz
./updatebeta
Time to install the broadlink stuff:

Code: Select all

sudo apt-get install python3-pip
sudo pip3 install Crypto
sudo pip3 install broadlink
sudo pip3 install pyaes
sudo cp -r /usr/local/lib/python3.5/dist-packages/Crypto/ /usr/lib/python3.5/
sudo cp -r /usr/local/lib/python3.5/dist-packages/broadlink /usr/lib/python3.5/
Place these files in the plugins folder of Domoticz:
plugin_send.py
plugin_http.py
plugin.py
plugin_http.sh

Code: Select all

chmod +x plugin.py
chmod +x plugin_send.py
chmod +x plugin_http.py
chmod +x plugin_http.sh
sudo service domoticz restart
Done!
Now follow the broadlink wiki on how to add the device in Domoticz.
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by febalci »

Thanks @fvdp80,

I also made some experimenting on this issue. I thought it was due to python 3.4 which was the problem. So I installed python 3.6.7 on jessie and managed to make it work this python with domoticz 4.9700. However broadlink plugin is still crashing. So as a result, i conclude that the broadlink plugin doesn't work on raspbian jessie in any way. I also tried on raspbian stretch with python 3.5 and broadlink plugin works successfully there. I have to go to stretch raspbian definitely.

Thanks for all your help...
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by febalci »

UPDATE: I used stretch raspbian 2018-10-09 version with domoticz 4.9700. You definitely have to pip3 uninstall pycryptodome. No need to install Crypto or libcurl4 or libssl. Just for your info. Works as a charm now. So in total:

Code: Select all

curl -L install.domoticz.com | sudo bash

sudo pip3 install broadlink
sudo pip3 install pyaes

sudo pip3 uninstall pycryptodome

copy plugin files to plugins/broadlink/
chmod +x plugin.py
chmod +x plugin_send.py
chmod +x plugin_http.py
chmod +x plugin_http.sh
sudo service domoticz restart
yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

yorlik wrote: Monday 15 October 2018 20:19 I gave up trying to get past SSL fault in pyuthon3.5 and again (8th try) installed python 3.6.6. I can now install with sudo python3.6 -m pip install broadlink
FYI, FULL stretch with GUI was my problem - it is NOT compatible with installation of broadlink! changing to stretch LITE allowed fpv80's install instructions to work.

So anyone fighting installation of all this, consider changing to stretch LITE if you are using full GUI version!
yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

AurelioF wrote: Thursday 11 October 2018 11:19 Hello everyone..
I'm trying to make the plugin work and both in windows and raspbery I do not see the import device, only two devices appear, Command and Remote, plus, in Command device, learn the IR commands well, but it does not seem to learn the RF commands, with the mobile application if it recognizes the RF commands.
Some clue?
Thank you
SAME HERE! I finally have domoticz, mochad (for x10), and broadlink installed and running on pi zero W, BUT NO RF LEARNING!

IR seems to work but no 300mhz RF learned! Just ignored. I know my broadlink RM2 Pro lears 310mhz X10 RF as I had it working and repeating them when using HomeGenie months ago...

Any idea how to turn RF learning back on with this broadlink plugin?
yorlik
Posts: 6
Joined: Wednesday 03 October 2018 22:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by yorlik »

In case anyone wants to know about RF commands with broadlink, there is info on another thread explaining it in detail:

https://github.com/mjg59/python-broadlink/issues/87

I am working on getting my past programmed codes transferred over to domoticz; I think until an RF module is perfected inside broadlink python plugin, that is how we will get RF working.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by zak45 »

you can try also to learn RF using Broadlink application and import data to the plugin using the import feature.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by zak45 »

henk99 wrote: Tuesday 09 October 2018 11:24 So, I have finally successfully added my Broadlink outlets, but in this process two items per outlet are added to the utilities tab in domoticz.
Broadlink 1.JPG
One of these was 'working' right away, displaying the current power usage in Watts (W) and logging it. The second item should be displaying usage I think, according to the text, but nothing is displaying for either outlet. There are some settings which I tried of course, but nothing is happening.
B.JPG
Can someone tell me how this works? Do I have to change something in the plugin perhaps?
Try to put computed instead From device.
ActionHenk
Posts: 28
Joined: Monday 05 March 2018 3:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by ActionHenk »

Oke i installed a second raspberry pi from scratch because my currently main pi is having some issues and although i have a lot of sd-card backups its not really clear to me when the problems kicked in.

Anyway everything was installing succesfull except the broadlink plugin, i really could not remember how i did install it back in march 2018 on my main pi. What i did know is that back then it was also horrible to install for a Linux noob like me. Unlike a lot of other plugins i manage to install easy the broadlink plugin really is something that i cant wrap my mind arround.


Anyway, i clean installed from scratch the following things

1# raspberry stretch lite,
2# domoticz 4.9700
3# phyton 3.5.3
4# libpython3.5.3
5# then i put the 4 files manually in the self created /home/pi/domoticz/plugins/BroadlinkRM2 folder with winSCP

So i installed it all and keep getting these errors:
2018-11-01 00:34:32.015 Error: (BroadlinkRM2) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/BroadlinkRM2/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.

2018-11-01 00:34:32.015 Error: (broadlink ir) Module Import failed, exception: 'ImportError'

2018-11-01 00:34:32.015 Error: (broadlink ir) Module Import failed: ' Name: broadlink'

2018-11-01 00:34:32.015 Error: (broadlink ir) Error Line details not available.
After these errors i did the following things:

6# i manually put the python-broadlink folder in /home/pi/ because it was also on my main rasp pi, don't know why i need it. but still same problems

7# then i manually put the python-broadlink-0.8 folder in /home/pi/ i think this is a newer version, but i think i don't need this anyway since it seems like a totall different thing that has nothing to do with the broadlink plugin files in /home/pi/domoticz/plugins/BroadlinkRM2

8# i also copy the files of the python-broadlink-0.8 folder to the phyton-broadlink folder but still the same errors.

9# python3-dev (this one i installed later on but did not help me) still same errors

10# Well i was kinda giving up and i searched on my main pi in the phyton folder (also 3.5.3) and i noticed there was one extra folder named crypto, i installed this to my second raspberry pi but still no difference.

But after days of trying i finally got it working with this command:

11# sudo apt-get install python3-pip libglib2.0-dev

And after this command i could use this command:

12# sudo pip3 install pyaes

I don't know what the hell these plugin do, i think the first command (libglip2.0) enables me to use the sudo pip3 command, and the second command well it installes pyaes and that made it finally working i guess.

Now that the plugin finally works and is able to learn remote's and make buttons in the switch tab on domoticz i was curious if it still keeped working after deleting the python-broadlink and python-broadlink-0.8 folder in /home/pi/ and yes it still keeps working so i don't need these folders and files.

Anyway i'm happy i'm able to run this plugin on my second test raspberry pi because using domoticz without this plugin as my main home controller is no option. Thanks by the way for your wonderfull plugin!!


I think for a noob like me it is very hard to install this plugin, i made myself a readme file for in the future so i can install it again without trying for days without succes. The domoticz broadlink rm2 wiki really does not help a noob like me and is not telling the whole picture about what i need to do from scratch. When i type in my errors in google i noticed that a lot of people are having the same troubles as me, probable those people make the same mistakes as me because like me they don't know a thing about Linux.

I hope these steps that helped me installing it from scratch will help other noobs like me in the future, and althought i don't really know what the last steps did, it made it working so maybe you (zak) or someone else could explain the steps for people like me that are new in the linux world.

And maybe the domoticz broadlink wiki could get updated with these steps and the explenation why they are needed?

Anyway, again thanks for your plugin! Because of your plugin in combination with power consumption meassuring i have automated all my audio and video systems with scripts commanding it with voice commands and my family don't need to touch a remote ever again! All we have to do is say what we want, watch video, listen music, listen radio, and domoticz with your plugin and read out of power messuring knows what to turn off, turn on and wich hdmi channels to select . Its really cool.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by zak45 »

ActionHenk wrote: Thursday 01 November 2018 1:34
Anyway everything was installing succesfull except the broadlink plugin, i really could not remember how i did install it back in march 2018 on my main pi. What i did know is that back then it was also horrible to install for a Linux noob like me. Unlike a lot of other plugins i manage to install easy the broadlink plugin really is something that i cant wrap my mind arround.

Anyway, again thanks for your plugin! Because of your plugin in combination with power consumption meassuring i have automated all my audio and video systems with scripts commanding it with voice commands and my family don't need to touch a remote ever again! All we have to do is say what we want, watch video, listen music, listen radio, and domoticz with your plugin and read out of power messuring knows what to turn off, turn on and wich hdmi channels to select . Its really cool.
Sorry you have trouble, but not really related to broadlink plugin itself. once you have a system with python installed in right way, as required for Domoticz, you should not have problem to run broadlink plugin. I'm not able to provide lots of help on linux, I run all my system on Windows.

But happy to see that you have been able to have it running again
ActionHenk
Posts: 28
Joined: Monday 05 March 2018 3:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by ActionHenk »

Hi, thanks for your answer.

Yeah my problem is more related to phyton, the plugin itself has no troubles once i installed it.

Could you explain what the phyton-broadlink-0.8 folder does? and what it is for?

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest