From 1b8663dab7bc02aaa52c664cee442498243f8d86 Mon Sep 17 00:00:00 2001 From: Benjamin Paap Date: Sun, 16 Oct 2022 00:16:31 +0200 Subject: [PATCH] Added find_me action --- pyneato/enum.py | 6 +++++- pyneato/robot.py | 13 +++++++++---- pyproject.toml | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pyneato/enum.py b/pyneato/enum.py index 4d49961..cf6de5f 100644 --- a/pyneato/enum.py +++ b/pyneato/enum.py @@ -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' diff --git a/pyneato/robot.py b/pyneato/robot.py index cfb0088..26ca3c4 100644 --- a/pyneato/robot.py +++ b/pyneato/robot.py @@ -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"] @@ -284,7 +284,7 @@ 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()) @@ -292,7 +292,7 @@ def info_robot(self): 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"] @@ -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"] diff --git a/pyproject.toml b/pyproject.toml index c2fd1be..ce16962 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "pyneato" -version = "0.0.3" +version = "0.0.4" authors = [ { name="Benjamin Paap", email="benjamin.paap@gmail.com" }, ]