[SOLVED] Plugin DSP-W215 makes webservice refuses connections

Python and python framework
Post Reply
Filip
Posts: 17
Joined: Thursday 03 November 2016 11:12
Target OS: Raspberry Pi
Domoticz version:
Contact:

[SOLVED] Plugin DSP-W215 makes webservice refuses connections

Post by Filip » Sunday 18 March 2018 19:27

I am using Domoticz on RPI with Stretch... Already running a while without any problem. Below you can find the version of the Domoticz (I switched to a Beta release to try to solve the described problem, but without result). I have installed Python 2.7, 3.4 and 3.5. Default "python3" is 3.5, "python" refers to 2.7. I created already a plugin to monitor my battery and it works without problem (you will see the difference with this problem).

When I am using now the plugin of the DSP-W215 available in the examples (copied into the "plugins" folder and restart domoticz, add hardware), domoticz is not accessible anymore through its webservice ("connection refused"). It can only be restored by removing this plugin (delete from the directory) and restart the RPI. Just restarting domoticz doesn't help...

If found out that it all has to do with the import of libraries "import hmac" and "import hashlib". I made a simple plugin with these imports and have the identical behaviour. Commenting them out solved the problem. So I did the same with the DSP-W215 plugin (and of course commented all the code using those libraries) and indeed the problem was gone. Of course the functionality does not work because these libraries are required for the SOAP protocol to the DSP-W215. I didn't install those libraries because they are coming by default with the installation of python (I find them in the "/usr/lib/python3.5" directory).

If start python3 (3.5) on the command line and try to import these libraries manually, there is no problem. I already forced domoticz using python3.4, but seems not possible. With "update-alternatives" I forced python and python3 to version 3.4, but if Domoticz starts, it uses always 3.5. So left this solution track because I don't believe it would solve my problem. "python --version" and "python3 --version" gives resp. "Python 2.7.13" and "Python 2.5.3".

:evil: I am already investigating the problem for one day and become desperate...
Any help or suggestions are welcome!

Domoticz version:
Version: 3.9052
Build Hash: 927ba005
Compile Date: 2018-03-18 08:38:55
dzVents Version: 2.4.1
Python Version: 3.5.3 (default, Jan 19 2017, 14:11:04) [GCC 6.3.0 20170124]
Last edited by Filip on Saturday 24 March 2018 18:37, edited 1 time in total.

Filip
Posts: 17
Joined: Thursday 03 November 2016 11:12
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by Filip » Friday 23 March 2018 21:45

Tried to do it with a debugger and got the following error
> <frozen importlib._bootstrap>(182)_get_module_lock()
(Pdb) s
KeyError: 'hmac'

Anyone can help?

febalci
Posts: 317
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by febalci » Saturday 24 March 2018 0:08

beta release have some problems with python3.5 and urllib. Are you trying this on stable version?

Filip
Posts: 17
Joined: Thursday 03 November 2016 11:12
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by Filip » Saturday 24 March 2018 0:16

I tried first on the latest stable. But seen the problems, I tried with the latest beta... But this does not change anything...

febalci
Posts: 317
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by febalci » Saturday 24 March 2018 0:34

The dsp-w215 plugin in the examples folder follow the beta http connection scheme, so it will not work with stable unless you change some parts. Did you checked the domoticz.log file, is there any clue there?

Filip
Posts: 17
Joined: Thursday 03 November 2016 11:12
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by Filip » Saturday 24 March 2018 0:45

No. Webservice just crashes and only reboot can solve the problem. I mapped the log file on a RAMdisk so after reboot info has gone. But as said, I did the same in debug mode and see clearly there is a problem with the import of the library.
> <frozen importlib._bootstrap>(182)_get_module_lock()
(Pdb) s
KeyError: 'hmac'

Filip
Posts: 17
Joined: Thursday 03 November 2016 11:12
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin DSP-W215 makes webservice refuses connections

Post by Filip » Saturday 24 March 2018 18:35

Solved. I just uninstalled Python 3.5 and all worked!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests