mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-08 22:07:06 +00:00
use asyncio.run on coroutines in cli.py
This commit is contained in:
parent
0e0ab1dfc9
commit
3b27f7d7e7
@ -1,4 +1,5 @@
|
|||||||
"""pyHS100 cli tool."""
|
"""pyHS100 cli tool."""
|
||||||
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
import click
|
import click
|
||||||
import logging
|
import logging
|
||||||
@ -80,7 +81,7 @@ def cli(ctx, ip, host, alias, target, debug, bulb, plug, strip):
|
|||||||
else:
|
else:
|
||||||
if not bulb and not plug and not strip:
|
if not bulb and not plug and not strip:
|
||||||
click.echo("No --strip nor --bulb nor --plug given, discovering..")
|
click.echo("No --strip nor --bulb nor --plug given, discovering..")
|
||||||
dev = Discover.discover_single(host)
|
dev = asyncio.run(Discover.discover_single(host))
|
||||||
elif bulb:
|
elif bulb:
|
||||||
dev = SmartBulb(host)
|
dev = SmartBulb(host)
|
||||||
elif plug:
|
elif plug:
|
||||||
@ -222,7 +223,7 @@ def raw_command(dev: SmartDevice, module, command, parameters):
|
|||||||
|
|
||||||
if parameters is not None:
|
if parameters is not None:
|
||||||
parameters = ast.literal_eval(parameters)
|
parameters = ast.literal_eval(parameters)
|
||||||
res = dev._query_helper(module, command, parameters)
|
res = asyncio.run(dev._query_helper(module, command, parameters))
|
||||||
click.echo(res)
|
click.echo(res)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user