GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — Fix IOT KLAPv2 transport selection and class detection by thatdaveguy1 · Pull Request #1692 · python-kasa/python-kasa ConversationSummaryThis PR fixes two related regressions for IOT KLAP devices on newer firmware:
Why
Tests
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
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 <[email protected]>
|
There was an error while loading. Please reload this page.
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 Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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:
KlapTransportV2 for IOT KLAP devices when login_version >= 2.system.get_sysinfo-based device class detection during connect() for IOT plug/switch and bulb families (not just XOR).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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
✅ Independently confirmed this fix works on real hardware. I hit this exact bug on an HS103 (US) HW 5.0, FW 1.1.3 Build 250908 running on Home Assistant 2026.5.4 (python-kasa 0.10.2). Device reports with in discovery, but mapped it to (v1, MD5) — causing . I independently arrived at the same fix (upgrading to when ) before finding this PR. Validated by:
This is blocking real HA users — anyone with HS103/HS200/HS300/KP303 on newer firmware (HW 5.0+) can't add these devices. The fix is minimal, correct, and well-tested. Would love to see this merged. 🚀 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey Brad! Another Brad here confirming this against real hardware. I hit the same failure path in Home Assistant with a TP-Link HS103:
Before applying this patch, Home Assistant/python-kasa selected the normal I applied the same selection logic from this PR inside the HA container and restarted HA. A direct transport-selection probe then showed: After that, the HS103 began authenticating/querying successfully from Home Assistant: So this is another confirmation that IOT KLAP devices advertising |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed and tested.
KlapTransportV2 for IOT KLAP devices with login_version >= 2, and fixes device-class detection (sysinfo-based) for IOT plug/bulb families so strips aren't misclassified as plugs (#1691).tests/test_device_factory.py passes (1287 passed) with the new iot-klap-lv2 and sysinfo-class-detection cases.master: the 182 test_discover_raw failures are pre-existing on master too -- unrelated to this change.LGTM -- recommend merging.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
paging @rytilahti to review this PR |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I independently validated this failure and the two-part fix against a real HS300 power strip through Home Assistant. Environment and device:
Stock HA / A direct KLAP v2 handshake succeeded with the same credentials, and
After restarting HA, the reconfigure flow completed successfully and the config entry stored the credential hash. The sysinfo/class-detection part was also required: without that path, this HS300 gets treated as a generic So this PR matches the fix required for HS300 as well as the HS103 confirmations above: the transport change fixes auth, and the sysinfo class detection fixes child outlet/entity creation for strips. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGMT
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
There is already an existing, extensively tested PR that handles all of the CLI and API changes, #1580, we are working to get this implemented and a new version released soon. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Adding KP303 power-strip evidence for the two changes in this PR, also relevant to #1580. On 2026-09-02 I upgraded Home Assistant Core from 2026.7.2 to 2026.8.3, retaining a local backport on
After replacing the HA container and restarting, the real KP303 parent and all three child outlets were still present. The outlet states remained one ON and two OFF, matching the pre-upgrade snapshot; none of those outlets became unavailable. The candidate image also passed isolated checks with networking disabled: login version 1 selects Scope: this is evidence for an equivalent local backport and its HA restart/upgrade behavior, not a test of the complete #1692 or #1580 branch. The isolated class test calls the sysinfo class resolver, not the full |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I tried using this change for 2 of my HS200 that I updated and that stopped responding, it didn't work. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.