From f0312540f29fe1e7d1f68b99f76e978c5237461e Mon Sep 17 00:00:00 2001 From: Andrea Mattioli Date: Thu, 5 Dec 2024 21:05:51 +0000 Subject: [PATCH] add new attribute remaining time --- custom_components/bticino_x8000/__init__.py | 1 + custom_components/bticino_x8000/api.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/custom_components/bticino_x8000/__init__.py b/custom_components/bticino_x8000/__init__.py index e9de7cc..be8c547 100644 --- a/custom_components/bticino_x8000/__init__.py +++ b/custom_components/bticino_x8000/__init__.py @@ -49,6 +49,7 @@ async def update_token(now: dt_util.dt.datetime | None) -> None: refresh_token, access_token_expires_on, ) = await refresh_access_token(data) + _LOGGER.debug("Access_token_expires_on: %s", access_token_expires_on) data["access_token"] = access_token data["refresh_token"] = refresh_token data["access_token_expires_on"] = access_token_expires_on diff --git a/custom_components/bticino_x8000/api.py b/custom_components/bticino_x8000/api.py index 1a56495..48cf9a9 100644 --- a/custom_components/bticino_x8000/api.py +++ b/custom_components/bticino_x8000/api.py @@ -56,7 +56,7 @@ async def check_api_endpoint_health(self) -> bool: ) return True if status_code == 401: - _LOGGER.warning( + _LOGGER.debug( "Attempt to update token. HTTP %s, Content: %s, data: %s", status_code, content, @@ -80,7 +80,7 @@ async def handle_unauthorized_error(self, response: aiohttp.ClientResponse) -> b status_code = response.status if status_code == 401: - _LOGGER.warning("Received 401 Unauthorized error. Attempting token refresh") + _LOGGER.debug("Received 401 Unauthorized error. Attempting token refresh") ( access_token, _, @@ -187,8 +187,7 @@ async def set_chronothermostat_status( return { "status_code": 500, "error": ( - f"Errore nella richiesta di set_chronothermostat_status: " - f"{e}" + f"Error during set_chronothermostat_status request: " f"{e}" ), } @@ -217,7 +216,7 @@ async def get_chronothermostat_status( except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di get_chronothermostat_status: {e}", + "error": f"Error during get_chronothermostat_status request: {e}", } async def get_chronothermostat_measures( @@ -245,7 +244,7 @@ async def get_chronothermostat_measures( except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di get_chronothermostat_measures: {e}", + "error": f"Error during get_chronothermostat_measures request: {e}", } async def get_chronothermostat_programlist( @@ -278,7 +277,7 @@ async def get_chronothermostat_programlist( except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di get_chronothermostat_programlist: {e}", + "error": f"Error during get_chronothermostat_programlist request: {e}", } async def get_subscriptions_c2c_notifications(self) -> dict[str, Any]: @@ -302,7 +301,7 @@ async def get_subscriptions_c2c_notifications(self) -> dict[str, Any]: except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di get_subscriptions_C2C_notifications: {e}", + "error": f"Error during get_subscriptions_C2C_notifications request: {e}", } async def set_subscribe_c2c_notifications( @@ -329,7 +328,7 @@ async def set_subscribe_c2c_notifications( except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di set_subscribe_C2C_notifications: {e}", + "error": f"Error during set_subscribe_C2C_notifications request: {e}", } async def delete_subscribe_c2c_notifications( @@ -359,5 +358,5 @@ async def delete_subscribe_c2c_notifications( except aiohttp.ClientError as e: return { "status_code": 500, - "error": f"Errore nella richiesta di delete_subscribe_C2C_notifications: {e}", + "error": f"Error during delete_subscribe_C2C_notifications request: {e}", }