Python Plugin: Broadlink RM2 V2

Python and python framework

Moderator: leecollings

DrJS
Posts: 7
Joined: Saturday 29 April 2017 15:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.587
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by DrJS »

zak45 wrote:@DrJS
hi, maybe you have mixed python version i.e; 2.7.x & 3.x ?? !!
if this is the case, pip command would install on the default one, which is probable 2.7.
you need to use pip3 if i'm not wrong, but first I would uninstall broadlink from 2.7 (pip uninstall broadlink)
Thanks for getting back so soon! I definitely used pip3 to install one version but I think you're right, I did find a version installed in pip.

pi@domoticz:/tmp/pip-l8yisscy-build/broadlink $ sudo pip uninstall broadlink
Uninstalling broadlink:
/usr/local/lib/python2.7/dist-packages/broadlink-0.3.egg-info
Proceed (y/n)? y
Successfully uninstalled broadlink
pi@domoticz:/tmp/pip-l8yisscy-build/broadlink $ cd ~
pi@domoticz:~ $ cd broadlink
pi@domoticz:~/broadlink $ ls
broadlink-0.4 broadlink-0.4.tar.gz python-broadlink-master.zip setup.py
pi@domoticz:~/broadlink $ sudo pip3 install .
Unpacking /home/pi/broadlink
Running setup.py (path:/tmp/pip-c9mtso4b-build/setup.py) egg_info for package from file:///home/pi/broadlink

Requirement already satisfied (use --upgrade to upgrade): broadlink==0.3 from file:///home/pi/broadlink in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): pycrypto==2.6.1 in /usr/local/lib/python3.4/dist-packages (from broadlink==0.3)
Cleaning up...

However, I still don't have a broadlink folder under the dist-packages folder - I have NO idea where it's going, because the script (setup.py) seems to execute OK when I run the "sudo pip3 install ." command. I really wish the issue with 0.4 could be sorted! I'm having no success getting 0.3 installed. Gutted, was really hoping to have worked with this over the bank holiday.
DrJS
Posts: 7
Joined: Saturday 29 April 2017 15:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.587
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by DrJS »

DrJS wrote:
zak45 wrote:@DrJS
hi, maybe you have mixed python version i.e; 2.7.x & 3.x ?? !!
if this is the case, pip command would install on the default one, which is probable 2.7.
you need to use pip3 if i'm not wrong, but first I would uninstall broadlink from 2.7 (pip uninstall broadlink)
Thanks for getting back so soon! I definitely used pip3 to install one version but I think you're right, I did find a version installed in pip.

pi@domoticz:/tmp/pip-l8yisscy-build/broadlink $ sudo pip uninstall broadlink
Uninstalling broadlink:
/usr/local/lib/python2.7/dist-packages/broadlink-0.3.egg-info
Proceed (y/n)? y
Successfully uninstalled broadlink
pi@domoticz:/tmp/pip-l8yisscy-build/broadlink $ cd ~
pi@domoticz:~ $ cd broadlink
pi@domoticz:~/broadlink $ ls
broadlink-0.4 broadlink-0.4.tar.gz python-broadlink-master.zip setup.py
pi@domoticz:~/broadlink $ sudo pip3 install .
Unpacking /home/pi/broadlink
Running setup.py (path:/tmp/pip-c9mtso4b-build/setup.py) egg_info for package from file:///home/pi/broadlink

Requirement already satisfied (use --upgrade to upgrade): broadlink==0.3 from file:///home/pi/broadlink in /usr/local/lib/python3.4/dist-packages
Requirement already satisfied (use --upgrade to upgrade): pycrypto==2.6.1 in /usr/local/lib/python3.4/dist-packages (from broadlink==0.3)
Cleaning up...

Scrap all the above - I now see it Domoticz. Convinced more and more I had a corrupt zip file as lots of things seem to be affected.

However... when I add the Broadlink RM2 device under Domoticz, I don't get the same dialogue box tbat's shown here. I don't get any IP address for example, as something I need to complete. I'm upgrading my Python to 3,5 as I write this, so we'll see if that's made a difference but I'm on the latest Beta (3.7 something) for Domotiga and upgrading the overall system now. Anyone point me to why I'm not getting the full dialogue box?
Last edited by DrJS on Sunday 30 April 2017 2:48, edited 2 times in total.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

@DrJS
and do you have created the BroadlinkRM2 folder under plugins and stored on it plugin.py ?
and when you restart Domoticz, do yhou have confirmation that all is ok regarding python plugin system:

2017-04-29 22:45:12.011 Domoticz V3.7310 (c)2012-2017 GizMoCuz
2017-04-29 22:45:12.011 Build Hash: c2017701, Date: 2017-04-12 11:42:19
2017-04-29 22:45:12.052 Sunrise: 06:36:00 SunSet:20:58:00
2017-04-29 22:45:12.052 EventSystem: reset all events...
2017-04-29 22:45:12.089 PluginSystem: Started, Python version '3.5.3'.
2017-04-29 22:45:12.096 Active notification Subsystems: email, kodi, pushbullet (3/12)
2017-04-29 22:45:12.098 WebServer(HTTP) started on address: :: with port 8080
2017-04-29 22:45:12.232 WebServer(SSL) started on address: :: with port 443

you need to have PluginSystem: Started etc ...
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

@shoyboom
An advice: not real good idea to store your ini files under python directory...

for the plugin_http.sh, in fact I need to see what you have put on it!
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

to all:
please read this if not already done :

http://www.domoticz.com/wiki/Using_Python_plugins
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

@shoyboom
and I think that your .sh file need to be set as executable.
this is what I have found about error 126
Capture.JPG
Capture.JPG (128.85 KiB) Viewed 3368 times
shoyboom
Posts: 12
Joined: Saturday 25 March 2017 16:42
Target OS: -
Domoticz version:
Contact:

Re: RE: Re: Python Plugin: Broadlink RM2 V2

Post by shoyboom »

zak45 wrote:@shoyboom
and I think that your .sh file need to be set as executable.
this is what I have found about error 126
Capture.JPG
Gave it executable, got another error
Image

Sent from my ONEPLUS A3000 using Tapatalk
DrJS
Posts: 7
Joined: Saturday 29 April 2017 15:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.587
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by DrJS »

zak45 wrote:@DrJS
and do you have created the BroadlinkRM2 folder under plugins and stored on it plugin.py ?
and when you restart Domoticz, do yhou have confirmation that all is ok regarding python plugin system:

2017-04-29 22:45:12.011 Domoticz V3.7310 (c)2012-2017 GizMoCuz
2017-04-29 22:45:12.011 Build Hash: c2017701, Date: 2017-04-12 11:42:19
2017-04-29 22:45:12.052 Sunrise: 06:36:00 SunSet:20:58:00
2017-04-29 22:45:12.052 EventSystem: reset all events...
2017-04-29 22:45:12.089 PluginSystem: Started, Python version '3.5.3'.
2017-04-29 22:45:12.096 Active notification Subsystems: email, kodi, pushbullet (3/12)
2017-04-29 22:45:12.098 WebServer(HTTP) started on address: :: with port 8080
2017-04-29 22:45:12.232 WebServer(SSL) started on address: :: with port 443

you need to have PluginSystem: Started etc ...
Yes to the BroadlinkRM2 folder, I've read the articles about chnmodding the py scripts too, done all that. I assume it's reading that, as I see Broadlink RM2 in the hardware - but I don't get the full set of parameters.
Where would I see this? I've looked at dmesg - there's absolutely nothing in my Domoticz log. When I restart the service from the command line I don't get anything like this...

This is all I get :(
domoticz problem.png
domoticz problem.png (119.29 KiB) Viewed 3344 times
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by jlites00 »

Don't know if this a plugin or domoticz question. For my TC2 switches, it creates two set of codes ON & OFF. How do I combine that as one toggle?
Meaning not having two separate switches for ON & OFF.

The other thing to know about configuring the TC2, the plugin doesn't do the multiplication of HEX code for you. One will need to re-edit the ini file to see what work best.

If it's not too much to ask. It will be nice to be able to do the multiplication in Domoticz without manually multiplying the HEX in the "ini" file.
Last edited by jlites00 on Monday 01 May 2017 17:23, edited 1 time in total.
flyguy729
Posts: 2
Joined: Monday 01 May 2017 11:08
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by flyguy729 »

DrJS wrote:
zak45 wrote:@DrJS
and do you have created the BroadlinkRM2 folder under plugins and stored on it plugin.py ?
and when you restart Domoticz, do yhou have confirmation that all is ok regarding python plugin system:

2017-04-29 22:45:12.011 Domoticz V3.7310 (c)2012-2017 GizMoCuz
2017-04-29 22:45:12.011 Build Hash: c2017701, Date: 2017-04-12 11:42:19
2017-04-29 22:45:12.052 Sunrise: 06:36:00 SunSet:20:58:00
2017-04-29 22:45:12.052 EventSystem: reset all events...
2017-04-29 22:45:12.089 PluginSystem: Started, Python version '3.5.3'.
2017-04-29 22:45:12.096 Active notification Subsystems: email, kodi, pushbullet (3/12)
2017-04-29 22:45:12.098 WebServer(HTTP) started on address: :: with port 8080
2017-04-29 22:45:12.232 WebServer(SSL) started on address: :: with port 443

you need to have PluginSystem: Started etc ...
Yes to the BroadlinkRM2 folder, I've read the articles about chnmodding the py scripts too, done all that. I assume it's reading that, as I see Broadlink RM2 in the hardware - but I don't get the full set of parameters.
Where would I see this? I've looked at dmesg - there's absolutely nothing in my Domoticz log. When I restart the service from the command line I don't get anything like this...

This is all I get :(
domoticz problem.png

I'm having the same problem as well. Anyone can enlighten us on why we're not getting the configuration field?

Running on beta version. Even xiaomi gateway doesn't have the configuration column.

What could be the problem?
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

jlites00 wrote:Don't know if this a plugin or domoticz question. For my TC2 switches, it creates two set of codes ON & OFF. How do I include that as one toggle?
Mening not having two separate switches for ON / OFF.

The other thing to know about the TC2 configuration, the plugin dosen't do the multification of HEX code for you. One will need to re-edit the ini file to see what work best.

If it't not too much to ask. It will be nice to be able to do the multification in Domoticz without manually multiplying the HEX in the "ini" file.
Just create a dummy switch and put on the on & off action necessary command. if you keep existing devices, you can use http / json to do that and if you decide to remove devices you can use script/command line to do the same.
Capture.JPG
Capture.JPG (66.49 KiB) Viewed 3323 times
for TC2, it looks like it's work.. nice.

I suppose you have imported code from e-control. ?? !!
Do not own this materiel so not able to test; have seen code need to be a multiple of 16, maybe put that in todo list...
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

@flyguy729/DrJs
try to see/read that :
https://www.domoticz.com/forum/viewtopi ... 6&p=119747
http://www.domoticz.com/wiki/Using_Python_plugins

if this not help, open a new thread as the plugin framework is still in beta. Provide as much information as possible, OS version, Domoticz build version etc ...
jlites00
Posts: 22
Joined: Friday 31 March 2017 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by jlites00 »

zak45 wrote:
jlites00 wrote:Don't know if this a plugin or domoticz question. For my TC2 switches, it creates two set of codes ON & OFF. How do I include that as one toggle?
Mening not having two separate switches for ON / OFF.

The other thing to know about the TC2 configuration, the plugin dosen't do the multification of HEX code for you. One will need to re-edit the ini file to see what work best.

If it't not too much to ask. It will be nice to be able to do the multification in Domoticz without manually multiplying the HEX in the "ini" file.
Just create a dummy switch and put on the on & off action necessary command. if you keep existing devices, you can use http / json to do that and if you decide to remove devices you can use script/command line to do the same.
Capture.JPG
for TC2, it looks like it's work.. nice.

I suppose you have imported code from e-control. ?? !!
Do not own this materiel so not able to test; have seen code need to be a multiple of 16, maybe put that in todo list...

YES, I have managed to import the HEX codes using the manual transfer method, web transfer did go so well for me as it wouldn't connect.

So far everything works great except the TC2 I can't seem to fire as combine toggle, however, I can control each ON / OFF without any issues.
It was a field trip for me since I had two versions of TC2 with one batch needed a multiplication of 3 to trigger while others 6.

Coming back to what you said. In Dummy Switch setup can I copy the HEX to the ON & OFF action or there's more to it? I tried it but it won't safe.

And about existing devices setup, is there any documentation on this? I'm not sure where to begin as I don't have experience in this part.
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

jlites00 wrote:
Coming back to what you said. In Dummy Switch setup can I copy the HEX to the ON & OFF action or there's more to it? I tried it but it won't safe.

And about existing devices setup, is there any documentation on this? I'm not sure where to begin as I don't have experience in this part.
All can be found on Wiki and on forum.
quick step:
https://www.domoticz.com/wiki/Hardware_ ... y_Hardware

Once you have created your Dummy switch put on it your scripts:
Capture.JPG
Capture.JPG (81.33 KiB) Viewed 3284 times
what you see is for Windows, need to be adapted to your OS... but all if this work.
farhanito
Posts: 34
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by farhanito »

hi,

I'm running latest beta on a raspberrypi.

i manually copied those json files to the ../import folder, since the webserver won't run. but when i pressed the "generate" button, i get this error

Code: Select all

User: Admin initiated a switch command (148/kids_ir - Import/Set Level)
(kids_ir) Calling message handler 'onCommand'.
(kids_ir) onCommand called for Unit 255: Parameter 'Set Level', Level: 20 , Connected : True
Error: (kids_ir) Error with json files to import
what could possibly be the issue?

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

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

farhanito wrote:hi,

I'm running latest beta on a raspberrypi.

i manually copied those json files to the ../import folder, since the webserver won't run. but when i pressed the "generate" button, i get this error

Code: Select all

User: Admin initiated a switch command (148/kids_ir - Import/Set Level)
(kids_ir) Calling message handler 'onCommand'.
(kids_ir) onCommand called for Unit 255: Parameter 'Set Level', Level: 20 , Connected : True
Error: (kids_ir) Error with json files to import
what could possibly be the issue?

thanks
please post your three json files.
farhanito
Posts: 34
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by farhanito »

zak45 wrote:
farhanito wrote:hi,

I'm running latest beta on a raspberrypi.

i manually copied those json files to the ../import folder, since the webserver won't run. but when i pressed the "generate" button, i get this error

Code: Select all

User: Admin initiated a switch command (148/kids_ir - Import/Set Level)
(kids_ir) Calling message handler 'onCommand'.
(kids_ir) onCommand called for Unit 255: Parameter 'Set Level', Level: 20 , Connected : True
Error: (kids_ir) Error with json files to import
what could possibly be the issue?

thanks
please post your three json files.
here's the files
json.zip
(11.7 KiB) Downloaded 82 times
thanks
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

farhanito wrote:
here's the files json.zip

thanks
tested at home, your Json files are ok, able to create more than 90 devices.
be sure to have put them on the right place:
need to be under ''Folder to store ini files"/import
User avatar
michaldobrotka
Posts: 50
Joined: Sunday 01 November 2015 17:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by michaldobrotka »

I´m trying to configure Dummy switch. I copied command from log window, but it doesn't work :

Code: Select all

script://"/home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py" /home/pi/domoticz/plugins/BroadlinkRM2/broadlink\BroadlinkRM2-16-19.ini
Can somebody correct it please?
Thanks
Domoticz on Raspi 3 and slave on ZeroW (running only with Broadlink plugin), Serial Mysensors GW on Arduino nano, Broadlink RM2, Rehau CO2 USB Stick, RF link 433 MHz, 2x Amazon Echo Dot (Controlicz), ESP2866 witk Espeasy, Sonoff
zak45
Posts: 952
Joined: Sunday 22 January 2017 11:37
Target OS: Windows
Domoticz version: V2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V2

Post by zak45 »

michaldobrotka wrote:I´m trying to configure Dummy switch. I copied command from log window, but it doesn't work :

Code: Select all

script://"/home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py" /home/pi/domoticz/plugins/BroadlinkRM2/broadlink\BroadlinkRM2-16-19.ini
Can somebody correct it please?
Thanks
I would do it in this way:
script:///home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.sh /home/pi/domoticz/plugins/BroadlinkRM2/broadlink\BroadlinkRM2-16-19.ini

plugin_send.sh:
nohup python /home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py $1 &

make plugin_sh executable

not linux specialist, so correct what is necessary ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest