File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Command-line interface to interact with dingz devices."""
2- import click
3- from .discovery import discover_dingz_devices
42import 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
1112def 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
4259if __name__ == "__main__" :
4360 main ()
You can’t perform that action at this time.
0 commit comments