8000 Show discovery data for state with verbose by rytilahti · Pull Request #678 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Show discovery data for state with verbose #678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2024
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
35 changes: 16 additions & 19 deletions kasa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ async def discover(ctx):
target = ctx.parent.params["target"]
username = ctx.parent.params["username"]
password = ctx.parent.params["password"]
verbose = ctx.parent.params["verbose"]
discovery_ 8000 timeout = ctx.parent.params["discovery_timeout"]
timeout = ctx.parent.params["timeout"]
port = ctx.parent.params["port"]
Expand Down Expand Up @@ -429,9 +428,6 @@ async def print_discovered(dev: SmartDevice):
discovered[dev.host] = dev.internal_state
ctx.parent.obj = dev
await ctx.parent.invoke(state)
if verbose:
echo()
_echo_discovery_info(dev._discovery_info)
echo()

await Discover.discover(
Expand Down Expand Up @@ -473,21 +469,20 @@ def _echo_discovery_info(discovery_info):
return

echo("\t[bold]== Discovery Result ==[/bold]")
echo(f"\tDevice Type: {dr.device_type}")
echo(f"\tDevice Model: {dr.device_model}")
echo(f"\tIP: {dr.ip}")
echo(f"\tMAC: {dr.mac}")
echo(f"\tDevice Id (hash): {dr.device_id}")
echo(f"\tOwner (hash): {dr.owner}")
echo(f"\tHW Ver: {dr.hw_ver}")
echo(f"\tIs Support IOT Cloud: {dr.is_support_iot_cloud})")
echo(f"\tOBD Src: {dr.obd_src}")
echo(f"\tFactory Default: {dr.factory_default}")
echo("\t\t== Encryption Scheme ==")
echo(f"\t\tEncrypt Type: {dr.mgt_encrypt_schm.encrypt_type}")
echo(f"\t\tIs Support HTTPS: {dr.mgt_encrypt_schm.is_support_https}")
echo(f"\t\tHTTP Port: {dr.mgt_encrypt_schm.http_port}")
echo(f"\t\tLV (Login Level): {dr.mgt_encrypt_schm.lv}")
echo(f"\tDevice Type: {dr.device_type}")
echo(f"\tDevice Model: {dr.device_model}")
echo(f"\tIP: {dr.ip}")
echo(f"\tMAC: {dr.mac}")
echo(f"\tDevice Id (hash): {dr.device_id}")
echo(f"\tOwner (hash): {dr.owner}")
echo(f"\tHW Ver: {dr.hw_ver}")
echo(f"\tSupports IOT Cloud: {dr.is_support_iot_cloud}")
echo(f"\tOBD Src: {dr.obd_src}")
echo(f"\tFactory Default: {dr.factory_default}")
echo(f"\tEncrypt Type: {dr.mgt_encrypt_schm.encrypt_type}")
echo(f"\tSupports HTTPS: {dr.mgt_encrypt_schm.is_support_https}")
echo(f"\tHTTP Port: {dr.mgt_encrypt_schm.http_port}")
echo(f"\tLV (Login Level): {dr.mgt_encrypt_schm.lv}")


async def find_host_from_alias(alias, target="255.255.255.255", timeout=1, attempts=3):
Expand Down Expand Up @@ -562,6 +557,8 @@ async def state(ctx, dev: SmartDevice):
echo(f"\tDevice ID: {dev.device_id}")
for feature in dev.features:
echo(f"\tFeature: {feature}")
echo()
_echo_discovery_info(dev._discovery_info)
return dev.internal_state


Expand Down
0