コード例 #1
0
ファイル: vacuum_cli.py プロジェクト: sq5gvm/python-miio
def dnd(vac: miio.Vacuum, cmd: str,
        start_hr: int, start_min: int,
        end_hr: int, end_min: int):
    """Query and adjust do-not-disturb mode."""
    if cmd == "off":
        click.echo("Disabling DND..")
        print(vac.disable_dnd())
    elif cmd == "on":
        click.echo("Enabling DND %s:%s to %s:%s" % (start_hr, start_min,
                                                    end_hr, end_min))
        click.echo(vac.set_dnd(start_hr, start_min, end_hr, end_min))
    else:
        x = vac.dnd_status()
        click.echo(click.style("Between %s and %s (enabled: %s)" % (
            x.start, x.end, x.enabled), bold=x.enabled))
コード例 #2
0
ファイル: vacuum_cli.py プロジェクト: hanang128/python-miio
def dnd(vac: miio.Vacuum, cmd: str, start_hr: int, start_min: int, end_hr: int,
        end_min: int):
    """Query and adjust do-not-disturb mode."""
    if cmd == "off":
        click.echo("Disabling DND..")
        print(vac.disable_dnd())
    elif cmd == "on":
        click.echo("Enabling DND %s:%s to %s:%s" %
                   (start_hr, start_min, end_hr, end_min))
        click.echo(vac.set_dnd(start_hr, start_min, end_hr, end_min))
    else:
        x = vac.dnd_status()[0]
        click.echo("DND %02i:%02i to %02i:%02i (enabled: %s)" %
                   (x['start_hour'], x['start_minute'], x['end_hour'],
                    x['end_minute'], x['enabled']))