mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
cb89342be1
Add LinkieTransportV2 transport used by kasa cameras and a basic implementation for IOT.IPCAMERA (kasacam) devices. --------- Co-authored-by: Zach Price <pricezt@ornl.gov> Co-authored-by: Steven B <51370195+sdb9696@users.noreply.github.com> Co-authored-by: Teemu Rytilahti <tpr@iki.fi>
43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
"""Module for cameras."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
from datetime import datetime, tzinfo
|
|
|
|
from ..device_type import DeviceType
|
|
from ..deviceconfig import DeviceConfig
|
|
from ..protocols import BaseProtocol
|
|
from .iotdevice import IotDevice
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
class IotCamera(IotDevice):
|
|
"""Representation of a TP-Link Camera."""
|
|
|
|
def __init__(
|
|
self,
|
|
host: str,
|
|
*,
|
|
config: DeviceConfig | None = None,
|
|
protocol: BaseProtocol | None = None,
|
|
) -> None:
|
|
super().__init__(host=host, config=config, protocol=protocol)
|
|
self._device_type = DeviceType.Camera
|
|
|
|
@property
|
|
def time(self) -> datetime:
|
|
"""Get the camera's time."""
|
|
return datetime.fromtimestamp(self.sys_info["system_time"])
|
|
|
|
@property
|
|
def timezone(self) -> tzinfo:
|
|
"""Get the camera's timezone."""
|
|
return None # type: ignore
|
|
|
|
@property # type: ignore
|
|
def is_on(self) -> bool:
|
|
"""Return whether device is on."""
|
|
return True
|