diff --git a/psa_car_controller/psacc/application/psa_client.py b/psa_car_controller/psacc/application/psa_client.py index bef30ce..fee3ff9 100644 --- a/psa_car_controller/psacc/application/psa_client.py +++ b/psa_car_controller/psacc/application/psa_client.py @@ -71,7 +71,7 @@ class PSAClient: self.set_proxies(proxies) self.config_file = DEFAULT_CONFIG_FILENAME Ecomix.co2_signal_key = co2_signal_api - self.refresh_thread = None + self.refresh_thread: threading.Timer = None remote_credentials = RemoteCredentials(remote_refresh_token) remote_credentials.update_callbacks.append(self.save_config) self.remote_client = RemoteClient(self.account_info, @@ -119,6 +119,7 @@ class PSAClient: if self.info_refresh_rate is not None: if self.refresh_thread and self.refresh_thread.is_alive(): logger.debug("refresh_vehicle_info: precedent task still alive") + self.refresh_thread.cancel() self.refresh_thread = threading.Timer(self.info_refresh_rate, self.__refresh_vehicle_info) self.refresh_thread.daemon = True self.refresh_thread.start()