Use SslTransport only if encryption_type is AES, log the config and support SMART.KLAP.HTTPS

This commit is contained in:
Teemu Rytilahti 2025-01-03 18:59:24 +01:00
parent b7a2062950
commit 1bbc55ac81

View File

@ -6,6 +6,7 @@ import logging
import time
from typing import Any
from . import EncryptType
from .device import Device
from .device_type import DeviceType
from .deviceconfig import DeviceConfig, DeviceFamily
@ -185,6 +186,7 @@ def get_protocol(
the protocol/transport. For other device types the transport varies
based on the discovery information.
"""
_LOGGER.debug("Finding protocol for %s", config.host)
ctype = config.connection_type
protocol_name = ctype.device_family.value.split(".")[0]
@ -194,7 +196,11 @@ def get_protocol(
if ctype.device_family is DeviceFamily.IotIpCamera:
return IotProtocol(transport=LinkieTransportV2(config=config))
if ctype.device_family is DeviceFamily.SmartTapoRobovac:
# Older FW used a different transport
if (
ctype.device_family is DeviceFamily.SmartTapoRobovac
and ctype.encryption_type is EncryptType.Aes
):
return SmartProtocol(transport=SslTransport(config=config))
protocol_transport_key = (
@ -212,6 +218,7 @@ def get_protocol(
"IOT.KLAP": (IotProtocol, KlapTransport),
"SMART.AES": (SmartProtocol, AesTransport),
"SMART.KLAP": (SmartProtocol, KlapTransportV2),
"SMART.KLAP.HTTPS": (SmartProtocol, KlapTransportV2),
# H200 is device family SMART.TAPOHUB and uses SmartCamProtocol so use
# https to distuingish from SmartProtocol devices
"SMART.AES.HTTPS": (SmartCamProtocol, SslAesTransport),