Skip to content

Commit 1e94f90

Browse files
committed
Add option to get details
1 parent 0bf3538 commit 1e94f90

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

dingz/cli.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
"""Command-line interface to interact with dingz devices."""
2-
import click
3-
from .discovery import discover_dingz_devices
42
import asyncio
3+
from functools import wraps
54

5+
import click
66

7-
import asyncio
8-
from functools import wraps
7+
from dingz.dingz import Dingz
8+
9+
from .discovery import discover_dingz_devices
910

1011

1112
def coro(f):
@@ -38,6 +39,22 @@ async def discover():
3839
f" MAC address: {device.mac}, IP address: {device.host}, HW: {device.hardware}"
3940
)
4041

42+
@main.group("info")
43+
def info():
44+
"""Get the information of a dingz device."""
45+
46+
47+
@info.command("read")
48+
@coro
49+
@click.option(
50+
"--ip", prompt="IP address of the device", help="IP address of the device."
51+
)
52+
async def get_config(ip):
53+
"""Read the current configuration of a myStrom device."""
54+
click.echo("Read configuration from %s" % ip)
55+
async with Dingz(ip) as dingz:
56+
await dingz.get_device_info()
57+
click.echo(dingz.device_details)
4158

4259
if __name__ == "__main__":
4360
main()

0 commit comments

Comments
 (0)