Skip to content

Conversation

@dlee1j1
Copy link
Contributor

@dlee1j1 dlee1j1 commented Mar 20, 2021

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
Copy link

codecov-io commented Mar 20, 2021

Codecov Report

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

Impacted file tree graph

@@            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.

Copy link
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

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.

@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2021

Codecov Report

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

Impacted file tree graph

@@            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
Copy link
Contributor Author

dlee1j1 commented Apr 24, 2021

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.

@rytilahti rytilahti added the bug Something isn't working label Jan 24, 2022
@dlee1j1
Copy link
Contributor Author

dlee1j1 commented Jan 27, 2022

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.

@rytilahti
Copy link
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 rytilahti closed this Dec 8, 2023
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