see wikiJufo wrote: ↑Thursday 03 May 2018 9:46Can you give a link to github?zak45 wrote: ↑Wednesday 02 May 2018 22:43 What you need to do:
Do not use the plugin until you do not have been able to connect to your RM Mini 3 manually.
You will found all information on Github.
Once you have been able to connect manually, lets reconfigure the plugin, this should work.. this work for others.
Python Plugin : Broadlink RM2 V4
Moderator: leecollings
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Hi HarleyZard,HarleyZard wrote: ↑Thursday 03 May 2018 11:12 I tried to install Python 3.6, but when I start domoticz, it only load library 3.5 in the log ; I don't understand to load library 3.6 in Domoticz... perhaps it's the solution...
I also installed python 3.6 the same symptom as yours. Domoticz could not load python plugins.
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@zak45
I did a simple test. It looks like the discover works:
I did a simple test. It looks like the discover works:
Code: Select all
robert@domoticz:~$ sudo python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> broadlink.discover(timeout=5)
[<broadlink.rm object at 0x7ff9da213828>]
>>>
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Perfect, so we can focus now on Domoticz. THis should be problem with python framework and maybe some imported modules
can you modify plugin.py in this way :
Code: Select all
#
# Main Import
import Domoticz
#import configparser
#import datetime
#import time
#import codecs
#import subprocess
#import socket
#
#
# Required for import: path is OS dependent
# Python framework in Domoticz do not include OS dependent path
#
import site
import sys
import os
path=''
path=site.getsitepackages()
for i in path:
sys.path.append(i)
#
#import broadlink
#
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@zak45
It's better, I modified the code.
1. Discovery version, in logs:
A virtual device has also been added but it does not work (switching to discovery):
2. Version configured with RM mini 3, in logs:
A virtual device has also been added but it does not work:
Logs indicate that the plugin can not connect to the device (device works without any problems with the e-Control application), it responds to pings. IP reservation in DHCP and MAC address correct.
It's better, I modified the code.
1. Discovery version, in logs:
Code: Select all
2018-05-03 17:40:49.713 (RM mini 3) Initialized version 4.1.0, author 'zak45'
2018-05-03 17:40:49.713 (RM mini 3) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2018-05-03 17:40:49.713 (RM mini 3) Creating device 'Discovery'.
2018-05-03 17:40:49.713 (RM mini 3) Creating device 'Discovery Info'.
2018-05-03 17:40:49.714 (RM mini 3) 'Author':'zak45'
2018-05-03 17:40:49.714 (RM mini 3) 'Name':'RM mini 3'
2018-05-03 17:40:49.714 (RM mini 3) 'Key':'BroadlinkRM2'
2018-05-03 17:40:49.714 (RM mini 3) 'DomoticzVersion':'3.9389'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode5':'9000'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode1':'000000000000'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode4':'yes'
2018-05-03 17:40:49.714 (RM mini 3) 'Port':'0'
2018-05-03 17:40:49.714 (RM mini 3) 'HardwareID':'14'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode3':'DIS'
2018-05-03 17:40:49.714 (RM mini 3) 'Address':'127.0.0.1'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode2':'/home/robert/domoticz/plugins/BroadlinkRM2/import'
2018-05-03 17:40:49.714 (RM mini 3) 'HomeFolder':'/home/robert/domoticz/plugins/BroadlinkRM2/'
2018-05-03 17:40:49.714 (RM mini 3) 'Mode6':'Debug'
2018-05-03 17:40:49.714 (RM mini 3) 'Version':'4.1.0'
2018-05-03 17:40:49.714 (RM mini 3) 'DomoticzHash':'28d24885'
2018-05-03 17:40:49.714 (RM mini 3) 'DomoticzBuildTime':'2018-05-01 00:17:26'
2018-05-03 17:40:49.714 (RM mini 3) Device count: 2
2018-05-03 17:40:49.714 (RM mini 3) Device: 1 - ID: 41, Name: 'RM mini 3 - Discovery', nValue: 0, sValue: ''
2018-05-03 17:40:49.714 (RM mini 3) Device ID: '41'
2018-05-03 17:40:49.714 (RM mini 3) Device Name: 'RM mini 3 - Discovery'
2018-05-03 17:40:49.714 (RM mini 3) Device nValue: 0
2018-05-03 17:40:49.714 (RM mini 3) Device sValue: ''
2018-05-03 17:40:49.714 (RM mini 3) Device LastLevel: 0
2018-05-03 17:40:49.714 (RM mini 3) Device: 2 - ID: 42, Name: 'RM mini 3 - Discovery Info', nValue: 0, sValue: ''
2018-05-03 17:40:49.714 (RM mini 3) Device ID: '42'
2018-05-03 17:40:49.714 (RM mini 3) Device Name: 'RM mini 3 - Discovery Info'
2018-05-03 17:40:49.714 (RM mini 3) Device nValue: 0
2018-05-03 17:40:49.714 (RM mini 3) Device sValue: ''
2018-05-03 17:40:49.714 (RM mini 3) Device LastLevel: 0
2018-05-03 17:40:49.714 (RM mini 3) Pushing 'PollIntervalDirective' on to queue
2018-05-03 17:40:49.714 (RM mini 3) Connecting to: 127.0.0.1:000000000000
2018-05-03 17:40:49.714 (RM mini 3) Device Number begin to : 1
2018-05-03 17:40:49.714 (RM mini 3) Processing 'PollIntervalDirective' message
2018-05-03 17:40:49.714 (RM mini 3) Heartbeat interval set to: 30.
2018-05-03 17:40:59.215 (RM mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:40:59.233 (RM mini 3) Processing 'onHeartbeatCallback' message
2018-05-03 17:40:59.233 (RM mini 3) Calling message handler 'onHeartbeat'.
2018-05-03 17:40:59.233 Error: (RM mini 3) 'onHeartbeat' failed 'NameError':'name 'datetime' is not defined'.
2018-05-03 17:40:59.233 Error: (RM mini 3) ----> Line 364 in /home/robert/domoticz/plugins/BroadlinkRM2/plugin.py, function onHeartbeat
2018-05-03 17:41:29.221 (RM mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:41:29.245 (RM mini 3) Processing 'onHeartbeatCallback' message
2018-05-03 17:41:29.245 (RM mini 3) Calling message handler 'onHeartbeat'.
2018-05-03 17:41:29.245 Error: (RM mini 3) 'onHeartbeat' failed 'NameError':'name 'datetime' is not defined'.
2018-05-03 17:41:29.245 Error: (RM mini 3) ----> Line 364 in /home/robert/domoticz/plugins/BroadlinkRM2/plugin.py, function onHeartbeat
2018-05-03 17:41:59.228 (RM mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:41:59.257 (RM mini 3) Processing 'onHeartbeatCallback' message
2018-05-03 17:41:59.257 (RM mini 3) Calling message handler 'onHeartbeat'.
2. Version configured with RM mini 3, in logs:
Code: Select all
2018-05-03 17:46:24.691 (Rm mini 3) Started.
2018-05-03 17:46:24.728 (Rm mini 3) Entering work loop.
2018-05-03 17:46:24.728 (Rm mini 3) Initialized version 4.1.0, author 'zak45'
2018-05-03 17:46:24.729 (Rm mini 3) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2018-05-03 17:46:24.729 (Rm mini 3) Creating device 'Command'.
2018-05-03 17:46:24.747 (Rm mini 3) Creating device 'Remote'.
2018-05-03 17:46:24.747 (Rm mini 3) Creating device 'Import'.
2018-05-03 17:46:24.747 (Rm mini 3) 'Author':'zak45'
2018-05-03 17:46:24.747 (Rm mini 3) 'Name':'Rm mini 3'
2018-05-03 17:46:24.747 (Rm mini 3) 'Key':'BroadlinkRM2'
2018-05-03 17:46:24.747 (Rm mini 3) 'DomoticzVersion':'3.9389'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode5':'9000'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode1':'b4430df91287'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode4':'yes'
2018-05-03 17:46:24.747 (Rm mini 3) 'Port':'0'
2018-05-03 17:46:24.747 (Rm mini 3) 'HardwareID':'14'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode3':'RM2'
2018-05-03 17:46:24.747 (Rm mini 3) 'Address':'192.168.3.9'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode2':'/home/robert/domoticz/plugins/BroadlinkRM2/import'
2018-05-03 17:46:24.747 (Rm mini 3) 'HomeFolder':'/home/robert/domoticz/plugins/BroadlinkRM2/'
2018-05-03 17:46:24.747 (Rm mini 3) 'Mode6':'Debug'
2018-05-03 17:46:24.747 (Rm mini 3) 'Version':'4.1.0'
2018-05-03 17:46:24.747 (Rm mini 3) 'DomoticzHash':'28d24885'
2018-05-03 17:46:24.747 (Rm mini 3) 'DomoticzBuildTime':'2018-05-01 00:17:26'
2018-05-03 17:46:24.747 (Rm mini 3) Device count: 3
2018-05-03 17:46:24.747 (Rm mini 3) Device: 1 - ID: 41, Name: 'Rm mini 3 - Command', nValue: 0, sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device ID: '41'
2018-05-03 17:46:24.747 (Rm mini 3) Device Name: 'Rm mini 3 - Command'
2018-05-03 17:46:24.747 (Rm mini 3) Device nValue: 0
2018-05-03 17:46:24.747 (Rm mini 3) Device sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device LastLevel: 0
2018-05-03 17:46:24.747 (Rm mini 3) Device: 254 - ID: 42, Name: 'Rm mini 3 - Remote', nValue: 0, sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device ID: '42'
2018-05-03 17:46:24.747 (Rm mini 3) Device Name: 'Rm mini 3 - Remote'
2018-05-03 17:46:24.747 (Rm mini 3) Device nValue: 0
2018-05-03 17:46:24.747 (Rm mini 3) Device sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device LastLevel: 0
2018-05-03 17:46:24.747 (Rm mini 3) Device: 255 - ID: 43, Name: 'Rm mini 3 - Import', nValue: 0, sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device ID: '43'
2018-05-03 17:46:24.747 (Rm mini 3) Device Name: 'Rm mini 3 - Import'
2018-05-03 17:46:24.747 (Rm mini 3) Device nValue: 0
2018-05-03 17:46:24.747 (Rm mini 3) Device sValue: ''
2018-05-03 17:46:24.747 (Rm mini 3) Device LastLevel: 0
2018-05-03 17:46:24.747 (Rm mini 3) Pushing 'PollIntervalDirective' on to queue
2018-05-03 17:46:24.747 (Rm mini 3 - Import) Updating device from 0:'' to have values 0:'Off'.
2018-05-03 17:46:24.763 (Rm mini 3) Update 0:'Off' (Rm mini 3 - Import)
2018-05-03 17:46:24.763 (Rm mini 3) Connecting to: 192.168.3.9:b4430df91287
2018-05-03 17:46:24.763 Error: (Rm mini 3) Error Connecting to Broadlink device....192.168.3.9
2018-05-03 17:46:24.763 (Rm mini 3 - Command) Updating device from 0:'' to have values 0:'Off'.
2018-05-03 17:46:24.764 (Rm mini 3) Update 0:'Off' (Rm mini 3 - Command)
2018-05-03 17:46:24.764 (Rm mini 3) No ini file :/home/robert/domoticz/plugins/BroadlinkRM2/import/remote/plugin_remote_14.ini
2018-05-03 17:46:24.764 (Rm mini 3) Custom Commands for Remote not managed
2018-05-03 17:46:24.764 (Rm mini 3) Device Number begin to : 1
2018-05-03 17:46:24.764 (Rm mini 3) Processing 'PollIntervalDirective' message
2018-05-03 17:46:24.764 (Rm mini 3) Heartbeat interval set to: 30.
2018-05-03 17:46:34.230 (Rm mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:46:34.234 (Rm mini 3) Processing 'onHeartbeatCallback' message
2018-05-03 17:46:34.234 (Rm mini 3) Calling message handler 'onHeartbeat'.
2018-05-03 17:46:34.234 Error: (Rm mini 3) 'onHeartbeat' failed 'NameError':'name 'datetime' is not defined'.
2018-05-03 17:46:34.234 Error: (Rm mini 3) ----> Line 364 in /home/robert/domoticz/plugins/BroadlinkRM2/plugin.py, function onHeartbeat
2018-05-03 17:47:04.237 (Rm mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:47:04.246 (Rm mini 3) Processing 'onHeartbeatCallback' message
2018-05-03 17:47:04.246 (Rm mini 3) Calling message handler 'onHeartbeat'.
2018-05-03 17:47:04.246 Error: (Rm mini 3) 'onHeartbeat' failed 'NameError':'name 'datetime' is not defined'.
2018-05-03 17:47:04.246 Error: (Rm mini 3) ----> Line 364 in /home/robert/domoticz/plugins/BroadlinkRM2/plugin.py, function onHeartbeat
2018-05-03 17:47:34.243 (Rm mini 3) Pushing 'onHeartbeatCallback' on to queue
2018-05-03 17:47:34.260 (Rm mini 3) Processing 'onHeartbeatCallback' message
Logs indicate that the plugin can not connect to the device (device works without any problems with the e-Control application), it responds to pings. IP reservation in DHCP and MAC address correct.
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
OK, now just remove this HW, modify the plugin.py by removing # in front of #import one by one.. we need to found which module made trouble in your system ( i would begin by the end, this mean #import broadlink) and create a new HW
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Problem is with broadlink module, others are working.
I found a nice search script:
Code: Select all
# File: locate.py
# Script to locate RM mini 3
# python locate.py
#!/usr/bin/python
import broadlink
import time
print ("************************************************")
print ("Using python library created by Matthew Garrett")
print ("https://github.com/mjg59/python-broadlink")
print ("************************************************")
print ("Scanning network for Broadlink devices....")
mydevices = broadlink.discover(timeout=5)
print ("Found " + str(len(mydevices )) + " broadlink devices")
time.sleep(1)
print ("...............")
for index, item in enumerate(mydevices):
mydevices[index].auth()
ipadd = mydevices[index].host
ipadd = str(ipadd)
print ("Device " + str(index + 1) +" Host address = " + ipadd[1:19])
macadd = ''.join(format(x, '02x') for x in mydevices[index].mac[::-1])
macadd = str(macadd)
mymacadd = macadd[:2] + " " + macadd[2:4] + " " + macadd[4:6] + " " + macadd[6:8] + " " + macadd[8:10] + " " + macadd[10:12]
print ("Device " + str(index + 1) +" MAC address = " + mymacadd)
print ("...............")
Code: Select all
sudo python3 test.py
************************************************
Using python library created by Matthew Garrett
https://github.com/mjg59/python-broadlink
************************************************
Scanning network for Broadlink devices....
Found 1 broadlink devices
...............
Device 1 Host address = '192.168.3.9', 80)
Device 1 MAC address = b4 43 0d f9 12 87
...............
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
So.. very bad situation: if trouble with module broadlink, this mean no way for you to use the plugin if we do not found why on some OS this work and not on your...
Another way to investigate: try to compile from source and not use the pre-build version, you should found all information on wiki.
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@zak45
I made a new Domoticz compilation + new database did not help
I made a new Domoticz compilation + new database did not help
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Code: Select all
broadlink (0.9)
cryptography (1.7.1)
idna (2.2)
keyring (10.1)
keyrings.alt (1.3)
pip (9.0.1)
pyaes (1.6.1)
pyasn1 (0.1.9)
PyCRC (1.21)
pycrypto (2.6.1)
pycryptodome (3.4.11)
pygobject (3.22.0)
pyserial (3.2.1)
pyxdg (0.25)
SecretStorage (2.3.1)
setuptools (33.1.1)
six (1.10.0)
wheel (0.29.0)
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
If you do not need them, try to remove pycrypto & pycryptodomeJufo wrote: ↑Saturday 05 May 2018 12:41Code: Select all
broadlink (0.9) cryptography (1.7.1) idna (2.2) keyring (10.1) keyrings.alt (1.3) pip (9.0.1) pyaes (1.6.1) pyasn1 (0.1.9) PyCRC (1.21) pycrypto (2.6.1) pycryptodome (3.4.11) pygobject (3.22.0) pyserial (3.2.1) pyxdg (0.25) SecretStorage (2.3.1) setuptools (33.1.1) six (1.10.0) wheel (0.29.0)
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@zak45
It works!
Are these packages needed (pycrypto & pycryptodome)?
It works!
Are these packages needed (pycrypto & pycryptodome)?
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
@zak45
I analyzed the problem deeper (I did tests on a clean copy of a virtual machine).
You would have to add to the domoticz's manual to uninstall (only) pycryptodome-3.4.11. This package is installed by default with the broadlink.
Best Regards,
Robert
I analyzed the problem deeper (I did tests on a clean copy of a virtual machine).
You would have to add to the domoticz's manual to uninstall (only) pycryptodome-3.4.11. This package is installed by default with the broadlink.
Best Regards,
Robert
-
- Posts: 28
- Joined: Friday 17 February 2017 13:24
- Target OS: Linux
- Domoticz version: 3.9389
- Location: Poland
- Contact:
Re: Python Plugin : Broadlink RM2 V4
I have one question I'd like to make a toggle button (on / off), but what should be the syntax on Linux?, under Windows it looks like this:
I do not want to work the following version:
I do not want to work the following version:
Code: Select all
script:///home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/robert/domoticz/plugins/BroadlinkRM2/RM_mini_3/BroadlinkRM2-14-4.ini
script:///home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/robert/domoticz/plugins/BroadlinkRM2/RM_mini_3/BroadlinkRM2-14-2.ini
-
- Posts: 952
- Joined: Sunday 22 January 2017 11:37
- Target OS: Windows
- Domoticz version: V2024.4
- Contact:
Re: Python Plugin : Broadlink RM2 V4
Something like that:Jufo wrote: ↑Saturday 05 May 2018 19:57 I have one question I'd like to make a toggle button (on / off), but what should be the syntax on Linux?Code: Select all
script:///home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/robert/domoticz/plugins/BroadlinkRM2/RM_mini_3/BroadlinkRM2-14-4.ini script:///home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/robert/domoticz/plugins/BroadlinkRM2/RM_mini_3/BroadlinkRM2-14-2.ini
create a plugin_send.sh under plugin folder.
put on it
nohup python3 /home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.py $1 &
And on the on action :
script:///home/robert/domoticz/plugins/BroadlinkRM2/plugin_send.sh /home/robert/domoticz/plugins/BroadlinkRM2/RM_mini_3/BroadlinkRM2-14-4.ini
-
- Posts: 28
- Joined: Thursday 02 March 2017 11:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python Plugin : Broadlink RM2 V4
I hope this is not a silly question, but I'm uncertain about the Python role in all of this. I have ordered two SP3S units and would like to use them in Domoticz, so I ended up here. I have Domoticz running on a RP. However, the domoticz dashboard is only accessed through windows machines or my phone.
Do I need to install Python on my windows pc to be able to get this to work on my domoticz, or do I need to do something on the RP? I have already checked my domoticz dashboard, but I can't find any Broadlink in 'hardware' yet.
Is it possible that someone explains it to me in 'dummy' terms? It's fine by me if that goes through Private messages
Do I need to install Python on my windows pc to be able to get this to work on my domoticz, or do I need to do something on the RP? I have already checked my domoticz dashboard, but I can't find any Broadlink in 'hardware' yet.
Is it possible that someone explains it to me in 'dummy' terms? It's fine by me if that goes through Private messages
Who is online
Users browsing this forum: No registered users and 1 guest