From 28e3567931c614a5979e51b224b7b2ed4a7627be Mon Sep 17 00:00:00 2001 From: Richard van den Berg Date: Thu, 13 Jun 2024 09:34:17 +0200 Subject: [PATCH] Increase cacheTime for vehicle_data to 300, set vehicle lastErrorTime at 429 in wakeVehicle() --- lib/TWCManager/Vehicle/TeslaAPI.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/TWCManager/Vehicle/TeslaAPI.py b/lib/TWCManager/Vehicle/TeslaAPI.py index 6664e0a6..3b730df5 100644 --- a/lib/TWCManager/Vehicle/TeslaAPI.py +++ b/lib/TWCManager/Vehicle/TeslaAPI.py @@ -1269,6 +1269,7 @@ def wakeVehicle(self, vehicle): elif req.status_code == 429: # We're explicitly being told to back off self.errorCount = max(30, self.errorCount) + self.updateCarApiLastErrorTime(vehicle) return False except json.decoder.JSONDecodeError: return False @@ -1479,7 +1480,7 @@ def get_car_api(self, url, checkReady=True, provesOnline=True): self.carapi.updateCarApiLastErrorTime(self) return (False, None) - def update_location(self, cacheTime=60): + def update_location(self, cacheTime=300): if self.syncSource == "TeslaAPI": return self.update_vehicle_data(cacheTime) @@ -1490,7 +1491,7 @@ def update_location(self, cacheTime=60): return True - def update_vehicle_data(self, cacheTime=60): + def update_vehicle_data(self, cacheTime=300): url = ( "/".join([self.carapi.getCarApiBaseURL(), str(self.VIN), "vehicle_data"]) + "?endpoints="