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

Handle hubs that omit the child list when they have no children by IDavinciCode · Pull Request #1785 · python-kasa/python-kasa · GitHub

Repository navigation

Handle hubs that omit the child list when they have no children - #1785

Open
IDavinciCode wants to merge 1 commit into
python-kasa:masterfrom
IDavinciCode:fix-empty-hub-child-list
Open

IDavinciCode wants to merge 1 commit into
python-kasa:masterfrom
IDavinciCode:fix-empty-hub-child-list

Conversation

Copy link
Copy Markdown

An H200 (or H500) hub without paired children answers
getChildDeviceList / getChildDeviceComponentList with only
start_index and sum, no list. _handle_response_lists then calls
next() on an empty iterator, which inside a coroutine becomes
RuntimeError: coroutine raised StopIteration and aborts setup in
Home Assistant.

  • _handle_response_lists returns early when the response carries no list.
  • The child update paths read child_device_list / child_component_list
    with a default instead of indexing them, so the list-less response is
    treated as "no children" (smart and smartcam).

This is the change proposed in the issue by a user who confirmed it on an
empty hub; with children present the behaviour is unchanged.

Tests:

  • test_smart_protocol_list_response_without_list reproduces the
    StopIteration from the issue on master.
  • test_dynamic_devices now also updates every hub fixture with both lists
    omitted and asserts no error is logged; on master all 9 hub fixtures fail.

Fixes #1728
Related: #1773 (same traceback on an H500)

🤖 Generated with Claude Code

An H200 or H500 hub without paired children answers getChildDeviceList
and getChildDeviceComponentList with only start_index and sum. The
pagination helper then called next() on an empty iterator, which inside
a coroutine surfaces as "RuntimeError: coroutine raised StopIteration"
and aborts setup. Return early when no list is present, and read the
child lists with a default where the code indexed them directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.41%. Comparing base (ff26187) to head (5425613).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1785   +/-   ##
=======================================
  Coverage   93.41%   93.41%           
=======================================
  Files         159      159           
  Lines       10113    10115    +2     
  Branches     1043     1044    +1     
=======================================
+ Hits         9447     9449    +2     
  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.

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

None yet

Projects

None yet

1 participant


Back | FazBrowse Home | New Git URL