FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Keep hub children when the child component list is missing by Richardtristan · Pull Request #1797 · python-kasa/python-kasa · GitHub

Repository navigation

Keep hub children when the child component list is missing - #1797

Merged
rytilahti merged 1 commit into
python-kasa:masterfrom
Richardtristan:fix/hub-missing-child-component-list
Oct 24, 2026
Merged

rytilahti merged 1 commit into
python-kasa:masterfrom
Richardtristan:fix/hub-missing-child-component-list

Conversation

Copy link
Copy Markdown
Contributor

Fixes #1796

Problem

Some hubs intermittently return a getChildDeviceComponentList result without the child_component_list key. I hit this on an H200 with no child device paired (firmware 1.7.7 Build 20260917). Every update then failed in _create_delete_children() with KeyError: 'child_component_list', and all of the hub's entities became unavailable in Home Assistant.

The response is most likely an empty dict. A result without start_index/sum skips _handle_response_lists() and reaches _create_delete_children() unchanged.

Change

When the list is missing, children are neither created nor deleted for that update, and a debug message is logged. Treating the response as an empty list would delete the known children of a hub that has some, so they are kept until the next complete response.

Tests

test_dynamic_devices now also covers a component list response without the list:

  • on a hub with children, the children are kept;
  • on a hub without children, the update no longer raises and there are still no children.

Ran locally on tests/smart, tests/smartcam, tests/test_childdevice.py and tests/protocols: 4491 passed, 175 skipped. ruff check, ruff format --check and mypy pass on the changed files.

A one-line .get("child_component_list", []) version of this fix has been running on my H200 since the issue was opened, with no more errors.

Some hubs intermittently return a getChildDeviceComponentList result
without the child_component_list key. Seen on an H200 without any child
device paired (firmware 1.7.7 Build 20260917): every update then failed
with KeyError: 'child_component_list' in _create_delete_children and all
of the hub entities became unavailable.

Skip creating and deleting children for that update instead of failing.
Treating the response as an empty list would delete the known children
of a hub that has some, so they are kept until the next complete
response.

codecov Bot commented Oct 12, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (38a3184) to head (344b431).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1797   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files         159      159           
  Lines       10113    10116    +3     
  Branches     1043     1044    +1     
=======================================
+ Hits         9447     9450    +3     
  Misses        472      472           
  Partials      194      194           

☔ 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.

rytilahti added the bug Something isn't working label Oct 12, 2026

rytilahti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you @Richardtristan, let's get this in for the next release!

rytilahti merged commit 78146d4 into python-kasa:master Oct 24, 2026
22 checks passed
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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

H200 hub without child devices: KeyError 'child_component_list' in _create_delete_children (0.11.0.1)

2 participants


Back | FazBrowse Home | New Git URL