Skip to content

Commit

Permalink
Merge pull request #7 from stianaske/dev
Browse files Browse the repository at this point in the history
Second attempt at category 4
  • Loading branch information
dshokouhi authored Dec 10, 2018
2 parents 2d0ec40 + 9ad2e79 commit b450758
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pybotvac/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ def start_cleaning(self, mode=2, navigation_mode=1, category=None):
"navigationMode": navigation_mode}
}

try:
response = self._message(json)
response_dict = response.json()

# Fall back to category 2 if we tried and failed with category 4
if category == 4 and 'alert' in response_dict and response_dict['alert'] == 'nav_floorplan_load_fail':
json['params']['category'] = 2
return self._message(json)
except Exception:
# Todo: catch specific exception that is causing this
# Fall back to category 2 if we tried and failed with category 4
if category == 4:
json['params']['category'] = 2
return self._message(json)

return response

def start_spot_cleaning(self, spot_width=400, spot_height=400):
# Spot cleaning if applicable to version
Expand Down

0 comments on commit b450758

Please sign in to comment.