Python Plugin: Broadlink RM2 V3

Python and python framework

Moderator: leecollings

Bundy75
Posts: 7
Joined: Friday 08 June 2018 7:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Bundy75 »

Thanks for your suggestion - I've removed pycrypto and now it's slightly better but still no perfect ;-)

Code: Select all

2018-06-11 17:27:24.126 (RM3) Device ID: '48'
2018-06-11 17:27:24.126 (RM3) Device Name: 'RM3 - Command'
2018-06-11 17:27:24.126 (RM3) Device nValue: 0
2018-06-11 17:27:24.126 (RM3) Device sValue: ''
2018-06-11 17:27:24.126 (RM3) Device LastLevel: 0
2018-06-11 17:27:24.126 (RM3) Device: 254 - ID: 49, Name: 'RM3 - Remote', nValue: 0, sValue: ''
2018-06-11 17:27:24.126 (RM3) Device ID: '49'
2018-06-11 17:27:24.126 (RM3) Device Name: 'RM3 - Remote'
2018-06-11 17:27:24.126 (RM3) Device nValue: 0
2018-06-11 17:27:24.126 (RM3) Device sValue: ''
2018-06-11 17:27:24.126 (RM3) Device LastLevel: 0
2018-06-11 17:27:24.126 (RM3) Device: 255 - ID: 50, Name: 'RM3 - Import', nValue: 0, sValue: ''
2018-06-11 17:27:24.126 (RM3) Device ID: '50'
2018-06-11 17:27:24.126 (RM3) Device Name: 'RM3 - Import'
2018-06-11 17:27:24.126 (RM3) Device nValue: 0
2018-06-11 17:27:24.126 (RM3) Device sValue: ''
2018-06-11 17:27:24.126 (RM3) Device LastLevel: 0
2018-06-11 17:27:24.126 (RM3 - Import) Updating device from 0:'' to have values 0:'Off'.
2018-06-11 17:27:24.131 (RM3) Update 0:'Off' (RM3 - Import)
2018-06-11 17:27:24.131 (RM3) Connecting to: 192.168.0.216:34EA34BB1E4B
2018-06-11 17:27:24.147 Error: (RM3) Error Connecting to Broadlink device....
2018-06-11 17:27:24.147 (RM3 - Command) Updating device from 0:'' to have values 0:'Off'.
2018-06-11 17:27:24.152 (RM3) Update 0:'Off' (RM3 - Command)
2018-06-11 17:27:24.152 (RM3) Device Number begin to : 1
2018-06-11 17:27:24.155 (RM3) No ini file :C:/BroadlinkRM2/remote/plugin_remote_17.ini
2018-06-11 17:27:24.155 (RM3) Custom Commands for Remote not managed
2018-06-11 17:27:24.155 (RM3) Heartbeat interval set to: 30.
2018-06-11 17:27:24.155 (RM3) Heartbeat interval set to: 30.
Plugin produces more output to the log but it still fails to connect to Broadlink.
When I try to click "Learn" I receive the following error (broadlink 0.5 installed)

Code: Select all

2018-06-11 17:32:21.036 User: Admin initiated a switch command (48/RM3 - Command/Set Level)
2018-06-11 17:32:21.079 (RM3) Calling message handler 'onCommand'.
2018-06-11 17:32:21.079 (RM3) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : False
2018-06-11 17:32:21.092 Error: (RM3) Error Connecting to Broadlink device....
2018-06-11 17:32:21.092 (RM3) All plugin system is on pause for 5s...
2018-06-11 17:32:21.092 (RM3) When Broadlink led is lit press the button on your remote within 5 seconds
2018-06-11 17:32:21.098 Error: (RM3) 'onCommand' failed 'TypeError':'sequence item 0: expected str instance, bytes found'.
2018-06-11 17:32:21.098 Error: (RM3) ----> Line 158 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-11 17:32:21.098 Error: (RM3) ----> Line 417 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function learn
2018-06-11 17:32:21.098 Error: (RM3) ----> Line 487 in /usr/lib/python3.4/broadlink/__init__.py, function enter_learning
2018-06-11 17:32:21.098 Error: (RM3) ----> Line 258 in /usr/lib/python3.4/broadlink/__init__.py, function send_packet
2018-06-11 17:32:21.098 Error: (RM3) ----> Line 162 in /usr/lib/python3.4/broadlink/__init__.py, function encrypt_pyaes
Bundy75
Posts: 7
Joined: Friday 08 June 2018 7:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Bundy75 »

I think that I've managed to solve it!!!
Uninstalled 'pyaes' and installed pycrypto instead and it did the trick :-) Now it works like a charm. Thanks Zak for your huge effort and help!
reza
Posts: 112
Joined: Tuesday 13 September 2016 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by reza »

dear zak, please help me about this topic:
http://www.domoticz.com/forum/viewtopic.php?f=4&t=23843
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 V3

Post by kalinkamaen »

Windows 10 64bit
Domoticz 4.9700 Turned on Beta mode in Settings
Python 3.6 installed

Error I get is "File not found - plugin.py" Where do I find this file, and do I copy to scripts/Python?
Spoiler: show
"Broadlink RM2 python plugin install for Win"
" this need to be run with admin right "
" if pycrypto or pycryptodome are installed you need to remove them "
" this installation file is only for new install "
""
""
"Search python version"
Python 3.6.7rc1
" main module used by the plugin"
"Python version : " 36
Requirement already satisfied: pyaes in c:\users\server\appdata\local\programs\python\python36-32\lib\site-packages (1.6.0)
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.
Processing c:\users\server\appdata\local\temp\ixp000.tmp\python-broadlink-0.8\python-broadlink-0.8
Requirement already satisfied: pyaes==1.6.0 in c:\users\server\appdata\local\programs\python\python36-32\lib\site-packages (from broadlink==0.8) (1.6.0)
Requirement already satisfied: PyCRC in c:\users\server\appdata\local\programs\python\python36-32\lib\site-packages (from broadlink==0.8) (1.21)
Installing collected packages: broadlink
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"
Press any key to continue . . .
Windows 10, Domoticz 14784
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 »

plugin.py is included into setup.exe. just do setup.exe /? and you will find additionall command to extract data.
Thomas2000
Posts: 2
Joined: Friday 15 February 2019 21:01
Target OS: Linux
Domoticz version: 4.10429
Location: holland
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Thomas2000 »

Problem with starting the remote:
2019-02-15 21:04:09.102 Status: User: Admin initiated a switch command (1669/Broadlink tv - Remote/On)
2019-02-15 21:04:09.107 Error: (Broadlink tv) ini file not found: /home/thomas/domoticz/plugins/BroadlinkRM2-10-254.ini

Only when I change the settings to
ip 127.0.0.1
mac 000000000000
type discover

Than it will discover and i can start remote, but than learning/test/save/reset dissapear...

When set to correct ip mac and type (RM mini 3) i can learn/test/save/reset, but cant start remote.

I made remote ini file but no difference.

It's also disconnected a lot, sometimes after trying to get temperature, while I selected device without temp, which it is....

2019-02-15 22:50:23.913 Error: (Broadlink tv) 'onHeartbeat' failed 'TypeError':''>' not supported between instances of 'NoneType' and 'int''.
2019-02-15 22:50:23.913 Error: (Broadlink tv) ----> Line 473 in '/home/thomas/domoticz/plugins/BroadlinkRM2/plugin.py', function onHeartbeat
2019-02-15 22:50:23.913 Error: (Broadlink tv) ----> Line 757 in '/home/thomas/domoticz/plugins/BroadlinkRM2/plugin.py', function checkTemp
2019-02-15 22:50:40.973 Error: MySensors: Can not connect to: 192.168.2.145:5003
2019-02-15 22:50:53.926 Error: (Broadlink tv) 'onHeartbeat' failed 'TypeError':''>' not supported between instances of 'NoneType' and 'int''.
2019-02-15 22:50:53.926 Error: (Broadlink tv) ----> Line 473 in '/home/thomas/domoticz/plugins/BroadlinkRM2/plugin.py', function onHeartbeat
2019-02-15 22:50:53.926 Error: (Broadlink tv) ----> Line 757 in '/home/thomas/domoticz/plugins/BroadlinkRM2/plugin.py', function checkTemp
Thomas2000
Posts: 2
Joined: Friday 15 February 2019 21:01
Target OS: Linux
Domoticz version: 4.10429
Location: holland
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Thomas2000 »

Disconnection solved, something wrong with the 5v -> 3.3v in the broadlink. Now put external 3.3v on a pin I found in the broadlink and no disconnect problems.

Problem with the remote/ini still exist.
Darkneo
Posts: 24
Joined: Sunday 10 February 2019 16:22
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Darkneo »

Hello all,

I am facing a strange issue on my Domoticz (installed on Synology).

On the logs I am having the same error message than other users:

Code: Select all

2019-02-25 22:33:15.076 Status: User: Darkneo initiated a switch command (16/Broadcom - Remote/On)
2019-02-25 22:33:15.107 Error: (Broadcom) ini file not found: /volume1/@appstore/domoticz/var/plugins/BroadlinkRM2/BroadlinkRM2-8-254.ini
2019-02-25 22:33:16.525 (Broadcom) Pushing 'onHeartbeatCallback' on to queue
2019-02-25 22:33:16.559 (Broadcom) Processing 'onHeartbeatCallback' message
2019-02-25 22:33:16.559 (Broadcom) Calling message handler 'onHeartbeat'.
But the switch does not have the learn button (and the others). I had no issues when discovering the Broadlink, but I cant set it up...

Domoticz 4.9700
Plugin version 4.1.0

The complete logs:

Code: Select all

2019-02-25 22:35:28.994 Status: (Broadcom) Started.
2019-02-25 22:35:29.102 (Broadcom) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2019-02-25 22:35:29.102 (Broadcom) 'Key':'BroadlinkRM2'
2019-02-25 22:35:29.102 (Broadcom) 'DomoticzHash':'a3a4590-modified'
2019-02-25 22:35:29.102 (Broadcom) 'Author':'zak45'
2019-02-25 22:35:29.102 (Broadcom) 'Mode5':'9000'
2019-02-25 22:35:29.102 (Broadcom) 'Port':'0'
2019-02-25 22:35:29.102 (Broadcom) 'Mode6':'Debug'
2019-02-25 22:35:29.102 (Broadcom) 'DomoticzBuildTime':'2018-06-23 16:24:51'
2019-02-25 22:35:29.102 (Broadcom) 'Mode3':'RM2'
2019-02-25 22:35:29.102 (Broadcom) 'Mode2':'/volume1/@appstore/domoticz/var/plugins/BroadlinkRM2'
2019-02-25 22:35:29.102 (Broadcom) 'Name':'Broadcom'
2019-02-25 22:35:29.102 (Broadcom) 'HomeFolder':'/usr/local/domoticz/var/plugins/BroadlinkRM2/'
2019-02-25 22:35:29.102 (Broadcom) 'Mode4':'no'
2019-02-25 22:35:29.102 (Broadcom) 'Address':'192.168.1.34'
2019-02-25 22:35:29.102 (Broadcom) 'Mode1':'780f77b94bfe'
2019-02-25 22:35:29.102 (Broadcom) 'HardwareID':'8'
2019-02-25 22:35:29.102 (Broadcom) 'Version':'4.1.0'
2019-02-25 22:35:29.102 (Broadcom) 'DomoticzVersion':'4.9700'
2019-02-25 22:35:29.102 (Broadcom) Device count: 3
2019-02-25 22:35:29.102 (Broadcom) Device: 1 - ID: 12, Name: 'Broadcom - Discovery', nValue: 0, sValue: 'Off'
2019-02-25 22:35:29.102 (Broadcom) Device ID: '12'
2019-02-25 22:35:29.102 (Broadcom) Device Name: 'Broadcom - Discovery'
2019-02-25 22:35:29.102 (Broadcom) Device nValue: 0
2019-02-25 22:35:29.102 (Broadcom) Device sValue: 'Off'
2019-02-25 22:35:29.102 (Broadcom) Device LastLevel: 0
2019-02-25 22:35:29.102 (Broadcom) Device: 2 - ID: 13, Name: 'Broadcom - Discovery', nValue: 1, sValue: '0.0'
2019-02-25 22:35:29.102 (Broadcom) Device ID: '13'
2019-02-25 22:35:29.102 (Broadcom) Device Name: 'Broadcom - Discovery'
2019-02-25 22:35:29.102 (Broadcom) Device nValue: 1
2019-02-25 22:35:29.103 (Broadcom) Device sValue: '0.0'
2019-02-25 22:35:29.103 (Broadcom) Device LastLevel: 0
2019-02-25 22:35:29.103 (Broadcom) Device: 254 - ID: 16, Name: 'Broadcom - Remote', nValue: 0, sValue: ''
2019-02-25 22:35:29.103 (Broadcom) Device ID: '16'
2019-02-25 22:35:29.103 (Broadcom) Device Name: 'Broadcom - Remote'
2019-02-25 22:35:29.103 (Broadcom) Device nValue: 0
2019-02-25 22:35:29.103 (Broadcom) Device sValue: ''
2019-02-25 22:35:29.103 (Broadcom) Device LastLevel: 0
2019-02-25 22:35:29.103 (Broadcom) Pushing 'PollIntervalDirective' on to queue
2019-02-25 22:35:29.103 (Broadcom) Connecting to: 192.168.1.34:780f77b94bfe
2019-02-25 22:35:29.165 (Broadcom) Connected to Broadlink device: 192.168.1.34
2019-02-25 22:35:29.165 (Broadcom - Discovery) Updating device from 0:'Off' to have values 1:'10'.
2019-02-25 22:35:29.166 (Broadcom) Update 1:'10' (Broadcom - Discovery)
2019-02-25 22:35:29.167 (Broadcom) No ini file :/volume1/@appstore/domoticz/var/plugins/BroadlinkRM2/remote/plugin_remote_8.ini
2019-02-25 22:35:29.167 (Broadcom) Custom Commands for Remote not managed
2019-02-25 22:35:29.167 (Broadcom) Device Number begin to : 2
2019-02-25 22:35:29.167 (Broadcom) Processing 'PollIntervalDirective' message
2019-02-25 22:35:29.167 (Broadcom) Heartbeat interval set to: 30.
2019-02-25 22:35:29.101 Status: (Broadcom) Initialized version 4.1.0, author 'zak45'
2019-02-25 22:35:29.101 Status: (Broadcom) Entering work loop.
2019-02-25 22:35:38.602 (Broadcom) Pushing 'onHeartbeatCallback' on to queue
2019-02-25 22:35:38.627 (Broadcom) Processing 'onHeartbeatCallback' message
2019-02-25 22:35:38.627 (Broadcom) Calling message handler 'onHeartbeat'.
The find command on my installation:

Code: Select all

root@Syno:/# find -iname "broadlink*"
./root/python-broadlink/broadlink
./root/python-broadlink/cli/broadlink_cli
./root/python-broadlink/cli/broadlink_discovery
./root/python-broadlink/broadlink.egg-info
./root/python-broadlink/build/lib/broadlink
./root/python-broadlink/dist/broadlink-0.9-py2.7.egg
./root/python-broadlink/dist/broadlink-0.9-py3.5.egg
./usr/lib/python2.7/site-packages/broadlink-0.9-py2.7.egg
./usr/lib/python2.7/site-packages/broadlink-0.9-py2.7.egg/broadlink
./volume1/@appstore/domoticz/var/plugins/BroadlinkRM2
./volume1/@appstore/domoticz/var/plugins/BroadlinkRM2/broadlink
./volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/broadlink-0.9-py3.5.egg
./volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/broadlink-0.9-py3.5.egg/broadlink
./C:/BroadlinkRM2
Thanks for your help and advice on that issue.
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Loky31 »

Hello All,

Is anyone making the web import working?

I'm struggling with the webstart that fails over and over again for some path reason apparently :
2019-05-01 13:33:12.724 Error: (RM salon) 127
2019-05-01 13:33:12.724 Error: (RM salon) /home/pi/domoticz/plugins/BroadlinkRM2/plugin_http.sh 0.0.0.0 9000 /home/pi/domoticz/plugins/BroadlinkRM2
2019-05-01 13:33:12.724 Error: (RM salon) None
2019-05-01 13:33:12.752 Error: (RM salon) Not able to start Web server

Is anyone able to help with that?
I'm on beta of domoticz.
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 »

Loky31 wrote: Wednesday 01 May 2019 13:39 Hello All,

Is anyone making the web import working?

I'm struggling with the webstart that fails over and over again for some path reason apparently :
2019-05-01 13:33:12.724 Error: (RM salon) 127
2019-05-01 13:33:12.724 Error: (RM salon) /home/pi/domoticz/plugins/BroadlinkRM2/plugin_http.sh 0.0.0.0 9000 /home/pi/domoticz/plugins/BroadlinkRM2
2019-05-01 13:33:12.724 Error: (RM salon) None
2019-05-01 13:33:12.752 Error: (RM salon) Not able to start Web server

Is anyone able to help with that?
I'm on beta of domoticz.
I suppose you use the v4....;-)
check if plugin_http.sh is executable ( chmod +x) and/or port 9000 is not already used.
Loky31
Posts: 40
Joined: Monday 11 March 2019 13:46
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Broadlink RM2 V3

Post by Loky31 »

Ho sorry indeed it is the V4.2 exactely.


Coming from the dropbox :https://www.dropbox.com/sh/htyghey9e402 ... ?dl=0&lst=

"Plugin_http.sh" is executable.
When trying to launch it by command line i have the folowing:

File "plugin_http.sh", line 1
nohup python /Domoticz/plugins/BroadlinkRM2/plugin_http.py $1 $2 $3 &
^
SyntaxError: invalid syntax

Looking everywhere in this plugin but didn't figure out what went wrong...

How do I check port usage under debian? ( silly question but I'm more a windows guy :) )


Edit : somehow something changed ! the nohup.out now indicates :
python: can't open file '/Domoticz/plugins/BroadlinkRM2/plugin_http.py': [Errno 13] Permission denied

wheras before it was a path error saying that such file or directory did not exist.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest