Page 26 of 33

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 11 March 2019 16:50
by zak45
garycooper wrote: Sunday 10 March 2019 21:06 I don't know how to manage my device. I did some script find here :
http://domo-attitude.fr/broadlink-domoticz/
but it doesn't work. I'm using version 4.9700 on Domoticz and 3.5.3 python.
No reason to be sorry: French guy is more than welcome ;-)
Check that you have set Domoticz to accept new devices..
Put plugin on debug mode and post the output.
show also the output of this command :
sudo pip3 list module

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 11 March 2019 17:23
by waaren
pvklink wrote: Monday 11 March 2019 11:44 script://home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/pi/domoticz/BroadlinkRM2ini/BroadlinkRM2-23-3.ini
Without any knowledge of this script whatsoever but should it not be script:///home... ? -- Add an extra /

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 11 March 2019 22:46
by pvklink
thanks again waaren! :D

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 12 March 2019 12:57
by luizcarlosnery
zak45 wrote: Monday 11 March 2019 16:50
garycooper wrote: Sunday 10 March 2019 21:06 I don't know how to manage my device. I did some script find here :
http://domo-attitude.fr/broadlink-domoticz/
but it doesn't work. I'm using version 4.9700 on Domoticz and 3.5.3 python.
No reason to be sorry: French guy is more than welcome ;-)
Check that you have set Domoticz to accept new devices..
Put plugin on debug mode and post the output.
show also the output of this command :
sudo pip3 list module
Hi, thanks!!

"DEBUG" is enabled, but I do not know where to find the generated data


pi@raspberrypi:~ $ sudo pip3 list module
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or defiy|columns) in your pip.conf under the
  • section) to disable this warning.
    automationhat (0.1.0)
    blinker (1.3)
    blinkt (0.1.2)
    broadlink (0.9)
    buttonshim (0.0.2)
    Cap1xxx (0.1.3)
    chardet (2.3.0)
    click (6.6)
    colorama (0.3.7)
    crypto (1.4.1)
    cryptography (1.7.1)
    drumhat (0.1.0)
    envirophat (1.0.0)
    ExplorerHAT (0.4.2)
    Flask (0.12.1)
    fourletterphat (0.1.0)
    gpiozero (1.4.1)
    idna (2.2)
    itsdangerous (0.24)
    jedi (0.10.2)
    Jinja2 (2.8)
    keyring (10.1)
    keyrings.alt (1.3)
    MarkupSafe (0.23)
    mcpi (0.1.1)
    microdotphat (0.2.1)
    mote (0.0.4)
    motephat (0.0.2)
    Naked (0.1.31)
    numpy (1.12.1)
    oauthlib (2.0.1)
    pantilthat (0.0.7)
    pgzero (1.2)
    phatbeat (0.1.1)
    pianohat (0.1.0)
    picamera (1.13)
    picraft (1.0)
    piglow (1.2.4)
    pigpio (1.38)
    Pillow (4.0.0)
    pip (9.0.1)
    pyaes (1.6.1)
    pyasn1 (0.1.9)
    PyCRC (1.21)
    pycrypto (2.6.1)
    pygame (1.9.3)
    pygobject (3.22.0)
    pyinotify (0.9.6)
    PyJWT (1.4.2)
    pyOpenSSL (16.2.0)
    pyserial (3.2.1)
    python-apt (1.1.0b5)
    pyxdg (0.25)
    PyYAML (3.13)
    rainbowhat (0.1.0)
    requests (2.12.4)
    requests-oauthlib (0.7.0)
    RPi.GPIO (0.6.5)
    RTIMULib (7.2.1)
    scrollphat (0.0.7)
    scrollphathd (1.2.1)
    SecretStorage (2.3.1)
    sense-emu (1.1)
    sense-hat (2.2.0)
    setuptools (33.1.1)
    shellescape (3.4.1)
    simplejson (3.10.0)
    six (1.12.0)
    skywriter (0.0.7)
    sn3218 (1.2.7)
    spidev (3.3)
    thonny (2.1.16)
    touchphat (0.0.1)
    twython (3.4.0)
    unicornhathd (0.0.4)
    urllib3 (1.19.1)
    virtualenv (15.1.0)
    Werkzeug (0.11.15)
    wheel (0.29.0)

Re: Python Plugin : Broadlink RM mini 3

Posted: Tuesday 12 March 2019 21:19
by Darkneo
zak45 wrote: Monday 11 March 2019 16:37
Darkneo wrote: Sunday 10 March 2019 21:11 Whoo... How to do so? As all my devices are declared in the Android app!
https://www.domoticz.com/wiki/Plugins/B ... RM2_Device
Ty, I will check that! (I am using IHC instead of e-control but the export does not seem to exists in this app).

EDIT: hmm something strange once again... I just realized that I do not have the Import switch... I have the Broadlink - Command, the Broadlink - Remote... And that's all... (More the switch created for the stereo :) )

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 13 March 2019 0:24
by garycooper
Hello zak45, yes I have set accept new devices. I had to delete the plugin beacause, some plugin doesn't work if there is active plugon broadlink.

You'll see the output list :

Package Version
------------- -------
bluepy 1.3.0
broadlink 0.9
btlewrap 0.0.4
chardet 2.3.0
crypto 1.4.1
cryptography 1.7.1
enum-compat 0.0.2
idna 2.2
keyring 10.1
keyrings.alt 1.3
miflora 0.5
Naked 0.1.31
pip 19.0.3
pyaes 1.6.1
pyasn1 0.1.9
PyCRC 1.21
pycrypto 2.6.1
pycryptodome 3.4.11
pygatt 3.2.0
pygobject 3.22.0
pyserial 3.4
pyxdg 0.25
PyYAML 3.13
requests 2.12.4
SecretStorage 2.3.1
setuptools 33.1.1
shellescape 3.4.1
six 1.12.0
urllib3 1.19.1
wheel 0.29.0

Cordialy

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 13 March 2019 0:52
by luizcarlosnery
Hello everyone,
after trying to make this plugin work often, I found a solution at, "http://domo-attitude.fr/broadlink-rm-promini-domoticz/" this solved my problem perfectly.

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 13 March 2019 18:15
by zak45
garycooper wrote: Wednesday 13 March 2019 0:24 Hello zak45, yes I have set accept new devices. I had to delete the plugin beacause, some plugin doesn't work if there is active plugon broadlink.

You'll see the output list :

Package Version
------------- -------
pycrypto 2.6.1
pycryptodome 3.4.11
these two both can cause trouble. if not necessary, remove and try. e.g. sudo pip3 uninstall pycryptodome

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 13 March 2019 19:13
by garycooper
OK, thank You zak. I'll try this evening !
I had uninstalled pycryptodome but when I had uninstalled pycrypto with "sudo apt-get remove python-crypto" I had several syntax error.

So when I do "sudo pip3 list module", I always see "pycrypto 2.6.1"

Re: Python Plugin : Broadlink RM2 V4

Posted: Wednesday 13 March 2019 23:12
by zak45
garycooper wrote: Wednesday 13 March 2019 19:13 OK, thank You zak. I'll try this evening !
I had uninstalled pycryptodome but when I had uninstalled pycrypto with "sudo apt-get remove python-crypto" I had several syntax error.

So when I do "sudo pip3 list module", I always see "pycrypto 2.6.1"
give it a try now, without pycryptodome only maybe could be ok.

Re: Python Plugin : Broadlink RM2 V4

Posted: Thursday 14 March 2019 17:35
by garycooper
Hello, I tried yesterday but always the same. No dispositives are available and severals scripts did not working.

Re: Python Plugin : Broadlink RM2 V4

Posted: Thursday 14 March 2019 20:32
by zak45
garycooper wrote: Thursday 14 March 2019 17:35 Hello, I tried yesterday but always the same. No dispositives are available and severals scripts did not working.
Put debug mode on, reload plugin and go to settings/logs and post the output.

Re: Python Plugin : Broadlink RM2 V4

Posted: Thursday 21 March 2019 22:04
by garycooper
Hello, I did it but it doesn't work. Logs are :
2019-03-21 21:58:08.804 Status: (Multprise Broadlink) Started.
2019-03-21 21:58:12.332 Status: (Multprise Broadlink) Initialized version 4.2.0, author 'zak45'
2019-03-21 21:58:12.333 Status: (Multprise Broadlink) Entering work loop.

then, nothing else about Broadlink... No devices are created

thanks

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 26 March 2019 15:32
by wonder
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.

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
When I go to the utility tab I see only values, taken from the IDX 25(current consumption).

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.

2019-03-26 14:56:47.723 (BR) Update 0:'912.16' (BR - SP3 USAGE)
2019-03-26 14:56:47.760 (BR) Power state : True
2019-03-26 14:56:47.797 (BR) Light state : False
2019-03-26 14:57:17.603 (BR) Pushing 'onHeartbeatCallback' on to queue
2019-03-26 14:57:17.616 (BR) Processing 'onHeartbeatCallback' message
2019-03-26 14:57:17.616 (BR) Calling message handler 'onHeartbeat'.
2019-03-26 14:57:17.617 (BR) SP3S called
2019-03-26 14:57:17.738 (BR) Energy : 907.68
2019-03-26 14:57:17.739 (BR - SP3S CURRENT) Updating device from 0:'912.16' to have values 0:'907.68'.
2019-03-26 14:57:17.742 (BR) Update 0:'907.68' (BR - SP3S CURRENT)
2019-03-26 14:57:17.743 (BR - SP3 USAGE) Updating device from 0:'912.16' to have values 0:'907.68'.
2019-03-26 14:57:17.746 (BR) Update 0:'907.68' (BR - SP3 USAGE)
2019-03-26 14:57:17.783 (BR) Power state : True
2019-03-26 14:57:17.820 (BR) Light state : False
2019-03-26 14:57:19.742 (BR) Pushing 'CPluginMessageBase' on to queue
2019-03-26 14:57:19.742 Status: EventSystem: reset all device statuses...
2019-03-26 14:57:19.776 (BR) Processing 'CPluginMessageBase' message
2019-03-26 14:57:19.777 (BR) Message handler 'onDeviceModified' not callable, ignored.
2019-03-26 14:57:47.609 (BR) Pushing 'onHeartbeatCallback' on to queue
2019-03-26 14:57:47.643 (BR) Processing 'onHeartbeatCallback' message
2019-03-26 14:57:47.643 (BR) Calling message handler 'onHeartbeat'.
2019-03-26 14:57:47.643 (BR) SP3S called
2019-03-26 14:57:47.785 (BR) Energy : 905.84
2019-03-26 14:57:47.785 (BR - SP3S CURRENT) Updating device from 0:'907.68' to have values 0:'905.84'.
2019-03-26 14:57:47.789 (BR) Update 0:'905.84' (BR - SP3S CURRENT)
2019-03-26 14:57:47.789 (BR - SP3 USAGE) Updating device from 0:'907.68' to have values 0:'905.84'.
2019-03-26 14:57:47.790 Error: Domoticz(pid:21854, tid:21873('PluginMgr')) received fatal signal 11 (Segmentation fault)
2019-03-26 14:57:47.790 Error: siginfo address=0x52422820, address=0x76ca057c
2019-03-26 14:57:57.267 Error: Thread 4 (Thread 0x74fbe430 (LWP 21873)):
2019-03-26 14:57:57.267 Error: #0 0x76ef24cc in __waitpid (pid=22028, stat_loc=0x74fbc868, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
2019-03-26 14:57:57.267 Error: #1 0x002c9af0 in dumpstack_gdb(bool) ()
2019-03-26 14:57:57.267 Error: #2 0x002ca0dc in signal_handler(int, siginfo_t*, void*) ()
2019-03-26 14:57:57.267 Error: #3 <signal handler called>
2019-03-26 14:57:57.267 Error: #4 __GI_____strtof_l_internal (nptr=0x52422820 <error: Cannot access memory at address 0x52422820>, endptr=0x0, group=<optimized out>, loc=0x76fd7b18) at strtod_l.c:583
2019-03-26 14:57:57.267 Error: #5 0x002dfcec in CSQLHelper::UpdateValueInt(int, char const*, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, int, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool) ()
2019-03-26 14:57:57.267 Error: #6 0x002e1204 in CSQLHelper::UpdateValue(int, char const*, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, int, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool) ()
2019-03-26 14:57:57.268 Error: #7 0x0061b8a4 in Plugins::CDevice_update(Plugins::CDevice*, _object*, _object*) ()
2019-03-26 14:57:57.268 Error: #8 0x760521d8 in PyCFunction_Call () from /usr/lib/arm-linux-gnueabihf/libpython3.5m.so
2019-03-26 14:57:57.268 Error: #9 0x761bc950 in PyEval_EvalFrameEx () from /usr/lib/arm-linux-gnueabihf/libpython3.5m.so
2019-03-26 14:57:57.268 Error: #10 0x761bb3b0 in PyEval_EvalFrameEx () from /usr/lib/arm-linux-gnueabihf/libpython3.5m.so
2019-03-26 14:57:57.268 Error: #11 0x7623c624 in ?? () from /usr/lib/arm-linux-gnueabihf/libpython3.5m.so

2019-03-26 14:58:11.134 Status: Domoticz V4.10548 (c)2012-2019 GizMoCuz
2019-03-26 14:58:11.135 Status: Build Hash: 3f713ad4, Date: 2019-03-14 12:11:35
2019-03-26 14:58:11.135 Status: Startup Path: /home/pi/domoticz/
2019-03-26 14:58:11.232 Sunrise: 06:32:00 SunSet: 19:05:00
2019-03-26 14:58:11.232 Day length: 12:32:00 Sun at south: 12:05:00
2019-03-26 14:58:11.232 Civil twilight start: 05:59:00 Civil twilight end: 19:38:00
2019-03-26 14:58:11.232 Nautical twilight start: 05:20:00 Nautical twilight end: 20:17:00
2019-03-26 14:58:11.232 Astronomical twilight start: 04:38:00 Astronomical twilight end: 20:58:00
2019-03-26 14:58:11.232 Status: EventSystem: reset all events...
2019-03-26 14:58:11.575 Status: PluginSystem: Started, Python version '3.5.3'.
2019-03-26 14:58:11.599 Active notification Subsystems: (0/13)
2019-03-26 14:58:11.604 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2019-03-26 14:58:11.609 Status: Proxymanager started.
2019-03-26 14:58:11.611 Status: Camera: settings (re)loaded
2019-03-26 14:58:11.614 Starting shared server on: 0.0.0.0:6144

After certain manipulations with server restart/disabling the hardware and devices I could force this meter to calculate computed daily consumption without crashes.

My questions are the following:

1) What is the correct way to configure this meter, should the value be "computed" or "from device"?
2) If it's computed, what the reason of plugin crash is that a known issue ?
3) If the value should be "From device" how I could force domoticz to show it in the utility meter?

Thanks for any help.
Here are my environment details:

Code: Select all

Name: broadlink
Version: 0.9
Summary: Python API for controlling Broadlink IR controllers
Home-page: http://github.com/mjg59/python-broadlink
Author: Matthew Garrett
Author-email: [email protected]
License: UNKNOWN
Location: /home/pi/.local/lib/python3.5/site-packages
Requires: pycryptodome, PyCRC

About Domoticz
Version: 4.10548
Build Hash: 3f713ad4
Compile Date: 2019-03-14 12:11:35
dzVents Version: 2.4.15
Python Version: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]
Uptime: 20 Minutes, 50 Seconds

plugin.py -  4.2.0

Re: Python Plugin : Broadlink RM2 V4

Posted: Thursday 28 March 2019 23:04
by zak45
@wonder

here is my configuration:
Capture.JPG
Capture.JPG (39.8 KiB) Viewed 2930 times
work since months without trouble.
maybe try to update your python version to avoid crash..??

Re: Python Plugin : Broadlink RM2 V4

Posted: Sunday 31 March 2019 23:54
by garycooper
Hello zak45, I finally could uninstall pycrypto doing :

Code: Select all

sudo apt-get remove python3-crypto
sudo apt-get remove python3-cryptography
I reinstalled the broadlinkRM2 plugin like your tuto but it's always the same.
In french forum, someone telle me to put "#" in front of "import broadlink" on "plugin.py".
Once I did it, 5 buttons created on "dispositives". So it seems the problem become about import library But I can't find more.
Thanks

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 01 April 2019 18:20
by zak45
garycooper wrote: Sunday 31 March 2019 23:54 Hello zak45, I finally could uninstall pycrypto doing :

Code: Select all

sudo apt-get remove python3-crypto
sudo apt-get remove python3-cryptography
I reinstalled the broadlinkRM2 plugin like your tuto but it's always the same.
In french forum, someone telle me to put "#" in front of "import broadlink" on "plugin.py".
Once I did it, 5 buttons created on "dispositives". So it seems the problem become about import library But I can't find more.
Thanks
put # in front of 'import broadlink' is a non-sense, this is the main module.
this plugin is running since many months now without trouble, I use it daily.

the Domoticz python framework is stable also, and I must say enough strong for what is required for this plugin.
Problem can occur with some security module (pycrypto etc...), but you have already removed them.
Be sure to have pyaes installed.

Many trouble come from old OS version , old python version.
see this post as reference:
https://www.domoticz.com/forum/viewtopi ... sh#p210360
this can help.

Re: Python Plugin : Broadlink RM2 V4

Posted: Monday 01 April 2019 23:24
by garycooper
Hello, thanks. I removed python 2.7 and I installed python 3.5.7 like your link. Now, when I try to write "sudo pip3 list module", I've got this error :
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python3.5/site-packages/pip/utils/__init__.py", line 19, in <module>
import zipfile
File "/usr/local/lib/python3.5/zipfile.py", line 9, in <module>
import importlib.util
File "/usr/local/lib/python3.5/importlib/util.py", line 7, in <module>
from ._bootstrap_external import MAGIC_NUMBER, _BACKCOMPAT_MAGIC_NUMBER
ImportError: cannot import name '_BACKCOMPAT_MAGIC_NUMBER'
Then, when I write "python --version", I have "Python 3.5.3".

I'm lost...

Could you help me to properly uninstall old python version and install the right version ? Thanks

Re: Python Plugin : Broadlink RM2 V4

Posted: Tuesday 02 April 2019 15:47
by zak45
garycooper wrote: Monday 01 April 2019 23:24 Hello, thanks. I removed python 2.7 and I installed python 3.5.7 like your link. Now, when I try to write "sudo pip3 list module", I've got this error :
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python3.5/site-packages/pip/utils/__init__.py", line 19, in <module>
import zipfile
File "/usr/local/lib/python3.5/zipfile.py", line 9, in <module>
import importlib.util
File "/usr/local/lib/python3.5/importlib/util.py", line 7, in <module>
from ._bootstrap_external import MAGIC_NUMBER, _BACKCOMPAT_MAGIC_NUMBER
ImportError: cannot import name '_BACKCOMPAT_MAGIC_NUMBER'
Then, when I write "python --version", I have "Python 3.5.3".

I'm lost...

Could you help me to properly uninstall old python version and install the right version ? Thanks
Hummm. do not know if removing 2.7 is a good option, but i'm not Pi specialist.
I know that exist some tools to put 3.x as default one version for linux base installation.. but my Domoticz is running on Windows and do not have Pi knowledge, sorry.

Re: Python Plugin : Broadlink RM2 V4

Posted: Saturday 13 April 2019 11:37
by EddyG
Everything is working (almost) fine.
This script give an error

Code: Select all

/usr/bin/python3 /home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py /home/pi/domoticz/plugins/BroadlinkRM2/ini/BroadlinkRM2-35-20.ini

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.5/configparser.py", line 786, in get
    value = d[option]
  File "/usr/lib/python3.5/collections/__init__.py", line 881, in __getitem__
    return self.__missing__(key)            # support subclasses that define __missing__
  File "/usr/lib/python3.5/collections/__init__.py", line 873, in __missing__
    raise KeyError(key)
KeyError: 'unit'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/domoticz/plugins/BroadlinkRM2/plugin_send.py", line 68, in <module>
    Unit=config.get("DEFAULT", "unit")
  File "/usr/lib/python3.5/configparser.py", line 789, in get
    raise NoOptionError(option, section)
configparser.NoOptionError: No option 'unit' in section: 'DEFAULT'
I checked there is an option 'unit' in the 'DEFAULT' section of the file. There was a capitalisation differance between the plugin_send.py and the ini file. I changed that but the error stays.
I have python 2.7.13 and Python 3.5.3 on the system Domoticz is running with Python 3.5.3, and in the script call I use '/usr/bin/python3', as above.
What am I doing wrong.

!!!! SORRY FOUND IT !!!! I have sudo it. :evil: :oops: :oops: :oops: