Python Plugin : Broadlink RM2 V4

Python and python framework

Moderator: leecollings

arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

zak45 wrote: Saturday 20 April 2019 12:39 @arcpaqua
Do you have verified right settings on your ini / folder ?
User running Domoticz need to have at minima read authorization.
Thank you zak and sorry for the delay.

Here the permission in ini folder:

Code: Select all

pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2/ini $ ls -altr
total 116
-rw-r----- 1 root root  547 Apr 10 10:08 BroadlinkRM2-5-5.ini
-rw-r----- 1 root root  677 Apr 10 10:12 BroadlinkRM2-5-10.ini
-rw-r----- 1 root root  549 Apr 10 10:13 BroadlinkRM2-5-11.ini
-rw-r----- 1 root root  549 Apr 10 10:14 BroadlinkRM2-5-13.ini
-rw-r----- 1 root root  677 Apr 10 10:16 BroadlinkRM2-5-14.ini
-rw-r----- 1 root root  677 Apr 10 10:21 BroadlinkRM2-5-16.ini
-rw-r----- 1 root root  549 Apr 10 10:22 BroadlinkRM2-5-17.ini
-rw-r----- 1 root root  677 Apr 10 10:22 BroadlinkRM2-5-18.ini
-rw-r----- 1 root root  549 Apr 10 10:23 BroadlinkRM2-5-19.ini
-rw-r----- 1 root root  549 Apr 10 10:23 BroadlinkRM2-5-20.ini
-rw-r----- 1 root root  549 Apr 10 10:24 BroadlinkRM2-5-21.ini
-rw-r----- 1 root root  677 Apr 10 10:24 BroadlinkRM2-5-22.ini
-rw-r----- 1 root root  549 Apr 10 10:25 BroadlinkRM2-5-23.ini
-rw-r----- 1 root root  549 Apr 10 10:25 BroadlinkRM2-5-24.ini
-rw-r----- 1 root root  549 Apr 10 10:26 BroadlinkRM2-5-25.ini
-rw-r----- 1 root root  677 Apr 10 10:26 BroadlinkRM2-5-26.ini
-rw-r----- 1 root root  558 Apr 10 10:59 BroadlinkRM2-5-3.ini
-rw-r----- 1 root root  556 Apr 10 21:01 BroadlinkRM2-5-2.ini
-rw-r----- 1 root root  683 Apr 10 21:02 BroadlinkRM2-5-27.ini
-rw-r----- 1 root root  683 Apr 10 21:02 BroadlinkRM2-5-9.ini
-rw-r----- 1 root root  551 Apr 10 21:02 BroadlinkRM2-5-4.ini
-rw-r----- 1 root root  685 Apr 10 21:02 BroadlinkRM2-5-8.ini
-rw-r----- 1 root root  552 Apr 10 21:02 BroadlinkRM2-5-6.ini
-rw-r----- 1 root root  561 Apr 13 14:56 BroadlinkRM2-5-12.ini
drwxr-xr-x 2 root root 4096 Apr 15 23:51 remote
drwxr-xr-x 2 root root 4096 Apr 15 23:53 import
drwxr-xr-x 4 pi   pi   4096 Apr 16 19:27 ..
drwxr-xr-x 4 root root 4096 Apr 16 19:27 .
-rw-r----- 1 root root  683 Apr 16 19:31 BroadlinkRM2-5-15.ini
Below the permission in remote folder

Code: Select all

pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2/ini/remote $ ls -altr
total 12
-rw-r----- 1 root root   69 Apr 11 17:34 plugin_remote_5.ini
drwxr-xr-x 2 root root 4096 Apr 15 23:51 .
drwxr-xr-x 4 root root 4096 Apr 16 19:27 ..
Do you see some wrong setting?
Thank you again,
P.
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 »

arcpaqua wrote: Tuesday 07 May 2019 11:12 Below the permission in remote folder

Code: Select all

pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2/ini/remote $ ls -altr
total 12
-rw-r----- 1 root root   69 Apr 11 17:34 plugin_remote_5.ini
drwxr-xr-x 2 root root 4096 Apr 15 23:51 .
drwxr-xr-x 4 root root 4096 Apr 16 19:27 ..
Do you see some wrong setting?
Thank you again,
P.
Hummm.. not linux specialist.. but try this:
sudo chmod -R 777 ~/domoticz/plugins/BroadlinkRM2/ini/remote
arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

zak45 wrote: Tuesday 07 May 2019 11:23 Hummm.. not linux specialist.. but try this:
sudo chmod -R 777 ~/domoticz/plugins/BroadlinkRM2/ini/remote
Thanks a lot,
but still not working. I really don't understand.
I restarted Domoticz and also Broadlink hardware, but nothing, the plugin doesn't search in the right place (the remote folder).
log:

Code: Select all

2019-05-07 10:51:04.675 Status: User: Admin initiated a switch command (28/Broadlink RM2 - Remote/On)
2019-05-07 10:51:04.689 Error: (Broadlink RM2) ini file not found: /home/pi/domoticz/plugins/BroadlinkRM2/ini/BroadlinkRM2-5-254.ini
I give up, it doesn't matter.

Thank you very very much zak, you made and make a great job.
Paolo
arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

arcpaqua wrote: Tuesday 07 May 2019 11:57
zak45 wrote: Tuesday 07 May 2019 11:23 Hummm.. not linux specialist.. but try this:
sudo chmod -R 777 ~/domoticz/plugins/BroadlinkRM2/ini/remote
Thanks a lot,
but still not working. I really don't understand.
I restarted Domoticz and also Broadlink hardware, but nothing, the plugin doesn't search in the right place (the remote folder).
log:

Code: Select all

2019-05-07 10:51:04.675 Status: User: Admin initiated a switch command (28/Broadlink RM2 - Remote/On)
2019-05-07 10:51:04.689 Error: (Broadlink RM2) ini file not found: /home/pi/domoticz/plugins/BroadlinkRM2/ini/BroadlinkRM2-5-254.ini
I give up, it doesn't matter.

Thank you very very much zak, you made and make a great job.
Paolo
Sorry zak,
it is possible that the problem is the python version?
I have python 3.5 installed. Maybe all of that works with python 3.4
EmmanuelFR
Posts: 1
Joined: Monday 16 January 2017 19:00
Target OS: Linux
Domoticz version: 2020.1
Location: France
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by EmmanuelFR »

Hi,

First thank you for this nice plugin.

I just suceeded in making it work with the last domoticz stable version (4.10731) under Ubuntu 18.04.2 LTS.

Before, I had an error in the log saying that it couldn't find a .ini file (note sure which one).

I'm not sure what did the trick, but I :
- created ini and remote folders
- populated them with dummy ini files :

Code: Select all

[Custom]
command = 2
- made a sudo chmod 755 on these folders and their content
- placed BroadlinkRM2-XXX-254.ini and plugin_remote_XXX.ini files in the plugin folder
- tried to update the hardware
- deleted it
- reinstalled it with the discovery information kept.

And now it works, I can learn a code and test it !

Update : There is still a ini file problem, I can't save a code and replay it yet.

Final update : There was a folder ownership problem and a missing ini file, I have absolutely no idea of the nature of the problem, just was lucky...

Cheers
Last edited by EmmanuelFR on Sunday 12 May 2019 16:47, edited 2 times in total.
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Hello Zak and all,
So i'm back to business :)
Eventually been able to check the rights and here is the result:

pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2 $ ls -altr
total 104
-rw-r--r-- 1 pi pi 1523 mars 31 12:20 plugin_send.py
-rw-r--r-- 1 pi pi 43486 mars 31 12:20 plugin.py
drwxr-x--- 2 root root 4096 avril 28 20:42 remote
drwxr-x--- 2 root root 4096 avril 28 20:42 import
-rw------- 1 root root 14059 mai 1 12:26 plugin_http.py.save
-rw-r--r-- 1 root root 11197 mai 1 12:57 plugin_http.py
drwxr-x--- 2 root root 4096 mai 1 13:09 __pycache__
-rw------- 1 pi pi 102 mai 1 14:29 nohup.out
drwxr-xr-x 11 pi pi 4096 mai 10 13:18 ..
-rwxr-xr-x 1 pi pi 86 mai 12 13:43 plugin_http.sh
drwxr-xr-x 5 pi pi 4096 mai 12 13:44 .

Compared to your exemple I'm indeed not in line....
Not linux expert at all, is the chmod 755 the solution on the BroadlinkRM2 directory?

And when coming to test the nohup here is the result :
pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2 $ nohup plugin_http.sh 0.0.0.0 9000 /home/pi/domoticz/
nohup: les entrées sont ignorées et la sortie est ajoutée à 'nohup.out'
nohup: impossible d'exécuter la commande 'plugin_http.sh': Aucun fichier ou dossier de ce type

in the nohup out :
python: can't open file '/Domoticz/plugins/BroadlinkRM2/plugin_http.py': [Errno 13] Permission denied
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Any help on that please?
arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

EmmanuelFR wrote: Sunday 12 May 2019 11:34 Hi,

First thank you for this nice plugin.

I just suceeded in making it work with the last domoticz stable version (4.10731) under Ubuntu 18.04.2 LTS.

Before, I had an error in the log saying that it couldn't find a .ini file (note sure which one).

I'm not sure what did the trick, but I :
- created ini and remote folders
- populated them with dummy ini files :

Code: Select all

[Custom]
command = 2
- made a sudo chmod 755 on these folders and their content
- placed BroadlinkRM2-XXX-254.ini and plugin_remote_XXX.ini files in the plugin folder
- tried to update the hardware
- deleted it
- reinstalled it with the discovery information kept.

And now it works, I can learn a code and test it !

Update : There is still a ini file problem, I can't save a code and replay it yet.

Final update : There was a folder ownership problem and a missing ini file, I have absolutely no idea of the nature of the problem, just was lucky...

Cheers
Thank you Emmanuel,
I'll try that.

Just one question for you, which python version you have?
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Hello all,

I've tried the chmod 755 but it seems not to change anything to the file rights...
I've made it on the directory.

Don't understand what to do then :(
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

I'm ending up to use the "chmod -R a+rx" command on the Broadlink directory but not getting better results...

Am I crazy or is there plenty of Broadlink directories? Are they symbolic links or real directories? On which other one should I apply those right changes???

Defenetely going crazy with that....
arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

Loky31 wrote: Friday 17 May 2019 12:14 Hello all,

I've tried the chmod 755 but it seems not to change anything to the file rights...
I've made it on the directory.

Don't understand what to do then :(
Hi Loky,
have you tried with:

Code: Select all

sudo chmod -R 755 /domoticz/plugins/BroadlinkRM2
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Just done that, doesn't work neither :(

I logged in through putty as PI user and directly put the command.
Then tried to start the webserver through domoticz but still have the 127 error.
Really wondering where do I fail on that...

I thought that pluggin would be more likely to install and play :)

I don't want to go for a removal and install again as I have some commands already imported and working fine. As I'm not sure to be able to import again all commands from the web app...
Last edited by Loky31 on Friday 17 May 2019 15:10, edited 1 time in total.
arcpaqua
Posts: 16
Joined: Saturday 23 June 2018 20:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10338
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by arcpaqua »

Loky31 wrote: Friday 17 May 2019 14:24 Just done that, doesn't work neither :(

I logged in through putty as PI user and directly put the command.
Then tried to start the webserver through domoticz but still have the 127 error.
Could you please provide shell result after you execute sudo chmod -R 755 /domoticz/plugins/BroadlinkRM2
and then the log in Domoticz?
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Sure will do it when back from work :)
garycooper
Posts: 21
Joined: Sunday 10 March 2019 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by garycooper »

Hello, since the last updating about Domoticz, multiplug MP1 is now ok !
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Hi,

So here is the result:

pi@raspberrypi:~ $ sudo chmod -R 755 /domoticz/plugins/BroadlinkRM2
pi@raspberrypi:~ $ cd domoticz/plugins/BroadlinkRM2/
pi@raspberrypi:~/domoticz/plugins/BroadlinkRM2 $ ls -altr
total 104
-rwxrwxrwx 1 pi pi 1523 mars 31 12:20 plugin_send.py
-rwxrwxrwx 1 pi pi 43486 mars 31 12:20 plugin.py
drwxrwxrwx 2 root root 4096 avril 28 20:42 remote
drwxrwxrwx 2 root root 4096 avril 28 20:42 import
-rwxrwxrwx 1 root root 14059 mai 1 12:26 plugin_http.py.save
-rwxrwxrwx 1 root root 11197 mai 1 12:57 plugin_http.py
drwxrwxrwx 2 root root 4096 mai 1 13:09 __pycache__
-rwxrwxrwx 1 pi pi 102 mai 1 14:29 nohup.out
drwxr-xr-x 11 pi pi 4096 mai 10 13:18 ..
-rwxrwxrwx 1 pi pi 86 mai 12 13:43 plugin_http.sh
drwxrwxrwx 5 pi pi 4096 mai 16 22:26 .

And domoticz logs :
2019-05-17 20:04:15.917 (RM salon) Pushing 'onCommandCallback' on to queue
2019-05-17 20:04:15.967 (RM salon) Processing 'onCommandCallback' message
2019-05-17 20:04:15.967 (RM salon) Calling message handler 'onCommand'.
2019-05-17 20:04:15.968 (RM salon) onCommand called for Unit 255: Parameter 'Set Level', Level: 10 , Connected : True
2019-05-17 20:04:15.917 Status: User: Admin initiated a switch command (46/RM salon - Import/Set Level)
2019-05-17 20:04:16.018 (RM salon - Import) Updating device from 0:'Off' to have values 0:'Off'.
2019-05-17 20:04:16.048 (RM salon) Update 0:'Off' (RM salon - Import)
2019-05-17 20:04:16.017 Error: (RM salon) 127
2019-05-17 20:04:16.018 Error: (RM salon) /home/pi/domoticz/plugins/BroadlinkRM2/plugin_http.sh 0.0.0.0 9000 /home/domoticz/plugins/BroadlinkRM2
2019-05-17 20:04:16.018 Error: (RM salon) None
2019-05-17 20:04:16.048 Error: (RM salon) Not able to start Web server
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 »

some info on linux setup/settings (not linux specialist ..):

we suppose all is running with sudo...
this is the content of my linux test box:
Spoiler: show

-rw-r--r-- 1 usr root 43486 Feb 19 21:41 plugin.py
-rw-r--r-- 1 usr root 1518 Feb 22 16:57 plugin_send.py
-rw-r--r-- 1 usr root 58 Feb 22 16:57 plugin_send.cmd
-rw-r--r-- 1 usr root 11469 Feb 22 16:57 plugin_http.py
-rw-r--r-- 1 usr root 76 Feb 22 16:57 plugin_http.cmd
drwxr-xr-x 2 usr root 4096 Apr 20 10:16 __pycache__
-rwxr-xr-x 1 usr root 87 May 4 10:10 plugin_http.sh
-rw------- 1 usr usr 784 May 4 10:24 nohup.out
drwxrwxr-x 2 usr usr 4096 May 7 09:22 remote
drwxr-xr-x 5 usr root 4096 May 7 09:22 .
drwxrwxr-x 3 usr usr 4096 May 7 09:22 ini
usr@amlogic:~/domoticz/plugins/BroadlinkRM2$
inside the plugin_http.sh

Code: Select all


nohup python3 /home/usr/domoticz/plugins/BroadlinkRM2/plugin_http.py $1 $2 $3 $4 $5 &

to summarize:
the .sh need to have +x right
the .sh need to be accessible by the user executing the action, in case of any problem, for testing you can set 777
always use absolute path ( vs relative ) in the .sh to avoid command not found error.
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

Hum... somehow I had it working!

I removed and create again the file in ( once in su mode) and now the webserver starts!!!!

Quick moment of glory as I ended up with the folowing error :
2019-05-19 00:24:05.738 Error: (RM salon) 'onCommand' failed 'FileNotFoundError'.
2019-05-19 00:24:05.738 Error: (RM salon) ----> Line 265 in '/home/pi/domoticz/plugins/BroadlinkRM2/plugin.py', function onCommand
2019-05-19 00:24:05.738 Error: (RM salon) ----> Line 825 in '/home/pi/domoticz/plugins/BroadlinkRM2/plugin.py', function createIniImport

but gettin closer then :)

Any idea of what is going wrong with those script lines? rootcause or any hints?
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin : Broadlink RM2 V4

Post by Loky31 »

No ideas at all???

Still hoping to be able to use this addon properly :s
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 »

Loky31 wrote: Wednesday 29 May 2019 11:12 No ideas at all???

Still hoping to be able to use this addon properly :s
Looks like you try to use the import feature but not copied required files : jsonSubIr, jsonButton, jsonIrCode
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest