mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-09 06:17:08 +00:00
tweaks
This commit is contained in:
parent
418e5088ad
commit
88d3b5e32b
@ -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})
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user