Page 1 of 3

Handling HNAP - DLink DSP-W215 example

Posted: Friday 27 January 2017 23:26
by Dnpwwo
Sample shows connecting (& reconnecting) over HTTP using SOAP.

Despite supporting HTTP 1.1 the DSP-W215 will disconnect after 10 seconds so a heartbeat query status happens every 8 seconds to prevent it. It will disconnect after 2 minutes anyway (Why DLink? Why!) so the disconnect initiates an immediate reconnect.

This should allow control of the remote device from within Domoticz and reflect direct changes on the device back into Domoticz.
DLink DSP-W215 v1.0.0.rar
(2.97 KiB) Downloaded 577 times
Requires the latest beta otherwise Domoticz will crash if the plugin is updated in the Hardware page.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Saturday 28 January 2017 10:24
by korniza
@Dnpwwo you are super! :D
I just installed! The response is VERY FAST when switch on/off. The problem is that even I have latest beta version (3.6518), I got domoticz crashing.
I enabled debug and I found this:
11:18:49.459 Error: Plugin: Async Read Exception: 125, Operation canceled
I like to thank Dnpwwo! Can we also add the power usage and temperature for this plug? :D

Re: Handling HNAP - DLink DSP-W215 example

Posted: Monday 30 January 2017 15:58
by saiko
Hi guys,

I just bought the DSP-W215.
Firmware External Version: V2.02
Firmware Internal Version: V2.02b04
Date: Wed, 22 Oct 2014

And I'd love to test this out.

However I'm unable to install the script in Domoticz. I've installed the script at: /home/pi/domoticz/plugin/DSP-W215/plugin.py and gave it 0744 permissions. After the reboot it doesnt show up under hardware dropdown list. What am I doing wrong?

Regards,
Saiko

Re: Handling HNAP - DLink DSP-W215 example

Posted: Monday 30 January 2017 21:11
by Dnpwwo
@saiko,

It needs to be : /home/pi/domoticz/plugins/DSP-W215/plugin.py

This will only work on the beta channel of Domoticz which you may not be running if the plugins folder wasn't there

Re: Handling HNAP - DLink DSP-W215 example

Posted: Tuesday 31 January 2017 8:30
by saiko
Dnpwwo wrote:@saiko,

It needs to be : /home/pi/domoticz/plugins/DSP-W215/plugin.py

This will only work on the beta channel of Domoticz which you may not be running if the plugins folder wasn't there
I've renamed the plugin map to plugins and rebooted Domoticz. However I'm unable to find d-link or DSP-w215 under hardware.

I'm running beta v3.6562 by changing Software Updates: to beta channel and updating. This however did not create the plugins folder.

Any suggestions?

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 01 February 2017 13:41
by Dnpwwo
@korniza,

Can you try this one:
DLink DSP-W215 v1.1.0.rar
(3.27 KiB) Downloaded 368 times
You will need to:
  • Replace the plugin.py file with the one in the archive
  • In Domoticz, delete the switch associated with the plugin from the devices page
  • Restart Domoticz and there should be switch, temperature and usage devices for the DLink

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 01 February 2017 17:55
by korniza
it worked everything 100%! :D
I'm a happy owner of DSP-W215 as they are an alternative solution from zwave to control plugs and get power usage! amazing!
As a learner I tried also to do it by myself using your code but I failed to pass value on domoticz, so now I can find my errors and check if I can do something with less or no help and share it back (I m a dreamer...) :lol:

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 01 February 2017 22:43
by benboyte
Hi,

I installed Domoticz (stable version) yesterday.
I created the "plugins" directory (744 permissions) and installed the script (v.1.1.0) in : /home/pi/domoticz/plugins/DSP-W215/plugin.py

I just upgraded Domoticz to the beta version (3.6577) but DSP-W215 does not appear in the Hardware page.

What can I do to make it works?

Thanks a lot for this plugin.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 01 February 2017 22:56
by korniza
benboyte wrote:Hi,

I installed Domoticz (stable version) yesterday.
I created the "plugins" directory (744 permissions) and installed the script (v.1.1.0) in : /home/pi/domoticz/plugins/DSP-W215/plugin.py

I just upgraded Domoticz to the beta version (3.6577) but DSP-W215 does not appear in the Hardware page.

What can I do to make it works?

Thanks a lot for this plugin.
Did you restart domoticz service?

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 01 February 2017 23:09
by benboyte
korniza wrote:
benboyte wrote:Hi,

I installed Domoticz (stable version) yesterday.
I created the "plugins" directory (744 permissions) and installed the script (v.1.1.0) in : /home/pi/domoticz/plugins/DSP-W215/plugin.py

I just upgraded Domoticz to the beta version (3.6577) but DSP-W215 does not appear in the Hardware page.

What can I do to make it works?

Thanks a lot for this plugin.
Did you restart domoticz service?
Yes I did, more than once.

I reinstalled the stable version, deleted the plugins directory (created manually previously), and updated to beta...the plugins directory is not created automatically...is it normal ?

Re: Handling HNAP - DLink DSP-W215 example

Posted: Thursday 02 February 2017 6:05
by korniza
benboyte wrote:
korniza wrote:
benboyte wrote:Hi,

I installed Domoticz (stable version) yesterday.
I created the "plugins" directory (744 permissions) and installed the script (v.1.1.0) in : /home/pi/domoticz/plugins/DSP-W215/plugin.py

I just upgraded Domoticz to the beta version (3.6577) but DSP-W215 does not appear in the Hardware page.

What can I do to make it works?

Thanks a lot for this plugin.
Did you restart domoticz service?
Yes I did, more than once.

I reinstalled the stable version, deleted the plugins directory (created manually previously), and updated to beta...the plugins directory is not created automatically...is it normal ?
I am not sure as you had upgrade from stable to beta what can cause this issue. :roll:

Re: Handling HNAP - DLink DSP-W215 example

Posted: Thursday 02 February 2017 10:16
by saiko
benboyte wrote:Hi,


Yes I did, more than once.

I reinstalled the stable version, deleted the plugins directory (created manually previously), and updated to beta...the plugins directory is not created automatically...is it normal ?
I'm having the same issue. I guess we have to wait untill this is added in the stable release.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Saturday 04 February 2017 22:25
by dezde29
Hi,

I had the same problem but since I apply :

sudo apt-get install libpython3.4

From : http://www.domoticz.com/wiki/Linux#Prob ... ing_Python

Restart domoticz and Dlink has appear in the hardware list.

Hope it helps.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Sunday 05 February 2017 17:04
by saiko
dezde29 wrote:Hi,

I had the same problem but since I apply :

sudo apt-get install libpython3.4

From : http://www.domoticz.com/wiki/Linux#Prob ... ing_Python

Restart domoticz and Dlink has appear in the hardware list.

Hope it helps.
Yes this did the trick thank you!

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 08 February 2017 14:18
by jelleeelco
Wow, this is great!

Just a quick question before I change my setup... I currently use Korniza code to switch them, just by IP address. So Domoticz doesn't really knows the status, temp or usage. This looks great, but... I have three Dlink plugs. Will three of them show up or will it only work on one?

Do I need to set an IP address in the file?

Thanks!
Jelle

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 08 February 2017 14:40
by Dnpwwo
@jelleeelco,

Do not set the IP in the file, if you are running a recent beta and Domoticz is finding Python on your system (there will be a message in the log at startup either way) then you can find this in the list of supported hardware in the Hardware page and you can configure 4 instances of it there.

You need to drop the file plugin.py into a folder under domoticz/plugins e.g domoticz/plugins/DLink

Re: Handling HNAP - DLink DSP-W215 example

Posted: Wednesday 08 February 2017 15:29
by jelleeelco
Thanks!!

I setup it up and it finds the Plug. I entered the the MyDlink number as the username and the pin as the password. It then finds the thermometer, the switch and the usage meter.

however, I can't switch it off/on with the switch. When press the switch, the log states the following:

User: Admin initiated a switch command (80/Dlink Plug 1 - Socket/off

No error message at that time.

However, it does correctly show the temperature and the status (if I switch off manually on the plug, the switch in Domoticz changes status).
Also it doesn't seem to matter what username I use... When I used the MyDlink number it worked (apart from switching) and now I readded everything with username Admin, and the same...

EDIT: Forgot that my first plug had a lot of Firmware updates... I'll add this one to the MyDlink app first and then try again.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Thursday 09 February 2017 1:46
by benboyte
dezde29 wrote:Hi,

I had the same problem but since I apply :

sudo apt-get install libpython3.4

From : http://www.domoticz.com/wiki/Linux#Prob ... ing_Python

Restart domoticz and Dlink has appear in the hardware list.

Hope it helps.
Thanks a lot, it worked for me.

Re: Handling HNAP - DLink DSP-W215 example

Posted: Saturday 11 March 2017 10:54
by dramich
Hi after upgrade to V3.6914
I have errors (maybe not errors but switch dont work) with my dsp-w215 switch:

(PIEC_OBIEG_WODY) Initialized version 1.1.0, author 'Dnpwwo'
2017-03-11 10:36:22.084 (PIEC_OBIEG_WODY) Devices created.
2017-03-11 10:36:22.085 PluginSystem: Starting I/O service thread.
2017-03-11 10:36:52.786 PluginSystem: Restarting I/O service thread.
2017-03-11 10:36:52.787 (PIEC_OBIEG_WODY) Device has disconnected
2017-03-11 10:36:52.787 PluginSystem: Starting I/O service thread.

Can You help me?

After enable debug mode got
2017-03-11 15:32:32.104 (PIEC_OBIEG_WODY) 48 54 54 50 2f 31 2e 31 20 35 30 30 20 49 6e 74 65 72 6e 61 HTTP/1.1.500.Interna
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 6c 20 53 65 72 76 65 72 20 45 72 72 6f 72 0d 0a 43 6f 6e 74 l.Server.Error..Cont
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d 6c 0d ent-Type:.text/html.
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 33 36 39 .Content-Length:.369
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d 61 ..Connection:.keep-a
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 6c 69 76 65 0d 0a 44 61 74 65 3a 20 53 61 74 2c 20 31 31 20 live..Date:.Sat,.11.
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 4d 61 72 20 32 30 31 37 20 31 34 3a 33 32 3a 33 31 20 47 4d Mar.2017.14:32:31.GM
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 54 0d 0a 53 65 72 76 65 72 3a 20 6c 69 67 68 74 74 70 64 2f T..Server:.lighttpd/
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 31 2e 34 2e 33 34 0d 0a 0d 0a 3c 3f 78 6d 6c 20 76 65 72 73 1.4.34....
2017-03-11 15:32:32.105 (PIEC_OBIEG_WODY) 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 ion="1.0".encoding="
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 69 73 6f 2d 38 38 35 39 2d 31 22 3f 3e 0a 3c 21 44 4f 43 54 iso-8859-1"?>.
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 59 50 45 20 68 74 6d 6c 20 50 55 42 4c 49 43 20 22 2d 2f 2f YPE.html.PUBLIC."-//
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 57 33 43 2f 2f 44 54 44 20 58 48 54 4d 4c 20 31 2e 30 20 54 W3C//DTD.XHTML.1.0.T
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 72 61 6e 73 69 74 69 6f 6e 61 6c 2f 2f 45 4e 22 0a 20 20 20 ransitional//EN"....
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 20 20 20 20 20 20 22 68 74 74 70 3a 2f 2f 77 77 77 2e 77 33 ......"http://www.w3
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 2e 6f 72 67 2f 54 52 2f 78 68 74 6d 6c 31 2f 44 54 44 2f 78 .org/TR/xhtml1/DTD/x
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 68 74 6d 6c 31 2d 74 72 61 6e 73 69 74 69 6f 6e 61 6c 2e 64 html1-transitional.d
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 74 64 22 3e 0a 3c 68 74 6d 6c 20 78 6d 6c 6e 73 3d 22 68 74 td">.
2017-03-11 15:32:32.106 (PIEC_OBIEG_WODY) 74 70 3a 2f 2f 77 77 77 2e 77 33 2e 6f 72 67 2f 31 39 39 39 tp://www.w3.org/1999
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 2f 78 68 74 6d 6c 22 20 78 6d 6c 3a 6c 61 6e 67 3d 22 65 6e /xhtml".xml:lang="en
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 22 20 6c 61 6e 67 3d 22 65 6e 22 3e 0a 20 3c 68 65 61 64 3e ".lang="en">..
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 0a 20 20 3c 74 69 74 6c 65 3e 35 30 30 20 2d 20 49 6e 74 65 ...
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 6f 72 3c 2f 74 rnal.Server.Error
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 69 74 6c 65 3e 0a 20 3c 2f 68 65 61 64 3e 0a 20 3c 62 6f 64 itle>....
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 79 3e 0a 20 20 3c 68 31 3e 35 30 30 20 2d 20 49 6e 74 65 72 y>...
500.-.Inter
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 6f 72 3c 2f 68 31 nal.Server.Error
2017-03-11 15:32:32.107 (PIEC_OBIEG_WODY) 3e 0a 20 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a .. >....

Re: Handling HNAP - DLink DSP-W215 example

Posted: Sunday 12 March 2017 8:41
by Dnpwwo
@dramich,

I did a big upgrade to the framework a week ago and broke some of the HTML functionality. I have pushed a fix today (request #1336) that should sort things out when it is merged hopefully later today.

Can you try that a report back if you still have issues.