From 39edd62637d37820d7bbb36708dcb8d121d06ed1 Mon Sep 17 00:00:00 2001 From: h4de5 Date: Wed, 2 Jun 2021 01:07:03 +0200 Subject: [PATCH] Add auto-relogin after a command failed #30 - Happens when the same vimar user logged in from somewhere else --- custom_components/vimar/manifest.json | 2 +- custom_components/vimar/vimarlink/vimarlink.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/vimar/manifest.json b/custom_components/vimar/manifest.json index 1331164..dcddbd0 100755 --- a/custom_components/vimar/manifest.json +++ b/custom_components/vimar/manifest.json @@ -6,6 +6,6 @@ "dependencies": [], "config_flow": false, "codeowners": ["@h4de5"], - "version": "2021.5.3", + "version": "2021.5.4", "iot_class": "local_polling" } diff --git a/custom_components/vimar/vimarlink/vimarlink.py b/custom_components/vimar/vimarlink/vimarlink.py index c7c285e..2300c8f 100755 --- a/custom_components/vimar/vimarlink/vimarlink.py +++ b/custom_components/vimar/vimarlink/vimarlink.py @@ -512,6 +512,10 @@ def _parse_sql_payload(self, string): # exc_type, exc_obj, exc_tb = sys.exc_info() _, _, exc_tb = sys.exc_info() _LOGGER.error("Error parsing SQL: %s in line: %d - payload: %s" % (err, exc_tb.tb_lineno, string)) + # enforce relogin + _LOGGER.info("Start to relogin..") + VimarLink._session_id = None + self.login() # raise VimarConnectionError( # "Error parsing SQL: %s in line: %d - payload: %s" % (err, exc_tb.tb_lineno, string))