diff --git a/pybotvac/robot.py b/pybotvac/robot.py index 2f4ad86..a79fdd0 100644 --- a/pybotvac/robot.py +++ b/pybotvac/robot.py @@ -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