D-link W215 Switch firmware update stopped them from working with HA

I updated some of my D-Link W215 Switches (AU/NZ) from version 1.24 to 1.25. I use Hass.io version 0.50.

HA still seems to be able to connect and report if the switch is on or off. But unable to turn the switch on or off.

I left one running 1.24 and it still works. I have tried setting use_legacy_protocol to false and that causes them to not connect at all.

Thank you

Yep, I have the same issue. Unfortunately, the pyw215 library that the Dlink component uses has only been tested against 1.24 with partial support.

Start:rant
Who built this useless myDlink app? The usage statistics view is a joke. I canā€™t go back to seeing previous billing cycles. I canā€™t even see actual usage values but only a graph.

I was hoping to use HASS to capture the statistics for some useful info but with the new firmware thatā€™s off the table as well.

I also think the AU/NZ versions are still on a older hardware version. That probably means we wonā€™t see the 2.x firmware either.
End:rant

I think I am going to give up on these D-link switches and get something else ._.

I have three d-link switches and all prompted to update firmware when I first plugged them in. I am only just getting into HA and have been bashing my head against a wall trying to figure out what I was doing wrong - sounds like its the hardware not me.

So we have H/W Ver A2 which shipped with FW 1.24 and is now 1.25 and you are saying all these drivers that work with 2.xx are based on a newer hardware board internally so ours may never see this upgrade (yes I understand for the AU plug we are on a different version but internally I thought they should have been pretty similar to the eu version.)

Assumptionsā€¦ Anyone else suggest a cheap piece of hardware that does switching and monitoring?

Hi guys, I just bought one AU plug as well and got updated to 1.25 straight away.
Same as you HA cannot talk with it for now.
But I have reported the bug to the pyW215 author and just found a way where we could have it working again.
(https://github.com/LinuxChristian/pyW215/issues/22)
So hopefullly a permanenet fix can be in place soon and later integrated to HA again.

Otherwise, when investigating for smartplug with power monitor (and support in HA), I could not find much else with AU plug, so interested as well if someone has some other options!

Cheers

@hcooh I literally just found your issue thread over at pyW215 and headed here to post about the progress being made.

My investigations were not as scientific but I did find that the plug was returning an ERROR response to an auth request. I did think it was something to do with session timeouts but didnā€™t have the time to look into it.

Thanks for your work on this!!!

No worries,

The code change has been pushed to HA, so it should work from the next release onward for 1.25 firmware.
Unfortunately we have not tested if the changes are still working on 1.24 firmware or if it breaks thingsā€¦
So if someone has 1.24 and experiences issues at the next HA release, let us know!

Just what I was looking for, thanks guys.
BTW how often does HA update?

Usually every 1 or 2 weeksā€¦
See stats here: HA Release stats

So, Iā€™ve got the update 0.53, but D-Link W215 switches are still not working, does 0.53 contain the fix?
Log message ->
2017-09-12 07:28:24 WARNING (SyncWorker_8) [pyW215.pyW215] Unable to open a connection to dlink switch http://192.168.1.*

Hi @bedo2405,
You are on dlink firmware 1.25, right?
Yes, looking at the git commit for 0.53, the fix for firmware 1.25 has made its way in.
While updating HA, it should have pulled the version 0.6 of pyW215 library. Maybe you can start by checking that this is the version of the lib installed in the HA environment?
Make sure you have the ā€œuse_legacy_protocol: Trueā€ line in your configuration file.
I am sure you have checked but is the IP address correct?
Also, looks unrelated to your problem, but looking at the history, some changes in the name of the switch attributes occured:
history of dlink for 0.53

1 Like

Thanks heaps for the reply.
My config looks like this ->

switch:

  • platform: dlink
    name: Bedroom Lamp
    host: http://192.168.1.51
    username: admin
    password: ******
    use_legacy_protocol: true
  • platform: dlink
    name: Mood Lighting
    host: http://192.168.1.50
    username: admin
    password: ******
    use_legacy_protocol: true

Iā€™ve double checked the IPs and pin numbers. What else could it be?
BTW, Iā€™m running hassio, how do I check I have 0.6 of pyW215 library?

after update to 0.53 and checking my /usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/dlink.py

I think my dlink.py is still on 0.5.1 (REQUIREMENTS = [ā€˜pyW215==0.5.1ā€™])
The attribute name are still in capitals.
ATTR_CURRENT_CONSUMPTION = ā€˜Current Consumptionā€™
ATTR_TOTAL_CONSUMPTION = ā€˜Total Consumptionā€™
ATTR_TEMPERATURE = ā€˜Temperatureā€™

Did a manual replace of the file and restart the service and its now WORKING!! woohoo! honestly it was the very reason I started to use HA. Still new to this but I can cant wait to automate all of it.

@Leo-R_Lee, Glad that it is working again for you. Not too sure why it did not pull pyW215 0.6 by itselfā€¦
I just upgraded HA to 0.53.1 and it did pull pyW215 0.6 normally.

@bedo2405, I am not too sure how to check on Hassioā€¦ but maybe by increasing the log level, it will tell us more. you could put the following in your configuration.yaml (and restart HA):

logger:
 default: error
 logs:
   homeassistant.components.switch: debug

This is all I get ->
2017-09-21 21:15:27 INFO (MainThread) [homeassistant.components.switch] Setting up switch.dlink
2017-09-21 21:15:27 INFO (SyncWorker_3) [pyW215.pyW215] Enabled support for legacy firmware.
2017-09-21 21:15:27 WARNING (SyncWorker_3) [pyW215.pyW215] Unable to open a connection to dlink switch http://192.168.1.50
2017-09-21 21:15:28 WARNING (SyncWorker_14) [pyW215.pyW215] Failed to open url to http://192.168.1.50

Hi @bedo2405,

So it seems, the pyW215 cannot establish a proper request to the url of the plugā€¦ Coming from:

try:
            response = urlopen(Request(self.url, payload, headers))
        except URLError:
            if self._error_report is False:
                _LOGGER.warning('Unable to open a connection to dlink switch {}'.format(self.ip))
                self._error_report = True
            return None

At this stage the authentication process has not even started so it seems there is something wrong with either the plug not being reachable or your hassio installation has some broken things around the needed requests ?
The issue you are experiencing is not connected with the recent changes in the library.

Are you able to control the plug with the dlink app ? In which case it would indicate something is wrong with hassioā€¦
I am not familiar with hassio, is there a way we can execute some custom python code to try to debug what is wrong ?

I have been having issues for a number of weeks now (after the upgrade to 0.53), but it is nof for all W215 plugs Iā€™m using. Iā€™m on HASSIO. First, all switches can still be controlled through the D-Link App. Four switches which are directly connected to the WLAN of my Fritzbox router work perfectly fine through HA. Three switches I have connected to an access point on the second floor of my house, I no longer can control through HA (these still work with the DLink App). I also went back to my old all-in-one installed HA on 0.52 and everything worked fine again. I then upgraded the all-in-one installer to 0.55 and the same problem is there. My log is showing ā€œunable to open a connection to dlink switch xyzā€. Very interesting why switched work that are directly connected to my Fritzbox WLAN, but not to the access point. Is there a delay factor or something in the component?

Hi @Felix ,

That is really interesting indeed. It looks like it could be the same issue as @bedo2405 . And you are both using Hassio.

Are all the switches identical? Have you tried to switch one from downstairs to upstairs? (or reverse, just as a sanity check)
Can you check the firmware version for each plug ? (in the dlink app)
Are you using the legacy protocol ?

The changes in the dlink library that got merged for 0.53, only changes the way the legacy protocol talks to the switch, nothing else.
And given the error you have it does not seem to even reach that stage as it does not get an answer from the plug.
Let me know the details mentioned above and if you are available there are a few things we can try to find out what is going onā€¦

Yes Iā€™m on Hasio

Iā€™m on Hassio. However, I also did go back to my old installation (all in one installer) and all plugs worked again. Then I upgraded to to the latest version and I have exactly the same issues as with Hassio (certain plugs not working). I did move switches around but the switches on the second floor donā€™t work. All plugs have firmware version 2.22. I do not have legacy protocol activated. Appreciate your help!