Classify IOT devices via sysinfo regardless of transport (fixes #1740) (#1769)

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:
bluntman001
2026-10-04 07:48:22 -06:00
committed by GitHub
parent 53823ea9a5
commit b2a15afa7e
2 changed files with 65 additions and 3 deletions

View File

@@ -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)