IOT KLAP devices can be misclassified as IotPlug (missing children) · Issue #1691 · python-kasa/python-kasa · GitHub
Skip to content

IOT KLAP devices can be misclassified as IotPlug (missing children) #1691

@thatdaveguy1

Description

@thatdaveguy1

Bug description

Device.connect() for IOT + KLAP devices can instantiate the wrong device class because _connect() currently derives class from device_family instead of live system.get_sysinfo.

For IOT.SMARTPLUGSWITCH, family mapping always yields IotPlug, so strips like HS300/KP303 can be created without children (device.children == []) even though sysinfo contains child outlets.

Why this happens

In kasa/device_factory.py, _connect() only does system.get_sysinfo-based class detection for IotProtocol + XorTransport.

IOT KLAP paths (including KLAP v2 devices) go through family mapping:

  • IOT.SMARTPLUGSWITCH -> IotPlug

This loses strip-vs-plug distinction for KLAP-connected strips.

Expected behavior

For IOT plug/switch and bulb families, _connect() should derive device class from system.get_sysinfo (same behavior pattern currently used for XOR), regardless of whether transport is XOR or KLAP/KLAPv2.

Impact

  • HS300/KP303 and similar strips can authenticate but be exposed as plain plugs.
  • Child outlet controls become unavailable.

Related

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