mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-09 22:37:08 +00:00
Use SslTransport only if encryption_type is AES, log the config and support SMART.KLAP.HTTPS
This commit is contained in:
parent
b7a2062950
commit
1bbc55ac81
@ -6,6 +6,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from . import EncryptType
|
||||||
from .device import Device
|
from .device import Device
|
||||||
from .device_type import DeviceType
|
from .device_type import DeviceType
|
||||||
from .deviceconfig import DeviceConfig, DeviceFamily
|
from .deviceconfig import DeviceConfig, DeviceFamily
|
||||||
@ -185,6 +186,7 @@ def get_protocol(
|
|||||||
the protocol/transport. For other device types the transport varies
|
the protocol/transport. For other device types the transport varies
|
||||||
based on the discovery information.
|
based on the discovery information.
|
||||||
"""
|
"""
|
||||||
|
_LOGGER.debug("Finding protocol for %s", config.host)
|
||||||
ctype = config.connection_type
|
ctype = config.connection_type
|
||||||
protocol_name = ctype.device_family.value.split(".")[0]
|
protocol_name = ctype.device_family.value.split(".")[0]
|
||||||
|
|
||||||
@ -194,7 +196,11 @@ def get_protocol(
|
|||||||
if ctype.device_family is DeviceFamily.IotIpCamera:
|
if ctype.device_family is DeviceFamily.IotIpCamera:
|
||||||
return IotProtocol(transport=LinkieTransportV2(config=config))
|
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))
|
return SmartProtocol(transport=SslTransport(config=config))
|
||||||
|
|
||||||
protocol_transport_key = (
|
protocol_transport_key = (
|
||||||
@ -212,6 +218,7 @@ def get_protocol(
|
|||||||
"IOT.KLAP": (IotProtocol, KlapTransport),
|
"IOT.KLAP": (IotProtocol, KlapTransport),
|
||||||
"SMART.AES": (SmartProtocol, AesTransport),
|
"SMART.AES": (SmartProtocol, AesTransport),
|
||||||
"SMART.KLAP": (SmartProtocol, KlapTransportV2),
|
"SMART.KLAP": (SmartProtocol, KlapTransportV2),
|
||||||
|
"SMART.KLAP.HTTPS": (SmartProtocol, KlapTransportV2),
|
||||||
# H200 is device family SMART.TAPOHUB and uses SmartCamProtocol so use
|
# H200 is device family SMART.TAPOHUB and uses SmartCamProtocol so use
|
||||||
# https to distuingish from SmartProtocol devices
|
# https to distuingish from SmartProtocol devices
|
||||||
"SMART.AES.HTTPS": (SmartCamProtocol, SslAesTransport),
|
"SMART.AES.HTTPS": (SmartCamProtocol, SslAesTransport),
|
||||||
|
Loading…
Reference in New Issue
Block a user