From 79bbde26e964ebd992796ae765a4719245b5bfa3 Mon Sep 17 00:00:00 2001 From: Benjamin Paap Date: Thu, 20 Oct 2022 12:35:47 +0200 Subject: [PATCH] Fixed problem with D8 --- pyneato/account.py | 2 +- pyneato/enum.py | 3 +++ pyneato/floorplan.py | 3 +-- pyneato/robot.py | 11 +++++------ pyneato/session.py | 2 -- pyproject.toml | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pyneato/account.py b/pyneato/account.py index b1bae00..97f87b8 100644 --- a/pyneato/account.py +++ b/pyneato/account.py @@ -61,7 +61,7 @@ { Required("floorplan_uuid"): str, Required("rank_uuid"): str, - Required("name"): str, + Required("name"): Any(str, None), "map_versions_count": int, }, extra=ALLOW_EXTRA, diff --git a/pyneato/enum.py b/pyneato/enum.py index cf6de5f..c993445 100644 --- a/pyneato/enum.py +++ b/pyneato/enum.py @@ -115,3 +115,6 @@ def from_str(mode: str): return NavigationModeEnum.NORMAL else: raise NotImplementedError('NavigationMode %s'%mode) + +class RobotErrorEnum(str, Enum): + DUSTBIN_MISSING = 'dustbin_missing' diff --git a/pyneato/floorplan.py b/pyneato/floorplan.py index 4e1c2eb..44af12c 100644 --- a/pyneato/floorplan.py +++ b/pyneato/floorplan.py @@ -37,7 +37,7 @@ ) class Floorplan: - def __init__(self, session: Session, uuid: str, name: str, rank_uuid: str): + def __init__(self, session: Session, uuid: str, name: str | None, rank_uuid: str): self._session = session self.name = name self.uuid = uuid @@ -70,7 +70,6 @@ def refresh_tracks(self): if track["name"] == None: continue - _LOGGER.debug("Create Floorplan Track: %s"%(track["name"])) try: cleaning_mode = None if None != track["cleaning_mode"]: diff --git a/pyneato/robot.py b/pyneato/robot.py index 26ca3c4..63a5361 100644 --- a/pyneato/robot.py +++ b/pyneato/robot.py @@ -152,9 +152,6 @@ def _message(self, message: str, json: dict, schema: Schema): :param json: dict containing data to send :return: server response """ - - _LOGGER.debug(json) - try: response = requests.post( self._url + "?ability=%s"%message, @@ -179,7 +176,11 @@ def _message(self, message: str, json: dict, schema: Schema): return response def start_cleaning( - self, floorplan: Floorplan, tracks: list[Track] = None, cleaning_mode = CleaningModeEnum.MAX, nogo_enabled = True + self, + floorplan: Floorplan, + tracks: list[Track] = None, + cleaning_mode = CleaningModeEnum.ECO, + nogo_enabled = True ): ability_name = "cleaning.start" runs = [] @@ -287,8 +288,6 @@ def info_robot(self): 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: diff --git a/pyneato/session.py b/pyneato/session.py index 6bfff5b..7df76d6 100644 --- a/pyneato/session.py +++ b/pyneato/session.py @@ -68,8 +68,6 @@ def _login(self, email: str, password: str) -> None: headers=self.headers, ) - _LOGGER.warning("Status Code: %d"%(response.status_code)) - response.raise_for_status() self.access_token = response.json()["token"] diff --git a/pyproject.toml b/pyproject.toml index ce16962..5897540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "pyneato" -version = "0.0.4" +version = "0.0.5" authors = [ { name="Benjamin Paap", email="benjamin.paap@gmail.com" }, ]