-
-
Notifications
You must be signed in to change notification settings - Fork 223
TP Link Dimmer switch (HS220) hardware version 2.0 not being discovered #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This needs some investigation for the best approach. The library currently uses |
The HS220 2.0 hardware is relatively new / was launched in July from what I can tell. Previous HW versions still seem to work ok with the current code, but the new HW/FW does not. I got the library up and running on Ubuntu if there are any tests I can run/help with. Can also grab packet captures/etc if helpful. |
Could you modify the discovery request manually only to contain the sysinfo request and create a PR to add the devinfo file ( The |
Oddly, when I make that change discovery just seems to hang. It works fine in the older pyHS100 version running on HA, but that doesn't seem to have a dump-discover command? Perhaps I can take the debug output from pyHS100 and manually build the devinfo file? |
Turning --debug on, discovery works ok and sees all the devices with the modified string, but I see it hanging on:
|
PR submitted. Please review as I pieced together this fixture from the debug output, as I was not able to ever get it to save from Can share the raw debug logs via a non-public channel if helpful. |
Hmm, looking at the file, it still has all those services available? Which parts did you "glue" manually to it? I have seen some devices not being always responsive to the discovery requests, maybe this hw 2.0 is such? Can you please do repeat the discovery multiple times to see if it works sometimes (without the query modification)? |
I built it from the debug output, which looked like this:
|
Discovery works 100% of the time with the query modification (though the CLI tool hangs; likely a separate issue). Without the query mod, they don't ever discover from what I've seen so far. |
This is the culprit for why discovery was hanging even with the modified discovery string: python-kasa/kasa/smartdevice.py Line 302 in c59b748
The emeter requests are what the v2.0 hw/fw don't like, so the logic to " # Check for emeter if we were never updated, or if the device has emeter" fails. If I replace the line above with a pass, I successfully generate the device profiles. Updating PR with the "real" profile now: |
Appleguru, can you explain how you're implementing the fix? I am not very familiar with Python. To at least try something, I tried to comment out lines 301 and 302 and that didn't change anything. Unfortunately, I am a little desperate trying to get the led indicator off on a v2 hs220 as it is waking up my children at night. Any help would be greatly appreciated. |
Try commenting out this line: Line 140 in c59b748
And then replace this line with “pass”: python-kasa/kasa/smartdevice.py Line 302 in c59b748
|
Adam, thank you so much. The line on discover.py was on 134, not 140, but other than that, that worked great. Now the wife is happy and I am happy. |
I have a number of TPLink dimmers which are not being discovered automatically. I'd like to utilize this updated integration but, being new to HA, I don't know how to install. Is there a timeline on inclusion of this update with stable versions of HA? If not, where would I find instruction on how to add the revised integration to HA? Regards |
If you're running a "managed" HA system (You have a "Supervisor" tab), you can follow my instructions here to apply this fix to HA: home-assistant/core#39395 (comment) |
I'm running HassOS 5.3 on a RPi. I see the supervisory tab but don't know which tool to use to execute the commands. I tried issuing the commands noted in the solution from a terminal window (SSH & Term add-on) but received an error. I'm new to Linux and HA, thus my knowledge in these areas is somewhat limited. What tips could you offer that might point me in the right direction? |
What error did you receive? If you're using the Terminal add on, make sure you Disable "protection mode" so that you can actually run useful commands.. |
That was it! I disabled "protection mode" made the change and rebooted. Now all devices are discovered. Thank you for the tip. |
What can I do to help with this issue? @appleguru do you know? I have an HS220 that is experiencing the issue, I can develop in Python, and I'd like to help. |
I am having an issue where HS103 switches with latest firmware are not being discovered and need to be manually configured to work. I intended to simply open a documentation PR, but by reading this read it seems that it is fixable by tweaking the module? Would you rather get a PR for that? |
We'd always prefer a PR :) Please don't forget to provide dumps and tests for the specific device! |
So I have been thinking about how to handle this neatly, but I'm not completely sure how to do it. Here a couple of thoughts:
@Belval if you want to give it a shot, I'd be happy to do code review & help with testing :-) |
Ok, so to modify the discovery process I added a parameter called You can see those changes here: Belval@32dc52a As for the last point, I saw that there was already an I am still not sure about the second point though, shouldn't the current changes address it? EDIT: I'll be waiting for your ok before opening a PR, just to make sure that I am not 100% off with what you had in mind. |
@Belval I created a PR with some existing cleanups I had done locally previously, which allow dimmer detection using only the data accessible in I also added some comments to the commits you linked, please feel to create a PR (even when it's not ready yet) as they are much easier to comment on and the CI will be run automatically (which should have spotted those issues I mentioned in the comments :-). |
Uh oh!
There was an error while loading. Please reload this page.
TP Link Dimmer switch (HS220) hardware version 2.0 not being discovered. All other TP Link switches, bulbs, and plugs are successfully discovered.
Relates to home-assistant/core#39395
While I don't currently have a good environment to test python-kasa in currently, I was able to fix this on home assistant by manually editing the old
pyHS100/discover.py
that it uses.Specifically, I changed
class Discover: DISCOVERY_QUERY = {"system": {"get_sysinfo": None}, "emeter": {"get_realtime": None}}
to
class Discover: DISCOVERY_QUERY = {"system": {"get_sysinfo": None}}
and then was able to successfully discover and use the version 2.0 dimmers.
I suspect a similar modification to python-kasa's discover.py will fix it here too:
python-kasa/kasa/discover.py
Line 138 in c59b748
The text was updated successfully, but these errors were encountered: