carconnectivity-connector-seatcupra 0.3__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {carconnectivity_connector_seatcupra-0.3.dist-info → carconnectivity_connector_seatcupra-0.4.1.dist-info}/METADATA +3 -3
- {carconnectivity_connector_seatcupra-0.3.dist-info → carconnectivity_connector_seatcupra-0.4.1.dist-info}/RECORD +9 -9
- carconnectivity_connectors/seatcupra/_version.py +2 -2
- carconnectivity_connectors/seatcupra/auth/openid_session.py +2 -3
- carconnectivity_connectors/seatcupra/command_impl.py +1 -1
- carconnectivity_connectors/seatcupra/connector.py +15 -2
- {carconnectivity_connector_seatcupra-0.3.dist-info → carconnectivity_connector_seatcupra-0.4.1.dist-info}/WHEEL +0 -0
- {carconnectivity_connector_seatcupra-0.3.dist-info → carconnectivity_connector_seatcupra-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {carconnectivity_connector_seatcupra-0.3.dist-info → carconnectivity_connector_seatcupra-0.4.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: carconnectivity-connector-seatcupra
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.1
|
4
4
|
Summary: CarConnectivity connector for Seat and Cupra services
|
5
5
|
Author: Till Steinbach
|
6
6
|
License: MIT License
|
@@ -37,10 +37,10 @@ Classifier: Topic :: Software Development :: Libraries
|
|
37
37
|
Requires-Python: >=3.9
|
38
38
|
Description-Content-Type: text/markdown
|
39
39
|
License-File: LICENSE
|
40
|
-
Requires-Dist: carconnectivity>=0.
|
40
|
+
Requires-Dist: carconnectivity>=0.7
|
41
41
|
Requires-Dist: oauthlib~=3.2.2
|
42
42
|
Requires-Dist: requests~=2.32.3
|
43
|
-
Requires-Dist:
|
43
|
+
Requires-Dist: pyjwt~=2.10
|
44
44
|
Dynamic: license-file
|
45
45
|
|
46
46
|
|
@@ -1,21 +1,21 @@
|
|
1
|
-
carconnectivity_connector_seatcupra-0.
|
1
|
+
carconnectivity_connector_seatcupra-0.4.1.dist-info/licenses/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
|
2
2
|
carconnectivity_connectors/seatcupra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
carconnectivity_connectors/seatcupra/_version.py,sha256=
|
3
|
+
carconnectivity_connectors/seatcupra/_version.py,sha256=yF2DwGUoQKNnLhAbpZX8kCQKjw77EZzhRk7_OTftets,511
|
4
4
|
carconnectivity_connectors/seatcupra/capability.py,sha256=936V06hOX8AuAMxL_S9wVyVa36Xw1bo9081X0xf5f94,5064
|
5
5
|
carconnectivity_connectors/seatcupra/charging.py,sha256=mayvseay5x2r2qjWqol0ijlgoBL2L2A0A96T44FOiHg,4076
|
6
6
|
carconnectivity_connectors/seatcupra/climatization.py,sha256=0xxWlxrheAPzkVT8WRQtbm6ExZmVdgW7lUdOXyS_qWY,1695
|
7
|
-
carconnectivity_connectors/seatcupra/command_impl.py,sha256=
|
8
|
-
carconnectivity_connectors/seatcupra/connector.py,sha256=
|
7
|
+
carconnectivity_connectors/seatcupra/command_impl.py,sha256=5kIzMWhabUTtLVcrWQuu2Xp78NnF96G3Fr-nt9h6IA0,3234
|
8
|
+
carconnectivity_connectors/seatcupra/connector.py,sha256=N8LhUSgy6zK4rjtLuLgI1xPwYqPmFzqaZ4gczaXy2tE,131556
|
9
9
|
carconnectivity_connectors/seatcupra/vehicle.py,sha256=LHkAlVD_C8xOX81wCGFZbZqyhctpKx-CN0T3NZJ2jFk,3946
|
10
10
|
carconnectivity_connectors/seatcupra/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
carconnectivity_connectors/seatcupra/auth/auth_util.py,sha256=Y81h8fGOMSMgPtE4wI_TI9WgE_s43uaPjRLBBINhj4g,4433
|
12
12
|
carconnectivity_connectors/seatcupra/auth/my_cupra_session.py,sha256=VF_9U8fESLkndVaPn2W1ZxZwNr9-ndeaegeTVT5FyYk,13904
|
13
|
-
carconnectivity_connectors/seatcupra/auth/openid_session.py,sha256=
|
13
|
+
carconnectivity_connectors/seatcupra/auth/openid_session.py,sha256=TWcM2htpvEZ3UMgnLaizHR8_knmoAoIbWWJFvtwZSGg,16909
|
14
14
|
carconnectivity_connectors/seatcupra/auth/session_manager.py,sha256=ZIDvC848T3fy6PgGqCl8A2SzaNhu2YG19Xam5kgp7SA,5635
|
15
15
|
carconnectivity_connectors/seatcupra/auth/vw_web_session.py,sha256=CcI6m68IyRs6WsMDu-IsW3Dj85vyGiMmxvFqNETMHO0,10929
|
16
16
|
carconnectivity_connectors/seatcupra/auth/helpers/blacklist_retry.py,sha256=f3wsiY5bpHDBxp7Va1Mv9nKJ4u3qnCHZZmDu78_AhMk,1251
|
17
17
|
carconnectivity_connectors/seatcupra/ui/connector_ui.py,sha256=UXDWnMAyTrm0UReTP2WamorrPE5kAJ5oxOjCp-MrZ-c,1414
|
18
|
-
carconnectivity_connector_seatcupra-0.
|
19
|
-
carconnectivity_connector_seatcupra-0.
|
20
|
-
carconnectivity_connector_seatcupra-0.
|
21
|
-
carconnectivity_connector_seatcupra-0.
|
18
|
+
carconnectivity_connector_seatcupra-0.4.1.dist-info/METADATA,sha256=d9HfYwoW_xuUPhOwIAHzgHy6VaQce2QWnYD6p40NYU8,5494
|
19
|
+
carconnectivity_connector_seatcupra-0.4.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
20
|
+
carconnectivity_connector_seatcupra-0.4.1.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
|
21
|
+
carconnectivity_connector_seatcupra-0.4.1.dist-info/RECORD,,
|
@@ -6,7 +6,7 @@ from enum import Enum, auto
|
|
6
6
|
import time
|
7
7
|
import logging
|
8
8
|
import requests
|
9
|
-
|
9
|
+
import jwt
|
10
10
|
from datetime import datetime, timezone
|
11
11
|
|
12
12
|
from oauthlib.common import UNICODE_ASCII_CHARACTER_SET, generate_nonce, generate_token
|
@@ -151,8 +151,7 @@ class OpenIDSession(requests.Session):
|
|
151
151
|
new_token['expires_in'] = self._token['expires_in']
|
152
152
|
else:
|
153
153
|
if 'id_token' in new_token:
|
154
|
-
|
155
|
-
meta_data = jwt_instance.decode(new_token['id_token'], do_verify=False)
|
154
|
+
meta_data = jwt.decode(new_token['id_token'], do_verify=False)
|
156
155
|
if 'exp' in meta_data:
|
157
156
|
new_token['expires_at'] = meta_data['exp']
|
158
157
|
expires_at = datetime.fromtimestamp(meta_data['exp'], tz=timezone.utc)
|
@@ -44,7 +44,7 @@ class SpinCommand(GenericCommand):
|
|
44
44
|
parser.add_argument('--spin', dest='spin', help='Spin to be used instead of spin from config or .netrc', type=str, required=False,
|
45
45
|
default=None)
|
46
46
|
try:
|
47
|
-
args = parser.parse_args(new_value.split(sep=' '))
|
47
|
+
args = parser.parse_args(new_value.strip().split(sep=' '))
|
48
48
|
except argparse.ArgumentError as e:
|
49
49
|
raise SetterError(f'Invalid format for SpinCommand: {e.message} {parser.format_usage()}') from e
|
50
50
|
|
@@ -316,7 +316,7 @@ class Connector(BaseConnector):
|
|
316
316
|
and vehicle.position.position_type.enabled and vehicle.position.position_type.value == Position.PositionType.PARKING:
|
317
317
|
vehicle.state._set_value(GenericVehicle.State.PARKED) # pylint: disable=protected-access
|
318
318
|
else:
|
319
|
-
vehicle.state._set_value(
|
319
|
+
vehicle.state._set_value(GenericVehicle.State.UNKNOWN) # pylint: disable=protected-access
|
320
320
|
|
321
321
|
def fetch_vehicles(self) -> None:
|
322
322
|
"""
|
@@ -669,11 +669,13 @@ class Connector(BaseConnector):
|
|
669
669
|
if 'levelPct' in vehicle_status_data['engines'][drive_id] and vehicle_status_data['engines'][drive_id]['levelPct'] is not None:
|
670
670
|
# pylint: disable-next=protected-access
|
671
671
|
drive.level._set_value(value=vehicle_status_data['engines'][drive_id]['levelPct'])
|
672
|
+
drive.level.precision = 1
|
672
673
|
else:
|
673
674
|
drive.level._set_value(None) # pylint: disable=protected-access
|
674
675
|
if 'rangeKm' in vehicle_status_data['engines'][drive_id] and vehicle_status_data['engines'][drive_id]['rangeKm'] is not None:
|
675
676
|
# pylint: disable-next=protected-access
|
676
677
|
drive.range._set_value(value=vehicle_status_data['engines'][drive_id]['rangeKm'], unit=Length.KM)
|
678
|
+
drive.range.precision = 1
|
677
679
|
total_range += vehicle_status_data['engines'][drive_id]['rangeKm']
|
678
680
|
else:
|
679
681
|
drive.range._set_value(None, unit=Length.KM) # pylint: disable=protected-access
|
@@ -681,6 +683,7 @@ class Connector(BaseConnector):
|
|
681
683
|
'levelPct',
|
682
684
|
'rangeKm'})
|
683
685
|
vehicle.drives.total_range._set_value(total_range, unit=Length.KM) # pylint: disable=protected-access
|
686
|
+
vehicle.drives.total_range.precision = 1
|
684
687
|
else:
|
685
688
|
vehicle.drives.enabled = False
|
686
689
|
if len(vehicle.drives.drives) > 0:
|
@@ -816,7 +819,9 @@ class Connector(BaseConnector):
|
|
816
819
|
else:
|
817
820
|
longitude = None
|
818
821
|
vehicle.position.latitude._set_value(latitude) # pylint: disable=protected-access
|
822
|
+
vehicle.position.latitude.precision = 0.000001
|
819
823
|
vehicle.position.longitude._set_value(longitude) # pylint: disable=protected-access
|
824
|
+
vehicle.position.longitude.precision = 0.000001
|
820
825
|
vehicle.position.position_type._set_value(Position.PositionType.PARKING) # pylint: disable=protected-access
|
821
826
|
log_extra_keys(LOG_API, 'parkingposition', data, {'lat', 'lon'})
|
822
827
|
else:
|
@@ -847,6 +852,7 @@ class Connector(BaseConnector):
|
|
847
852
|
if data is not None:
|
848
853
|
if 'mileageKm' in data and data['mileageKm'] is not None:
|
849
854
|
vehicle.odometer._set_value(data['mileageKm'], unit=Length.KM) # pylint: disable=protected-access
|
855
|
+
vehicle.odometer.precision = 1
|
850
856
|
else:
|
851
857
|
vehicle.odometer._set_value(None) # pylint: disable=protected-access
|
852
858
|
log_extra_keys(LOG_API, f'https://ola.prod.code.seat.cloud.vwgroup.com/v1/vehicles/{vin}/mileage', data, {'mileageKm'})
|
@@ -869,22 +875,26 @@ class Connector(BaseConnector):
|
|
869
875
|
if 'rangeName' in range_dict and range_dict['rangeName'] is not None and range_dict['rangeName'] == 'electricRangeKm' \
|
870
876
|
and 'value' in range_dict and range_dict['value'] is not None:
|
871
877
|
drive.range._set_value(range_dict['value'], unit=Length.KM) # pylint: disable=protected-access
|
878
|
+
drive.range.precision = 1
|
872
879
|
break
|
873
880
|
elif drive.type.enabled and drive.type.value == GenericDrive.Type.GASOLINE:
|
874
881
|
for range_dict in data['ranges']:
|
875
882
|
if 'rangeName' in range_dict and range_dict['rangeName'] is not None and range_dict['rangeName'] == 'gasolineRangeKm' \
|
876
883
|
and 'value' in range_dict and range_dict['value'] is not None:
|
877
884
|
drive.range._set_value(range_dict['value'], unit=Length.KM) # pylint: disable=protected-access
|
885
|
+
drive.range.precision = 1
|
878
886
|
break
|
879
887
|
elif drive.type.enabled and drive.type.value == GenericDrive.Type.DIESEL:
|
880
888
|
for range_dict in data['ranges']:
|
881
889
|
if 'rangeName' in range_dict and range_dict['rangeName'] is not None and range_dict['rangeName'] == 'dieselRangeKm' \
|
882
890
|
and 'value' in range_dict and range_dict['value'] is not None:
|
883
891
|
drive.range._set_value(range_dict['value'], unit=Length.KM) # pylint: disable=protected-access
|
892
|
+
drive.range.precision = 1
|
884
893
|
elif 'rangeName' in range_dict and range_dict['rangeName'] is not None and range_dict['rangeName'] == 'adBlueKm' \
|
885
894
|
and 'value' in range_dict and range_dict['value'] is not None:
|
886
895
|
if isinstance(drive, DieselDrive):
|
887
896
|
drive.adblue_range._set_value(range_dict['value'], unit=Length.KM) # pylint: disable=protected-access
|
897
|
+
drive.adblue_range.precision = 1
|
888
898
|
log_extra_keys(LOG_API, f'https://ola.prod.code.seat.cloud.vwgroup.com/v1/vehicles/{vin}/ranges', data, {'ranges'})
|
889
899
|
return vehicle
|
890
900
|
|
@@ -905,6 +915,7 @@ class Connector(BaseConnector):
|
|
905
915
|
vehicle.maintenance.inspection_due_at._set_value(None) # pylint: disable=protected-access
|
906
916
|
if 'inspectionDueKm' in data and data['inspectionDueKm'] is not None:
|
907
917
|
vehicle.maintenance.inspection_due_after._set_value(data['inspectionDueKm'], unit=Length.KM) # pylint: disable=protected-access
|
918
|
+
vehicle.maintenance.inspection_due_after.precision = 1
|
908
919
|
else:
|
909
920
|
vehicle.maintenance.inspection_due_after._set_value(None) # pylint: disable=protected-access
|
910
921
|
if 'oilServiceDueDays' in data and data['oilServiceDueDays'] is not None:
|
@@ -917,11 +928,13 @@ class Connector(BaseConnector):
|
|
917
928
|
vehicle.maintenance.oil_service_due_at._set_value(None) # pylint: disable=protected-access
|
918
929
|
if 'oilServiceDueKm' in data and data['oilServiceDueKm'] is not None:
|
919
930
|
vehicle.maintenance.oil_service_due_after._set_value(data['oilServiceDueKm'], unit=Length.KM) # pylint: disable=protected-access
|
931
|
+
vehicle.maintenance.oil_service_due_after.precision = 1
|
920
932
|
else:
|
921
933
|
vehicle.maintenance.oil_service_due_after._set_value(None) # pylint: disable=protected-access
|
922
934
|
log_extra_keys(LOG_API, f'/v1/vehicles/{vin}/maintenance', data, {'inspectionDueDays', 'inspectionDueKm', 'oilServiceDueDays', 'oilServiceDueKm'})
|
923
935
|
else:
|
924
936
|
vehicle.odometer._set_value(None) # pylint: disable=protected-access
|
937
|
+
vehicle.odometer.precision = 1
|
925
938
|
return vehicle
|
926
939
|
|
927
940
|
def fetch_climatisation(self, vehicle: SeatCupraVehicle, no_cache: bool = False) -> SeatCupraVehicle:
|
@@ -1330,7 +1343,7 @@ class Connector(BaseConnector):
|
|
1330
1343
|
elif not allow_http_error or (allowed_errors is not None and status_response.status_code not in allowed_errors):
|
1331
1344
|
raise RetrievalError(f'Could not fetch data even after re-authorization. Status Code was: {status_response.status_code}')
|
1332
1345
|
elif not allow_http_error or (allowed_errors is not None and status_response.status_code not in allowed_errors):
|
1333
|
-
raise RetrievalError(f'Could not fetch data. Status Code was: {status_response.status_code}')
|
1346
|
+
raise RetrievalError(f'Could not fetch data for {url}. Status Code was: {status_response.status_code}')
|
1334
1347
|
except requests.exceptions.ConnectionError as connection_error:
|
1335
1348
|
raise RetrievalError(f'Connection error: {connection_error}.'
|
1336
1349
|
' If this happens frequently, please check if other applications communicate with the Seat/Cupra server.') from connection_error
|
File without changes
|
File without changes
|