This commit is contained in:
J. Nick Koston 2023-11-19 08:02:43 -06:00
parent 418e5088ad
commit 88d3b5e32b
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -393,6 +393,12 @@ class SmartDevice:
sys_info = self.sys_info
return str(sys_info["alias"])
@property # type: ignore
@requires_update
def has_children(self) -> bool:
"""Check if the device has children devices."""
return bool(self._sys_info.get("child_num"))
async def set_alias(self, alias: str) -> None:
"""Set the device name (alias)."""
return await self._query_helper("system", "set_dev_alias", {"alias": alias})

View File

@ -170,12 +170,14 @@ async def test_representation(dev):
assert pattern.match(str(dev))
async def test_childrens(dev):
async def test_children(dev):
"""Make sure that children property is exposed by every device."""
if dev.is_strip:
assert len(dev.children) > 0
assert dev.has_children is True
else:
assert len(dev.children) == 0
assert dev.has_children is False
async def test_internal_state(dev):