mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
0d119e63d0
* Refactor devices into subpackages and deprecate old names * Tweak and add tests * Fix linting * Remove duplicate implementations affecting project coverage * Update post review * Add device base class attributes and rename subclasses * Rename Module to BaseModule * Remove has_emeter_history * Fix missing _time in init * Update post review * Fix test_readmeexamples * Fix erroneously duped files * Clean up iot and smart imports * Update post latest review * Tweak Device docstring
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
"""Module for a TAPO Plug."""
|
|
import logging
|
|
from typing import Any, Dict, Optional
|
|
|
|
from ..device_type import DeviceType
|
|
from ..deviceconfig import DeviceConfig
|
|
from ..plug import Plug
|
|
from ..smartprotocol import SmartProtocol
|
|
from .smartdevice import SmartDevice
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
class SmartPlug(SmartDevice, Plug):
|
|
"""Class to represent a TAPO Plug."""
|
|
|
|
def __init__(
|
|
self,
|
|
host: str,
|
|
*,
|
|
config: Optional[DeviceConfig] = None,
|
|
protocol: Optional[SmartProtocol] = None,
|
|
) -> None:
|
|
super().__init__(host=host, config=config, protocol=protocol)
|
|
self._device_type = DeviceType.Plug
|
|
|
|
@property
|
|
def state_information(self) -> Dict[str, Any]:
|
|
"""Return the key state information."""
|
|
return {
|
|
**super().state_information,
|
|
**{
|
|
"On since": self.on_since,
|
|
"auto_off_status": self._info.get("auto_off_status"),
|
|
"auto_off_remain_time": self._info.get("auto_off_remain_time"),
|
|
},
|
|
}
|