-
-
Notifications
You must be signed in to change notification settings - Fork 247
Fixes for powerstrips initialized using the discover protocol #149
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
rytilahti
left a comment
There was a problem hiding this 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 Report
@@ 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
Continue to review full report at Codecov.
|
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. |
Co-authored-by: Teemu R. <tpr@iki.fi>
|
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. |
|
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 :-) |
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