mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-15 06:38:42 +00:00
Change state_information to return feature values (#804)
This changes `state_information` to return the names and values of all defined features. It was originally a "temporary" hack to show some extra, device-specific information in the cli tool, but now that we have device-defined features we can leverage them.
This commit is contained in:
11
kasa/cli.py
11
kasa/cli.py
@@ -609,16 +609,7 @@ async def state(ctx, dev: Device):
|
||||
echo(f"\tMAC (rssi): {dev.mac} ({dev.rssi})")
|
||||
echo(f"\tLocation: {dev.location}")
|
||||
|
||||
echo("\n\t[bold]== Device specific information ==[/bold]")
|
||||
for info_name, info_data in dev.state_information.items():
|
||||
if isinstance(info_data, list):
|
||||
echo(f"\t{info_name}:")
|
||||
for item in info_data:
|
||||
echo(f"\t\t{item}")
|
||||
else:
|
||||
echo(f"\t{info_name}: {info_data}")
|
||||
|
||||
echo("\n\t[bold]== Features == [/bold]")
|
||||
echo("\n\t[bold]== Device-specific information == [/bold]")
|
||||
for id_, feature in dev.features.items():
|
||||
echo(f"\t{feature.name} ({id_}): {feature.value}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user