Skip to content

Commit

Permalink
Avoid sending ABRP update without SoC
Browse files Browse the repository at this point in the history
The ABRP battery prediction algorithm doesn't work when live data is
uploaded without State of Charge (soc) field. This commit avoids sending
 such updates.

(cherry picked from commit d8ca85c)
  • Loading branch information
cascer1 authored and flobz committed Nov 14, 2023
1 parent 771cf54 commit 8b0c625
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions psa_car_controller/psacc/application/abrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def call(self, car: Car, ext_temp: float = None):
logger.debug("No abrp token provided")
elif car.vin in self.abrp_enable_vin:
energy = car.status.get_energy('Electric')

if energy.level is None:
logger.debug("No energy level available")
return False

tlm = {"utc": int(datetime.timestamp(energy.updated_at)),
"soc": energy.level,
"speed": getattr(car.status.kinetic, "speed", None),
Expand Down

0 comments on commit 8b0c625

Please sign in to comment.