carconnectivity-connector-skoda 0.4a1__py3-none-any.whl → 0.4a2__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.

Potentially problematic release.


This version of carconnectivity-connector-skoda might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: carconnectivity-connector-skoda
3
- Version: 0.4a1
3
+ Version: 0.4a2
4
4
  Summary: CarConnectivity connector for Skoda services
5
5
  Author: Till Steinbach
6
6
  License: MIT License
@@ -37,7 +37,7 @@ Classifier: Topic :: Software Development :: Libraries
37
37
  Requires-Python: >=3.8
38
38
  Description-Content-Type: text/markdown
39
39
  License-File: LICENSE
40
- Requires-Dist: carconnectivity>=0.4a3
40
+ Requires-Dist: carconnectivity>=0.4a4
41
41
  Requires-Dist: oauthlib~=3.2.2
42
42
  Requires-Dist: requests~=2.32.3
43
43
  Requires-Dist: jwt~=1.3.1
@@ -1,10 +1,10 @@
1
1
  carconnectivity_connectors/skoda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- carconnectivity_connectors/skoda/_version.py,sha256=p7ZZqa8oRphtLfQU8e4Q4hQOZs0YIdMNs8F2n65fSsQ,508
2
+ carconnectivity_connectors/skoda/_version.py,sha256=k0XQJjsv6zABE1_Xxh5_DMFT99-ORJxNLpqt6IuzIT0,508
3
3
  carconnectivity_connectors/skoda/capability.py,sha256=vbAKK8KKre-CndLF6_5qyWLpfa4KZHk1U-hpb6nCL5w,4225
4
4
  carconnectivity_connectors/skoda/charging.py,sha256=CoUOYHHUPPPldKQvv0h-qrUsoEtstR3iUx-l0IU5rNM,6798
5
5
  carconnectivity_connectors/skoda/climatization.py,sha256=Jut468SkxjPBDTqroWFvDifVPfJBxGjsFed5pc4kZkg,1768
6
6
  carconnectivity_connectors/skoda/command_impl.py,sha256=WdgxWPgi82-UgmyFpiSZE-KHRtRjqn7CH-YX9N3bAoI,2875
7
- carconnectivity_connectors/skoda/connector.py,sha256=_JBlqhBSjxDjmYKIlyPmb9aLxZZeUhPQmrmxG1W_kk4,110681
7
+ carconnectivity_connectors/skoda/connector.py,sha256=7nrQiB1njFPgUYQx-ryrEyJXARSopwC8WPWQabmL2jc,114063
8
8
  carconnectivity_connectors/skoda/error.py,sha256=ffxzvjmci7vtp9Q1K4DR1kBF0kTJxN5Gluci3kDBkEI,2459
9
9
  carconnectivity_connectors/skoda/mqtt_client.py,sha256=PHvMkNhmkP_FxHvVlXzFLJA6Q3vkFCK8jZHkfII_j74,38123
10
10
  carconnectivity_connectors/skoda/vehicle.py,sha256=OhB0MUsCnaqQCnWXBlf_RFUUc9F4W8Gtk-30WYEN6nk,3554
@@ -16,8 +16,8 @@ carconnectivity_connectors/skoda/auth/session_manager.py,sha256=Uf1vujuDBYUCAXhY
16
16
  carconnectivity_connectors/skoda/auth/skoda_web_session.py,sha256=cjzMkzx473Sh-4RgZAQULeRRcxB1MboddldCVM_y5LE,10640
17
17
  carconnectivity_connectors/skoda/auth/helpers/blacklist_retry.py,sha256=f3wsiY5bpHDBxp7Va1Mv9nKJ4u3qnCHZZmDu78_AhMk,1251
18
18
  carconnectivity_connectors/skoda/ui/connector_ui.py,sha256=2Gywhyki52IxIZXV6DhWhzrBLn2293LlUMhK1Rxnw9w,1376
19
- carconnectivity_connector_skoda-0.4a1.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
20
- carconnectivity_connector_skoda-0.4a1.dist-info/METADATA,sha256=rNSjmUcWo1ZuJNFpYjGj6BhjXzehT5ugvlaXOj1fTQU,5365
21
- carconnectivity_connector_skoda-0.4a1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
- carconnectivity_connector_skoda-0.4a1.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
23
- carconnectivity_connector_skoda-0.4a1.dist-info/RECORD,,
19
+ carconnectivity_connector_skoda-0.4a2.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
20
+ carconnectivity_connector_skoda-0.4a2.dist-info/METADATA,sha256=nOT8M1dofmrvCcxQtB0I3xG_RdqtojQ5nf06jzwHu0w,5365
21
+ carconnectivity_connector_skoda-0.4a2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
+ carconnectivity_connector_skoda-0.4a2.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
23
+ carconnectivity_connector_skoda-0.4a2.dist-info/RECORD,,
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.4a1'
20
+ __version__ = version = '0.4a2'
21
21
  __version_tuple__ = version_tuple = (0, 4)
@@ -345,6 +345,8 @@ class Connector(BaseConnector):
345
345
  vehicle_to_update = self.fetch_charging(vehicle_to_update)
346
346
  if vehicle_to_update.capabilities.has_capability('AIR_CONDITIONING'):
347
347
  vehicle_to_update = self.fetch_air_conditioning(vehicle_to_update)
348
+ if vehicle_to_update.capabilities.has_capability('VEHICLE_HEALTH_INSPECTION'):
349
+ vehicle_to_update = self.fetch_maintenance(vehicle_to_update)
348
350
 
349
351
  def fetch_charging(self, vehicle: SkodaElectricVehicle, no_cache: bool = False) -> SkodaElectricVehicle:
350
352
  """
@@ -608,6 +610,53 @@ class Connector(BaseConnector):
608
610
  vehicle.position.position_type._set_value(None) # pylint: disable=protected-access
609
611
  return vehicle
610
612
 
613
+ def fetch_maintenance(self, vehicle: SkodaVehicle, no_cache: bool = False) -> SkodaVehicle:
614
+ """
615
+ Fetches the maintenance information for a given Skoda vehicle.
616
+
617
+ Args:
618
+ vehicle (SkodaVehicle): The vehicle object for which maintenance information is to be fetched.
619
+ no_cache (bool, optional): If True, bypasses the cache and fetches fresh data. Defaults to False.
620
+
621
+ Returns:
622
+ SkodaVehicle: The vehicle object with updated maintenance information.
623
+
624
+ Raises:
625
+ APIError: If the VIN is missing or if the 'capturedAt' field is missing in the fetched data.
626
+ ValueError: If the vehicle has no charging object.
627
+ """
628
+ vin = vehicle.vin.value
629
+ if vin is None:
630
+ raise APIError('VIN is missing')
631
+ if vehicle.position is None:
632
+ raise ValueError('Vehicle has no charging object')
633
+ url = f'https://mysmob.api.connect.skoda-auto.cz/api/v3/vehicle-maintenance/vehicles/{vin}/report'
634
+ data: Dict[str, Any] | None = self._fetch_data(url=url, session=self.session, no_cache=no_cache)
635
+ #{'capturedAt': '2025-02-24T19:54:32.728Z', 'inspectionDueInDays': 620, 'mileageInKm': 2512}
636
+ if data is not None:
637
+ if 'capturedAt' in data and data['capturedAt'] is not None:
638
+ captured_at: datetime = robust_time_parse(data['capturedAt'])
639
+ else:
640
+ raise APIError('Could not fetch maintenance, capturedAt missing')
641
+ if 'mileageInKm' in data and data['mileageInKm'] is not None:
642
+ vehicle.odometer._set_value(value=data['mileageInKm'], measured=captured_at, unit=Length.KM) # pylint: disable=protected-access
643
+ else:
644
+ vehicle.odometer._set_value(None) # pylint: disable=protected-access
645
+ if 'inspectionDueInDays' in data and data['inspectionDueInDays'] is not None:
646
+ inspection_due: timedelta = timedelta(days=data['inspectionDueInDays'])
647
+ inspection_date: datetime = captured_at + inspection_due
648
+ inspection_date = inspection_date.replace(hour=0, minute=0, second=0, microsecond=0)
649
+ # pylint: disable-next=protected-access
650
+ vehicle.maintenance.inspection_due_at._set_value(value=inspection_date, measured=captured_at)
651
+ else:
652
+ vehicle.maintenance.inspection_due_at._set_value(None) # pylint: disable=protected-access
653
+ log_extra_keys(LOG_API, 'maintenance', data, {'capturedAt', 'mileageInKm', 'inspectionDueInDays'})
654
+
655
+ #url = f'https://mysmob.api.connect.skoda-auto.cz/api/v1/vehicle-health-report/warning-lights/{vin}'
656
+ #data: Dict[str, Any] | None = self._fetch_data(url=url, session=self.session, no_cache=no_cache)
657
+ #{'capturedAt': '2025-02-24T15:32:35.032Z', 'mileageInKm': 2512, 'warningLights': [{'category': 'ASSISTANCE', 'defects': []}, {'category': 'COMFORT', 'defects': []}, {'category': 'BRAKE', 'defects': []}, {'category': 'ELECTRIC_ENGINE', 'defects': []}, {'category': 'LIGHTING', 'defects': []}, {'category': 'TIRE', 'defects': []}, {'category': 'OTHER', 'defects': []}]}
658
+ return vehicle
659
+
611
660
  def fetch_air_conditioning(self, vehicle: SkodaVehicle, no_cache: bool = False) -> SkodaVehicle:
612
661
  """
613
662
  Fetches the air conditioning data for a given Skoda vehicle and updates the vehicle object with the retrieved data.