Fix IOT KLAPv2 transport selection and class detection#1692
Open
thatdaveguy1 wants to merge 1 commit intopython-kasa:masterfrom
Open
Fix IOT KLAPv2 transport selection and class detection#1692thatdaveguy1 wants to merge 1 commit intopython-kasa:masterfrom
thatdaveguy1 wants to merge 1 commit intopython-kasa:masterfrom
Conversation
Use KlapTransportV2 for IOT KLAP devices with login_version >= 2 and derive IOT plug/switch+b ulb classes from get_sysinfo so strips are not misclassified as plugs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1692 +/- ##
=======================================
Coverage 93.22% 93.22%
=======================================
Files 157 157
Lines 9815 9817 +2
Branches 1003 1004 +1
=======================================
+ Hits 9150 9152 +2
Misses 472 472
Partials 193 193 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes regressions affecting IOT devices using KLAP on newer firmware by selecting the correct KLAP transport for login v2 and ensuring correct device-class instantiation (e.g., strips vs plugs) based on system.get_sysinfo during connect().
Changes:
- Select
KlapTransportV2for IOT KLAP devices whenlogin_version >= 2. - Use
system.get_sysinfo-based device class detection duringconnect()for IOT plug/switch and bulb families (not just XOR). - Add unit tests covering both transport selection and KLAP device-class detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
kasa/device_factory.py |
Adjusts IOT connect path to derive class from sysinfo for plugs/bulbs and selects KlapTransportV2 for IOT KLAP login v2. |
tests/test_device_factory.py |
Adds tests asserting IOT KLAP login v2 uses KlapTransportV2 and that KLAP strips are instantiated via sysinfo detection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two related regressions for IOT KLAP devices on newer firmware:
KlapTransportV2for IOT KLAP devices whenlogin_version >= 2.system.get_sysinfoduringconnect()(not family-only mapping), so strips are correctly instantiated asIotStripinstead ofIotPlug.Why
KlapTransportfor devices that require v2._connect()only used sysinfo-based class detection for XOR.Tests
iot-klap-lv2coverage intest_get_protocolto assertKlapTransportV2for login v2.test_connect_iot_klap_uses_sysinfo_for_device_classto ensure KLAP strips are identified from sysinfo and not misclassified as plugs.