Skip to content

Commit 5cb33da

Browse files
committed
Add support for the front LED
1 parent c5ca01d commit 5cb33da

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

dingz/cli.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async def discover():
3939
f" MAC address: {device.mac}, IP address: {device.host}, HW: {device.hardware}"
4040
)
4141

42+
4243
@main.group("info")
4344
def info():
4445
"""Get the information of a dingz device."""
@@ -56,5 +57,33 @@ async def get_config(ip):
5657
await dingz.get_device_info()
5758
click.echo(dingz.device_details)
5859

60+
61+
@main.group("front_led")
62+
def front_led():
63+
"""Handle the front LED of dingz."""
64+
65+
66+
@front_led.command("on")
67+
@coro
68+
@click.option(
69+
"--ip", prompt="IP address of the device", help="IP address of the device."
70+
)
71+
async def set_on(ip):
72+
"""Turn the front LED on."""
73+
async with Dingz(ip) as dingz:
74+
await dingz.turn_on()
75+
76+
77+
@front_led.command("off")
78+
@coro
79+
@click.option(
80+
"--ip", prompt="IP address of the device", help="IP address of the device."
81+
)
82+
async def set_off(ip):
83+
"""Turn the front LED off."""
84+
async with Dingz(ip) as dingz:
85+
await dingz.turn_off()
86+
87+
5988
if __name__ == "__main__":
6089
main()

0 commit comments

Comments
 (0)