Page 1 of 1

[SOLVED] Plugin DSP-W215 makes webservice refuses connections

Posted: Sunday 18 March 2018 18:27
by Filip
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]

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Friday 23 March 2018 20:45
by Filip
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?

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Friday 23 March 2018 23:08
by febalci
beta release have some problems with python3.5 and urllib. Are you trying this on stable version?

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Friday 23 March 2018 23:16
by Filip
I tried first on the latest stable. But seen the problems, I tried with the latest beta... But this does not change anything...

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Friday 23 March 2018 23:34
by febalci
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?

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Friday 23 March 2018 23:45
by Filip
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'

Re: Plugin DSP-W215 makes webservice refuses connections

Posted: Saturday 24 March 2018 17:35
by Filip
Solved. I just uninstalled Python 3.5 and all worked!