mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-10-07 05:13:49 +00:00
Drop the `XorTransport` guard and always query sysinfo for `IotProtocol` connections, so `get_device_class_from_sys_info` sees `dev_name` (\"Wi-Fi Smart Dimmer\", etc.) and picks the right class to initialize. This is necessary, as some IOT-speaking devices have moved to use KLAP instead of XOR as their transport, which in turn caused devices like dimmers to be detected incorrectly as plugs. --------- Co-authored-by: bluntman001 <noreply@github.com> Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
This commit is contained in:
@@ -104,9 +104,9 @@ async def _connect(config: DeviceConfig, protocol: BaseProtocol) -> Device:
|
||||
device_class: type[Device] | None
|
||||
device: Device | None = None
|
||||
|
||||
if isinstance(protocol, IotProtocol) and isinstance(
|
||||
protocol._transport, XorTransport
|
||||
):
|
||||
# For IOT devices, we need to obtain the initial sysinfo in order decide
|
||||
# on the device class to initialize.
|
||||
if isinstance(protocol, IotProtocol):
|
||||
info = await protocol.query(GET_SYSINFO_QUERY)
|
||||
_perf_log(True, "get_sysinfo")
|
||||
device_class = get_device_class_from_sys_info(info)
|
||||
|
||||
Reference in New Issue
Block a user