Page 1 of 33
Python Plugin : Broadlink RM2 V4
Posted: Thursday 25 January 2018 17:47
by zak45
Hi,
the v4 uploaded.
EDIT 01/07/2020
************
CAUTION : no more maintained
New version released,
link for download :
https://www.dropbox.com/sh/ui5h2hyfzq0c ... 3gQWa?dl=0
link to new topic :
https://www.domoticz.com/forum/viewtopi ... 65&t=33223
***********
Changes:
# 4.0.0: Add eSensor / Smart plug / Multi plug devices
# --> big thanks to deennoo to have provided test devices :
http://domo-attitude.fr
# support for chinese char thanks to :
https://zhougy0717.github.io/2017/07/31 ... on%20Echo/
# Change the way to retreive module by using 'site', no more 'copy' should be necessary specially for linux systems
# Broadlink lib to v 0.6.0
# socket.setdefaulttimeout put on comment as plugin framework is on trouble on onheartbeat(): even with other plugins.
Lots of things have been changed and specially into the parameters but hope for existing users, you should be able to upgrade if wanted:
copy the new plugin.py
update broadlink if not already done :
sudo pip3 install broadlink --upgrade
do always a backup of your files in case of and before proceed ...
For new installation just follow wiki
wiki:
https://www.domoticz.com/wiki/Plugins/BroadlinkRM2.html
enjoy!
EDIT 14/04/2018:
Ver 4.1.0 uploaded.
to update, copy plugin.py plugin_send.py and update module Broadlink to 0.8
this correct mainly :
# 4.1.0: Broadlink lib to v 0.8.0
# add check/set nightlight on device which manage it (SP3)
# correct utf-8 char handle in ini file creation
the Broadlink 0.8 provided in pip do not manage in right way the check_power/nightlight (SP2/SP3 devices)
if you need it use the one provided in dropbox:
download python-broadlink-0.8.zip / unzip it / go to folder with setup.py/ execute pip3 install .
#
#
EDIT 19/02/2019
V 4.2.0 uploaded
Correct problem on checktemp
to update, just replace plugin.py
#
#
Re: Python Plugin : Broadlink RM2 V4
Posted: Thursday 25 January 2018 18:52
by febalci
Good work, thanks... Does that mean SP mini will also work?
Re: Python Plugin : Broadlink RM2 V4
Posted: Thursday 25 January 2018 19:06
by zak45
Hi, thanks... should be, just use Smartplug 2/3 as device type. let us know.
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 16:18
by Velly
Hi, Zak
I get multiple LOG errors like:
2018-01-27 18:15:28.121 Error: (Broadlink MP1 A3) Error getting temperature data from Broadlink device....Timeout
2018-01-27 18:15:28.347 Error: (Broadlink MP1 - 70) Error getting temperature data from Broadlink device....Timeout
both are MP1 power distributors
How can I fix that?
Thanks!
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 16:52
by zak45
Velly wrote: ↑Saturday 27 January 2018 16:18
Hi, Zak
I get multiple LOG errors like:
2018-01-27 18:15:28.121 Error: (Broadlink MP1 A3) Error getting temperature data from Broadlink device....Timeout
2018-01-27 18:15:28.347 Error: (Broadlink MP1 - 70) Error getting temperature data from Broadlink device....Timeout
both are MP1 power distributors
How can I fix that?
Thanks!
Do not have been able to test the MP1... try with this plugin.py
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 17:03
by Velly
after last one plugin:
2018-01-27 19:01:08.395 Error: (Broadlink MP1 A3) check power error
2018-01-27 19:01:08.409 Error: (Broadlink MP1 - 70) check power error
no "TEMP" error anymore
but STATUS is always OFF
however all plugs are controlled well.
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 17:47
by zak45
Velly wrote: ↑Saturday 27 January 2018 17:03
after last one plugin:
2018-01-27 19:01:08.395 Error: (Broadlink MP1 A3) check power error
2018-01-27 19:01:08.409 Error: (Broadlink MP1 - 70) check power error
no "TEMP" error anymore
but STATUS is always OFF
however all plugs are controlled well.
Fine ,
check power error should be seen only once. (hope so ...)
lets try this plugin.py
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 18:01
by Velly
yes, only once
then in 30-50sec Status is to ON
Everything looks Ok except I needed to manually restart Domoticz service, - it went to Offline after reboot with new plugin.
Maybe it is my SD or Python files corrupted (??)
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 18:05
by Velly
Zak, another question if possible:
when I make IR command for example for my Panasonic TV -
before (V3) I could choose TV Icon
now (V4) only default Round On/OFF is present
Can I make logical switch On/OFF for Broadlink IR ini with TV pic ?
Thanks!
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 18:29
by zak45
Velly wrote: ↑Saturday 27 January 2018 18:05
Zak, another question if possible:
when I make IR command for example for my Panasonic TV -
before (V3) I could choose TV Icon
now (V4) only default Round On/OFF is present
Can I make logical switch On/OFF for Broadlink IR ini with TV pic ?
Thanks!
should work in this way :

- Capture.JPG (35.97 KiB) Viewed 18385 times
Re: Python Plugin : Broadlink RM2 V4
Posted: Saturday 27 January 2018 18:36
by Velly
GREAT !!!
I could never guess about off delay...
Thank you man!
Re: Python Plugin : Broadlink RM2 V4
Posted: Sunday 28 January 2018 14:47
by Hesmink
Hello,
I installed this plugin for my Smartsocket with power indicator, but I cannot get the power information:
2018-01-28 14:44:32.736 (Broadlink Smart Outlet) Calling message handler 'onHeartbeat'.
2018-01-28 14:44:32.737 (Broadlink Smart Outlet) SP3S called
2018-01-28 14:44:32.848 Error: (Broadlink Smart Outlet) Get Energy error
2018-01-28 14:44:32.885 (Broadlink Smart Outlet) Power state : True
2018-01-28 14:44:32.886 (Broadlink Smart Outlet - SP3S) Updating device from 0:'Off' to have values 1:'On'.
2018-01-28 14:44:32.894 (Broadlink Smart Outlet) Update 1:'On' (Broadlink Smart Outlet - SP3S)
What can be wrong here?
Re: Python Plugin : Broadlink RM2 V4
Posted: Sunday 28 January 2018 16:14
by Hesmink
Hesmink wrote: ↑Sunday 28 January 2018 14:47
Hello,
I installed this plugin for my Smartsocket with power indicator, but I cannot get the power information:
2018-01-28 14:44:32.736 (Broadlink Smart Outlet) Calling message handler 'onHeartbeat'.
2018-01-28 14:44:32.737 (Broadlink Smart Outlet) SP3S called
2018-01-28 14:44:32.848 Error: (Broadlink Smart Outlet) Get Energy error
2018-01-28 14:44:32.885 (Broadlink Smart Outlet) Power state : True
2018-01-28 14:44:32.886 (Broadlink Smart Outlet - SP3S) Updating device from 0:'Off' to have values 1:'On'.
2018-01-28 14:44:32.894 (Broadlink Smart Outlet) Update 1:'On' (Broadlink Smart Outlet - SP3S)
What can be wrong here?
Found the issue to be an incompatibility of python3 with ord, as described here:
https://github.com/mjg59/python-broadlink/issues/140
Re: Python Plugin : Broadlink RM2 V4
Posted: Sunday 28 January 2018 17:41
by zak45
Yep.. you can found the corrected version in dropBox : python-broadlink-master-0.6.zip
waiting official release
Re: Python Plugin : Broadlink RM2 V4
Posted: Sunday 28 January 2018 19:43
by Hesmink
Another question, why use 2 status blocks for power and usage?
I'd prefer it to be one, like:

- Preferred.jpg (12.19 KiB) Viewed 18310 times
Now it looks like:

- Current.jpg (21 KiB) Viewed 18310 times
Re: Python Plugin : Broadlink RM2 V4
Posted: Sunday 28 January 2018 19:44
by Hesmink
zak45 wrote: ↑Sunday 28 January 2018 17:41
Yep.. you can found the corrected version in dropBox : python-broadlink-master-0.6.zip
waiting official release
Ah! I managed to miss that one. Thanks.
Re: Python Plugin : Broadlink RM2 V4
Posted: Monday 29 January 2018 16:01
by titoz
Hi to all
i'm a newbie and i have a problems with the broadlink multisensor A1 Device.
I follow the wiki (First time users) and i have created a new Hardware called "My br - Discover", when i go to the switches tab and i try to swith to on i get this errors.
2018-01-29 15:47:12.676 (My br- Discover) Found 4 broadlink devices
2018-01-29 15:47:12.679 Error: (My br- Discover) 'onCommand' failed 'TypeError':'object of type 'NoneType' has no len()'.
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 278 in /usr/local/domoticz/var/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 578 in /usr/local/domoticz/var/plugins/BroadlinkRM2/plugin.py, function Discover
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 203 in /usr/local/domoticz/var/plugins/BroadlinkRM2/broadlink/__init__.py, function auth
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 263 in /usr/local/domoticz/var/plugins/BroadlinkRM2/broadlink/__init__.py, function send_packet
Anyone can help me in someway?
Thanks
titoz
Re: Python Plugin : Broadlink RM2 V4
Posted: Monday 29 January 2018 17:37
by zak45
titoz wrote: ↑Monday 29 January 2018 16:01
2018-01-29 15:47:12.676 (My br- Discover) Found 4 broadlink devices
2018-01-29 15:47:12.679 Error: (My br- Discover) 'onCommand' failed 'TypeError':'object of type 'NoneType' has no len()'.
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 278 in /usr/local/domoticz/var/plugins/BroadlinkRM2/plugin.py, function onCommand
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 578 in /usr/local/domoticz/var/plugins/BroadlinkRM2/plugin.py, function Discover
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 203 in /usr/local/domoticz/var/plugins/BroadlinkRM2/broadlink/__init__.py, function auth
2018-01-29 15:47:12.679 Error: (My br- Discover) ----> Line 263 in /usr/local/domoticz/var/plugins/BroadlinkRM2/broadlink/__init__.py, function
can you post the full Domoticz Log, just after restarted the plugin ?
something like that :
- Spoiler: show
-
2018-01-29 17:32:08.429 (zz) Started.
2018-01-29 17:32:08.569 (zz) Initialized version 4.0.0, author 'zak45'
2018-01-29 17:32:08.569 (zz) Entering work loop.
2018-01-29 17:32:08.585 (zz) Debug log level set to: 'true'.
2018-01-29 17:32:08.585 (zz) Creating device 'Discovery'.
2018-01-29 17:32:08.601 (zz) Creating device 'Discovery Info'.
2018-01-29 17:32:08.616 (zz) 'Mode2':'C:/BroadlinkRM2'
2018-01-29 17:32:08.616 (zz) 'DomoticzVersion':'3.8872'
2018-01-29 17:32:08.616 (zz) 'Mode4':'no'
2018-01-29 17:32:08.616 (zz) 'Mode1':'000000000000'
2018-01-29 17:32:08.616 (zz) 'Mode5':'9000'
2018-01-29 17:32:08.616 (zz) 'Mode6':'Debug'
2018-01-29 17:32:08.616 (zz) 'Version':'4.0.0'
2018-01-29 17:32:08.616 (zz) 'Address':'127.0.0.1'
2018-01-29 17:32:08.616 (zz) 'Mode3':'DIS'
2018-01-29 17:32:08.616 (zz) 'HardwareID':'25'
2018-01-29 17:32:08.616 (zz) 'Name':'zz'
2018-01-29 17:32:08.616 (zz) 'Key':'BroadlinkRM2'
2018-01-29 17:32:08.616 (zz) 'Author':'zak45'
2018-01-29 17:32:08.616 (zz) 'DomoticzBuildTime':'2018-01-29 16:59:49'
2018-01-29 17:32:08.616 (zz) 'DomoticzHash':'fc97f529'
2018-01-29 17:32:08.616 (zz) 'Port':'0'
2018-01-29 17:32:08.616 (zz) 'HomeFolder':'C:\Program Files (x86)\Domoticz\plugins\BroadlinkRM2\'
2018-01-29 17:32:08.616 (zz) Device count: 2
2018-01-29 17:32:08.616 (zz) Device: 1 - ID: 987, Name: 'zz - Discovery', nValue: 0, sValue: ''
2018-01-29 17:32:08.616 (zz) Device ID: '987'
2018-01-29 17:32:08.616 (zz) Device Name: 'zz - Discovery'
2018-01-29 17:32:08.616 (zz) Device nValue: 0
2018-01-29 17:32:08.616 (zz) Device sValue: ''
2018-01-29 17:32:08.616 (zz) Device LastLevel: 0
2018-01-29 17:32:08.616 (zz) Device: 2 - ID: 988, Name: 'zz - Discovery Info', nValue: 0, sValue: ''
2018-01-29 17:32:08.616 (zz) Device ID: '988'
2018-01-29 17:32:08.616 (zz) Device Name: 'zz - Discovery Info'
2018-01-29 17:32:08.616 (zz) Device nValue: 0
2018-01-29 17:32:08.616 (zz) Device sValue: ''
2018-01-29 17:32:08.616 (zz) Device LastLevel: 0
2018-01-29 17:32:08.616 (zz) Connecting to: 127.0.0.1:000000000000
2018-01-29 17:32:08.616 (zz) Device Number begin to : 1
2018-01-29 17:32:08.616 (zz) Heartbeat interval set to: 30.
2018-01-29 17:32:10.835 (RFX433E) Energy (Compteur EDF)
2018-01-29 17:32:15.663 (RFX433E) Temp + Humidity (433-TempSDBE)
2018-01-29 17:32:18.070 OpenZWave: Received timeout notification from HomeID: 3985658065, NodeID: 3 (0x03)
2018-01-29 17:32:18.179 (zz) Calling message handler 'onHeartbeat'.
2018-01-29 17:32:20.679 User: Admin initiated a switch command (987/zz - Discovery/On)
2018-01-29 17:32:20.742 (zz) Calling message handler 'onCommand'.
2018-01-29 17:32:20.742 (zz) onCommand called for Unit 1: Parameter 'On', Level: 0 , Connected : False
2018-01-29 17:32:20.742 (zz) All plugin system is on pause for 5s...
2018-01-29 17:32:25.742 (zz) Found 4 broadlink devices
2018-01-29 17:32:25.773 (zz) Device 1 Host address = '192.168.1.21', 80
2018-01-29 17:32:25.773 (zz) Device 1 MAC address = 3xxxxx4b2axxx Type: A1
2018-01-29 17:32:25.820 (zz) Device 2 Host address = '192.168.1.13', 80
2018-01-29 17:32:25.820 (zz) Device 2 MAC address = bxxxxxda2xxx Type: RM2
2018-01-29 17:32:25.836 (zz) Device 3 Host address = '192.168.1.32', 80
2018-01-29 17:32:25.836 (zz) Device 3 MAC address = 3xxxxx91xxxxx Type: SP2
2018-01-29 17:32:25.851 (zz) Device 4 Host address = '192.168.1.29', 80
2018-01-29 17:32:25.851 (zz) Device 4 MAC address = 34ea3xxxxxxxx Type: SP2
2018-01-29 17:32:25.851 (zz - Discovery Info) Updating device from 0:'' to have values 1:'[Device 1 Host address = '192.168.1.21', 80][Device 1 MAC address = 3xxxxxx0e Type: A1][Device 2 Host address = '192.168.1.13', 80][Device 2 MAC address = bxxxxxxx Type: RM2][Device 3 Host a...'.
2018-01-29 17:32:25.883 (zz) Update 1:'[Device 1 Host address = '192.168.1.21', 80][Device 1 MAC address = 3xxxxxxx Type: A1][Device 2 Host address = '192.168.1.13', 80][Device 2 MAC address = b4xxxxxxx Type: RM2][Device 3 Host a...' (zz - Discovery Info)
2018-01-29 17:32:25.883 (zz - Discovery) Updating device from 0:'' to have values 1:'Found : 4 device(s)'.
2018-01-29 17:32:25.914 (zz) Update 1:'Found : 4 device(s)' (zz - Discovery)
Re: Python Plugin : Broadlink RM2 V4
Posted: Monday 29 January 2018 17:57
by febalci
I tried SP mini with SP2/3, unfortunately it gives:
and
Code: Select all
Error: (test) Error Connecting to Broadlink device....192.168.1.117
Just for the info, for a new installation it gives 'pyaes' is missing. You also have to pip3 install pyaes. Or just put broadlink and pyaes master directories to broadlink plugin folder, so that you do not need to pip3 install anything...
Re: Python Plugin : Broadlink RM2 V4
Posted: Tuesday 30 January 2018 15:42
by titoz
Hi Zak45
This is the full Domoticz log, after the restart
2018-01-30 15:16:55.189 Domoticz V3.8153 (c)2012-2017 GizMoCuz
2018-01-30 15:16:55.189 Build Hash: 494fff7-modified, Date: 2017-07-30 12:19:41
2018-01-30 15:16:55.190 Startup Path: /usr/local/domoticz/
2018-01-30 15:16:55.277 Sunrise: 07:39:00 SunSet:17:15:00
2018-01-30 15:16:55.277 EventSystem: reset all events...
2018-01-30 15:16:55.461 PluginSystem: Started, Python version '3.5.1'.
2018-01-30 15:16:55.471 Active notification Subsystems: pushover (1/12)
2018-01-30 15:16:55.484 WebServer(HTTP) started on address: :: with port 8084
2018-01-30 15:16:55.512 WebServer(SSL) started on address: :: with port 8443
2018-01-30 15:16:55.514 Proxymanager started.
2018-01-30 15:16:55.515 Starting shared server on: :::6150
2018-01-30 15:16:55.516 RxQueue: queue worker started...
2018-01-30 15:16:55.516 TCPServer: shared server started...
2018-01-30 15:16:55.590 Incoming connection from: 217.xx.xx.xx
2018-01-30 15:16:57.517 EventSystem: reset all events...
2018-01-30 15:16:57.518 EventSystem: reset all device statuses...
2018-01-30 15:16:57.518 Netatmo: Worker started...
2018-01-30 15:16:57.518 Logitech Media Server: Worker started...
2018-01-30 15:16:57.554 Logitech Media Server: 2 player-switch(es) found.
2018-01-30 15:16:57.757 Python EventSystem: Module not found - Trying to initialize.
2018-01-30 15:16:57.757 Python EventSystem: Initalizing event module.
2018-01-30 15:16:57.758 EventSystem: Started
2018-01-30 15:16:57.859 PluginSystem: Entering work loop.
2018-01-30 15:16:58.224 Logitech Media Server: 279 playlist(s) found.
2018-01-30 15:16:58.520 RFXCOM: Using serial port: /dev/ttyUSB0
2018-01-30 15:16:58.775 (My br- Discover) Initialized version 4.0.0, author 'zak45'
2018-01-30 15:16:58.836 (My br- Discover) Debug log level set to: 'true'.
2018-01-30 15:16:58.836 (My br- Discover) 'Mode2':'C:/BroadlinkRM2'
2018-01-30 15:16:58.836 (My br- Discover) 'HomeFolder':'/usr/local/domoticz/var/plugins/BroadlinkRM2/'
2018-01-30 15:16:58.836 (My br- Discover) 'Mode3':'DIS'
2018-01-30 15:16:58.836 (My br- Discover) 'Mode1':'000000000000'
2018-01-30 15:16:58.836 (My br- Discover) 'Author':'zak45'
2018-01-30 15:16:58.836 (My br- Discover) 'Name':'My br- Discover'
2018-01-30 15:16:58.836 (My br- Discover) 'Port':'0'
2018-01-30 15:16:58.836 (My br- Discover) 'HardwareID':'17'
2018-01-30 15:16:58.836 (My br- Discover) 'Version':'4.0.0'
2018-01-30 15:16:58.837 (My br- Discover) 'Mode6':'Debug'
2018-01-30 15:16:58.837 (My br- Discover) 'Mode4':'no'
2018-01-30 15:16:58.837 (My br- Discover) 'Mode5':'9000'
2018-01-30 15:16:58.837 (My br- Discover) 'Key':'BroadlinkRM2'
2018-01-30 15:16:58.837 (My br- Discover) 'Address':'127.0.0.1'
2018-01-30 15:16:58.837 (My br- Discover) Device count: 2
2018-01-30 15:16:58.837 (My br- Discover) Device: 1 - ID: 79, Name: 'My br- Discover - Discovery', nValue: 0, sValue: ''
2018-01-30 15:16:58.837 (My br- Discover) Device ID: '79'
2018-01-30 15:16:58.837 (My br- Discover) Device Name: 'My br- Discover - Discovery'
2018-01-30 15:16:58.837 (My br- Discover) Device nValue: 0
2018-01-30 15:16:58.837 (My br- Discover) Device sValue: ''
2018-01-30 15:16:58.838 (My br- Discover) Device LastLevel: 0
2018-01-30 15:16:58.838 (My br- Discover) Device: 2 - ID: 80, Name: 'My br- Discover - Discovery Info', nValue: 0, sValue: ''
2018-01-30 15:16:58.838 (My br- Discover) Device ID: '80'
2018-01-30 15:16:58.838 (My br- Discover) Device Name: 'My br- Discover - Discovery Info'
2018-01-30 15:16:58.838 (My br- Discover) Device nValue: 0
2018-01-30 15:16:58.838 (My br- Discover) Device sValue: ''
2018-01-30 15:16:58.838 (My br- Discover) Device LastLevel: 0
2018-01-30 15:16:58.838 (My br- Discover) Connecting to: 127.0.0.1:000000000000
2018-01-30 15:16:58.838 (My br- Discover) Device Number begin to : 1
2018-01-30 15:16:58.838 (My br- Discover) Heartbeat interval set to: 30.
2018-01-30 15:16:59.095
2018-01-30 15:16:59.173 subtype = Interface Response