Merge branch 'master' into feature-hybrid_compatibility

This commit is contained in:
jlayec
2021-03-06 17:38:16 +00:00
3 changed files with 25 additions and 14 deletions
+3 -3
View File
@@ -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
@@ -22,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.
+12 -8
View File
@@ -227,7 +227,7 @@ class MyPSACC:
headers={
"Connection": "Keep-Alive",
"User-Agent": "okhttp/4.8.0",
"x-introspect-realm": "clientsB2CPeugeot"
"x-introspect-realm": self.realm
})
return res
@@ -362,13 +362,17 @@ class MyPSACC:
reg = r"PT([0-9]{1,2})H([0-9]{1,2})?"
data = self.get_vehicle_info(vin)
hour_str = data.get_energy('Electric').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)
+10 -3
View File
@@ -78,9 +78,16 @@ def preconditioning(vin, activate):
@app.route('/position/<string:vin>')
def get_position(vin):
res = myp.get_vehicle_info(vin)
longitude, latitude = res.last_position.geometry.coordinates
return jsonify(
{"longitude": longitude, "latitude": latitude, "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