diff --git a/sucks/__init__.py b/sucks/__init__.py index 2b2ac6f..f715054 100644 --- a/sucks/__init__.py +++ b/sucks/__init__.py @@ -582,10 +582,11 @@ class EcoVacsIOT(): def _handle_ctl(self, action, message): - resp = self._ctl_to_dict(action, message['resp']) - if resp is not None: - for s in self.ctl_subscribers: - s(resp) + if not message == {}: + resp = self._ctl_to_dict(action, message['resp']) + if resp is not None: + for s in self.ctl_subscribers: + s(resp) def _ctl_to_dict(self, action, xmlstring): @@ -709,6 +710,7 @@ class EcoVacsXMPP(ClientXMPP): class VacBotCommand: ACTION = { 'forward': 'forward', + 'backward': 'backward', 'left': 'SpinLeft', 'right': 'SpinRight', 'turn_around': 'TurnAround', diff --git a/sucks/cli.py b/sucks/cli.py index bf77453..7e49704 100644 --- a/sucks/cli.py +++ b/sucks/cli.py @@ -215,9 +215,13 @@ def run(actions, debug): vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, vacuum, config['continent']) #vacbot.connect_and_wait_until_ready()( - #vacbot.run(Clean('spotarea', 'normal', 'start', '2')) - vacbot.request_all_statuses() - + vacbot.run(Move('backward')) + vacbot.run(Move('backward')) + vacbot.run(Move('stop')) + #vacbot.run(Clean('spotarea', 'normal', 'start', '0')) + + #vacbot.request_all_statuses() + # for action in actions: # click.echo("performing " + str(action.vac_command)) # vacbot.run(action.vac_command) diff --git a/tests/test_commands.py b/tests/test_commands.py index a3039b3..6ed18cc 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -103,6 +103,9 @@ def test_move_command(): c = Move(action='forward') assert_equals(ElementTree.tostring(c.to_xml()), b'') + c = Move(action='backward') + assert_equals(ElementTree.tostring(c.to_xml()), + b'') c = Move(action='stop') assert_equals(ElementTree.tostring(c.to_xml()), b'')