fix: use charging rate as a indicator for not updated api when charging

This commit is contained in:
SharkEzz
2022-09-03 20:30:25 +02:00
parent a324a5ed5a
commit bce6e5c3f5
+4
View File
@@ -92,6 +92,10 @@ class RemoteClient:
if charge_info is not None and charge_info.get('remaining_time', 0) != 0:
try:
car = self.vehicles_list.get_car_by_vin(vin=vin)
if car and car.status.get_energy('Electric').charging.status == INPROGRESS and charge_info.get('rate', 0) != 0:
# if the api report the car as charging and the charging rate is not 0, it means that the api is up to date
return
if car and car.status.get_energy('Electric').charging.status != INPROGRESS:
# fix a psa server bug where charge beginning without status api being properly updated
logger.warning("charge begin but API isn't updated")