Developing a Binding for DLink Plugs

Thankyou for you brilliant explanation, in my ignorance I didn’t realise JAR files had to stay complete. I understand how it works now.

1 Like

First version of the DLink smart home binding with the plug integrated into it has been uploaded. The link is in the first post of this thread.

I am going to leave it running on my system for several days before submitting the code. For those of you with other plug versions, if you could try it out and test to be sure it can get the data for your plugs that would be appreciated. At the moment I am running under the assumption that all plug models use the same parameter configurations, however it would not surprise me if that assumption is wrong.

Hopefully this version has eliminated the freezing problem thanks to @MikeJMajor

1 Like

Some information for the community.

These DLink smart plugs have minimal security, in fact it seems that many of the DLink smart devices have the same flaw. They are protected by a minimal 6 digit number which is easily brute forced, which means for anyone on your network they are an easy target.

More recently I discovered that even your network is not a security layer for them. It seems that my plugs never turn off the setup wifi network. Which means they are constantly broadcasting an unsecured network available to anyone who wants to hack into them.

While this binding does make them very convenient and simple to use, this is one of the biggest security flaws I have found so far in smart devices. I would recommend avoiding them due to this.

1 Like

@Jereme_Guenther did the changes to using the Jetty HTTP client resolve your freezing issues?

The DLink smart home binding has now been merged into the master if you are still considering adding support for the smart plugs.

Yes, Jetty fixed my issues.

My code should be submitted, is it not on git? I have not submitted a pull request for it yet because it has not been cleaned up to community standards. But it does function great, I am currently using it.

Where is the latest code and instructions for W215, these are selling very strongly here. But a bit flaky on the dlink app

The very first post in this thread has a link to the compiled jar file. The source code is all on Github.

I have put the file in addons folder and restarted. However it doesn’t come up on paperui- what am I doing wrong?

@MikeJMajor might be able to help you, I have not had time to mess with openhab in a couple of months. I think it should just show up. Where are you trying to find it in paper ui?

Looking under bindings, but kinda looked around all over the place for it.

Any help would be appreciated as it core functionality for me

If you login to the karaf console and type bundle:list do you see any bundles with dlink in the name?

I have the same issue, bundle:list shows both D-link bundles ->
D-Link Smart Home Binding
DLinkSmartPlugs Binding
but I can only see the “D-Link Smart Home Binding” bundle in paperui bindings.
Any idea?

Oops, I had the wrong plugin, so the binding now appears in paperui, yippee. However the plugs still don’t work after adding them manully. The error I’m getting is ->
Status: OFFLINE - CONFIGURATION_ERROR Can not contact device, UNSUPPORTED_FIRMWARE
The firmware I have is 1.25
Any help appreciated

First, I’d like to thank you for this plugin, it’s cool. :slight_smile:

Do you have an updated code somewhere, where you’ve fixed the lock-up issue? I couldn’t find it in your Github repo.

Also, do you have any plans to do the finishing touches, and make a pull request?

The lock-up issue was fixed by @MikeJMajor. The code base it was being developed under was moved: https://github.com/openhab/openhab2-addons/pull/2035

I do not see any commits from me in his code, so I may never have actually submitted the changes. I remember I was waiting for his work to be approved so I would not mess up his pull request. My code was finished and functioning, however variable names etc did not match community standards, which is why I never submitted an official pull request.

The very first post in this thread has a link to the compiled functioning jar file that I use in my own openhab2 installation.

I just tried syncing my code base with @MikeJMajor s, and it said I did not have permission to do so. Perhaps he revoked it, or I did something wrong. I have no problem giving the code to someone, at the moment I am working on location aware algorithms for my house and don’t have time to struggle through github and spiffing up the code.

I am not a huge fan of github, I find it very clunky and painful to use, so whenever I am forced to use it it is very slow going.

@Jereme_Guenther So if I read this thread correctly, the binding is not available within OpenHab2 but can be installed manually? Also will it work with DSP-W110? Thanks

@Rathna-K Yes, that is all correct. DSP-W110 is the model I used during development.

Thanks, I am downloading now. How do I create a thing file? is there an example for that? And the below is still right for Items and Sitemap? And finally, do I need to do the PaperUI config as mentioned below? I am running off of Raspberry Pi so if I need to make that change can you tell me where this would go? Thanks in advance!

ITEMS:
String DSPW215 “dsp-w215” { channel=“exec:command:internetplug:input”}
String DSPW215s “dsp-status [%s]” { channel=“exec:command:testplug:output”}

SITEMAP:
Switch item=DSPW215 mappings=[“on”=“on”, “off”=“off”]
Text item=DSPW215s

PAPERUI config:
internetplug (interval=0 autorun=on):
node C:\dsp-w215-hnap-master\app.js %2$s
testplug (interval=10, autorun=off):
node C:\dsp-w215-hnap-master\app.js state

@Jereme_Guenther getting this exception. maybe conflicting names for existing binding from openhab 2.3 snapshot?

11:42:50.365 [ERROR] [org.openhab.binding.dlinksmarthome   ] - FrameworkEvent ERROR - org.openhab.binding.dlinksmarthome
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.dlinksmarthome [289]
  Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version="2.3.0.201802191719"; osgi.identity="org.openhab.binding.dlinksmarthome"; singleton:="true"

        at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1620) [?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1600) [?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1571) [?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1514) [?:?]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [?:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]

That could be true, especially if the version without the plug code in it has been integrated.

I’ve been buried in upgrading my camera system for the last half year or so. I would still like to finish up this binding, however due to the security issues in the DLink firmware I am certainly not promoting getting their stuff.