Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions kasa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,10 @@ async def state(ctx, dev: Device):
echo("\t[bold]== Children ==[/bold]")
for child in dev.children:
echo(f"\t* {child.alias} ({child.model}, {child.device_type})")
for feat in child.features.values():
for id_, feat in child.features.items():
try:
echo(f"\t\t{feat.name}: {feat.value}")
unit = f" {feat.unit}" if feat.unit else ""
echo(f"\t\t{feat.name} ({id_}): {feat.value}{unit}")
except Exception as ex:
echo(f"\t\t{feat.name}: got exception (%s)" % ex)
echo()
Expand Down Expand Up @@ -1173,7 +1174,8 @@ async def feature(dev: Device, child: str, name: str, value):
def _print_features(dev):
for name, feat in dev.features.items():
try:
echo(f"\t{feat.name} ({name}): {feat.value}")
unit = f" {feat.unit}" if feat.unit else ""
echo(f"\t{feat.name} ({name}): {feat.value}{unit}")
except Exception as ex:
echo(f"\t{feat.name} ({name}): [red]{ex}[/red]")

Expand All @@ -1194,7 +1196,8 @@ def _print_features(dev):
feat = dev.features[name]

if value is None:
echo(f"{feat.name} ({name}): {feat.value}")
unit = f" {feat.unit}" if feat.unit else ""
echo(f"{feat.name} ({name}): {feat.value}{unit}")
return feat.value

echo(f"Setting {name} to {value}")
Expand Down