From e3399b432717eb6b7742dc4163492cf235f9571a Mon Sep 17 00:00:00 2001 From: SharkEzz Date: Sat, 3 Sep 2022 21:09:32 +0200 Subject: [PATCH] Fix --- psa_car_controller/psa/RemoteClient.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/psa_car_controller/psa/RemoteClient.py b/psa_car_controller/psa/RemoteClient.py index 83b0518..9efdb36 100644 --- a/psa_car_controller/psa/RemoteClient.py +++ b/psa_car_controller/psa/RemoteClient.py @@ -89,13 +89,9 @@ class RemoteClient: logger.exception("on_mqtt_message:") def _fix_not_updated_api(self, charge_info, vin): - if charge_info is not None and charge_info.get('remaining_time', 0) != 0: + if charge_info is not None and charge_info.get('remaining_time', 0) != 0 and charge_info.get('rate', 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")