From 9b9de26680503ead85f5e452524cd9eb7ff89b76 Mon Sep 17 00:00:00 2001 From: jm-73 Date: Tue, 12 Oct 2021 06:45:31 +0200 Subject: [PATCH 1/2] Changes in Bosch API --- pyIndego/indego_async_client.py | 6 +++--- pyIndego/states.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pyIndego/indego_async_client.py b/pyIndego/indego_async_client.py index 9bdc5bf..15b34d0 100644 --- a/pyIndego/indego_async_client.py +++ b/pyIndego/indego_async_client.py @@ -446,8 +446,8 @@ async def get_user(self): async def login(self, attempts: int = 0): """Login to the api and store the context.""" response = await self._request( - method=Methods.POST, - path="authenticate", + method=Methods.GET, + path="authenticate/check", data=DEFAULT_BODY, headers=DEFAULT_HEADER, auth=BasicAuth(self._username, self._password), @@ -524,7 +524,7 @@ async def _request( # noqa: C901 ) return None if status == 401: - if path == "authenticate": + if path == "authenticate/check": _LOGGER.info( "401: Unauthorized, credentials are wrong, won't retry" ) diff --git a/pyIndego/states.py b/pyIndego/states.py index 8e844ae..6be15cf 100644 --- a/pyIndego/states.py +++ b/pyIndego/states.py @@ -167,6 +167,8 @@ class GenericData: model_description: str = None model_voltage: ModelVoltage = field(default_factory=ModelVoltage) mowing_mode_description: str = None + #renew_date: str = None + renew_date: datetime = None def __post_init__(self): """Set model description, voltage, mode description.""" @@ -179,6 +181,7 @@ def __post_init__(self): self.mowing_mode_description = MOWING_MODE_DESCRIPTION.get( self.alm_mode, DEFAULT_LOOKUP_VALUE ) + self.renew_date = convert_bosch_datetime(self.renew_date) @dataclass @@ -317,6 +320,7 @@ class State: svg_yPos: int = None config_change: bool = None mow_trig: bool = None + enabled: bool @dataclass From a2a0d3d2f40275902ebfe068196e7ce89c896c0d Mon Sep 17 00:00:00 2001 From: jm-73 Date: Tue, 12 Oct 2021 06:53:59 +0200 Subject: [PATCH 2/2] Changes in Bosch API default values for new state variable --- pyIndego/states.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyIndego/states.py b/pyIndego/states.py index 6be15cf..57a36e9 100644 --- a/pyIndego/states.py +++ b/pyIndego/states.py @@ -320,7 +320,7 @@ class State: svg_yPos: int = None config_change: bool = None mow_trig: bool = None - enabled: bool + enabled: bool = None @dataclass