GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add Device.supports_module() and stop querying HomeKit for iot devices by rytilahti · Pull Request #1808 · python-kasa/python-kasa

Conversation

@rytilahti

@rytilahti rytilahti commented Oct 24, 2026

Copy link
Copy Markdown
Member

Some legacy iot firmware stops responding when an unsupported module follows system in a request, which made every update time out once the HomeKit query was added.

This stops querying HomeKit in update() and adds Device.supports_module() to check if a module is supported by the device. Downstreams can use it to decide whether to enable HomeKit support.

  • Device.supports_module(module) returns True if the device supports the module. The default implementation checks modules.
  • For iot devices, optional modules (only HomeKit for now) are checked with a separate query, and the result is remembered. A timeout counts as not supported and is not remembered. Retrying is left to the caller.
  • HomeKit is no longer registered by default, so Module.IotHomeKit and the homekit_setup_code feature are not available after update(). The data is still available e.g. using kasa command --module smartlife.iot.homekit setup_info_get.

This replaces #1792, which sends the HomeKit query separately on every update. The same separate query is now done at most once, and only when a downstream asks for it.

Fixes #1791
Fixes #1788

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasoncodes and cheeseandcereal reacted with heart emoji
All reactions
  • ❤️ 2 reactions
@rytilahti
Add Device.supports_module() and stop querying HomeKit for iot devices
4152bbc
Some legacy iot firmware stops responding when an unsupported module follows
`system` in a request, which made every update time out after the HomeKit
query was added (python-kasa#1791, python-kasa#1788).

HomeKit is no longer queried by update(). `Device.supports_module()` checks
whether the device supports a module, optional modules like HomeKit are
queried on their own and the answer is remembered.
@rytilahti rytilahti added the bug Something isn't working label Oct 24, 2026
@codecov

codecov Bot commented Oct 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (e29864b) to head (4a16906).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1808   +/-   ##
=======================================
  Coverage   93.43%   93.44%           
=======================================
  Files         160      160           
  Lines       10095    10110   +15     
  Branches     1042     1044    +2     
=======================================
+ Hits         9432     9447   +15     
  Misses        471      471           
  Partials      192      192           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti
rytilahti requested a review from ZeliardM October 24, 2026 00:40
@rytilahti

rytilahti commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

@ZeliardM let me know what you think about this approach to fix the issue with some firmwares being cranky about the homekit query. It would be great to get this in to the next release, while still allowing you to check for the homekit support :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rytilahti rytilahti mentioned this pull request Oct 24, 2026
fix: query IoT HomeKit separately to avoid legacy device timeouts #1792
Closed
@rytilahti rytilahti added this to the 0.12 milestone Oct 24, 2026
@rytilahti
Add tests for the remaining supports_module paths
4a16906
Cover the real-device unsupported answer, errors other than a timeout,
modules of the device for all device types, and HomeKit.info without data.
@ZeliardM

ZeliardM commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

@rytilahti I'm testing it now, should be good but just want to make sure.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeliardM ZeliardM mentioned this pull request Oct 24, 2026
[fix] Fix devices stuck after a failed write, slow writes during discovery, and Adaptive Lighting turning itself off ZeliardM/homebridge-kasa-python#396
Merged
11 of 18 tasks
ZeliardM
ZeliardM approved these changes Oct 24, 2026
View reviewed changes

@ZeliardM ZeliardM left a comment

Copy link
Copy Markdown
Collaborator

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.

LGTM! This will work great for how I need to check device module availability. Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rytilahti reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@rytilahti
rytilahti merged commit 30f5e4a into python-kasa:master Oct 24, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ZeliardM ZeliardM mentioned this pull request Oct 25, 2026
Add Python 3.15 to supported versions and update pins #1793
Merged
@rytilahti rytilahti mentioned this pull request Oct 25, 2026
Prepare 0.12.0 #1811
Merged
rytilahti added a commit that referenced this pull request Oct 25, 2026
@rytilahti
Prepare 0.12.0 (#1811)
a178fba
## [0.12.0](https://github.com/python-kasa/python-kasa/tree/0.12.0)
(2026-10-25)

This release include several compatibility fixes (updated accepted SSL
ciphers, removal of Homekit from the default update cycle).
The new API `Device.supports_module()` provide a way to find out if the
device supports some specific module, e.g., HomeKit, without including
it in the default update cycle.

[Full
Changelog](0.11.0.1...0.12.0)

**Fixed bugs:**

- Keep hub children when the child component list is missing
[\#1797](#1797)
(@Richardtristan)
- Strip multi-word rich tags when rich is not installed
[\#1807](#1807)
(@wolfgang-aura)
- Add Device.supports_module() and stop querying HomeKit for iot devices
[\#1808](#1808)
(@rytilahti)
- Keep multi requests for smartcam devices after a timeout
[\#1802](#1802)
(@hugaraujo)
- Consolidate SSL ciphers and use them in SslTransport
[\#1798](#1798)
(@rytilahti)
- Raise UnsupportedDeviceError instead of crashing on unknown device
types [\#1781](#1781)
(@GhostCoder6969)

**Added support for devices:**

- Add TD21(EU) device fixture
[\#1786](#1786)
(@Smugaski)
- Add P116M(IN) fixture
[\#1795](#1795)
(@Partha-dev01)

**Project maintenance:**

- Add Python 3.15 to supported versions and update pins
[\#1793](#1793)
(@rytilahti)
- Generate the changelog with git-cliff and draft releases in CI
[\#1809](#1809)
(@rytilahti)
- Build and check packages in CI and publish workflows
[\#1782](#1782)
(@rytilahti)

**Other changes:**

- Use the real discovery reply in the TD21 fixture
[\#1800](#1800)
(@Smugaski)
@rytilahti rytilahti mentioned this pull request Oct 25, 2026
Bump python-kasa to 0.12.0 home-assistant/core#188594
Merged
2 of 21 tasks
This was referenced Oct 26, 2026
Add HS103(US) hw 5.0 fw 1.0.3 fixture #1818
Merged
TP-Link HS103 issues home-assistant/core#185859
Closed
@rytilahti rytilahti mentioned this pull request Oct 26, 2026
Regression in python-kasa 0.11.0.1: KP100(US) Times Out on Combined IoT Requests (Works in 0.10.2) #1799
Closed
@jimjaeger jimjaeger mentioned this pull request Oct 28, 2026
TP-Link EP-10 plugs fail to initialize on HA Core 2026.10.4, home-assistant/core#189364
Closed
pillarsdotnet pushed a commit to pillarsdotnet/python-kasa that referenced this pull request Oct 30, 2026
@rytilahti
Add Device.supports_module() and stop querying HomeKit for iot devices (
4dd805f
python-kasa#1808)

Some legacy iot firmware stops responding when an unsupported module follows `system` in a request, which made every update time out once the HomeKit query was added.

This stops querying HomeKit in `update()` for IOT devices and adds `Device.supports_module()` API to allow checking if some module is supported by the device.
pillarsdotnet pushed a commit to pillarsdotnet/python-kasa that referenced this pull request Oct 30, 2026
@rytilahti
Prepare 0.12.0 (python-kasa#1811)
7ddf1ef
## [0.12.0](https://github.com/python-kasa/python-kasa/tree/0.12.0)
(2026-10-25)

This release include several compatibility fixes (updated accepted SSL
ciphers, removal of Homekit from the default update cycle).
The new API `Device.supports_module()` provide a way to find out if the
device supports some specific module, e.g., HomeKit, without including
it in the default update cycle.

[Full
Changelog](python-kasa/python-kasa@0.11.0.1...0.12.0)

**Fixed bugs:**

- Keep hub children when the child component list is missing
[\python-kasa#1797](python-kasa#1797)
(@Richardtristan)
- Strip multi-word rich tags when rich is not installed
[\python-kasa#1807](python-kasa#1807)
(@wolfgang-aura)
- Add Device.supports_module() and stop querying HomeKit for iot devices
[\python-kasa#1808](python-kasa#1808)
(@rytilahti)
- Keep multi requests for smartcam devices after a timeout
[\python-kasa#1802](python-kasa#1802)
(@hugaraujo)
- Consolidate SSL ciphers and use them in SslTransport
[\python-kasa#1798](python-kasa#1798)
(@rytilahti)
- Raise UnsupportedDeviceError instead of crashing on unknown device
types [\python-kasa#1781](python-kasa#1781)
(@GhostCoder6969)

**Added support for devices:**

- Add TD21(EU) device fixture
[\python-kasa#1786](python-kasa#1786)
(@Smugaski)
- Add P116M(IN) fixture
[\python-kasa#1795](python-kasa#1795)
(@Partha-dev01)

**Project maintenance:**

- Add Python 3.15 to supported versions and update pins
[\python-kasa#1793](python-kasa#1793)
(@rytilahti)
- Generate the changelog with git-cliff and draft releases in CI
[\python-kasa#1809](python-kasa#1809)
(@rytilahti)
- Build and check packages in CI and publish workflows
[\python-kasa#1782](python-kasa#1782)
(@rytilahti)

**Other changes:**

- Use the real discovery reply in the TD21 fixture
[\python-kasa#1800](python-kasa#1800)
(@Smugaski)
This was referenced Nov 3, 2026
Split KLAP IoT updates into smaller requests and validate KLAP responses #1829
Merged
KLAP HS100(UK) hw 4.1 fails after HA bumped python-kasa to 0.11.0.1: "Bad status line" on /app/request #1790
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeliardM ZeliardM ZeliardM approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

0.12

Development

Successfully merging this pull request may close these issues.

IoT HomeKit query ordering causes update timeouts for legacy devices in 0.11.0.1 HS110(UK) v4.1 beta firmware times out with the HomeKit probe in 0.11.0.1

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rytilahti @ZeliardM
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.