FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fixes for powerstrips initialized using the discover protocol by dlee1j1 · Pull Request #149 · python-kasa/python-kasa · GitHub

Repository navigation

Fixes for powerstrips initialized using the discover protocol - #149

Closed
dlee1j1 wants to merge 23 commits into
python-kasa:masterfrom
dlee1j1:master
Closed

dlee1j1 wants to merge 23 commits into
python-kasa:masterfrom
dlee1j1:master

Conversation

dlee1j1 commented Mar 20, 2021

Copy link
Copy Markdown
Contributor

Two chunks of changes:
(1) when powerstrip is discovered, initialize its children in addition to the parent

(2) For my device (KP400), during direct TCP sysinfo calls, the child deviceId returned is parent device id + child index. This ID is expected by the device for the query call. However, during discovery the child deviceid is only the child index which makes query calls fail.
I don't know if other or older devices worked with just the child index (the tests seem to indicate that) so the code now tries both

codecov-io commented Mar 20, 2021 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #149 (7f08895) into master (2fe1b20) will increase coverage by 0.27%.
The diff coverage is 67.85%.

@@            Coverage Diff             @@
##           master     #149      +/-   ##
==========================================
+ Coverage   73.24%   73.51%   +0.27%     
==========================================
  Files          11       11              
  Lines        1241     1265      +24     
  Branches      183      186       +3     
==========================================
+ Hits          909      930      +21     
  Misses        299      299              
- Partials       33       36       +3     
Impacted Files Coverage Δ
kasa/smartstrip.py 76.51% <64.70%> (-1.69%) ⬇️
kasa/discover.py 44.53% <72.72%> (+4.35%) ⬆️
kasa/__init__.py 100.00% <0.00%> (ø)
kasa/smartdevice.py 82.94% <0.00%> (+0.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fe1b20...7f08895. Read the comment docs.

rytilahti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hi, thanks for the PR & sorry for the delay! I did a brief review and added some comments inline. Just as a side note, my KP303 works with the current IDs just fine.

Comment thread kasa/discover.py Outdated
Comment thread kasa/discover.py Outdated
Comment thread kasa/smartstrip.py Outdated

codecov-commenter commented Apr 24, 2021 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #149 (c53abc9) into master (bcb9fe1) will decrease coverage by 0.55%.
The diff coverage is 61.40%.

@@            Coverage Diff             @@
##           master     #149      +/-   ##
==========================================
- Coverage   82.15%   81.60%   -0.56%     
==========================================
  Files          12       12              
  Lines        1317     1348      +31     
  Branches      195      202       +7     
==========================================
+ Hits         1082     1100      +18     
- Misses        196      206      +10     
- Partials       39       42       +3     
Impacted Files Coverage Δ
kasa/cli.py 58.73% <44.82%> (-1.87%) ⬇️
kasa/discover.py 75.70% <63.63%> (-0.54%) ⬇️
kasa/smartstrip.py 90.96% <87.50%> (-0.65%) ⬇️
kasa/smartdevice.py 86.26% <100.00%> (+0.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcb9fe1...c53abc9. Read the comment docs.

dlee1j1 commented Apr 24, 2021

Copy link
Copy Markdown
Contributor Author

Hi, thanks for the PR & sorry for the delay! I did a brief review and added some comments inline. Just as a side note, my KP303 works with the current IDs just fine.

Mine works with the pykasa cli because it grabs get_sysinfo from the direct TCP call. That one returns the full child ID (with the parent ID pre-pended). I found this problem in my Home Assistant branch which avoids that TCP call by pulling in the sysinfo data from the discovery call.

Comment thread kasa/smartstrip.py
rytilahti added the bug Something isn't working label Jan 24, 2022
Comment thread kasa/tests/test_discovery.py Outdated
Comment thread kasa/smartstrip.py Outdated
Comment thread kasa/discover.py Outdated
Comment thread kasa/smartstrip.py
Comment thread kasa/discover.py

dlee1j1 commented Jan 27, 2022

Copy link
Copy Markdown
Contributor Author

I also added a new CLI option to set the state of the device using discovery info. That allows you to test with the actual device. You can try to see if your KP400 has the same behavior as mine by filling the data with --use_discovery then trying to set the state one of the plugs.

If I back out the exception code in SmartStrip.py it fails for mine.

Copy link
Copy Markdown
Member

To my understanding this has been fixed through other means & there has been many, many changes to how the devices are initialized, so I think we can close this now. If there are still issues with these, it probably makes sense to fix those in a separate PR anyway :-)

rytilahti closed this Dec 8, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL