flandre/test/legacy/testmiio.py

37 lines
938 B
Python
Raw Normal View History

2025-02-26 16:22:09 +08:00
from miio.miioprotocol import MiIOProtocol
from config import SWITCH1_IP, SWITCH1_TOKEN, SWITCH2_IP, SWITCH2_TOKEN
from miio import Device
2025-03-03 22:22:06 +08:00
# from utils.mi import c1_disconnect, c1_connect, c2_connect
#
# if __name__ == '__main__':
# # m = MiIOProtocol(
# # SWITCH1_IP, SWITCH1_TOKEN,
# # )
# # r = m.send('get_properties', [{'did': 'MYDID', 'siid': 2, 'piid': 1}])
# # print(r[0]['value'])
# c1_connect()
# c2_connect()
2025-02-26 21:41:15 +08:00
2025-03-03 22:22:06 +08:00
import click
@click.group()
def cli():
pass
@cli.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', prompt='Your name',
help='The person to greet.')
def con(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo(f"Hello {name}!")
@cli.command()
def disconnect():
click.echo('Dropped the database')
2025-02-26 16:22:09 +08:00
if __name__ == '__main__':
2025-03-03 22:22:06 +08:00
cli()