Closed nvella closed 8 years ago
Everything checks out on my plugs. A shame you could not get the temperature or consumptions to work. If would be nice if they could publish a API for this thing :)
I will bump the version in home assistant during the weekend so the legacy support is included with the next home assistant release.
Nice π.
I did enquire with D-Link Australia regarding an IoT API in my emails, but then they just replied with the beta firmware. Not sure if it'd be worth the time asking them about the temperature and power consumption APIs.
I think they keep the platform quite closed unfortunately. They really want people to use their D-Link app/cloud solution and keep things in their infrastructure. Perhaps one day :smile:
Hey, would it be alright if I bumped the version number in HA? I understand if you're a bit busy. Edit: I also noticed that the version number in setup.py hasn't been bumped to match the new release (still on 0.2). That should be fixed before the bump in HA.
I have some state attr stuff for HA which would be nice to get into the same merge request. I will just write it up and fix the setup.py error.
Sounds good.
For some reason my switches cannot change state with the updates to HA. Could you pull my HA fork https://github.com/LinuxChristian/home-assistant and see if everything works with your switches? If it works I can send the PR and fix my issue while the changes gets merged.
The library works fine on its own and everything work with HA just not changing state. I have tried installing a fresh HA on a separate machine with no luck. Even though this is a HA issue I cannot create a PR before it has been resolved.
Just tried your fork and everything looks fine here. HA isn't throwing any errors?
My logs:
16-09-05 00:29:04 INFO (CP Server Thread-8) [homeassistant.core] Bus:Handling <Event call_service[L]: service=turn_off, domain=homeassistant, service_data=entity_id=switch.lounge_cornerlamp, service_call_id=140690595547064-5>
16-09-05 00:29:04 INFO (ThreadPool Worker 18) [homeassistant.core] Bus:Handling <Event call_service[L]: service=turn_off, domain=switch, service_data=entity_id=['switch.lounge_cornerlamp'], service_call_id=140690595547064-6>
16-09-05 00:29:07 WARNING (ThreadPool Worker 6) [pyW215.pyW215] Could not find TotalConsumption in response.
16-09-05 00:29:07 INFO (ThreadPool Worker 6) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state switch.lounge_cornerlamp=off; Current Comsumption=0 W, Temperature=0 β, icon=mdi:lightbulb, Total Comsumption=None W, friendly_name=Corner Lamp @ 2016-09-05T00:29:07.467172+10:00>, old_state=<state switch.lounge_cornerlamp=on; Current Comsumption=0 W, Temperature=0 β, icon=mdi:lightbulb, Total Comsumption=None W, friendly_name=Corner Lamp @ 2016-09-05T00:29:02.247665+10:00>, entity_id=switch.lounge_cornerlamp>
Great. Then it is perhaps only a local problem. I will send the PR to balloob and continue debugging my system π
I must have tested on the system libraries when I merged the PR because the new protocol does not work now. Removing the <Controller>1</Controller>
fixes my problems. I have made a legacy support flag to __init__
.
I had to close the PR until everything was fixed. The user will now get a legacy support flag option in the configure.yaml file in HA. Just need to clean it up and test. Then I will make a new PR tomorrow.
That's fine. I didn't originally think it'd be possible to use the same protocol on both firmwares but thought it would be worth a shot. Config option for specifying legacy support should be fine.
Hi again.
Firstly I'd like to say that I've been in contact with D-Link Australia and have obtained and flashed a firmware that identifies itself as V1.24B01Beta. There doesn't seem to be a difference between this and v1.24.
After comparing pyW215 to dsp-w215-hnap (which works, surprisingly), I found a few differences in the way dsp-w215-hnap authenticated and sent state change requests. After fixing these few differences, I have managed to get pyW215 working with my v1.24 plug.
Here's a list of what I managed to get working;
Working
state
state=
Not working
temperature
(returns 0 every time)current_consumption
(returns 0 every time)total_consumption
(logs warningCould not find TotalConsumption in response.
, possibly unsupported?)I'd recommend you test this patch with your 2.xx plug to ensure I haven't broken anything. I may try and work on
temperature
andcurrent_consumption
in the future, but that would most likely require me to decompile or reverse-engineer the phone app, as thedsp-w215-hnap
implementation doesn't work there either.