mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
Show discovery data for state with verbose (#678)
* Show discovery data for state with verbose * Remove duplicate discovery printout on discovery, add a newline for readability
This commit is contained in:
parent
1db955b05e
commit
cfbdf7c64a
17
kasa/cli.py
17
kasa/cli.py
@ -390,7 +390,6 @@ async def discover(ctx):
|
|||||||
target = ctx.parent.params["target"]
|
target = ctx.parent.params["target"]
|
||||||
username = ctx.parent.params["username"]
|
username = ctx.parent.params["username"]
|
||||||
password = ctx.parent.params["password"]
|
password = ctx.parent.params["password"]
|
||||||
verbose = ctx.parent.params["verbose"]
|
|
||||||
discovery_timeout = ctx.parent.params["discovery_timeout"]
|
discovery_timeout = ctx.parent.params["discovery_timeout"]
|
||||||
timeout = ctx.parent.params["timeout"]
|
timeout = ctx.parent.params["timeout"]
|
||||||
port = ctx.parent.params["port"]
|
port = ctx.parent.params["port"]
|
||||||
@ -429,9 +428,6 @@ async def discover(ctx):
|
|||||||
discovered[dev.host] = dev.internal_state
|
discovered[dev.host] = dev.internal_state
|
||||||
ctx.parent.obj = dev
|
ctx.parent.obj = dev
|
||||||
await ctx.parent.invoke(state)
|
await ctx.parent.invoke(state)
|
||||||
if verbose:
|
|
||||||
echo()
|
|
||||||
_echo_discovery_info(dev._discovery_info)
|
|
||||||
echo()
|
echo()
|
||||||
|
|
||||||
await Discover.discover(
|
await Discover.discover(
|
||||||
@ -480,14 +476,13 @@ def _echo_discovery_info(discovery_info):
|
|||||||
echo(f"\tDevice Id (hash): {dr.device_id}")
|
echo(f"\tDevice Id (hash): {dr.device_id}")
|
||||||
echo(f"\tOwner (hash): {dr.owner}")
|
echo(f"\tOwner (hash): {dr.owner}")
|
||||||
echo(f"\tHW Ver: {dr.hw_ver}")
|
echo(f"\tHW Ver: {dr.hw_ver}")
|
||||||
echo(f"\tIs Support IOT Cloud: {dr.is_support_iot_cloud})")
|
echo(f"\tSupports IOT Cloud: {dr.is_support_iot_cloud}")
|
||||||
echo(f"\tOBD Src: {dr.obd_src}")
|
echo(f"\tOBD Src: {dr.obd_src}")
|
||||||
echo(f"\tFactory Default: {dr.factory_default}")
|
echo(f"\tFactory Default: {dr.factory_default}")
|
||||||
echo("\t\t== Encryption Scheme ==")
|
echo(f"\tEncrypt Type: {dr.mgt_encrypt_schm.encrypt_type}")
|
||||||
echo(f"\t\tEncrypt Type: {dr.mgt_encrypt_schm.encrypt_type}")
|
echo(f"\tSupports HTTPS: {dr.mgt_encrypt_schm.is_support_https}")
|
||||||
echo(f"\t\tIs Support HTTPS: {dr.mgt_encrypt_schm.is_support_https}")
|
echo(f"\tHTTP Port: {dr.mgt_encrypt_schm.http_port}")
|
||||||
echo(f"\t\tHTTP Port: {dr.mgt_encrypt_schm.http_port}")
|
echo(f"\tLV (Login Level): {dr.mgt_encrypt_schm.lv}")
|
||||||
echo(f"\t\tLV (Login Level): {dr.mgt_encrypt_schm.lv}")
|
|
||||||
|
|
||||||
|
|
||||||
async def find_host_from_alias(alias, target="255.255.255.255", timeout=1, attempts=3):
|
async def find_host_from_alias(alias, target="255.255.255.255", timeout=1, attempts=3):
|
||||||
@ -562,6 +557,8 @@ async def state(ctx, dev: SmartDevice):
|
|||||||
echo(f"\tDevice ID: {dev.device_id}")
|
echo(f"\tDevice ID: {dev.device_id}")
|
||||||
for feature in dev.features:
|
for feature in dev.features:
|
||||||
echo(f"\tFeature: {feature}")
|
echo(f"\tFeature: {feature}")
|
||||||
|
echo()
|
||||||
|
_echo_discovery_info(dev._discovery_info)
|
||||||
return dev.internal_state
|
return dev.internal_state
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user