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

H500 hub: RuntimeError: coroutine raised StopIteration in _handle_response_lists during child initialisation · Issue #1773 · python-kasa/python-kasa · GitHub

Repository navigation

H500 hub: RuntimeError: coroutine raised StopIteration in _handle_response_lists during child initialisation #1773

Open

Description

Device: Tapo H500 hub (with a Tapo radiator valve paired) python-kasa: 0.10.2 (via Home Assistant 2026.9.4, tplink integration, Python 3.14)

What happens

Adding the H500 in Home Assistant (TP-Link Smart Home → host) authenticates successfully, then fails with "Unknown error occurred". The same happens on HA 2026.6.1.

Traceback

File "kasa/smartcam/smartcamdevice.py", line 222, in _negotiate
await self._initialize_children()
File "kasa/smartcam/smartcamdevice.py", line 148, in _initialize_children
resp = await self.protocol.query(child_info_query)
File "kasa/protocols/smartprotocol.py", line 135, in query
File "kasa/protocols/smartprotocol.py", line 140, in _query
File "kasa/protocols/smartcamprotocol.py", line 153, in _execute_query
return await self._execute_multiple_query(
File "kasa/protocols/smartprotocol.py", line 300, in _execute_multiple_query
await self._handle_response_lists(
RuntimeError: coroutine raised StopIteration

Likely cause

In SmartProtocol._handle_response_lists, response_list_name = next(iter([key for key in response_result if isinstance(response_result[key], list)])) raises StopIteration when the response contains start_index and sum but no list-valued key. Inside a coroutine that becomes RuntimeError (PEP 479). One of the H500's responses to getChildDeviceList / getChildDeviceComponentList (childControl, start_index: 0) appears to be shaped like that.

A guard would avoid the crash, e.g.:

response_list_name = next(
(k for k, v in response_result.items() if isinstance(v, list)), None
)
if response_list_name is None:
return

I can provide a dump_devinfo fixture if helpful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL