-
-
Notifications
You must be signed in to change notification settings - Fork 246
New Wi-Fi handling for SMART devices #1639
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1639 +/- ##
==========================================
+ Coverage 92.82% 92.86% +0.03%
==========================================
Files 157 157
Lines 9649 9698 +49
Branches 976 981 +5
==========================================
+ Hits 8957 9006 +49
Misses 492 492
Partials 200 200 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull request overview
This pull request adds support for a newer Wi-Fi connection process for SMART devices, including support for WPA3 and RSA-encrypted passwords. The changes introduce a fallback mechanism where devices first attempt to use the legacy get_wireless_scan_info API, and if that fails, fall back to the newer scanApList API with enhanced security features.
Key Changes
- Added dual-path Wi-Fi scanning with automatic fallback between
get_wireless_scan_infoandscanApListAPIs - Implemented RSA public key encryption for Wi-Fi passwords in the newer connection flow
- Extended the
WifiNetworkdataclass to support additional fields (auth,encryption) used by newer SMART devices
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| kasa/device.py | Extended WifiNetwork dataclass with optional auth and encryption fields for newer SMART device APIs |
| kasa/smart/smartdevice.py | Implemented dual-path Wi-Fi scanning and joining with RSA encryption support for newer devices, added instance variables for WPA3 support and public key tracking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Hey @ZeliardM and happy belated new year! Sorry for not getting back to you earlier, I added some comments to this PR and will try to review the rest of your open ones in a timely manner.
For this PR, I would suggest that we split the wifi handling into its own module to avoid overloading the base class with many implementation details. See my comments inline, and let me know what you think!
|
@rytilahti I was actually thinking since this is pertaining to the SmartCamDevice, I just create wifi_scan and wifi_join in the smartcamdevice.py files instead. I didn't realize the smartcamdevice.py used the same wifi_scan and wifi_join as the smartdevice.py and didn't have their own functions. Thoughts? It would change how I have this setup and make it cleaner since the new functions would be in there without the back and forth in the smartdevice.py |
Ah, it probabbly makes sense to move them there if that's the case, but I think we could still proceed to clean up the implementation and reuse the interfaces wherever it makes sense. Some parts of the scanning (fallbacks to other methods) will probably need some thought to see how it fits the best API-wise. |
|
I'll update everything after a bit and let you know when to take another look. I think the original implementation in the smartdevice.py was fine for those devices, we just need to add the functions to the smartcamdevice.py and have it use those instead of the ones in the smartdevice.py...will let you know. |
|
@rytilahti I made the following changes:
|
Updated scanning and joining Wi-Fi for SMART devices that may use a newer connection process.