mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-12 10:28:01 +00:00
Put modules back on children for wall switches (#881)
Puts modules back on the children for `WallSwitches` (i.e. ks240) and makes them accessible from the `modules` property on the parent.
This commit is contained in:
@@ -15,6 +15,7 @@ from .emeterstatus import EmeterStatus
|
||||
from .exceptions import KasaException
|
||||
from .feature import Feature
|
||||
from .iotprotocol import IotProtocol
|
||||
from .module import Module
|
||||
from .protocol import BaseProtocol
|
||||
from .xortransport import XorTransport
|
||||
|
||||
@@ -72,7 +73,6 @@ class Device(ABC):
|
||||
self._last_update: Any = None
|
||||
self._discovery_info: dict[str, Any] | None = None
|
||||
|
||||
self.modules: dict[str, Any] = {}
|
||||
self._features: dict[str, Feature] = {}
|
||||
self._parent: Device | None = None
|
||||
self._children: Mapping[str, Device] = {}
|
||||
@@ -111,6 +111,11 @@ class Device(ABC):
|
||||
"""Disconnect and close any underlying connection resources."""
|
||||
await self.protocol.close()
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def modules(self) -> Mapping[str, Module]:
|
||||
"""Return the device modules."""
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def is_on(self) -> bool:
|
||||
|
Reference in New Issue
Block a user