Page 1 of 1

Mydlink

Posted: Thursday 25 June 2015 13:02
by Varazir
Hi,

I wounder if I can control a Home WiFi Smart Plug (DSP-W215) from my domoticz
And if I can connect a DCS-935L ?

TIA
Daniel

Re: Mydlink

Posted: Friday 20 November 2015 21:29
by berkens
Somebody tried it for you and me:

viewtopic.php?f=17&t=6073#p39537

It is not possible due to the encryption using it in Domoticz.

Grtn Ben...

Re: Mydlink

Posted: Thursday 13 October 2016 20:06
by todip
Yes it's possible, i do that
see https://github.com/bikerp/dsp-w215-hnap

Re: Mydlink

Posted: Saturday 14 January 2017 10:23
by korniza
todip wrote:Yes it's possible, i do that
see https://github.com/bikerp/dsp-w215-hnap
It is working! :D

I suppose there is no way to control the on/off from domoticz. They are a cheap (crappy sometimes) way to control some plugs. I have 3 plugs and I suppose there are a lot of mates that did wrong on start and bought these starter kits from Dlink.
Hope for developers engagement and include D-link products to Domoticz.

Re: Mydlink

Posted: Saturday 14 January 2017 11:08
by korniza
looking around I found that also D-Link motion sensor DCH-150 uses the same protocol.
I do not know what can be the usage on polling a motion sensor but I like to add it on the common knowledge. :lol:

Re: Mydlink

Posted: Saturday 14 January 2017 12:18
by korniza
Very productive day! :D
I used the following script to power on/off DSP-W215 plug!!!
Responding is amazing as it is not using IFTTT. Firmware on the plug is the latest (2.22), so I need others owners to confirm that is working to other firmware versions.

https://github.com/nodeofgithub/DSP-W21 ... r/power.py

You need to provide the ip / pin (can be found on the back of plug) / and the command (on/off).
So we have the power consumption/temperature and the control. What is next? ;) ;)

Re: Mydlink

Posted: Saturday 14 January 2017 12:44
by korniza
We can read also the plug power status from a fork of first github repo
https://github.com/Bananis/dsp-w215-hnap/tree/patch-1 using a different app.js, which reports if plug is powered on. the hard is that the change on Domoticz will take some seconds to updated.

https://github.com/Bananis/dsp-w215-hna ... h-1/app.js

Re: Mydlink

Posted: Saturday 14 January 2017 18:34
by korniza
Developer request:
Can you build/add a entry on beta of domoticz for DSP-W215 plug? It is a 40 Euros plug with IFTTT integration. I can provide a donation for that.

Re: Mydlink

Posted: Wednesday 25 January 2017 12:52
by jelleeelco
Hi,

thank you so much for your work! I have these plugs, and I'm trying to use your script to get the on/off done. However, I can't work it out!

I have the script in /domoticz/scripts/python and called them OFF.py and ON.py. I made the script executable via chmod +x. When I run ./ON.py from the command line, it gives me multiple errors ("import: command not found"), pin: command not found, etc.

So I'm doing something wrong :) Did you add anything to the script other then what is on Github? I simply copied your code, made the ON.py script, made a dummy switch in Domoticz and used the ON.py and OFF.py for switching... but no luck.

Any direction or help would be GREATLY appreciated!!
Cheers
Jelle

Re: Mydlink

Posted: Wednesday 25 January 2017 14:26
by jelleeelco
Hi,

I think I got it to work more or less... stupid error! My findings,please correct me if I'm wromg:

- the commands have to be low capital, so 'on' and not 'ON'.
- when copying your code as-is, it doesn't work. I have to add the following at the start of the script: #!/usr/bin/python
- it doesn't run with the IPaddress, pincode and command from in the script. If I use SSH and run the script, it tells me:
USAGE: ./ON.py <ipadress> <pin> <off>
- If i then do that in SSH, so:
./ON.py '192.168.1.31' '890789' 'on'
and the light switches on! And off if I choose 'off' of course.

So I'll create a .sh script, and in that script just execute the above SSH line.

Is this the way your code is intented? Or am I completely missing the point!?
Thanks!!
Jelle

Re: Mydlink

Posted: Wednesday 25 January 2017 14:47
by jelleeelco
ah, update. Got it to work.

- Create script with your code and add #!/usr/bin/python to the top.
- In Domoticz, create dummy switch (first create dummy hardware if you don't have on yet)
- To turn it on: script://python/power.py '192.168.1.31' '890765' 'on'
- to turn it off: script://python/power.py '192.168.1.31' '890765' 'off'

Were the IP address is the IP address of the Dlink Plug (duh..but I got it wrong at first!) and the number is your pin.

Now going to look at your status code. Many thanks so far, you have made a huge contribution!! I'm a complete idiot when it comes to coding so depend on people like you to make this happen.

Re: Mydlink

Posted: Saturday 28 January 2017 22:09
by korniza
great news guys!
We need to thank Dnpwwo for his great work! :D
Now you can put the file you will find on the link and put it under the folder plugin/DSP-W215 (you have to create the folder first). After that restart domoticz. Go to Hardware and add new device searching for Dlink smart plug DSP-W215!!! :D
Please test it are respond any issues.
http://www.domoticz.com/forum/viewtopic ... 65&t=15753

Re: Mydlink

Posted: Friday 13 April 2018 13:11
by skorpion03
Hello to all,
I have a problem with these sockets, I can safely turn them on and off via Domoticz but it is not clear how I can display in Domoticz the various data such as current consumption (W) and temperature (c).

I have read and downloaded the files at https://github.com/bikerp/dsp-w215-hnap/wiki but it is not clear how to use the files.


I make a trivial example,
to know if the device is online I should use this string


<soap: Envelope xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http : //schemas.xmlsoap.org/soap/envelope/ "> <soap: Body>
<IsDeviceReady xmlns = "IP-DEVICE / HNAP1 /" /> </ soap: Body>
</ Soap: Envelope>

in the wiki we talk about HNAP_AUTH and Cookie, where these codes must be entered?


the answer I would get is:

<? xml version = "1.0" encoding = "UTF-8"?>
<soap: Envelope xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: xsd = "http://www.w3.org/2001/XMLSchema" xmlns: soap = "http : //schemas.xmlsoap.org/soap/envelope/ "> <soap: Body>
<IsDeviceReadyResponse xmlns = "IP-DEVICE / HNAP1 /"> <IsDeviceReadyResult> OK </ IsDeviceReadyResult> </ IsDeviceReadyResponse>
</ Soap: Body>
</ Soap: Envelope>


Where should I enter this information in Domoticz?

Is it possible to have a step by step guide? it could also be useful to others


thank you so much