Python Plugin : Broadlink RM2 V4
Moderator: leecollings
-
- Posts: 17
- Joined: Wednesday 22 March 2017 9:31
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Oh, ii see a video and he talk from IR an RF learning.
ok RF is importend for my, i have to wait.
but i installed today 0.10 but with 0.14 i get error no device with this Mac adress
i install 0.10 an learning works.
what did i wrong. i will use the newest version.
Thank you
ok RF is importend for my, i have to wait.
but i installed today 0.10 but with 0.14 i get error no device with this Mac adress
i install 0.10 an learning works.
what did i wrong. i will use the newest version.
Thank you
-
- Posts: 28
- Joined: Monday 05 March 2018 3:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
This domoticz plugin is based on the broadlink 0.8 api.
0.14 doesnt work, 0.10 does work yeah.
you can install and uninstall different versions with these commands
This uninstalls the version that is installed on your setup.
installs the newest version, (0.14 for now) but this version doesn't work.
installs 0.8, this version works and the plugin is based on 0.8
installs 0.10, this version works also, but the plugin isn't based on this version.
Also what is important, the broadlink api can use different encryption software, when installing the broadlink api it also installs pycryptodome and crypto. But for me i found out that pyaes encrytion works great, but, and this is important: you can't use them together!
So, after installing the broadlink api, you can uninstall pycryptodome and crypto with this command
After this, you can install pyaes with this command
Do note that this only works if you have libglib2.0 installed, you can install it with this command
Also you need to change the rights for the 4 files you copy to the plugin/BroadlinkRM2 folder.
You can do that with these commands, commands only work when you are in the working folder, cd etc....
Or you can change the rights within WinSCP.
0.14 doesnt work, 0.10 does work yeah.
you can install and uninstall different versions with these commands
Code: Select all
sudo pip3 uninstall broadlink
Code: Select all
sudo pip3 install broadlink
Code: Select all
sudo pip3 install broadlink==0.8
Code: Select all
sudo pip3 install broadlink==0.10
Also what is important, the broadlink api can use different encryption software, when installing the broadlink api it also installs pycryptodome and crypto. But for me i found out that pyaes encrytion works great, but, and this is important: you can't use them together!
So, after installing the broadlink api, you can uninstall pycryptodome and crypto with this command
Code: Select all
sudo pip3 uninstall pycryptodome
After this, you can install pyaes with this command
Code: Select all
sudo pip3 install pyaes
Do note that this only works if you have libglib2.0 installed, you can install it with this command
Code: Select all
sudo apt-get install python3-pip libglib2.0-dev
Also you need to change the rights for the 4 files you copy to the plugin/BroadlinkRM2 folder.
You can do that with these commands, commands only work when you are in the working folder, cd etc....
Code: Select all
sudo chmod +x plugin.py
sudo chmod +x plugin_send.py
sudo chmod +x plugin_http.py
sudo chmod +x plugin_http.sh
-
- Posts: 1
- Joined: Friday 29 May 2020 13:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Hello everybody,
I know that isn't new thread but I have the same problem.
I know that isn't new thread but I have the same problem.
@wonder How did You do that?wonder wrote: ↑Tuesday 26 March 2019 15:32 Hello amazing forum.
This is my first post here and I would like to get assistance with Broadlink SP3S configuration.
I've followed this guide (https://www.domoticz.com/wiki/Plugins/BroadlinkRM2.html) in order to install the plugin.
I would say everything works fine except of the one thing.
I can't figure out how to configure the meter in order to calculate energy usage per day/week/month...
Current energy consumption is being displayed correctly, the issue is only with total values.
When I go to the utility tab I see only values, taken from the IDX 25(current consumption).Code: Select all
IDX Hardware ID Unit Name Type Subtype Data --------------------------------------------------------------------------------------------------------- 25 BR 000A0002 2 BR - SP3S CURRENT Usage Electric 909.36 Watt 26 BR 000A0003 3 BR - SP3 USAGE General kWh 0, 909.36
Configuration of the device IDX 26 is:
Energy read: From device
Type - Usage.
In this case it doesn't show anything, so the graphs are just empty.
If I put Type - Usage, Energy read - Computed, the plugin crashes.
After certain manipulations with server restart/disabling the hardware and devices I could force this meter to calculate computed daily consumption without crashes.
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Work on progress for the RF and RM4 ... now depend of my free time !!!
-
- Posts: 6
- Joined: Thursday 15 September 2016 21:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Hi
I installed a new broadlink rm3 mini. Using the broadlink plugin version 0.10 I see the connected message in the domoticz log:
2020-06-12 14:05:54.232 (broadlink slaapkamer) Connecting to: XXX.XXX.XX.XX:XXXXXXXXXXXX
2020-06-12 14:05:54.351 (broadlink slaapkamer) Connected to Broadlink device: XXX.XXX.XX.XX
2020-06-12 14:05:54.374 (broadlink slaapkamer) No ini file :/home/pi/BroadlinkRM2/remote/plugin_remote_11.ini
2020-06-12 14:05:54.374 (broadlink slaapkamer) Custom Commands for Remote not managed
2020-06-12 14:05:54.374 (broadlink slaapkamer) Device Number begin to : 1
2020-06-12 14:05:54.374 (broadlink slaapkamer) Processing 'PollIntervalDirective' message
2020-06-12 14:05:54.479 (broadlink slaapkamer) Heartbeat interval set to: 30.
So that looks correct now (first had issue with the broadlink 0.14 version)
But If I want to start learning I see this in the log:
(broadlink slaapkamer) Pushing 'onCommandCallback' on to queue
2020-06-12 14:08:41.813 (broadlink slaapkamer) Processing 'onCommandCallback' message
2020-06-12 14:08:41.815 (broadlink slaapkamer) Calling message handler 'onCommand'.
2020-06-12 14:08:41.815 (broadlink slaapkamer) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : True
2020-06-12 14:08:41.816 (broadlink slaapkamer) All plugin system is on pause for 5s...
2020-06-12 14:08:41.816 (broadlink slaapkamer) When Broadlink led is lit press the button on your remote within 5 seconds
2020-06-12 14:08:41.792 Status: User: Admin initiated a switch command (311/broadlink slaapkamer - Command/Set Level)
2020-06-12 14:08:46.845 (broadlink slaapkamer) None
2020-06-12 14:08:46.845 (broadlink slaapkamer) Command not received
But unfortunately the rm mini does nothing and can't learn.
Can anybody help?
Alex
I installed a new broadlink rm3 mini. Using the broadlink plugin version 0.10 I see the connected message in the domoticz log:
2020-06-12 14:05:54.232 (broadlink slaapkamer) Connecting to: XXX.XXX.XX.XX:XXXXXXXXXXXX
2020-06-12 14:05:54.351 (broadlink slaapkamer) Connected to Broadlink device: XXX.XXX.XX.XX
2020-06-12 14:05:54.374 (broadlink slaapkamer) No ini file :/home/pi/BroadlinkRM2/remote/plugin_remote_11.ini
2020-06-12 14:05:54.374 (broadlink slaapkamer) Custom Commands for Remote not managed
2020-06-12 14:05:54.374 (broadlink slaapkamer) Device Number begin to : 1
2020-06-12 14:05:54.374 (broadlink slaapkamer) Processing 'PollIntervalDirective' message
2020-06-12 14:05:54.479 (broadlink slaapkamer) Heartbeat interval set to: 30.
So that looks correct now (first had issue with the broadlink 0.14 version)
But If I want to start learning I see this in the log:
(broadlink slaapkamer) Pushing 'onCommandCallback' on to queue
2020-06-12 14:08:41.813 (broadlink slaapkamer) Processing 'onCommandCallback' message
2020-06-12 14:08:41.815 (broadlink slaapkamer) Calling message handler 'onCommand'.
2020-06-12 14:08:41.815 (broadlink slaapkamer) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : True
2020-06-12 14:08:41.816 (broadlink slaapkamer) All plugin system is on pause for 5s...
2020-06-12 14:08:41.816 (broadlink slaapkamer) When Broadlink led is lit press the button on your remote within 5 seconds
2020-06-12 14:08:41.792 Status: User: Admin initiated a switch command (311/broadlink slaapkamer - Command/Set Level)
2020-06-12 14:08:46.845 (broadlink slaapkamer) None
2020-06-12 14:08:46.845 (broadlink slaapkamer) Command not received
But unfortunately the rm mini does nothing and can't learn.
Can anybody help?
Alex
-
- Posts: 59
- Joined: Sunday 28 July 2019 22:59
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Hi AlexW,
I'm not sure where the error lies, but the log looks okay to me. Compare it to mine:
Maybe just to verify your connection: in the swithes tab, is your 'Broadlink - Command' set to 'Learn'? And is it on (ie: is the play button grayed out or colored?)?
I'm not sure where the error lies, but the log looks okay to me. Compare it to mine:
Code: Select all
2020-06-14 21:01:59.196 (Broadlink1) Processing 'onCommandCallback' message
2020-06-14 21:01:59.196 (Broadlink1) Calling message handler 'onCommand'.
2020-06-14 21:01:59.196 (Broadlink1) onCommand called for Unit 1: Parameter 'Set Level', Level: 10 , Connected : True
2020-06-14 21:01:59.196 (Broadlink1) All plugin system is on pause for 5s...
2020-06-14 21:01:59.197 (Broadlink1) When Broadlink led is lit press the button on your remote within 5 seconds
2020-06-14 21:01:59.156 Status: User: Admin initiated a switch command (100/Broadlink1 - Command/Set Level)
2020-06-14 21:02:05.437 (Broadlink1) b"&\x00\x18\x01O\x14\x13\x14\x14\x14&\x15\x13\x14'\x14\x13\x15\x13\x14'\x14\x13\x15\x13\x14\x13\x14\x14\x00\x03dN\x15\x13\x14\x14\x14'\x14\x12\x15'\x14\x13\x15\x13\x14&\x15\x13\x14\x13\x15\x13\x14\x13\x00\x03dN\x15\x13\x14\x13\x15&\ (and lots of more weird numbers)"
2020-06-14 21:02:05.445 (Broadlink1) 260018014f1413141414261513142714131513142714131513141314140003644e1513141414271412152714131513142615131413151314130 (and lots of more weird numbers)
2020-06-14 21:02:05.445 (Broadlink1) Code stored in memory
2020-06-14 21:02:05.445 (Broadlink1 - Command) Updating device from 1:'10' to have values 1:'20'.
2020-06-14 21:02:05.498 (Broadlink1) Update 1:'20' (Broadlink1 - Command)
2020-06-14 21:02:12.325 (Broadlink1) Pushing 'onCommandCallback' on to queue
2020-06-14 21:02:12.366 (Broadlink1) Processing 'onCommandCallback' message
-
- Posts: 6
- Joined: Thursday 15 September 2016 21:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Thanks Jaaap for your help,
But I managed to fix it (temporarily).
What is the problem. My broadlink RM3 mini is a new one. It's having firmware v44057. I found out the device.enter_learning method from the broadlink plugin in broadlink v0.10 is not working correctly with my device (probably due to new firmware).
I switched to the new broadlink v0.14 plugin and of course there is no connection anymore as stated in comments above. But when I tried to create a small test python script:
I recognized that my rm mini was in learning mode. So learning mode is working with version 0.14, but set up a connection in domoticz is only working with version 0.10
The issue is with plugin.py script within the method: broadlinkConnect(line 727). It's the line:
device = broadlink.rm(host=..... within the first if because Mode3 = RM2 in the case of a RM mini3.
If you look into the code of the broadlink 0.14 plugin you can see the call of class rm is now with *args and **kwargs instead of host, mac and devtype. Class devices is still host, mac and devtype. So I think the only change should be the call in that line. But unfortunately Python is not my main language (it's java) so I didn't manage to solve that one.
But I have a workaround if you use only one RM mini3 in your network:
change the mentioned line (line 727) by the following two lines:
Now the plugin will search for broadlink devices and it will connect to the first one that is found.
I hope the developer of the plugin (@zak45) can solve it correctly so above workaround is not necessary anymore.
So in short the issue: With broadlink v0.10 my rm mini 3 with firmware v 44057 can connect in domoticz BUT learning is not possible.
The workaround:
* Upgrade broadlink 0.10 to 0.14 (sudo pip3 uninstall broadlink and then: subo pip3 install broadlink==0.14)
* Change the plugin.py on line 727:
should be two new lines:
* restart domotics (sudo service domoticz.sh restart)
I hope this will help others to solve there issue.
Alex
But I managed to fix it (temporarily).
What is the problem. My broadlink RM3 mini is a new one. It's having firmware v44057. I found out the device.enter_learning method from the broadlink plugin in broadlink v0.10 is not working correctly with my device (probably due to new firmware).
I switched to the new broadlink v0.14 plugin and of course there is no connection anymore as stated in comments above. But when I tried to create a small test python script:
Code: Select all
import broadlink
import time
devices = broadlink.discover(timeout=5)
devices[0].auth()
devices[0].enter_learning()
The issue is with plugin.py script within the method: broadlinkConnect(line 727). It's the line:
device = broadlink.rm(host=..... within the first if because Mode3 = RM2 in the case of a RM mini3.
If you look into the code of the broadlink 0.14 plugin you can see the call of class rm is now with *args and **kwargs instead of host, mac and devtype. Class devices is still host, mac and devtype. So I think the only change should be the call in that line. But unfortunately Python is not my main language (it's java) so I didn't manage to solve that one.
But I have a workaround if you use only one RM mini3 in your network:
change the mentioned line (line 727) by the following two lines:
Code: Select all
devices = broadlink.discover(timeout=5)
device = devices[0]
I hope the developer of the plugin (@zak45) can solve it correctly so above workaround is not necessary anymore.
So in short the issue: With broadlink v0.10 my rm mini 3 with firmware v 44057 can connect in domoticz BUT learning is not possible.
The workaround:
* Upgrade broadlink 0.10 to 0.14 (sudo pip3 uninstall broadlink and then: subo pip3 install broadlink==0.14)
* Change the plugin.py on line 727:
Code: Select all
device = broadlink.rm(host=(Parameters["Address"],80), mac=bytearray.fromhex(Parameters["Mode1"]), devtype = Parameters["Mode3"]
Code: Select all
devices = broadlink.discover(timeout=5)
device = devices[0]
I hope this will help others to solve there issue.
Alex
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Thanks Alex,
problem is that devtype is no more string in new release:
device = broadlink.rm(host=(Parameters["Address"],80), mac=bytearray.fromhex(Parameters["Mode1"]), devtype = Parameters["Mode3"]
This will be corrected by the new version ... just need some times to finalize it !
problem is that devtype is no more string in new release:
device = broadlink.rm(host=(Parameters["Address"],80), mac=bytearray.fromhex(Parameters["Mode1"]), devtype = Parameters["Mode3"]
This will be corrected by the new version ... just need some times to finalize it !
-
- Posts: 6
- Joined: Thursday 15 September 2016 21:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Thanks zak45 for your answer and explanation. I can work now and will wait for your update.
- gizmocuz
- Posts: 2350
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Just got myself a "RM mini 3" because i was very unsatisfied by a arduino IR-hat range.
Included the device with the application, tried to use this plugin and did not succeed.
Installed the latest python broadlink (pip install broadlink), which is now version 0.14
Tried the discovery tool (https://github.com/mjg59/python-broadli ... master/cli) but did not succeeded
Resetted the "RM Mini 3" hardware by using the pin, used the application to connect it to WiFi,
and right after this step stopped using the application, removed it from the phone.
And now I was able to use the discovery and cli tool.
Discovery displayed a device type of 0x0x5f36, so i tested a learn command with
./broadlink_cli --device "0x5f36 <ip_address> <6f... mac>" --learn
and that worked
changed this plugin's 'broadlinkConnect' function to:
Everything seems to work fine now
A list of the current supported types are found in:
https://github.com/mjg59/python-broadli ... _init__.py
@zak45, maybe you can include the complete list in the device type dropdown in the hardware setup ?
I noticed when using a wrong type, it is impossible to start a 'learn' command
Included the device with the application, tried to use this plugin and did not succeed.
Installed the latest python broadlink (pip install broadlink), which is now version 0.14
Tried the discovery tool (https://github.com/mjg59/python-broadli ... master/cli) but did not succeeded
Resetted the "RM Mini 3" hardware by using the pin, used the application to connect it to WiFi,
and right after this step stopped using the application, removed it from the phone.
And now I was able to use the discovery and cli tool.
Discovery displayed a device type of 0x0x5f36, so i tested a learn command with
./broadlink_cli --device "0x5f36 <ip_address> <6f... mac>" --learn
and that worked
changed this plugin's 'broadlinkConnect' function to:
Code: Select all
# connect to Broadlink
def broadlinkConnect():
global device, isConnected
try:
device = broadlink.gendevice(devtype = 0x5f36, host = (Parameters["Address"],80), mac = bytearray.fromhex(Parameters["Mode1"]))
device.auth()
isConnected = True
Domoticz.Log( "Connected to Broadlink device: " + str(Parameters["Address"]))
except:
Domoticz.Error( "Error Connecting to Broadlink device...." + str(Parameters["Address"]))
isConnected = False
return False
return True
A list of the current supported types are found in:
https://github.com/mjg59/python-broadli ... _init__.py
@zak45, maybe you can include the complete list in the device type dropdown in the hardware setup ?
I noticed when using a wrong type, it is impossible to start a 'learn' command
Quality outlives Quantity!
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@gizmocuz
yep, lot's of modification has been done into the Broadlink module.
I'm in process to completely rewrite the plugin, so will use the new version and put more... very more feature on it.
Should be published before end of week, hope so !
yep, lot's of modification has been done into the Broadlink module.
I'm in process to completely rewrite the plugin, so will use the new version and put more... very more feature on it.
Should be published before end of week, hope so !
Who is online
Users browsing this forum: Bing [Bot] and 1 guest