Page 1 of 2

Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 24 May 2017 14:30
by stuffnl
Hi guys,

I've created a plugin I would like to share with you. The plugin will integrate the Woonveilig Gate01 alarmsystem into Domoticz.

The following Woonveilig accessories are supported:
  • Door contacts
  • Keypad
More info and installation instructions can be found at: https://github.com/StuffNL/domoticz-woonveilig

If you have any comments or suggestions please let me know. Cheers!
Preview of Woonveilig devices
Preview of Woonveilig devices
Woonveilig devices.PNG (32.83 KiB) Viewed 4867 times

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Friday 28 July 2017 21:31
by jpbriaire
Thanks for this! I was looking for an easy way to include my Woonveilig system into Domoticz.

Unfortunately, I get an error when trying to use the plugin:

Code: Select all

2017-07-28 21:18:23.327 Error: (Woonveilig) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/domoticz-woonveilig/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.
2017-07-28 21:18:23.327 Error: (Woonveilig Alarm) Module Import failed, exception: 'ImportError'
2017-07-28 21:18:23.327 Error: (Woonveilig Alarm) Module Import failed: ' Name: demjson'
Do you know what's wrong?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Saturday 29 July 2017 0:00
by stuffnl
Did you install demjson?

For installation instructions check https://github.com/StuffNL/domoticz-woo ... /README.md

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Saturday 29 July 2017 8:54
by jpbriaire
Oh, I totally did not read that part, sorry... Going to try and get that up and running on my Synology then.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Saturday 29 July 2017 9:25
by jpbriaire
So, I installed demjson:

Code: Select all

running install
running build
running build_py
running build_scripts
creating build/scripts-3.5
copying and adjusting jsonlint -> build/scripts-3.5
changing mode of build/scripts-3.5/jsonlint from 644 to 755
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running install_lib
copying build/lib/demjson.py -> /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages
byte-compiling /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/demjson.py to demjson.cpython-35.pyc
  File "/volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/demjson.py", line 645
    class json_int( (1L).__class__ ):    # Have to specify base this way to satisfy 2to3
                      ^
SyntaxError: invalid syntax

running install_scripts
copying build/scripts-3.5/jsonlint -> /volume1/@appstore/py3k/usr/local/bin
changing mode of /volume1/@appstore/py3k/usr/local/bin/jsonlint to 755
running install_egg_info
Writing /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages/demjson-2.2.4-py3.5.egg-info
After that, still no luck. Getting the same error in Domoticz.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Sunday 30 July 2017 19:20
by jpbriaire
Ok, so I figured out that demjson was not in the correct folder. I copied demjson.py to the folder

/volume1/@appstore/py3k/usr/local/lib/python3.5/

and made it executable. This solves the first problem. But now, I'm getting an other error:

Code: Select all

2017-07-30 18:46:04.547 Error: (Woonveilig) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/domoticz-woonveilig/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.
2017-07-30 18:46:04.547 Error: (Woonveilig) Module Import failed, exception: 'SyntaxError'
2017-07-30 18:46:04.547 Error: (Woonveilig) Import detail: File: /volume1/@appstore/py3k/usr/local/lib/python3.5/demjson.py, Line: 1803059968, offset: 645
2017-07-30 18:46:04.547 Error: (Woonveilig) Error Line 'class json_int( (1L).__class__ ): # Have to specify base this way to satisfy 2to3
I know, this has nothing to do with your plugin. But for me, as a non-coder, it's kinda hard figuring out those problems every time :cry:

So now I'm stuck with a demjson problem, in the code. Don't know what to do now.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Monday 31 July 2017 13:43
by jpbriaire
Have been trying to figure out how to get past this error. My logic is that there is something going wrong with the Python 2to3 conversion of demjson. I think my current installation of Python3, from the original Synology source, does not include the 2to3 library. Tried the same with the SynoCommunity version of Python3: no luck. Installed Python3 with Easy Boot Installer including all the necessary extra modules: no luck.

I'm out of options now. Been putting a lot of hours the past days to get this to work. If there is someone that got this to work on Synology I would appreciate some pointers on how they did it.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 03 August 2017 22:23
by rbo0567
Didn't get it to work on a Synology but on a RPi it works like a charm.
Keep up the good work!! :D

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 09 August 2017 20:42
by avantwist
Hello,

I have succesfully installed all additional plugins and software, and after the reboot I see the" Woonveilig Gate 01" under Hardware.
But when I add it, nothing happens. It will not appear under the Hardware list
If I addd other "hardware" they are addes to the list.

Any ideas?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 09 August 2017 21:26
by stuffnl
avantwist wrote: Wednesday 09 August 2017 20:42 Hello,

I have succesfully installed all additional plugins and software, and after the reboot I see the" Woonveilig Gate 01" under Hardware.
But when I add it, nothing happens. It will not appear under the Hardware list
If I addd other "hardware" they are addes to the list.

Any ideas?
It''s a lon dhot but in the past I had a similar problem (in Chrome). Could you try add the plug-in by using a different browser?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 09 August 2017 21:59
by avantwist
perfect.
It works.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 10 August 2017 20:24
by avantwist
Unfortunately Im getting the same error on my Pi in the log when addning the hardware:

2017-08-10 20:20:51.413 Error: (Woonveilig) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-woonveilig/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-08-10 20:20:51.413 Error: (Woonveilig) Module Import failed, exception: 'ImportError'
2017-08-10 20:20:51.413 Error: (Woonveilig) Module Import failed: ' Name: demjson'

Any suggestions?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 24 August 2017 16:36
by jpbriaire
avantwist wrote: Thursday 10 August 2017 20:24 Unfortunately Im getting the same error on my Pi in the log when addning the hardware:

2017-08-10 20:20:51.413 Error: (Woonveilig) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-woonveilig/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload'.
2017-08-10 20:20:51.413 Error: (Woonveilig) Module Import failed, exception: 'ImportError'
2017-08-10 20:20:51.413 Error: (Woonveilig) Module Import failed: ' Name: demjson'

Any suggestions?
Looks like demjson isn't loaded. Did you install it?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 24 August 2017 19:35
by avantwist
Yes I have,

This is the message I receive when I try to install it again.Any other weay to test it?

pi@piserver:~ $ sudo pip install demjson
Requirement already satisfied (use --upgrade to upgrade): demjson in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 24 August 2017 20:52
by jpbriaire
Sorry, I can't help you with that. Maybe the topic starter can help.

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 24 August 2017 21:40
by stuffnl
Hi, can hou check if your demjson module is located in /usr/local/lib/python3.4/dist-packages?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Thursday 24 August 2017 21:45
by avantwist
hmm, no, directory is empty
it is located in /usr/local/lib/python2.7/dist-packages

Can I just move it ?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Friday 25 August 2017 10:51
by imdos
avantwist wrote: Thursday 24 August 2017 21:45 hmm, no, directory is empty
it is located in /usr/local/lib/python2.7/dist-packages

Can I just move it ?
No; you should get the python 3 version (3.4 or 3.5) with for example pip3 or apt-get.
I solved it through:

Code: Select all

sudo apt-get install pip3
sudo pip3 install demjson

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 27 September 2017 7:44
by Daehnie
Hi,

I've installed Domoticz on a Raspberry with Raspbian Stretch.
Now, I had install the Plugin and the Logfile tolds me:

2017-09-27 07:36:28.820 Error: (Woonveilig) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/domoticz-woonveilig/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2017-09-27 07:36:28.820 Error: (Egardia) Module Import failed, exception: 'ImportError'
2017-09-27 07:36:28.820 Error: (Egardia) Module Import failed: ' Name: demjson'
2017-09-27 07:36:28.821 Error: (Egardia) Error Line details not available.

But demjson is installed!
Location: /usr/local/lib/python3.5/dist-packages

Python: 3.5.3
demjson 2.2.4

In the plugin.py I've seen "sys.path.append('/usr/local/lib/python3.4/dist-packages')"

So, doesn't it work with Raspbian Stretch, because of a newer Python-Version?

Re: Python Plugin: Woonvelig Gate01 Alarmsystem

Posted: Wednesday 27 September 2017 9:19
by Dnpwwo
@Daehnie,

The Python Plugin Framework functions on Python 3.4 and above and has been tested (and works) on Stretch's default version (3.5).

The log details you have posted would suggest that /usr/local/lib/python3.5/dist-packages is not in the Python path so you package is not being found. You could try adding it with something like:

Code: Select all

sys.path.append('/usr/local/lib/python3.5/dist-packages')
import demjson
in the plugin.py