Python Plugin: Broadlink RM2

Python and python framework

Moderator: leecollings

shoyboom
Posts: 12
Joined: Saturday 25 March 2017 16:42
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by shoyboom »

hi everyone and thank you for the plugin.
i installed it on my raspberry and i works grate.
have a question.
how can i combine several battens to one switch. ex " power on/off, hdmi1, hdmi2....."?

thank you
yaron
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Python Plugin: Broadlink RM2

Post by StanHD »

Hi,

After you have created the individual buttons, create a Selector Switch from the Dummy Hardware, then you can use the jason interface to define the sub-switches:-

Image

Image

You can find a comprehensive explanation of the Jason Interface in the Domoticz Wiki. ;)
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
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 »

All,

plugin updated to be compatible with version < 3.5.
wiki updated http://www.domoticz.com/wiki/Plugins/BroadlinkRM2.html

@shoyboom
see wiki

thanks
markjgabb
Posts: 142
Joined: Tuesday 24 January 2017 23:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8153
Location: Australia
Contact:

Re: Python Plugin: Broadlink RM2

Post by markjgabb »

hmmm interesting...ive upgraded to 3.7x beta...but i dont have a plugins folder....
ive manually created
ive run setup from admin cmd
interestingly it says setup complete, but it only takes like 2 seconds and domoticz doesnt restart....
possible conflict with server 2016?
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: Python Plugin: Broadlink RM2

Post by kniazio »

Does the plugin recognize 433MHz RF codes?
Because he sees no.
burton666
Posts: 85
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Post by burton666 »

I just tried this plugin on my rpi, but I can't get it to work. It looks like I have pyhon 2.7 installed, I tried the instructions and replaced the path python3.4 with python2.7 and downloaded and copied the files to the right location. But It still does not work.

I also wonder about the plugin directory, is it domoticz/plugins? And you are supposed to create the broadlink -folder yourself and put the .py files there?

I also tried upgrading the python version to a newer like it said in the beginning of this thread, but that does not work either. I still only have the python2.7 in the specified location and pip3 does not work.
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re:

Post by kniazio »

burton666 wrote:I just tried this plugin on my rpi, but I can't get it to work. It looks like I have pyhon 2.7 installed, I tried the instructions and replaced the path python3.4 with python2.7 and downloaded and copied the files to the right location. But It still does not work.

I also wonder about the plugin directory, is it domoticz/plugins? And you are supposed to create the broadlink -folder yourself and put the .py files there?

I also tried upgrading the python version to a newer like it said in the beginning of this thread, but that does not work either. I still only have the python2.7 in the specified location and pip3 does not work.
Try this
sudo curl -L install.domoticz.com | sudo bash
apt-get dist-upgrade
sudo apt-get install python3.4.2
sudo apt-get install python3-dev
sudo apt-get install libpython3.4
sudo apt-get install libglib2.0-dev
sudo apt-get install python3-pip
sudo pip3 install broadlink
sudo pip3 install Crypto
sudo cp -r /usr/local/lib/python3.4/dist-packages/Crypto/ /usr/lib/python3.4/
sudo cp -r /usr/local/lib/python3.4/dist-packages/broadlink /usr/lib/python3.4/
sudo service domoticz restart
copy plugins plugin.py and plugin_send.py (version for python3.4) to ..../domoticz/plugins/Broadlink/
config broadlink plugin in domoticz and set path for BroadlinkRM2-3-2.ini file to /home/domoticz/plugins/Broadlink/
burton666
Posts: 85
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by burton666 »

Ok, just tried it. the two first commands worked but then when it got to the python-command only this happened:

Code: Select all

pi@raspberrypi ~ $ sudo apt-get dist-upgrade
sudo: unable to resolve host raspberrypi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi ~ $ sudo apt-get install python3.4.2
sudo: unable to resolve host raspberrypi
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.4.2
E: Couldn't find any package by regex 'python3.4.2'
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

Hi, thanks for this great plugin. Unfortunately, I'm unable to get it to work on RPI3. the issue I'm having is similar to @kniazio

Are we suppose to create a folder then copy the files into or something else. The other thing is, does the plugin supports 433mhz radio?


I tried installing Python 3.5 by running the following script. It does it thing and I get this
Raspberry Pi pi @: ~ $ -version python
Python 2.7.9
ft @ Raspberry Pi: ~ $ python3 -version
Python 3.5.1
ft @ Raspberry Pi: ~ $ -version python
Python 2.7.9
ft @ Raspberry Pi: $ ~


Installing Python 3.5.1
cd ~
wget https://www.python.org/ftp/python/3.5.1 ... -3.5.1.tgz
tar -zxvf Python-3.5.1.tgz
cd Python-3.5.1
. / Configure && make && sudo make install
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 »

yep,
433 is supported by broadlink module and work for me.
I do not have experience on linux but others already has been able to install it.
wiki has been updated for that.
kniazio
Posts: 198
Joined: Thursday 06 October 2016 8:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: Python Plugin: Broadlink RM2

Post by kniazio »

I want to inform you that the plugin recognizes 433MHz RF codes.
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

how are you guys getting the plugin to work on RPi 3? I've tried so many times with no luck. I've followed all the steps and even got Python 3.4 & 3.5 installed. I see it has created a Broadlink & Crypto folder but no plugin folder. Am I suppose to create one?

what am I doing wrong in my steps? any help will be very much appreciated.
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 »

if you do not have it, just create it.
you need also to be on domoticz v 3.7xx or >
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

Thanks, ZAK45.

I realize I was running 3.5 and I've upgraded to 3.7. In Domoticz folder I see a folder plugins and there are some examples plugins in it. So I created a new folder labeled Broadlink with plugin.py in the folder. So.... /home/pi/domoticz/plugins/Broadlink

I finished off with a sudo reboot, I now see Broadlink RM2 show up in Hardware but there no Param field. I've included a screenshot for your view. My guess is the plugin not launching or it could be something else due to Phyton 3?
Attachments
Screen Shot 2017-04-02 at 5.04.12 AM.png
Screen Shot 2017-04-02 at 5.04.12 AM.png (214.56 KiB) Viewed 4110 times
andi216
Posts: 46
Joined: Tuesday 14 March 2017 13:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: Python Plugin: Broadlink RM2

Post by andi216 »

Thanks for integration Broadlink RM. It works really well (raspberry pi v3).
I tested only the infrared.
I have a question. I connected Broadlink A1 and displays only the temperature.
It is possible to display the rest function (Noise, illumination, humidity and air quality)?
I do not know anything about programming.
Thanks in advance for answers.
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

I did a fresh install of Domoticz 3.7, Python 3.5 & Broadlink modules on Raspberry Pi V3. It seems to be working now.

Any idea what the error message below is? I get it every time SAFE is hit despite the int file saved in the Broadlink folder.


Error
Filter:
X
2017-04-02 16:41:34.801 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:41:37.156 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:41:38.959 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:42:28.534 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:42:36.948 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:42:37.149 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:42:37.400 Error: (TEST100) ini file not found: /home/pi/domoticz/plugins/Broadlink\BroadlinkRM2-8-1.ini
2017-04-02 16:43:05.704 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:18.353 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:18.380 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:18.380 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:18.380 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:18.380 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:18.380 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:43:24.971 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:24.994 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:24.994 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:24.994 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:24.994 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:24.994 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:43:30.980 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:31.002 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:31.002 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:31.002 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:31.002 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:31.002 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:43:34.833 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:34.859 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:34.859 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:34.859 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:34.859 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:34.859 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:43:37.086 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:37.108 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:37.108 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:37.108 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:37.108 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:37.108 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:43:39.138 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:43:39.159 Error: (TEST101) 'onCommand' failed 'gaierror'.
2017-04-02 16:43:39.159 Error: (TEST101) ----> Line 118 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function onCommand
2017-04-02 16:43:39.159 Error: (TEST101) ----> Line 326 in /home/pi/domoticz/plugins/Broadlink/plugin.py, function learn
2017-04-02 16:43:39.159 Error: (TEST101) ----> Line 455 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2017-04-02 16:43:39.159 Error: (TEST101) ----> Line 255 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2017-04-02 16:44:15.241 Error: (TEST101) Error Connecting to Broadlink device....
2017-04-02 16:46:15.239 Error: (TEST101) Error Connecting to Broadlink device....


Is the LEARN process same as IR & RF 433?

Is there a way to auto-discover the Broadlink hub existing connected devices on Domoticz?

Last but not least, is the plugin compatible with Broadlink TC2 Switches?

Overall great learning curve as I've learned quite a bit. Thanks, ZAK45...
Attachments
Screen Shot 2017-04-03 at 12.24.22 AM.png
Screen Shot 2017-04-03 at 12.24.22 AM.png (298.27 KiB) Viewed 4074 times
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 »

@andi216
do not own A1 device, so not able to test, sorry.

@jlites00

this look like
gaierror: [Errno -2] Name or service not known...

Are you sure of the IP address/mac address of your Broadlink RM2 / RM Pro device ??

the learn process is the same for RF/IR

on param "Folder to store ini files" just replace \ by / everywhere

if you read the wiki, there is a way to auto discover Broadlink RM2 device and display IP address & mac in Domoticz log

if you own other Broadlink device, I will suggest also to let only the Broadlink RM2 connected to network during initial settings.
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

I did double check the IP & MAC, its the same as the logs

Found the problem to "ini" the ID labeling has to be right on the switches or it will get confused.

As for INT

Error
Filter:
X
2017-04-02 17:36:10.986 Error: (TEST 109) ini file not found: everywhere\BroadlinkRM2-14-1.ini
2017-04-02 17:36:12.589 Error: (TEST 109) ini file not found: everywhere\BroadlinkRM2-14-1.ini
2017-04-02 17:36:13.691 Error: (TEST 109) ini file not found: everywhere\BroadlinkRM2-14-1.ini
2017-04-02 17:36:14.493 Error: (TEST 109) ini file not found: everywhere\BroadlinkRM2-14-1.ini
2017-04-02 17:36:14.845 Error: (TEST 109) ini file not found: everywhere\BroadlinkRM2-14-1.ini
2017-04-02 17:39:28.189 Error: (TEST 110) ini file not found: /everywhere\BroadlinkRM2-15-1.ini
2017-04-02 17:39:30.243 Error: (TEST 110) ini file not found: /everywhere\BroadlinkRM2-15-1.ini
2017-04-02 17:39:31.996 Error: (TEST 110) ini file not found: /everywhere\BroadlinkRM2-15-1.ini
2017-04-02 17:40:07.556 Error: (TEST 110) ini file not found: /everywhere\BroadlinkRM2-15-1.ini



... still can't get RF to Learn though but IR, Learns fine.
Attachments
Screen Shot 2017-04-03 at 1.54.50 AM.png
Screen Shot 2017-04-03 at 1.54.50 AM.png (189.3 KiB) Viewed 4063 times
Screen Shot 2017-04-03 at 1.46.37 AM.png
Screen Shot 2017-04-03 at 1.46.37 AM.png (163.4 KiB) Viewed 4065 times
andi216
Posts: 46
Joined: Tuesday 14 March 2017 13:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.7243
Contact:

Re: Python Plugin: Broadlink RM2

Post by andi216 »

@jlites00

Try it! (/)
  /home/pi/domoticz/plugins/Broadlink/
Before that delete old ini
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2

Post by jlites00 »

Just an update. Following @andi216 & @zak45 tip on "Folder to store ini files" directory, they both worked as copied below with no Errors.

/everywhere

or

/home/pi/domoticz/plugins/Broadlink/
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest