mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Add smartcamera devices to supported docs (#1257)
The library now officially supports H200, C200 and TC65
This commit is contained in:
@@ -152,6 +152,22 @@ class WifiNetwork:
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class _DeviceInfo:
|
||||
"""Device Model Information."""
|
||||
|
||||
short_name: str
|
||||
long_name: str
|
||||
brand: str
|
||||
device_family: str
|
||||
device_type: DeviceType
|
||||
hardware_version: str
|
||||
firmare_version: str
|
||||
firmware_build: str
|
||||
requires_auth: bool
|
||||
region: str | None
|
||||
|
||||
|
||||
class Device(ABC):
|
||||
"""Common device interface.
|
||||
|
||||
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from ..device import _DeviceInfo
|
||||
from ..device_type import DeviceType
|
||||
from ..module import Module
|
||||
from ..protocols.smartcameraprotocol import _ChildCameraProtocolWrapper
|
||||
@@ -29,6 +30,30 @@ class SmartCamera(SmartDevice):
|
||||
return DeviceType.Hub
|
||||
return DeviceType.Camera
|
||||
|
||||
@staticmethod
|
||||
def _get_device_info(
|
||||
info: dict[str, Any], discovery_info: dict[str, Any] | None
|
||||
) -> _DeviceInfo:
|
||||
"""Get model information for a device."""
|
||||
basic_info = info["getDeviceInfo"]["device_info"]["basic_info"]
|
||||
short_name = basic_info["device_model"]
|
||||
long_name = discovery_info["device_model"] if discovery_info else short_name
|
||||
device_type = SmartCamera._get_device_type_from_sysinfo(basic_info)
|
||||
fw_version_full = basic_info["sw_version"]
|
||||
firmare_version, firmware_build = fw_version_full.split(" ", maxsplit=1)
|
||||
return _DeviceInfo(
|
||||
short_name=basic_info["device_model"],
|
||||
long_name=long_name,
|
||||
brand="tapo",
|
||||
device_family=basic_info["device_type"],
|
||||
device_type=device_type,
|
||||
hardware_version=basic_info["hw_version"],
|
||||
firmare_version=firmare_version,
|
||||
firmware_build=firmware_build,
|
||||
requires_auth=True,
|
||||
region=basic_info.get("region"),
|
||||
)
|
||||
|
||||
def _update_internal_info(self, info_resp: dict) -> None:
|
||||
"""Update the internal device info."""
|
||||
info = self._try_get_response(info_resp, "getDeviceInfo")
|
||||
|
Reference in New Issue
Block a user