From 41fe29cae3df0bc69651aa3604afaee959e46c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Mon, 1 Jul 2024 19:32:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5=20Remove=20compatibility=20with=20?= =?UTF-8?q?api=20v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This version of the api has been deprecated a long time ago and stopped on June 30th --- custom_components/rte_ecowatt/__init__.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/custom_components/rte_ecowatt/__init__.py b/custom_components/rte_ecowatt/__init__.py index 9ffce71..9395578 100644 --- a/custom_components/rte_ecowatt/__init__.py +++ b/custom_components/rte_ecowatt/__init__.py @@ -233,17 +233,9 @@ async def _real_update_method(self): api_result = await client.get(url, headers=headers) _LOGGER.info(f"data received, status code: {api_result.status}") if api_result.status == 403: - # a code 403 is likely to be an api key from a previous version of the api - if self.api_version == "v5": - _LOGGER.warn( - f"Received a 403, api key is likely from a previous version, downgrading to api v4. You can regenerate a new api key to avoid this warning" - ) - self.api_version = "v4" - return await self.update_method() - else: - raise UpdateFailed( - f"Error communicating with RTE API: received a 403 from api, even with version {self.api_version}" - ) + raise UpdateFailed( + f"Error communicating with RTE API: received a 403 from api" + ) if api_result.status == 429: # a code 429 is expected when requesting more often than every 15minutes and not using the sandbox url # FIXME(kamaradclimber): avoid this error when home assistant is restarting by storing state and last update