mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-09 00:48:01 +00:00
Create common Time module and add time set cli command (#1157)
This commit is contained in:
26
kasa/interfaces/time.py
Normal file
26
kasa/interfaces/time.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Module for time interface."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from datetime import datetime, tzinfo
|
||||
|
||||
from ..module import Module
|
||||
|
||||
|
||||
class Time(Module, ABC):
|
||||
"""Base class for tplink time module."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def time(self) -> datetime:
|
||||
"""Return timezone aware current device time."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def timezone(self) -> tzinfo:
|
||||
"""Return current timezone."""
|
||||
|
||||
@abstractmethod
|
||||
async def set_time(self, dt: datetime) -> dict:
|
||||
"""Set the device time."""
|
Reference in New Issue
Block a user