Add spotarea

Add SpotArea option for D90X w/ Mapping
This commit is contained in:
Brian Martin
2019-01-13 13:59:29 -05:00
parent e408157b72
commit 0da4532908
3 changed files with 28 additions and 18 deletions
+2 -1
View File
@@ -18,7 +18,8 @@
"program": "${workspaceFolder}/sucks/cli.py", "program": "${workspaceFolder}/sucks/cli.py",
"args" : [ "args" : [
"--debug", "--debug",
"charge" "clean",
"10"
], ],
"console": "integratedTerminal" "console": "integratedTerminal"
}, },
+21 -4
View File
@@ -19,9 +19,14 @@ _LOGGER = logging.getLogger(__name__)
CLEAN_MODE_AUTO = 'auto' CLEAN_MODE_AUTO = 'auto'
CLEAN_MODE_EDGE = 'edge' CLEAN_MODE_EDGE = 'edge'
CLEAN_MODE_SPOT = 'spot' CLEAN_MODE_SPOT = 'spot'
CLEAN_MODE_SPOT_AREA = 'spotarea'
CLEAN_MODE_SINGLE_ROOM = 'single_room' CLEAN_MODE_SINGLE_ROOM = 'single_room'
CLEAN_MODE_STOP = 'stop' CLEAN_MODE_STOP = 'stop'
CLEAN_ACTION_START = 'start'
CLEAN_ACTION_PAUSE = 'pause'
CLEAN_ACTION_RESUME = 'resume'
FAN_SPEED_NORMAL = 'normal' FAN_SPEED_NORMAL = 'normal'
FAN_SPEED_HIGH = 'high' FAN_SPEED_HIGH = 'high'
@@ -36,7 +41,7 @@ COMPONENT_FILTER = 'filter'
VACUUM_STATUS_OFFLINE = 'offline' VACUUM_STATUS_OFFLINE = 'offline'
CLEANING_STATES = {CLEAN_MODE_AUTO, CLEAN_MODE_EDGE, CLEAN_MODE_SPOT, CLEAN_MODE_SINGLE_ROOM} CLEANING_STATES = {CLEAN_MODE_AUTO, CLEAN_MODE_EDGE, CLEAN_MODE_SPOT, CLEAN_MODE_SPOT_AREA, CLEAN_MODE_SINGLE_ROOM}
CHARGING_STATES = {CHARGE_MODE_CHARGING} CHARGING_STATES = {CHARGE_MODE_CHARGING}
# These dictionaries convert to and from Sucks's consts (which closely match what the UI and manuals use) # These dictionaries convert to and from Sucks's consts (which closely match what the UI and manuals use)
@@ -45,14 +50,22 @@ CLEAN_MODE_TO_ECOVACS = {
CLEAN_MODE_AUTO: 'auto', CLEAN_MODE_AUTO: 'auto',
CLEAN_MODE_EDGE: 'border', CLEAN_MODE_EDGE: 'border',
CLEAN_MODE_SPOT: 'spot', CLEAN_MODE_SPOT: 'spot',
CLEAN_MODE_SPOT_AREA: 'SpotArea',
CLEAN_MODE_SINGLE_ROOM: 'singleroom', CLEAN_MODE_SINGLE_ROOM: 'singleroom',
CLEAN_MODE_STOP: 'stop' CLEAN_MODE_STOP: 'stop'
} }
CLEAN_ACTION_TO_ECOVACS = {
CLEAN_ACTION_START: 's',
CLEAN_ACTION_PAUSE: 'p',
CLEAN_ACTION_RESUME: 'r',
}
CLEAN_MODE_FROM_ECOVACS = { CLEAN_MODE_FROM_ECOVACS = {
'auto': CLEAN_MODE_AUTO, 'auto': CLEAN_MODE_AUTO,
'border': CLEAN_MODE_EDGE, 'border': CLEAN_MODE_EDGE,
'spot': CLEAN_MODE_SPOT, 'spot': CLEAN_MODE_SPOT,
'SpotArea': CLEAN_MODE_SPOT_AREA,
'singleroom': CLEAN_MODE_SINGLE_ROOM, 'singleroom': CLEAN_MODE_SINGLE_ROOM,
'stop': CLEAN_MODE_STOP, 'stop': CLEAN_MODE_STOP,
'going': CHARGE_MODE_RETURNING 'going': CHARGE_MODE_RETURNING
@@ -504,6 +517,7 @@ class VacBot():
self.send_command(action.to_xml()) self.send_command(action.to_xml())
def disconnect(self, wait=False): def disconnect(self, wait=False):
if not self.vacuum['iot']:
self.xmpp.disconnect(wait=wait) self.xmpp.disconnect(wait=wait)
class EcoVacsIOT(): class EcoVacsIOT():
@@ -728,9 +742,9 @@ class VacBotCommand:
class Clean(VacBotCommand): class Clean(VacBotCommand):
def __init__(self, mode='auto', speed='normal', terminal=False): #def __init__(self, mode='auto', speed='normal', terminal=False): - Keeping original in case
super().__init__('Clean', {'clean': {'type': CLEAN_MODE_TO_ECOVACS[mode], 'speed': FAN_SPEED_TO_ECOVACS[speed]}}) def __init__(self, mode='auto', speed='normal', action='start', mid='',p='',deep='', terminal=False):
super().__init__('Clean', {'clean': {'type': CLEAN_MODE_TO_ECOVACS[mode], 'speed': FAN_SPEED_TO_ECOVACS[speed], 'act': CLEAN_ACTION_TO_ECOVACS[action], 'mid':mid, 'p':p, 'deep':deep}})
class Edge(Clean): class Edge(Clean):
def __init__(self): def __init__(self):
@@ -746,6 +760,9 @@ class Stop(Clean):
def __init__(self): def __init__(self):
super().__init__('stop', 'normal') super().__init__('stop', 'normal')
class SpotArea(Clean):
def __init__(self):
super().__init__('spotarea', 'normal', 'start')
class Charge(VacBotCommand): class Charge(VacBotCommand):
def __init__(self): def __init__(self):
+4 -12
View File
@@ -213,24 +213,16 @@ def run(actions, debug):
vacuum = api.devices()[0] vacuum = api.devices()[0]
vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, vacuum, config['continent']) 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(Clean('spotarea', 'normal', 'start', '2'))
# for action in actions:
vacbot.request_all_statuses()
print(vacbot.components)
print(vacbot.vacuum_status)
print(vacbot)
#for action in actions:
# click.echo("performing " + str(action.vac_command)) # click.echo("performing " + str(action.vac_command))
# vacbot.run(action.vac_command) # vacbot.run(action.vac_command)
# action.wait.wait(vacbot) # action.wait.wait(vacbot)
#vacbot.disconnect(wait=True) vacbot.disconnect(wait=True)
click.echo("done") click.echo("done")