Skip to content

Commit

Permalink
Migrate miplug cli to the new ChuangmiPlug class (Fixes: #296) (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored May 20, 2018
1 parent bc88715 commit 884ba12
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions miio/plug_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
validate_token, )

_LOGGER = logging.getLogger(__name__)
pass_dev = click.make_pass_decorator(miio.Plug)
pass_dev = click.make_pass_decorator(miio.ChuangmiPlug)


@click.group(invoke_without_command=True, cls=ExceptionHandlerGroup)
Expand All @@ -35,7 +35,7 @@ def cli(ctx, ip: str, token: str, debug: int):
click.echo("You have to give ip and token!")
sys.exit(-1)

dev = miio.Plug(ip, token, debug)
dev = miio.ChuangmiPlug(ip, token, debug)
_LOGGER.debug("Connecting to %s with token %s", ip, token)

ctx.obj = dev
Expand All @@ -52,7 +52,7 @@ def discover():

@cli.command()
@pass_dev
def status(dev: miio.Plug):
def status(dev: miio.ChuangmiPlug):
"""Returns the state information."""
res = dev.status()
if not res:
Expand All @@ -64,14 +64,14 @@ def status(dev: miio.Plug):

@cli.command()
@pass_dev
def on(dev: miio.Plug):
def on(dev: miio.ChuangmiPlug):
"""Power on."""
click.echo("Power on: %s" % dev.on())


@cli.command()
@pass_dev
def off(dev: miio.Plug):
def off(dev: miio.ChuangmiPlug):
"""Power off."""
click.echo("Power off: %s" % dev.off())

Expand All @@ -80,7 +80,7 @@ def off(dev: miio.Plug):
@click.argument('cmd', required=True)
@click.argument('parameters', required=False)
@pass_dev
def raw_command(dev: miio.Plug, cmd, parameters):
def raw_command(dev: miio.ChuangmiPlug, cmd, parameters):
"""Run a raw command."""
params = [] # type: Any
if parameters:
Expand Down

0 comments on commit 884ba12

Please sign in to comment.