Make parent attribute on device consistent across iot and smart (#1023)

Both device types now have an internal `_parent` and a public property getter
This commit is contained in:
Steven B
2024-07-01 11:51:06 +01:00
committed by GitHub
parent 368590cd36
commit 2687c71c4b
3 changed files with 35 additions and 6 deletions

View File

@@ -328,6 +328,11 @@ class Device(ABC):
"""Send a raw query to the device."""
return await self.protocol.query(request=request)
@property
def parent(self) -> Device | None:
"""Return the parent on child devices."""
return self._parent
@property
def children(self) -> Sequence[Device]:
"""Returns the child devices."""