mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Add reboot() to the device interface (#1124)
Both device families have already had a method following this signature, but defining the interface in the base class will make the contract clear.
This commit is contained in:
parent
5df6c769b8
commit
f07341a5a6
@ -449,6 +449,14 @@ class Device(ABC):
|
||||
async def set_alias(self, alias: str):
|
||||
"""Set the device name (alias)."""
|
||||
|
||||
@abstractmethod
|
||||
async def reboot(self, delay: int = 1) -> None:
|
||||
"""Reboot the device.
|
||||
|
||||
Note that giving a delay of zero causes this to block,
|
||||
as the device reboots immediately without responding to the call.
|
||||
"""
|
||||
|
||||
def __repr__(self):
|
||||
if self._last_update is None:
|
||||
return f"<{self.device_type} at {self.host} - update() needed>"
|
||||
|
Loading…
Reference in New Issue
Block a user