mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-11 01:48:03 +00:00
Add state feature for iot devices (#924)
This is allows a generic implementation for the switch platform in the homeassistant integration. Also elevates set_state(bool) to be part of the standard API.
This commit is contained in:
@@ -138,6 +138,14 @@ class Device(ABC):
|
||||
async def turn_off(self, **kwargs) -> dict | None:
|
||||
"""Turn off the device."""
|
||||
|
||||
@abstractmethod
|
||||
async def set_state(self, on: bool):
|
||||
"""Set the device state to *on*.
|
||||
|
||||
This allows turning the device on and off.
|
||||
See also *turn_off* and *turn_on*.
|
||||
"""
|
||||
|
||||
@property
|
||||
def host(self) -> str:
|
||||
"""The device host."""
|
||||
|
Reference in New Issue
Block a user