Add tests and pretty output for HS220, fix minor issues in tests

This commit is contained in:
Teemu Rytilahti
2018-10-18 19:57:44 +02:00
parent 345216e245
commit 8d4f4a6de3
5 changed files with 96 additions and 13 deletions

View File

@@ -26,7 +26,6 @@ pass_dev = click.make_pass_decorator(SmartDevice)
help='The host name or IP address of the device to connect to.')
@click.option('--alias', envvar="PYHS100_NAME", required=False,
help='The device name, or alias, of the device to connect to.')
@click.option('--debug/--normal', default=False)
@click.option('--bulb', default=False, is_flag=True)
@click.option('--plug', default=False, is_flag=True)
@@ -183,7 +182,10 @@ def emeter(dev, year, month, erase):
required=False)
@pass_dev
def brightness(dev, brightness):
"""Get or set brightness. (Bulb Only)"""
"""Get or set brightness."""
if not dev.is_dimmable:
click.echo("This device does not support brightness.")
return
if brightness is None:
click.echo("Brightness: %s" % dev.brightness)
else:
@@ -263,5 +265,6 @@ def reboot(plug, delay):
click.echo("Rebooting the device..")
plug.reboot(delay)
if __name__ == "__main__":
cli()