bikerp / dsp-w215-hnap Goto Github PK
View Code? Open in Web Editor NEWTool for reading data from D-Link DSP-W215 Smart Plug
License: MIT License
Tool for reading data from D-Link DSP-W215 Smart Plug
License: MIT License
Hi ,
Your code is only for reading data, any idea on how to send on/off ?
Hi @thunderbird @bikerp @Bananis, not sure if you guys still interested in this but thank you for sharing your work here. With D-Link pulling IFTTT support, thought of controlling W110 plug with this script but I am getting login error : here are the details:
/dsp-w215-hnap/node_modules/promise/lib/done.js:10
throw err;
^
Login failed!
Thrown at:
at /dsp-w215-hnap/node_modules/promise/lib/done.js:10:7
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
I have 3 w215's setup as accessories and only the last one seems to work. The other three register, and show up in home kit, but turning any of them on always turns the last switch on. Same with turning it off.
Is it a config problem or is it a limitation? I'd appreciate any help you can offer. Here is my config:
config.json
{
"bridge":
{
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"accessories": [
{
"accessory": "w215",
"name": "Dlink1",
"host": "10.1.2.14",
"username": "admin",
"password": "edited"
},
{
"accessory": "w215",
"name": "Dlink2",
"host": "10.1.2.20",
"username": "admin",
"password": "edited"
},
{
"accessory": "w215",
"name": "Dlink3",
"host": "10.1.2.21",
"username": "admin",
"password": "edited"
}
]
}
Hi,
I tried this code and couldn't get it to read the temperature or power working.. I extracted the firmware and found some strings in the CGI module that implied the indexes were the other way around and lo and behold that worked.
However, I assume the ones in the repo work for you so it's a question of working out what they are supposed to be for a given device, and I have no clue on that :(
I have an Australian unit and the firmware is DSPW215A1_FW111b05.bin (i.e. A1 hardware).
Any chance to implement something for DLink DSP-W115?
I tried with this plugin, the accessory is showed into Home app (iOS) and it is connected, but when I turn it ON or OFF nothing happen. Thank you.
Hello bikerp,
Firstly, many thanks for sharing this code. It is fantastic and I have no idea how you did it!
In addition to a w215 I've also got a D-link DCH-S220 siren and was hoping to modify your code to control that device. I've had a dig around the available HNAP actions in the S220... but now I have no idea how to actually make the siren sound.
My question is, how did you work out how to turn the w215 on based only on the HNAP structure? For example, your code uses <controller>1</controller>
when activating the w215, but I can't find this anywhere in the HNAP for the w215.
Below are some of the available actions for the s220... Any ideas?
GetDeviceSettings
<GetDeviceSettingsResponse xmlns="http://purenetworks.com/HNAP1/">
<GetDeviceSettingsResult>OK</GetDeviceSettingsResult>
<Type>ConnectedHomeClient</Type>
<DeviceName>bedroom</DeviceName>
<VendorName>D-Link</VendorName>
<ModelDescription>D-Link Siren Alarm</ModelDescription>
<ModelName>DCH-S220</ModelName>
<DeviceMacId>6C:72:20:C5:1E:10</DeviceMacId>
<FirmwareVersion>1.22</FirmwareVersion>
<FirmwareRegion>Default</FirmwareRegion>
<LatestFirmwareVersion></LatestFirmwareVersion>
<HardwareVersion>A2</HardwareVersion>
<HNAPVersion>0124</HNAPVersion>
<PresentationURL>http://dch.local</PresentationURL>
<CAPTCHA>false</CAPTCHA>
<ModuleTypes>
<string>Audio Renderer</string>
</ModuleTypes>
<SOAPActions>
<string>http://purenetworks.com/HNAP1/Reboot</string>
<string>http://purenetworks.com/HNAP1/SetFactoryDefault</string>
<string>http://purenetworks.com/HNAP1/IsDeviceReady</string>
<string>http://purenetworks.com/HNAP1/GetDeviceSettings</string>
<string>http://purenetworks.com/HNAP1/SetDeviceSettings</string>
<string>http://purenetworks.com/HNAP1/GetDeviceSettings2</string>
<string>http://purenetworks.com/HNAP1/SetDeviceSettings2</string>
<string>http://purenetworks.com/HNAP1/GetGroupSettings</string>
<string>http://purenetworks.com/HNAP1/SetGroupSettings</string>
<string>http://purenetworks.com/HNAP1/GetSystemLogs</string>
<string>http://purenetworks.com/HNAP1/CleanSystemLogs</string>
<string>http://purenetworks.com/HNAP1/GetModuleSchedule</string>
<string>http://purenetworks.com/HNAP1/SetModuleSchedule</string>
<string>http://purenetworks.com/HNAP1/GetModuleEnabled</string>
<string>http://purenetworks.com/HNAP1/SetModuleEnabled</string>
<string>http://purenetworks.com/HNAP1/GetModuleProfile</string>
<string>http://purenetworks.com/HNAP1/SetModuleProfile</string>
<string>http://purenetworks.com/HNAP1/GetModuleSOAPActions</string>
<string>http://purenetworks.com/HNAP1/GetTimeSettings</string>
<string>http://purenetworks.com/HNAP1/SetTimeSettings</string>
<string>http://purenetworks.com/HNAP1/GetModuleGroup</string>
<string>http://purenetworks.com/HNAP1/SetModuleGroup</string>
<string>http://purenetworks.com/HNAP1/GetScheduleSettings</string>
<string>http://purenetworks.com/HNAP1/SetScheduleSettings</string>
<string>http://purenetworks.com/HNAP1/GetRecursiveSchedule</string>
<string>http://purenetworks.com/HNAP1/SetRecursiveSchedule</string>
<string>http://purenetworks.com/HNAP1/GetFirmwareStatus</string>
<string>http://purenetworks.com/HNAP1/GetFirmwareValidation</string>
<string>http://purenetworks.com/HNAP1/StartFirmwareDownload</string>
<string>http://purenetworks.com/HNAP1/PollingFirmwareDownload</string>
<string>http://purenetworks.com/HNAP1/CheckNewFirmware</string>
<string>http://purenetworks.com/HNAP1/SettriggerADIC</string>
<string>http://purenetworks.com/HNAP1/GetInternetSettings</string>
<string>http://purenetworks.com/HNAP1/GetCurrentInternetStatus</string>
<string>http://purenetworks.com/HNAP1/GetWLanRadios</string>
<string>http://purenetworks.com/HNAP1/SetTriggerWirelessSiteSurvey</string>
<string>http://purenetworks.com/HNAP1/GetSiteSurvey</string>
<string>http://purenetworks.com/HNAP1/SetAPClientSettings</string>
<string>http://purenetworks.com/HNAP1/GetAPClientSettings</string>
</SOAPActions>
<SubDeviceURLs></SubDeviceURLs>
</GetDeviceSettingsResponse>
GetModuleProfile
<GetModuleProfileResult>OK</GetModuleProfileResult>
<ModuleProfileList>
<ModuleProfile>
<ModuleID>1</ModuleID>
<ModuleNickName>Siren Alarm 1</ModuleNickName>
<ModuleCat>Reactor</ModuleCat>
<ModuleType>Audio Renderer</ModuleType>
<ModuleSubType>Siren Alarm</ModuleSubType>
<IsBuiltIn>true</IsBuiltIn>
<ModuleConnType>Not Available</ModuleConnType>
<ModuleGroupID>
<int>0</int>
</ModuleGroupID>
</ModuleProfile>
</ModuleProfileList>
</GetModuleProfileResponse>
GetModuleSOAPActions
<GetModuleSOAPActionsResponse xmlns="http://purenetworks.com/HNAP1/">
<GetModuleSOAPActionsResult>OK</GetModuleSOAPActionsResult>
<ModuleSOAPList>
<SOAPActions>
<ModuleID>1</ModuleID>
<Action>GetSirenAlarmSettings</Action>
<Action>GetSirenAlarmSettings2</Action>
<Action>SetSirenAlarmSettings</Action>
<Action>SetSoundPlay</Action>
<Action>SetAlarmDismissed</Action>
<Action>GetSirenAlarmLogs</Action>
<Action>CleanSirenAlarmLogs</Action>
</SOAPActions>
</ModuleSOAPList>
</GetModuleSOAPActionsResponse>
GetSirenAlarmSettings
<GetSirenAlarmSettingsResponse xmlns="http://purenetworks.com/HNAP1/">
<GetSirenAlarmSettingsResult>OK</GetSirenAlarmSettingsResult>
<ModuleID>1</ModuleID>
<NickName>Siren Alarm 1</NickName>
<Description>Siren Alarm 1</Description>
<SupportedSound>
<int>1</int>
<int>2</int>
<int>3</int>
<int>4</int>
<int>5</int>
<int>6</int>
</SupportedSound>
<DefaultSound>5</DefaultSound>
<Volume>11</Volume>
<Duration>3</Duration>
<OPStatus>true</OPStatus>
<IsSounding>false</IsSounding>
</GetSirenAlarmSettingsResponse>
You'll see there is a SetSoundPlay SOAP Action, but I'm not sure what it's expect in the message body to make it work.
Thanks in advance,
alex
Hi there, I am trying to run your package simply to try to turn my smartplug on and off.
But I have no idea, what my ´LOGIN_USER´ and ´LOGIN_PWD´ are supposed to be. I guess they are not the username and password I use to log into the dlink smarthome app, right?
I found that the data returned was invalid. I changed the module number for the consumption values from 2 to 3. And for the temperature modules from 3 to 2. Seems to work fine after that.
This does work with the D-Link W110 for interacting with the device. However there are different/missing sensors in the W110 which leads to intermittent errors when interacting through device using Homebridge; can still interact with device despite error. Am aware that this is not the intended device for this software, but may be helpful for others.
Hi there,
Sorry to bother but as you might know, D-link has discontinued the DSP-W215. So I cannot setup anymore the client. However, I would like to integrate it in a raspberry PI, at least for a certain purpose. You have in the wiki the tutorial how to Set up AP client
but there you mention " The element Key
contains encrypted password for you wireless network."
Please, do you know how to get my password encrypted? Can you provide a brief instruction how to encrypt the password in a way that the thing will recognize it. We cannot use the app anymore to setup the socket. Let's say I want to encrypt the password 1234
, how to I do that?
Thank you in advance,
I use DSP-W215 firmware 2.22 (latest) and when I run script, plug powers on.
I think has to do with the code that is send to plug. Is there any way to power on/off the plug from the script selecting by user variant?
Hi,
I have used your code and wrote this in JAVA to automatically read multiple devices temperature, active power and KWH. But after running these devices for more than 5 to 10 days, I have been receiving Internal Server Error 500.
Tested with the Python code also same result reads successfully for few days and suddenly stops with Internal Server error.
Any Ideas why ??
I've been using this node plugin for almost a year, alongside with Homebridge installed on a Synology NAS in Debian Chroot sandbox.
From 2 months ago, I'm now getting this error when the plug status is requested:
error: { [Error: connect EHOSTUNREACH]
code: 'EHOSTUNREACH',
errno: 'EHOSTUNREACH',
syscall: 'connect' }
[Mon Sep 17 2018 23:52:30 GMT+0200 (CEST)] [D-Link Smart Plug] Login failed!
error: { [Error: connect EHOSTUNREACH]
code: 'EHOSTUNREACH',
errno: 'EHOSTUNREACH',
syscall: 'connect' }
/usr/local/lib/node_modules/dsp-w215-hnap-master/node_modules/then-request/node_modules/promise/lib/done.js:10
throw err;
^
Error: This callback function has already been called by someone else; it can only be called one time.
at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/once.js:11:13
at DLinkPlug.<anonymous> (/usr/local/lib/node_modules/dsp-w215-hnap-master/index.js:50:13)
at tryCallOne (/usr/local/lib/node_modules/dsp-w215-hnap-master/node_modules/then-request/node_modules/promise/lib/core.js:37:12)
at /usr/local/lib/node_modules/dsp-w215-hnap-master/node_modules/then-request/node_modules/promise/lib/core.js:123:15
at flush (/usr/local/lib/node_modules/dsp-w215-hnap-master/node_modules/then-request/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:419:13)
IP has not changed (the plug regularly reply if I query it at http://<IP>/HNAP1
Note that curl http://<IP>/HNAP1
from the NAS correctly prints the soap actions list.
Can you help me?
I stumbled across this code from another site that referred to this Gitbug project. I have the presumably older DSP-W110 1.22 firmware. Using the code here while I can turn on a device attached to the Dlink it won't respond to turn off commands. I can't see any way to see what commands the device responds to since the /HNAP1 produces a message saying
This XML file does not appear to have any style information associated with it. The document tree is shown below.
and there is no XML below.
Any ideas how to find out what the OFF command string might be?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.