Add WallSwitch device type and autogenerate supported devices docs (#758)

This commit is contained in:
Steven B
2024-03-01 18:32:45 +00:00
committed by GitHub
parent 0306e05fb9
commit fcad0d2344
21 changed files with 714 additions and 211 deletions

View File

@@ -3,7 +3,7 @@ from .iotbulb import IotBulb
from .iotdevice import IotDevice
from .iotdimmer import IotDimmer
from .iotlightstrip import IotLightStrip
from .iotplug import IotPlug
from .iotplug import IotPlug, IotWallSwitch
from .iotstrip import IotStrip
__all__ = [
@@ -13,4 +13,5 @@ __all__ = [
"IotStrip",
"IotDimmer",
"IotLightStrip",
"IotWallSwitch",
]

View File

@@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__)
class IotPlug(IotDevice):
r"""Representation of a TP-Link Smart Switch.
r"""Representation of a TP-Link Smart Plug.
To initialize, you have to await :func:`update()` at least once.
This will allow accessing the properties using the exposed properties.
@@ -101,3 +101,17 @@ class IotPlug(IotDevice):
def state_information(self) -> Dict[str, Any]:
"""Return switch-specific state information."""
return {}
class IotWallSwitch(IotPlug):
"""Representation of a TP-Link Smart Wall Switch."""
def __init__(
self,
host: str,
*,
config: Optional[DeviceConfig] = None,
protocol: Optional[BaseProtocol] = None,
) -> None:
super().__init__(host=host, config=config, protocol=protocol)
self._device_type = DeviceType.WallSwitch