Add spotclean to cli

Add spotclean to cli
This commit is contained in:
Brian Martin
2019-01-14 13:13:02 -05:00
parent 304c576960
commit 62185d135f
3 changed files with 19 additions and 19 deletions
+3 -2
View File
@@ -18,8 +18,9 @@
"program": "${workspaceFolder}/sucks/cli.py",
"args" : [
"--debug",
"clean",
"10"
"spotclean",
"0",
"60"
],
"console": "integratedTerminal"
},
+4 -4
View File
@@ -360,11 +360,11 @@ class VacBot():
def connect_and_wait_until_ready(self):
if self.vacuum['iot']:
self.iot.connect_and_wait_until_ready()
self.iot.schedule('Ping', 30, lambda: self.send_ping(), repeat=True)
if not self.vacuum['iot']:
#self.iot.connect_and_wait_until_ready()
#self.iot.schedule('Ping', 30, lambda: self.send_ping(), repeat=True)
else:
#else:
self.xmpp.connect_and_wait_until_ready()
self.xmpp.schedule('Ping', 30, lambda: self.send_ping(), repeat=True)
+12 -13
View File
@@ -179,6 +179,12 @@ def edge(frequency, minutes):
return CliAction(Edge(), wait=TimeWait(minutes * 60))
@cli.command(help='spotcleans provided room(s) for the specified number of minutes')
@click.argument('room', type=click.STRING)
@click.argument('minutes', type=click.FLOAT)
def spotclean(room, minutes):
return CliAction(SpotArea('start', room), wait=TimeWait(minutes * 60))
@cli.command(help='returns to charger')
def charge():
return charge_action()
@@ -209,22 +215,15 @@ def run(actions, debug):
if actions:
config = read_config()
api = EcoVacsAPI(config['device_id'], config['email'], config['password_hash'],
config['country'], config['continent'])
config['country'], config['continent'])
vacuum = api.devices()[0]
vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, vacuum, config['continent'])
#vacbot.connect_and_wait_until_ready()(
vacbot.connect_and_wait_until_ready()
vacbot.run(SpotArea('start'))
#vacbot.request_all_statuses()
# for action in actions:
# click.echo("performing " + str(action.vac_command))
# vacbot.run(action.vac_command)
# action.wait.wait(vacbot)
for action in actions:
click.echo("performing " + str(action.vac_command))
vacbot.run(action.vac_command)
action.wait.wait(vacbot)
vacbot.disconnect(wait=True)