From 9e3f708d36f82193d56dd649061ded4e6156cc23 Mon Sep 17 00:00:00 2001 From: Romain Fafet Date: Sun, 7 Feb 2021 16:37:43 +0100 Subject: [PATCH 1/8] fix Value Error for position/ --- web/callback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/callback.py b/web/callback.py index 5158688..613fc8a 100644 --- a/web/callback.py +++ b/web/callback.py @@ -77,9 +77,9 @@ def preconditioning(vin, activate): @app.route('/position/') def get_position(vin): res = myp.get_vehicle_info(vin) - longitude, latitude = res.last_position.geometry.coordinates + longitude, latitude, altitude = res.last_position.geometry.coordinates return jsonify( - {"longitude": longitude, "latitude": latitude, "url": f"http://maps.google.com/maps?q={latitude},{longitude}"}) + {"longitude": longitude, "latitude": latitude, "altitude": altitude, "url": f"http://maps.google.com/maps?q={latitude},{longitude}"}) # Set a battery threshold and schedule an hour to stop the charge From 4458df212e25f40473c286c4361d017ddd22f804 Mon Sep 17 00:00:00 2001 From: Romain Fafet Date: Tue, 9 Feb 2021 00:34:03 +0100 Subject: [PATCH 2/8] fix case when there is no altitude --- web/callback.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web/callback.py b/web/callback.py index 613fc8a..74ae744 100644 --- a/web/callback.py +++ b/web/callback.py @@ -77,9 +77,16 @@ def preconditioning(vin, activate): @app.route('/position/') def get_position(vin): res = myp.get_vehicle_info(vin) - longitude, latitude, altitude = res.last_position.geometry.coordinates - return jsonify( - {"longitude": longitude, "latitude": latitude, "altitude": altitude, "url": f"http://maps.google.com/maps?q={latitude},{longitude}"}) + coordinates=res.last_position.geometry.coordinates + if len(coordinates)==3: # altitude is not always availlable + longitude, latitude, altitude = coordinates + return jsonify( + {"longitude": longitude, "latitude": latitude, "altitude": altitude, "url": f"http://maps.google.com/maps?q={latitude},{longitude}"}) + else: + longitude, latitude = coordinates + return jsonify( + {"longitude": longitude, "latitude": latitude, "url": f"http://maps.google.com/maps?q={latitude},{longitude}"}) + # Set a battery threshold and schedule an hour to stop the charge From 3155208001dfdd15753da0788f0b0fe7c280fa45 Mon Sep 17 00:00:00 2001 From: jlayec Date: Sun, 21 Feb 2021 22:49:20 +0000 Subject: [PATCH 3/8] fix charge_control web/callback --- server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 88f2950..3cf0fc8 100755 --- a/server.py +++ b/server.py @@ -66,4 +66,6 @@ if __name__ == "__main__": if args.charge_control: web.app.chc = ChargeControls.load_config(web.app.myp, name=args.charge_control) web.app.chc.start() - save_config(web.app.myp) \ No newline at end of file + save_config(web.app.myp) + t1 = Thread(target=start_app, args=["My car info", args.base_path, args.debug < 20, args.listen, int(args.port)]) + t1.start() From 34b600bc71dc744bb225ad5d085c6d1767c02dfd Mon Sep 17 00:00:00 2001 From: jlayec Date: Mon, 22 Feb 2021 22:13:42 +0100 Subject: [PATCH 4/8] re-fix charge_control web/callback --- server.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/server.py b/server.py index 3cf0fc8..b19aa10 100755 --- a/server.py +++ b/server.py @@ -57,8 +57,6 @@ if __name__ == "__main__": client_password = input("mypeugeot password: ") web.app.myp.connect(client_email, client_password) logger.info(web.app.myp.get_vehicles()) - t1 = Thread(target=start_app, args=["My car info", args.base_path, args.debug < 20, args.listen, int(args.port)]) - t1.start() if args.remote_disable: logger.info("mqtt disabled") else: From 6de8cf8cd265c89517984f0813936194a5aef10c Mon Sep 17 00:00:00 2001 From: Florian BEZANNIER <48728684+flobz@users.noreply.github.com> Date: Sun, 28 Feb 2021 19:13:37 +0100 Subject: [PATCH 5/8] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 752a636..3ad7b29 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -12,9 +12,8 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: -1. what solution did you use (solution 1 or 2) -2. what command did you use -3. when the bug append ? +1. what command did you use +2. when the bug append ? **Config file** Give the anonymize content of the config file From 7c62d5f6eb10bbc5bde44cc22dfb6c91ab939955 Mon Sep 17 00:00:00 2001 From: jlayec Date: Thu, 4 Mar 2021 07:18:45 +0000 Subject: [PATCH 6/8] fix realm to get otp --- MyPSACC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MyPSACC.py b/MyPSACC.py index 3c48dac..fc8be6c 100644 --- a/MyPSACC.py +++ b/MyPSACC.py @@ -233,7 +233,7 @@ class MyPSACC: headers={ "Connection": "Keep-Alive", "User-Agent": "okhttp/4.8.0", - "x-introspect-realm": "clientsB2CPeugeot" + "x-introspect-realm": self.realm }) return res From 5cac905cfdf75b8a76cf7b65c96bd0491c39c7df Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Sat, 6 Mar 2021 16:53:15 +0100 Subject: [PATCH 7/8] handle error in get_charge_hour --- MyPSACC.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/MyPSACC.py b/MyPSACC.py index fc8be6c..53a6d4f 100644 --- a/MyPSACC.py +++ b/MyPSACC.py @@ -366,13 +366,17 @@ class MyPSACC: reg = r"PT([0-9]{1,2})H([0-9]{1,2})?" data = self.get_vehicle_info(vin) hour_str = data.energy[0].charging.next_delayed_time - hour = re.findall(reg, hour_str)[0] - h = int(hour[0]) - if hour[1] == '': - m = 0 - else: - m = hour[1] - return h, m + try: + hour = re.findall(reg, hour_str)[0] + h = int(hour[0]) + if hour[1] == '': + m = 0 + else: + m = hour[1] + return h, m + except IndexError: + logger.error(traceback.format_exc()) + logger.error(f"Can't get charge hour: {hour_str}") def get_charge_status(self, vin): data = self.get_vehicle_info(vin) From 0ea9d603ba66f6e07d17d13f7cefe35d59c98c3a Mon Sep 17 00:00:00 2001 From: Florian BEZANNIER <48728684+flobz@users.noreply.github.com> Date: Sat, 6 Mar 2021 16:56:44 +0100 Subject: [PATCH 8/8] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3ad7b29..a301ba4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -21,6 +21,7 @@ Give the anonymize content of the config file **Environment (please complete the following information):** - OS: [e.g. Windows] - Android app Version [e.g. 26.0] + - Brand and model of car **Additional context** Add any other context about the problem here.