Skip to content

Commit

Permalink
Added find_me action
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPaap committed Oct 15, 2022
1 parent 8d20528 commit 1b8663d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 5 additions & 1 deletion pyneato/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

class RobotAbilityEnum(str, Enum):
STATE_SHOW = "state.show"

INFO = "info.robot"
FIND_ME = "utilities.find_me"
CLEANING_PAUSE = "cleaning.pause"
CLEANING_RESUME = "cleaning.resume"
RETURN_TO_BASE = "navigation.return_to_base"

class RobotStateEnum(Enum):
BUSY = 'busy'
Expand Down
13 changes: 9 additions & 4 deletions pyneato/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _base_message(self, message: str, schema: Schema):
}

def pause_cleaning(self) -> bool:
result = self._base_message("cleaning.pause", ABILITY_SCHEMA)
result = self._base_message(RobotAbilityEnum.CLEANING_PAUSE.value, ABILITY_SCHEMA)

return result["success"]

Expand Down Expand Up @@ -284,15 +284,15 @@ def get_state(self) -> RobotState:
return state

def info_robot(self):
result = self._base_message("info.robot", ROBOT_INFO_SCHEMA)
result = self._base_message(RobotAbilityEnum.INFO.value, ROBOT_INFO_SCHEMA)
response = result["response"]

_LOGGER.debug(response.json())

return response.json()

def resume_cleaning(self) -> bool:
result = self._base_message("cleaning.resume", ABILITY_SCHEMA)
result = self._base_message(RobotAbilityEnum.CLEANING_RESUME.value, ABILITY_SCHEMA)

return result["success"]

Expand All @@ -303,7 +303,12 @@ def cancel_cleaning(self) -> bool:
return pause_result and return_to_base_result

def return_to_base(self) -> bool:
result = self._base_message("navigation.return_to_base", ABILITY_SCHEMA)
result = self._base_message(RobotAbilityEnum.RETURN_TO_BASE.value, ABILITY_SCHEMA)

return result["success"]

def find_me(self) -> bool:
result = self._base_message(RobotAbilityEnum.FIND_ME.value, ABILITY_SCHEMA)

return result["success"]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pyneato"
version = "0.0.3"
version = "0.0.4"
authors = [
{ name="Benjamin Paap", email="[email protected]" },
]
Expand Down

0 comments on commit 1b8663d

Please sign in to comment.