From 1ec61ac61c64c087d5861a77c235696ba2266c11 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Thu, 31 Dec 2020 00:55:47 +0100 Subject: [PATCH] fix charge controlv5 --- ChargeControl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChargeControl.py b/ChargeControl.py index e5eda82..e8e8cf1 100644 --- a/ChargeControl.py +++ b/ChargeControl.py @@ -59,8 +59,8 @@ class ChargeControl: logger.info(f"charging status of {self.vin} is {status}, battery level: {level}") if status == "InProgress": # force update if the car doesn't send info during 10 minutes - last_update = res.energy[0].updated_at.replace(tzinfo=pytz.UTC) - if (datetime.utcnow() - last_update).total_seconds() > 60 * 10: + last_update = res.energy[0].updated_at + if (datetime.utcnow().replace(tzinfo=pytz.UTC) - last_update).total_seconds() > 60 * 10: self.psacc.wakeup(self.vin) if (level >= self.percentage_threshold and self.retry_count < 2) or stop_charge: self.psacc.charge_now(self.vin, False)