Page 14 of 33

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 18 June 2018 17:18
by zak45
olicot wrote: Monday 18 June 2018 11:45 Hello
I need some help with this Plugin
I've got issue for 2 month. So I install a new and fresh and "light" environnement to tests (My other production build works fine with other plugins such as Kodi, Zigate, LGWebOS T...)

So my test build ::
  • Ubuntu 16.04.4 (on Orange PI New PC+)
    Domoticz V3.9639
    Python version '3.5.2'.
    Broadlink 0.9
    plugin : Broadlink RM2 V4.1
    pycryptodome : 3.4.11
    pyaes : 1.6.1
Problem can be pycryptodome, if not use for something else, try to remove it.

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 18 June 2018 18:56
by olicot
zak45 wrote: Monday 18 June 2018 17:18
olicot wrote: Monday 18 June 2018 11:45 Hello
I need some help with this Plugin
I've got issue for 2 month. So I install a new and fresh and "light" environnement to tests (My other production build works fine with other plugins such as Kodi, Zigate, LGWebOS T...)

So my test build ::
  • Ubuntu 16.04.4 (on Orange PI New PC+)
    Domoticz V3.9639
    Python version '3.5.2'.
    Broadlink 0.9
    plugin : Broadlink RM2 V4.1
    pycryptodome : 3.4.11
    pyaes : 1.6.1
Problem can be pycryptodome, if not use for something else, try to remove it.
Thanks a lot Zak45 :D
it 'is working again...i'm trying to find about solution fot 2 months , since Broadlink 0.9 was installed.
Braodlink 0.9 install by itself pycryptodome : 3.4.11
So I remove pycryptodome , and I install pyaes and Crypto, and the plugin works yet ;-)

Thank you

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 19 June 2018 12:10
by Bundy75
Hi Zak!

After many hours of struggling with Python I've managed to launch working instance of the plugin.
On thing is still not completed - RM3 Remote. I would like to assign my TV's buttons codes to this virtual remote, but probably my ini file is not correct.
Could you share a proper structure of this file which can be customized to use with RM3 Remote?

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 19 June 2018 12:53
by zak45
Bundy75 wrote: Tuesday 19 June 2018 12:10 Hi Zak!

After many hours of struggling with Python I've managed to launch working instance of the plugin.
On thing is still not completed - RM3 Remote. I would like to assign my TV's buttons codes to this virtual remote, but probably my ini file is not correct.
Could you share a proper structure of this file which can be customized to use with RM3 Remote?
plugin_remote_13.ini
(33 Bytes) Downloaded 219 times
that's the one I use. Just put your value inside and rename it as necessary. see wiki.

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 19 June 2018 14:04
by Bundy75
Thanks for your fast reply!
My ini file for Remote is exactly the same (structure). It just contains:

Code: Select all


[Custom]
command = 4,5,6,7  
  
Values assigned to 'command' are unit numbers of previously learned and stored buttons (they work correctly as separate switches).

example:

Code: Select all

[DEFAULT]
pluginname = RM3
customname = TV 
unit = 4
hardwareid = 17
pluginkey = BroadlinkRM2
pluginfolder = /home/pi/domoticz/plugins/BroadlinkRM2/
...
I assume that I have to use 'unit' value and put it to remote's .ini in Custom section (in right order of buttons of course), right?

Unfortunately when I try to enable the Remote I see in the logs:

Code: Select all

User: Admin initiated a switch command (49/RM3 - Remote/On)
2018-06-19 13:54:04.689 (RM3) Calling message handler 'onCommand'.
2018-06-19 13:54:04.690 (RM3) onCommand called for Unit 254: Parameter 'On', Level: 0 , Connected : True
2018-06-19 13:54:04.690 (RM3) Generate on Command for learned code stored on unit/ini :254
2018-06-19 13:54:04.692 Error: (RM3) 'onCommand' failed 'NoSectionError'.
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 217 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 314 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function genCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 757 in /usr/lib/python3.4/configparser.py, function get
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 1119 in /usr/lib/python3.4/configparser.py, function _unify_values

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 19 June 2018 16:20
by domoticzba
Hello, I am trying to install my Broadlink RM 3 Mini on my Ubuntu Server but Domoticz freezes during add new hardware or update Broadlink RM 3 hardware.
After adding the hardware for the Broadlink using IP 127.0.0.1 and mac ‘000...’, an entry is added to the hardware is not add on devices.
Can anyone please help with a solution ?

Thanks in advance!!

Setup:
#################################################################################

OS
Description:Ubuntu 17.10
Release: 17.10
DOMOTICZ Version: 3.9639

#################################################################################

~/domoticz/plugins/BroadlinkRM2$ python -V
Python 2.7.14

~/domoticz/plugins/BroadlinkRM2$ python3 -V
Python 3.4.3

Name: broadlink
Version: 0.9
Location: /usr/local/lib/python3.4/site-packages
Requires: pyaes, PyCRC

Name: Paes
Version: 1.6.0
Location: /usr/local/lib/python3.4/site-packages
Requires:

Name: PyCRC
Version: 1.21
Location: /usr/local/lib/python3.4/site-packages
Requires:

#################################################################################

sudo pip3 show pycrypto

The directory '/home/˜/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/˜/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
You are using pip version 6.0.8, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' comanda.

sudo pip3 show pycryptodome

The directory '/home/˜/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
The directory '/home/˜/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want the -H flag.
You are using pip version 6.0.8, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

#################################################################################

~/domoticz/plugins/BroadlinkRM2$ ls -la

drwxr-x--- 2 root root 4096 Jun 18 20:01 __pycache__
-rwxrwxrwx 1 xxx xxx 43472 Jun 18 19:59 plugin.py
-rwxrwxrwx 1 xxx xxx 11469 Jun 18 20:00 plugin_http.py
-rwxrwxrwx 1 xxx xxx 72 Jun 18 19:59 plugin_http.sh
-rwxrwxrwx 1 xxx xxx 1523 Jun 18 19:59 plugin_send.py

#################################################################################

sudo cp -r /usr/local/lib/python3.4/site-packages/crypto/ /usr/lib/python3.4/
sudo cp -r /usr/local/lib/python3.4/site-packages/broadlink /usr/lib/python3.4/

#################################################################################

2018-06-19 10:37:42.559 Status: (BROADLINKmini2) Entering work loop.
2018-06-19 10:37:42.559 Status: (BROADLINKmini2) Initialized version 4.1.0, author 'zak45'

#################################################################################

LOGs
2018-06-19 10:44:32.607 Sunrise: 06:51:00 SunSet: 17:32:00
2018-06-19 10:44:32.607 Day length: 10:41:00 Sun at south: 12:05:00
2018-06-19 10:44:32.607 Civil twilight start: 06:26:00 Civil twilight end: 17:56:00
2018-06-19 10:44:32.607 Nautical twilight start: 05:58:00 Nautical twilight end: 18:25:00
2018-06-19 10:44:32.607 Astronomical twilight start: 05:30:00 Astronomical twilight end: 18:52:00
2018-06-19 10:44:32.624 Active notification Subsystems: kodi, pushbullet (2/14)
2018-06-19 10:44:32.626 Starting shared server on: :::6144
2018-06-19 10:44:32.601 Status: Domoticz V3.9639 (c)2012-2018 GizMoCuz
2018-06-19 10:44:32.601 Status: Build Hash: 786b9638, Date: 2018-06-14 11:44:52
2018-06-19 10:44:32.602 Status: Startup Path: /home/˜/domoticz/
2018-06-19 10:44:32.607 Status: EventSystem: reset all events...
2018-06-19 10:44:32.622 Status: PluginSystem: Started, Python version '3.6.3'.
2018-06-19 10:44:32.625 Status: WebServer(HTTP) started on address: :: with port 8080
2018-06-19 10:44:32.626 Status: WebServer(SSL) started on address: :: with port 4443
2018-06-19 10:44:32.626 Status: Proxymanager started.
2018-06-19 10:44:32.626 Status: TCPServer: shared server started...
2018-06-19 10:44:32.627 Status: RxQueue: queue worker started...
2018-06-19 10:44:34.633 Status: (KODI-QUARTO) Started.
2018-06-19 10:44:34.633 Status: (BROADLINKmini2) Started.
2018-06-19 10:44:34.633 Status: DarkSky: Started...
2018-06-19 10:44:34.633 Status: EventSystem: reset all events...
2018-06-19 10:44:34.633 Status: EventSystem: reset all device statuses...
2018-06-19 10:44:34.683 Status: Python EventSystem: Initalizing event module.
2018-06-19 10:44:34.683 Status: EventSystem: Started
2018-06-19 10:44:34.683 Status: EventSystem: Queue thread started...
2018-06-19 10:44:35.960 MQTT: Topic: domoticz/in, Message: {"idx": 12, "nvalue": 0, "svalue": ""}
2018-06-19 10:44:35.112 Status: PluginSystem: Entering work loop.
2018-06-19 10:44:35.165 Status: (KODI-QUARTO) Entering work loop.
2018-06-19 10:44:35.165 Status: (KODI-QUARTO) Initialized version 2.5.6, author 'dnpwwo'
2018-06-19 10:44:35.264 Status: (BROADLINKmini2) Entering work loop.
2018-06-19 10:44:35.264 Status: (BROADLINKmini2) Initialized version 4.1.0, author 'zak45'
2018-06-19 10:44:35.656 Status: MQTT: Connecting to 127.0.0.1:1883
2018-06-19 10:44:35.758 Status: MQTT: connected to: 127.0.0.1:1883
2018-06-19 10:44:35.859 Status: MQTT: Subscribed
2018-06-19 10:44:44.657 Error: DarkSky: Error getting http data!.
2018-06-19 10:49:45.253 Error: DarkSky: Error getting http data!.
2018-06-19 10:54:45.845 Error: DarkSky: Error getting http data!.
2018-06-19 10:59:46.448 Error: DarkSky: Error getting http data!.
2018-06-19 11:00:00.874 Status: Starting automatic database backup procedure...
2018-06-19 11:00:01.013 Status: Ending automatic database backup procedure...
2018-06-19 11:00:17.300 MQTT: Topic: domoticz/in, Message: {"idx": 12, "nvalue": 1, "svalue": ""}
2018-06-19 11:00:24.349 (SENSOR-CORREDOR) Light/Switch (SENSOR-CORREDOR)
2018-06-19 11:00:24.453 MQTT: Topic: domoticz/in, Message: {"idx": 12, "nvalue": 0, "svalue": ""}
2018-06-19 11:04:47.030 Error: DarkSky: Error getting http data!.

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 19 June 2018 16:49
by zak45
Bundy75 wrote: Tuesday 19 June 2018 14:04
I assume that I have to use 'unit' value and put it to remote's .ini in Custom section (in right order of buttons of course), right?

Code: Select all

User: Admin initiated a switch command (49/RM3 - Remote/On)
2018-06-19 13:54:04.689 (RM3) Calling message handler 'onCommand'.
2018-06-19 13:54:04.690 (RM3) onCommand called for Unit 254: Parameter 'On', Level: 0 , Connected : True
2018-06-19 13:54:04.690 (RM3) Generate on Command for learned code stored on unit/ini :254
2018-06-19 13:54:04.692 Error: (RM3) 'onCommand' failed 'NoSectionError'.
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 217 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 314 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function genCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 757 in /usr/lib/python3.4/configparser.py, function get
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 1119 in /usr/lib/python3.4/configparser.py, function _unify_values
yes, that's right for the unit.
Try to create the ini from scratch, if you have take the one from myself, do not forget I'm working on windows ( CR/LF vs LF)

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 20 June 2018 0:33
by moo2089
Bundy75 wrote: Tuesday 19 June 2018 14:04 Thanks for your fast reply!
My ini file for Remote is exactly the same (structure). It just contains:

Code: Select all


[Custom]
command = 4,5,6,7  
  
Values assigned to 'command' are unit numbers of previously learned and stored buttons (they work correctly as separate switches).

example:

Code: Select all

[DEFAULT]
pluginname = RM3
customname = TV 
unit = 4
hardwareid = 17
pluginkey = BroadlinkRM2
pluginfolder = /home/pi/domoticz/plugins/BroadlinkRM2/
...
I assume that I have to use 'unit' value and put it to remote's .ini in Custom section (in right order of buttons of course), right?

Unfortunately when I try to enable the Remote I see in the logs:

Code: Select all

User: Admin initiated a switch command (49/RM3 - Remote/On)
2018-06-19 13:54:04.689 (RM3) Calling message handler 'onCommand'.
2018-06-19 13:54:04.690 (RM3) onCommand called for Unit 254: Parameter 'On', Level: 0 , Connected : True
2018-06-19 13:54:04.690 (RM3) Generate on Command for learned code stored on unit/ini :254
2018-06-19 13:54:04.692 Error: (RM3) 'onCommand' failed 'NoSectionError'.
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 217 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 314 in /home/pi/domoticz/plugins/BroadlinkRM2/plugin.py, function genCommand
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 757 in /usr/lib/python3.4/configparser.py, function get
2018-06-19 13:54:04.692 Error: (RM3) ----> Line 1119 in /usr/lib/python3.4/configparser.py, function _unify_values
Hi,
I had same issue until i did not restart domoticz:)

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 20 June 2018 15:45
by Bundy75
I've restarted Domoticz after applying any changes - it doesn't help for this particular case
Regarding .ini file - I've created it from the scratch on my RPi, so there's no chance to contain any Windows EOL codes.

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 25 June 2018 23:54
by eserero
hi All, new here in the forums :oops:

I'v been running domoticz on windows for a while now, using the 0.5 plugin with 3 rm3 mini systems and it worked flawlessly.
last week domoticz updated to 4.9 - so of course I had to jump on the wagon and upgrade. most of the stuff worked, but the broadlink integration broke :-(. I decided to upgrade to 0.8 and now to 0.9 but nothing works. the plugin seems to be there, and seems to do all the right stuff, except that I"m getting a connection error in the log - and of course nothing works. I do have ping to the devices, and they are working fine from e-control for testing.

I'v been burning hours on this for a couple of days now, any help would very much be appreciated .

the error is

Code: Select all

Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sometime I"m getting other "Error: PROXY:Connect failed" errors as well (with different text after).

The log below is what I see after I created a new hardware device for testing, but I got similar results from the devices I had from backup.
I"m using python 3.6, and pip list show:

Code: Select all

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
broadlink (0.9)
pip (9.0.3)
pyaes (1.6.0)
PyCRC (1.21)
setuptools (39.0.1)
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
the log itself is below:

Code: Select all

018-06-26 00:33:59.128 (Broadlink Kids test) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2018-06-26 00:33:59.129 (Broadlink Kids test) Creating device 'Command'.
2018-06-26 00:33:59.153 (Broadlink Kids test) Creating device 'Remote'.
2018-06-26 00:33:59.171 (Broadlink Kids test) Creating device 'Import'.
2018-06-26 00:33:59.202 (Broadlink Kids test) 'HardwareID':'15'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'HomeFolder':'C:\Program Files (x86)\Domoticz\plugins\BroadlinkRM2\'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Version':'4.1.0'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Author':'zak45'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Name':'Broadlink Kids test'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Address':'10.0.0.60'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Port':'0'
2018-06-26 00:33:59.203 (Broadlink Kids test) 'Key':'BroadlinkRM2'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode1':'34ea34c77253'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode2':'C:/BroadlinkRM2_1'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode3':'RM2'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode4':'yes'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode5':'9000'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'Mode6':'Debug'
2018-06-26 00:33:59.204 (Broadlink Kids test) 'DomoticzVersion':'4.9700'
2018-06-26 00:33:59.205 (Broadlink Kids test) 'DomoticzHash':'a3a45906'
2018-06-26 00:33:59.205 (Broadlink Kids test) 'DomoticzBuildTime':'2018-06-23 17:24:51'
2018-06-26 00:33:59.205 (Broadlink Kids test) Device count: 3
2018-06-26 00:33:59.205 (Broadlink Kids test) Device: 1 - ID: 214, Name: 'Broadlink Kids test - Command', nValue: 0, sValue: ''
2018-06-26 00:33:59.205 (Broadlink Kids test) Device ID: '214'
2018-06-26 00:33:59.205 (Broadlink Kids test) Device Name: 'Broadlink Kids test - Command'
2018-06-26 00:33:59.205 (Broadlink Kids test) Device nValue: 0
2018-06-26 00:33:59.205 (Broadlink Kids test) Device sValue: ''
2018-06-26 00:33:59.206 (Broadlink Kids test) Device LastLevel: 0
2018-06-26 00:33:59.206 (Broadlink Kids test) Device: 254 - ID: 215, Name: 'Broadlink Kids test - Remote', nValue: 0, sValue: ''
2018-06-26 00:33:59.206 (Broadlink Kids test) Device ID: '215'
2018-06-26 00:33:59.206 (Broadlink Kids test) Device Name: 'Broadlink Kids test - Remote'
2018-06-26 00:33:59.206 (Broadlink Kids test) Device nValue: 0
2018-06-26 00:33:59.206 (Broadlink Kids test) Device sValue: ''
2018-06-26 00:33:59.206 (Broadlink Kids test) Device LastLevel: 0
2018-06-26 00:33:59.207 (Broadlink Kids test) Device: 255 - ID: 216, Name: 'Broadlink Kids test - Import', nValue: 0, sValue: ''
2018-06-26 00:33:59.207 (Broadlink Kids test) Device ID: '216'
2018-06-26 00:33:59.207 (Broadlink Kids test) Device Name: 'Broadlink Kids test - Import'
2018-06-26 00:33:59.207 (Broadlink Kids test) Device nValue: 0
2018-06-26 00:33:59.207 (Broadlink Kids test) Device sValue: ''
2018-06-26 00:33:59.207 (Broadlink Kids test) Device LastLevel: 0
2018-06-26 00:33:59.207 (Broadlink Kids test) Pushing 'PollIntervalDirective' on to queue
2018-06-26 00:33:59.207 (Broadlink Kids test - Import) Updating device from 0:'' to have values 0:'Off'.
2018-06-26 00:33:59.250 (Broadlink Kids test) Update 0:'Off' (Broadlink Kids test - Import)
2018-06-26 00:33:59.250 (Broadlink Kids test) Connecting to: 10.0.0.60:34ea34c77253
2018-06-26 00:33:59.285 (Broadlink Kids test) Connected to Broadlink device: 10.0.0.60
2018-06-26 00:33:59.286 (Broadlink Kids test - Command) Updating device from 0:'' to have values 1:'10'.
2018-06-26 00:33:59.341 (Broadlink Kids test) Update 1:'10' (Broadlink Kids test - Command)
2018-06-26 00:33:59.346 (Broadlink Kids test) No ini file :C:/BroadlinkRM2_1/remote/plugin_remote_15.ini
2018-06-26 00:33:59.346 (Broadlink Kids test) Custom Commands for Remote not managed
2018-06-26 00:33:59.347 (Broadlink Kids test) Device Number begin to : 1
2018-06-26 00:33:59.347 (Broadlink Kids test) Processing 'PollIntervalDirective' message
2018-06-26 00:33:59.347 (Broadlink Kids test) Heartbeat interval set to: 30.
2018-06-26 00:33:59.074 Status: (Broadlink Kids test) Entering work loop.
2018-06-26 00:33:59.074 Status: (Broadlink Kids test) Initialized version 4.1.0, author 'zak45'
2018-06-26 00:34:08.588 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:34:08.624 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:34:08.624 (Broadlink Kids test) Calling message handler 'onHeartbeat'.
2018-06-26 00:34:28.889 Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
2018-06-26 00:34:38.629 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:34:38.644 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:34:38.644 (Broadlink Kids test) Calling message handler 'onHeartbeat'.
2018-06-26 00:35:04.401 Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
2018-06-26 00:35:08.671 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:35:08.716 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:35:08.716 (Broadlink Kids test) Calling message handler 'onHeartbeat'.
2018-06-26 00:35:38.712 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:35:38.740 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:35:38.740 (Broadlink Kids test) Calling message handler 'onHeartbeat'.
2018-06-26 00:35:39.911 Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
2018-06-26 00:36:08.775 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:36:08.780 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:36:08.780 (Broadlink Kids test) Calling message handler 'onHeartbeat'.
2018-06-26 00:36:15.915 Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
2018-06-26 00:36:38.818 (Broadlink Kids test) Pushing 'onHeartbeatCallback' on to queue
2018-06-26 00:36:38.851 (Broadlink Kids test) Processing 'onHeartbeatCallback' message
2018-06-26 00:36:38.851 (Broadlink Kids test) Calling message handler 'onHeartbeat'.

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 26 June 2018 10:15
by devros
hello, plugin isnt working with latest Domoticz, whole domoticz crash so its quite hard to debug
im on bananapi ubuntu system
any idea what could be wrong

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 26 June 2018 17:59
by zak45
devros wrote: Tuesday 26 June 2018 10:15 hello, plugin isnt working with latest Domoticz, whole domoticz crash so its quite hard to debug
im on bananapi ubuntu system
any idea what could be wrong
if you have pycryptodome, you need to remove it.

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 26 June 2018 18:05
by zak45
eserero wrote: Monday 25 June 2018 23:54 hi All, new here in the forums :oops:

I'v been running domoticz on windows for a while now, using the 0.5 plugin with 3 rm3 mini systems and it worked flawlessly.
last week domoticz updated to 4.9 - so of course I had to jump on the wagon and upgrade. most of the stuff worked, but the broadlink integration broke :-(. I decided to upgrade to 0.8 and now to 0.9 but nothing works. the plugin seems to be there, and seems to do all the right stuff, except that I"m getting a connection error in the log - and of course nothing works. I do have ping to the devices, and they are working fine from e-control for testing.

I'v been burning hours on this for a couple of days now, any help would very much be appreciated .

the error is

Code: Select all

Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sometime I"m getting other "Error: PROXY:Connect failed" errors as well (with different text after).
Working here with Win 10 / python 3.4.
Try to remove stop any firewall. Try also to create a discovery HW to see if it retreive all yours Broadlink devices.

Re: Python Plugin : Broadlink RM2 V4

Posted: Friday 29 June 2018 17:07
by lec668
Hi all

I tried this (awesome/fantastic) plugin

After struggling with the cryptodome part a little bit, it works perfectly for learning remotes codes, creating devices, and using them.


Trouble is, It's unable to convert/import running config from the Broadlink app, see error below in plugin
I'm able to upload the 3x json files from my Android to the configured directory, /home/osmc/domoticz/plugins/BroadlinkRM2 for me,

files are uploaded fine :
osmc:~/domoticz/plugins/BroadlinkRM2$ ls json*
jsonButton jsonIrCode jsonSubIr

but get this error when trying to generate

2018-06-29 16:37:05.290 Error: (Broalink-chambre) 'onCommand' failed 'FileNotFoundError'.
2018-06-29 16:37:05.290 Error: (Broalink-chambre) ----> Line 262 in /home/osmc/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-29 16:37:05.290 Error: (Broalink-chambre) ----> Line 823 in /home/osmc/domoticz/plugins/BroadlinkRM2/plugin.py, function createIniImport

What could be the trouble ?

Thanks for helping

My setup : Domoticz (V4.9730) on OSMC (06/01/2018) on Raspberry

Re: Python Plugin : Broadlink RM2 V4

Posted: Friday 29 June 2018 17:36
by zak45
lec668 wrote: Friday 29 June 2018 17:07 Hi all

I'm able to upload the 3x json files from my Android to the configured directory, /home/osmc/domoticz/plugins/BroadlinkRM2 for me,

files are uploaded fine :
osmc:~/domoticz/plugins/BroadlinkRM2$ ls json*
jsonButton jsonIrCode jsonSubIr

but get this error when trying to generate

2018-06-29 16:37:05.290 Error: (Broalink-chambre) 'onCommand' failed 'FileNotFoundError'.
2018-06-29 16:37:05.290 Error: (Broalink-chambre) ----> Line 262 in /home/osmc/domoticz/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-06-29 16:37:05.290 Error: (Broalink-chambre) ----> Line 823 in /home/osmc/domoticz/plugins/BroadlinkRM2/plugin.py, function createIniImport

What could be the trouble ?

Thanks for helping

My setup : Domoticz (V4.9730) on OSMC (06/01/2018) on Raspberry
this need to be put here :
*** and transfert them in the ../import folder.

so for you should be /home/osmc/domoticz/plugins/BroadlinkRM2/import

Re: Python Plugin : Broadlink RM2 V4

Posted: Friday 29 June 2018 19:01
by lec668
Great ! Thanks a lot that fixed it

Using Python 3.5.3 works fine for me (Plugins Xiaomi Miflora, Bluetooth beacon, and now Broadlink)

Re: Python Plugin : Broadlink RM2 V4

Posted: Sunday 01 July 2018 6:56
by mistak1992
Hi zak45, i'm been trapped in "Error Connecting to Broadlink device...." for a long time, from domoticzV3.xxxx to V4.9732, pluging.py V3.0.0 to V4.1.0, i have try all the way. it's about 5 months ago, now, i need your help!(forgive my bad english...)
--------------------
now
Device:RM Pro Plus
OS:CentOS 7 x64
domoticz:V4.9732
Python:Python3.6.3
Pip list:
broadlink 0.6
pip 10.0.1
pyaes 1.6.0
PyCRC 1.21
pycrypto 2.6.1
setuptools 28.8.0

the log of domoticz(* for sercert, you know):

Code: Select all

2018-07-01 12:46:47.852 Sunrise: 05:42:00 SunSet: 19:14:00
2018-07-01 12:46:47.852 Day length: 13:32:00 Sun at south: 12:05:00
2018-07-01 12:46:47.852 Civil twilight start: 05:17:00 Civil twilight end: 19:39:00
2018-07-01 12:46:47.852 Nautical twilight start: 04:47:00 Nautical twilight end: 20:09:00
2018-07-01 12:46:47.852 Astronomical twilight start: 04:15:00 Astronomical twilight end: 20:40:00
2018-07-01 12:46:47.959 Active notification Subsystems: (0/13)
2018-07-01 12:46:47.969 Starting shared server on: :::6144
2018-07-01 12:46:47.812 Status: Domoticz V4.9732 (c)2012-2018 GizMoCuz
2018-07-01 12:46:47.812 Status: Build Hash: 89825c8, Date: 2018-06-30 03:42:37
2018-07-01 12:46:47.813 Status: Startup Path: /opt/domoticz/
2018-07-01 12:46:47.852 Status: EventSystem: reset all events...
2018-07-01 12:46:47.951 Status: PluginSystem: Started, Python version '3.6.3'.
2018-07-01 12:46:47.960 Status: WebServer(HTTP) started on address: :: with port 8800
2018-07-01 12:46:47.966 Status: WebServer(SSL) started on address: :: with port 443
2018-07-01 12:46:47.968 Status: Proxymanager started.
2018-07-01 12:46:47.970 Status: TCPServer: shared server started...
2018-07-01 12:46:47.971 Status: RxQueue: queue worker started...
2018-07-01 12:46:49.972 Status: (RM2) Started.
2018-07-01 12:46:49.972 Status: EventSystem: reset all events...
2018-07-01 12:46:49.973 Status: EventSystem: reset all device statuses...
2018-07-01 12:46:50.738 (RM2) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2018-07-01 12:46:50.738 (RM2) 'HardwareID':'2'
2018-07-01 12:46:50.738 (RM2) 'HomeFolder':'/opt/domoticz/plugins/BroadlinkRM2/'
2018-07-01 12:46:50.738 (RM2) 'Version':'4.1.0'
2018-07-01 12:46:50.738 (RM2) 'Author':'zak45'
2018-07-01 12:46:50.738 (RM2) 'Name':'RM2'
2018-07-01 12:46:50.738 (RM2) 'Address':'192.168.1.102'
2018-07-01 12:46:50.739 (RM2) 'Port':'0'
2018-07-01 12:46:50.739 (RM2) 'Key':'BroadlinkRM2'
2018-07-01 12:46:50.739 (RM2) 'Mode1':'34ea34c76***'
2018-07-01 12:46:50.739 (RM2) 'Mode2':'/opt/domoticz/plugins/BroadlinkRM2/conf'
2018-07-01 12:46:50.739 (RM2) 'Mode3':'RM2T'
2018-07-01 12:46:50.739 (RM2) 'Mode4':'no'
2018-07-01 12:46:50.739 (RM2) 'Mode5':'9000'
2018-07-01 12:46:50.739 (RM2) 'Mode6':'Debug'
2018-07-01 12:46:50.739 (RM2) 'DomoticzVersion':'4.9732'
2018-07-01 12:46:50.739 (RM2) 'DomoticzHash':'89825c8'
2018-07-01 12:46:50.739 (RM2) 'DomoticzBuildTime':'2018-06-30 03:42:37'
2018-07-01 12:46:50.739 (RM2) Device count: 3
2018-07-01 12:46:50.739 (RM2) Device: 1 - ID: 1, Name: 'RM2 - Command', nValue: 0, sValue: 'Off'
2018-07-01 12:46:50.739 (RM2) Device ID: '1'
2018-07-01 12:46:50.739 (RM2) Device Name: 'RM2 - Command'
2018-07-01 12:46:50.739 (RM2) Device nValue: 0
2018-07-01 12:46:50.739 (RM2) Device sValue: 'Off'
2018-07-01 12:46:50.739 (RM2) Device LastLevel: 0
2018-07-01 12:46:50.740 (RM2) Device: 2 - ID: 2, Name: 'RM2 - Temp', nValue: 0, sValue: ''
2018-07-01 12:46:50.740 (RM2) Device ID: '2'
2018-07-01 12:46:50.740 (RM2) Device Name: 'RM2 - Temp'
2018-07-01 12:46:50.740 (RM2) Device nValue: 0
2018-07-01 12:46:50.740 (RM2) Device sValue: ''
2018-07-01 12:46:50.740 (RM2) Device LastLevel: 0
2018-07-01 12:46:50.740 (RM2) Device: 254 - ID: 3, Name: 'RM2 - Remote', nValue: 0, sValue: ''
2018-07-01 12:46:50.740 (RM2) Device ID: '3'
2018-07-01 12:46:50.740 (RM2) Device Name: 'RM2 - Remote'
2018-07-01 12:46:50.740 (RM2) Device nValue: 0
2018-07-01 12:46:50.740 (RM2) Device sValue: ''
2018-07-01 12:46:50.740 (RM2) Device LastLevel: 0
2018-07-01 12:46:50.740 (RM2) Pushing 'PollIntervalDirective' on to queue
2018-07-01 12:46:50.740 (RM2) Connecting to: 192.168.1.102:34ea34c76***
2018-07-01 12:46:50.754 (RM2) No ini file :/opt/domoticz/plugins/BroadlinkRM2/conf/remote/plugin_remote_2.ini
2018-07-01 12:46:50.754 (RM2) Custom Commands for Remote not managed
2018-07-01 12:46:50.754 (RM2) Device Number begin to : 2
2018-07-01 12:46:50.754 (RM2) Processing 'PollIntervalDirective' message
2018-07-01 12:46:50.754 (RM2) Heartbeat interval set to: 30.
2018-07-01 12:46:50.106 Status: Python EventSystem: Initalizing event module.
2018-07-01 12:46:50.107 Status: EventSystem: Started
2018-07-01 12:46:50.107 Status: EventSystem: Queue thread started...
2018-07-01 12:46:50.356 Status: PluginSystem: Entering work loop.
2018-07-01 12:46:50.735 Status: (RM2) Initialized version 4.1.0, author 'zak45'
2018-07-01 12:46:50.735 Status: (RM2) Entering work loop.
2018-07-01 12:46:50.740 Error: (RM2) Error Connecting to Broadlink device....192.168.1.102
2018-07-01 12:47:00.238 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 12:47:00.275 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 12:47:00.275 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 12:47:30.244 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 12:47:30.286 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 12:47:30.286 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 12:48:00.251 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 12:48:00.296 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 12:48:00.296 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 12:48:00.297 Error: (RM2) Error Connecting to Broadlink device....192.168.1.102
will, i have learn some python, and write a test demo to locate the problem:

Code: Select all

import broadlink
# discover Broadlink device on the Network
def Discover():
    global brodevices

    print("All plugin system is on pause for 5s...")
    brodevices = broadlink.discover(timeout=5)
    print("Found " + str(len(brodevices )) + " broadlink devices")

    if str(len(brodevices )) == 0:
        return False

    txtdevice = ''

    for index, item in enumerate(brodevices):

        brodevices[index].auth()
        broip = brodevices[index].host
        broip = str(broip)
        print( "<b>Device " + str(index + 1) +" Host address = " + broip[1:19] + "</b>")
        txtdevice = txtdevice + "[Device " + str(index + 1) +" Host address = " + broip[1:19] + "]"
        macadd = ''.join(format(x, '02x') for x in brodevices[index].mac[::-1])
        macadd = str(macadd)
        brotype = str(brodevices[index].type)
        print( "<b>Device " + str(index + 1) +" MAC address = " + macadd + " Type: " + brotype + "</b>")
        print(brodevices[index].check_temperature())
    return True

Discover()
run in Centos 7 by "python3 test.py" and output is(* for sercert, you know)

Code: Select all

All plugin system is on pause for 5s...
Found 1 broadlink devices
<b>Device 1 Host address = '192.168.1.102', 8</b>
<b>Device 1 MAC address = 34ea34c76*** Type: RM2</b>
29.1
so, i am confuse...why Error connect in domoticz with plugins.
Oh, i set the plugins with the guide of your wiki...i have shutdown the iptables and selinux...
Please help me, thank you~ :( :( :(

Re: Python Plugin : Broadlink RM2 V4

Posted: Sunday 01 July 2018 11:59
by zak45
mistak1992 wrote: Sunday 01 July 2018 6:56 Hi zak45, i'm been trapped in "Error Connecting to Broadlink device...." for a long time, from domoticzV3.xxxx to V4.9732, pluging.py V3.0.0 to V4.1.0, i have try all the way. it's about 5 months ago, now, i need your help!(forgive my bad english...)
--------------------
now
Device:RM Pro Plus
OS:CentOS 7 x64
domoticz:V4.9732
Python:Python3.6.3
Pip list:
broadlink 0.6
pip 10.0.1
pyaes 1.6.0
PyCRC 1.21
pycrypto 2.6.1
setuptools 28.8.0

so, i am confuse...why Error connect in domoticz with plugins.
Oh, i set the plugins with the guide of your wiki...i have shutdown the iptables and selinux...
Please help me, thank you~ :( :( :(
your broadlink version is tool old: --> need to be 0.9
sudo pip3 uninstall broadlink
sudo pip3 install broadlink

remove pycrypto:
sudo pip3 uninstall pycrypto

Re: Python Plugin : Broadlink RM2 V4

Posted: Sunday 01 July 2018 13:16
by mistak1992
Thank you for your reply.
I have take the action for your advises:

Code: Select all

python3 -m pip uninstall broadlink
python3 -m pip install broadlink
python3 -m pip uninstall pycrypto
now the pip list is:
broadlink 0.9
pip 10.0.1
pyaes 1.6.0
PyCRC 1.21
setuptools 28.8.0
-------------------------------
but unforturnately,after restart, the problem still,
here is the log of domosticz(*for secret):

Code: Select all

2018-07-01 19:06:55.541 Sunrise: 05:42:00 SunSet: 19:14:00
2018-07-01 19:06:55.541 Day length: 13:32:00 Sun at south: 12:05:00
2018-07-01 19:06:55.541 Civil twilight start: 05:17:00 Civil twilight end: 19:39:00
2018-07-01 19:06:55.541 Nautical twilight start: 04:47:00 Nautical twilight end: 20:09:00
2018-07-01 19:06:55.542 Astronomical twilight start: 04:15:00 Astronomical twilight end: 20:40:00
2018-07-01 19:06:55.726 Active notification Subsystems: (0/13)
2018-07-01 19:06:55.751 Starting shared server on: :::6144
2018-07-01 19:06:55.479 Status: Domoticz V4.9732 (c)2012-2018 GizMoCuz
2018-07-01 19:06:55.479 Status: Build Hash: 89825c8, Date: 2018-06-30 03:42:37
2018-07-01 19:06:55.480 Status: Startup Path: /opt/domoticz/
2018-07-01 19:06:55.542 Status: EventSystem: reset all events...
2018-07-01 19:06:55.715 Status: PluginSystem: Started, Python version '3.6.3'.
2018-07-01 19:06:55.732 Status: WebServer(HTTP) started on address: :: with port 8800
2018-07-01 19:06:55.747 Status: WebServer(SSL) started on address: :: with port 443
2018-07-01 19:06:55.749 Status: Proxymanager started.
2018-07-01 19:06:55.752 Status: TCPServer: shared server started...
2018-07-01 19:06:55.752 Status: RxQueue: queue worker started...
2018-07-01 19:06:57.753 Status: (RM2) Started.
2018-07-01 19:06:57.753 Status: EventSystem: reset all events...
2018-07-01 19:06:57.754 Status: EventSystem: reset all device statuses...
2018-07-01 19:06:57.869 Status: Python EventSystem: Initalizing event module.
2018-07-01 19:06:57.870 Status: EventSystem: Started
2018-07-01 19:06:57.870 Status: EventSystem: Queue thread started...
2018-07-01 19:06:58.406 (RM2) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2018-07-01 19:06:58.406 (RM2) 'HardwareID':'2'
2018-07-01 19:06:58.406 (RM2) 'HomeFolder':'/opt/domoticz/plugins/BroadlinkRM2/'
2018-07-01 19:06:58.406 (RM2) 'Version':'4.1.0'
2018-07-01 19:06:58.406 (RM2) 'Author':'zak45'
2018-07-01 19:06:58.406 (RM2) 'Name':'RM2'
2018-07-01 19:06:58.406 (RM2) 'Address':'192.168.1.102'
2018-07-01 19:06:58.406 (RM2) 'Port':'0'
2018-07-01 19:06:58.406 (RM2) 'Key':'BroadlinkRM2'
2018-07-01 19:06:58.406 (RM2) 'Mode1':'34ea34c76d27'
2018-07-01 19:06:58.406 (RM2) 'Mode2':'/opt/domoticz/plugins/BroadlinkRM2/conf'
2018-07-01 19:06:58.406 (RM2) 'Mode3':'RM2T'
2018-07-01 19:06:58.406 (RM2) 'Mode4':'no'
2018-07-01 19:06:58.406 (RM2) 'Mode5':'9000'
2018-07-01 19:06:58.406 (RM2) 'Mode6':'Debug'
2018-07-01 19:06:58.406 (RM2) 'DomoticzVersion':'4.9732'
2018-07-01 19:06:58.406 (RM2) 'DomoticzHash':'89825c8'
2018-07-01 19:06:58.406 (RM2) 'DomoticzBuildTime':'2018-06-30 03:42:37'
2018-07-01 19:06:58.406 (RM2) Device count: 3
2018-07-01 19:06:58.407 (RM2) Device: 1 - ID: 1, Name: 'RM2 - Command', nValue: 0, sValue: 'Off'
2018-07-01 19:06:58.407 (RM2) Device ID: '1'
2018-07-01 19:06:58.407 (RM2) Device Name: 'RM2 - Command'
2018-07-01 19:06:58.407 (RM2) Device nValue: 0
2018-07-01 19:06:58.407 (RM2) Device sValue: 'Off'
2018-07-01 19:06:58.407 (RM2) Device LastLevel: 0
2018-07-01 19:06:58.407 (RM2) Device: 2 - ID: 2, Name: 'RM2 - Temp', nValue: 0, sValue: ''
2018-07-01 19:06:58.407 (RM2) Device ID: '2'
2018-07-01 19:06:58.407 (RM2) Device Name: 'RM2 - Temp'
2018-07-01 19:06:58.407 (RM2) Device nValue: 0
2018-07-01 19:06:58.407 (RM2) Device sValue: ''
2018-07-01 19:06:58.407 (RM2) Device LastLevel: 0
2018-07-01 19:06:58.407 (RM2) Device: 254 - ID: 3, Name: 'RM2 - Remote', nValue: 0, sValue: ''
2018-07-01 19:06:58.407 (RM2) Device ID: '3'
2018-07-01 19:06:58.407 (RM2) Device Name: 'RM2 - Remote'
2018-07-01 19:06:58.407 (RM2) Device nValue: 0
2018-07-01 19:06:58.407 (RM2) Device sValue: ''
2018-07-01 19:06:58.407 (RM2) Device LastLevel: 0
2018-07-01 19:06:58.407 (RM2) Pushing 'PollIntervalDirective' on to queue
2018-07-01 19:06:58.407 (RM2) Connecting to: 192.168.1.102:34ea34c76***
2018-07-01 19:06:58.418 (RM2) No ini file :/opt/domoticz/plugins/BroadlinkRM2/conf/remote/plugin_remote_2.ini
2018-07-01 19:06:58.418 (RM2) Custom Commands for Remote not managed
2018-07-01 19:06:58.418 (RM2) Device Number begin to : 2
2018-07-01 19:06:58.418 (RM2) Processing 'PollIntervalDirective' message
2018-07-01 19:06:58.418 (RM2) Heartbeat interval set to: 30.
2018-07-01 19:06:58.059 Status: PluginSystem: Entering work loop.
2018-07-01 19:06:58.402 Status: (RM2) Entering work loop.
2018-07-01 19:06:58.403 Status: (RM2) Initialized version 4.1.0, author 'zak45'
2018-07-01 19:06:58.407 Error: (RM2) Error Connecting to Broadlink device....192.168.1.102
2018-07-01 19:07:07.904 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 19:07:07.938 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 19:07:07.938 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 19:07:37.911 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 19:07:37.950 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 19:07:37.951 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 19:08:07.917 (RM2) Pushing 'onHeartbeatCallback' on to queue
2018-07-01 19:08:07.963 (RM2) Processing 'onHeartbeatCallback' message
2018-07-01 19:08:07.964 (RM2) Calling message handler 'onHeartbeat'.
2018-07-01 19:08:07.964 Error: (RM2) Error Connecting to Broadlink device....192.168.1.102
by the way, is there any way to get more log that i can figure out which part go wrong?
thank you~
------------------------update--------------------------
here are something different since i uninstall pycrypto, my test.py demo report Error
test.py

Code: Select all

import broadlink
# discover Broadlink device on the Network
def Discover():
    global brodevices

    print("All plugin system is on pause for 5s...")
    brodevices = broadlink.discover(timeout=5)
    print("Found " + str(len(brodevices )) + " broadlink devices")

    if str(len(brodevices )) == 0:
        return False

    txtdevice = ''

    for index, item in enumerate(brodevices):

        brodevices[index].auth()
        broip = brodevices[index].host
        broip = str(broip)
        print( "<b>Device " + str(index + 1) +" Host address = " + broip[1:19] + "</b>")
        txtdevice = txtdevice + "[Device " + str(index + 1) +" Host address = " + broip[1:19] + "]"
        macadd = ''.join(format(x, '02x') for x in brodevices[index].mac[::-1])
        macadd = str(macadd)
        brotype = str(brodevices[index].type)
        print( "<b>Device " + str(index + 1) +" MAC address = " + macadd + " Type: " + brotype + "</b>")
        print(brodevices[index].check_temperature())
    return True

Discover()
and the output

Code: Select all

All plugin system is on pause for 5s...
Found 1 broadlink devices
Traceback (most recent call last):
  File "test.py", line 22, in <module>
    Discover()
  File "test.py", line 17, in Discover
    brodevices[index].auth()
  File "/usr/local/python3.6.1/lib/python3.6/broadlink/__init__.py", line 203, in auth
    response = self.send_packet(0x65, payload)
  File "/usr/local/python3.6.1/lib/python3.6/broadlink/__init__.py", line 258, in send_packet
    payload = self.encrypt(payload)
  File "/usr/local/python3.6.1/lib/python3.6/broadlink/__init__.py", line 162, in encrypt_pyaes
    return "".join([aes.encrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)])
TypeError: sequence item 0: expected str instance, bytes found

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 02 July 2018 0:05
by eserero
zak45 wrote: Tuesday 26 June 2018 18:05
eserero wrote: Monday 25 June 2018 23:54 hi All, new here in the forums :oops:

I'v been running domoticz on windows for a while now, using the 0.5 plugin with 3 rm3 mini systems and it worked flawlessly.
last week domoticz updated to 4.9 - so of course I had to jump on the wagon and upgrade. most of the stuff worked, but the broadlink integration broke :-(. I decided to upgrade to 0.8 and now to 0.9 but nothing works. the plugin seems to be there, and seems to do all the right stuff, except that I"m getting a connection error in the log - and of course nothing works. I do have ping to the devices, and they are working fine from e-control for testing.

I'v been burning hours on this for a couple of days now, any help would very much be appreciated .

the error is

Code: Select all

Error: PROXY: Connect failed, reconnecting: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Sometime I"m getting other "Error: PROXY:Connect failed" errors as well (with different text after).
Working here with Win 10 / python 3.4.
Try to remove stop any firewall. Try also to create a discovery HW to see if it retreive all yours Broadlink devices.
thanks zak45, just want to update all that I found my problem(s).
the first issue was that I updated to pip10 - not sure why it break things, but after upgrading to PIP 10 I got a bunch of problems, including domotics hanging when I try to delete a broadlink hardeware. going back to pip 9 solve the issue.
the second issue was that for some reason after upgrading to domoticz 4.9 - it changes all of the urls I was using in my selector switches to something like:

Code: Select all

https%3A//10.0.0.2/json.htm%3Ftype%3Dcommand%26param%3Dswitchlight%26idx%3D92%26switchcmd%3DOn
I was using this for all my broadlink switches (I created a selector switch to change air conditioner status). once I fixed that, everything started working again!