carconnectivity-connector-skoda 0.5a1__py3-none-any.whl → 0.6__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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: carconnectivity-connector-skoda
3
- Version: 0.5a1
3
+ Version: 0.6
4
4
  Summary: CarConnectivity connector for Skoda services
5
5
  Author: Till Steinbach
6
6
  License: MIT License
@@ -37,11 +37,12 @@ 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.5a4
40
+ Requires-Dist: carconnectivity>=0.6
41
41
  Requires-Dist: oauthlib~=3.2.2
42
42
  Requires-Dist: requests~=2.32.3
43
43
  Requires-Dist: jwt~=1.3.1
44
44
  Requires-Dist: paho-mqtt~=2.1.0
45
+ Dynamic: license-file
45
46
 
46
47
 
47
48
 
@@ -1,13 +1,14 @@
1
+ carconnectivity_connector_skoda-0.6.dist-info/licenses/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
1
2
  carconnectivity_connectors/skoda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- carconnectivity_connectors/skoda/_version.py,sha256=bOACEC2JYUy747MhESx6BWoNpp7KZI9kUrva3bfgmQk,508
3
+ carconnectivity_connectors/skoda/_version.py,sha256=G_QL3w-CuhuwBbKEJ8sRu9z-JXqi9Z6ikIDJgV_9mtw,506
3
4
  carconnectivity_connectors/skoda/capability.py,sha256=wH563-XUb_TnT8di1qDjnj-cY-cNHcAT6z7mx21LhSQ,4770
4
- carconnectivity_connectors/skoda/charging.py,sha256=CoUOYHHUPPPldKQvv0h-qrUsoEtstR3iUx-l0IU5rNM,6798
5
+ carconnectivity_connectors/skoda/charging.py,sha256=7DPNiTWFhxiiEFKVnbIIU2TCmkpmcMWx_zsHXGXFpAQ,6856
5
6
  carconnectivity_connectors/skoda/climatization.py,sha256=Jut468SkxjPBDTqroWFvDifVPfJBxGjsFed5pc4kZkg,1768
6
- carconnectivity_connectors/skoda/command_impl.py,sha256=vgno5Qb5To0hCHOEBWSG8UOwCY9kT5fz1e2y0b6zF7U,3047
7
- carconnectivity_connectors/skoda/connector.py,sha256=OH0i5Z9MkTvr2QDTg6ENTXj3Kzd6bMBsu9gnLjvb290,136225
7
+ carconnectivity_connectors/skoda/command_impl.py,sha256=dWFoKR_G6j-p0wgqdeVbF3r68FO_jAmgzgPWxW9zvyY,3222
8
+ carconnectivity_connectors/skoda/connector.py,sha256=Q1pUXD27XkoHF7mnYm86uSh8VF4OzurjJ55lJR9mY4I,145317
8
9
  carconnectivity_connectors/skoda/error.py,sha256=ffxzvjmci7vtp9Q1K4DR1kBF0kTJxN5Gluci3kDBkEI,2459
9
10
  carconnectivity_connectors/skoda/mqtt_client.py,sha256=RkZ43NG1Z_TUmc2hUZS0yYUfwewzfut63zZUhQR1xug,39101
10
- carconnectivity_connectors/skoda/vehicle.py,sha256=TeY3qKWbBfxFxt6UzSDrB-YZ4L8GURAvINzBiFm9Y9E,3819
11
+ carconnectivity_connectors/skoda/vehicle.py,sha256=q5gwe-_yPfE_-aEc17UQ-Q0Z46IN7PCpNG5jLw5PZl0,3981
11
12
  carconnectivity_connectors/skoda/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
13
  carconnectivity_connectors/skoda/auth/auth_util.py,sha256=dGLUbUre0HBsTg_Ii5vW34f8DLrCykYJYCyzEvUBBEE,4434
13
14
  carconnectivity_connectors/skoda/auth/my_skoda_session.py,sha256=lSh23SFJs8opjmPwHTv-KNIKDep_WY4aItSP4Zq7bT8,10396
@@ -15,9 +16,8 @@ carconnectivity_connectors/skoda/auth/openid_session.py,sha256=5JfR-gS1uKpE8DD-s
15
16
  carconnectivity_connectors/skoda/auth/session_manager.py,sha256=Uf1vujuDBYUCAXhYToOsZkgbTtfmY3Qe0ICTfwomBpI,2899
16
17
  carconnectivity_connectors/skoda/auth/skoda_web_session.py,sha256=tapjCRRPBu3tHrDoKmtuAlQhgxktib3oWTB8MHEzZTY,10816
17
18
  carconnectivity_connectors/skoda/auth/helpers/blacklist_retry.py,sha256=f3wsiY5bpHDBxp7Va1Mv9nKJ4u3qnCHZZmDu78_AhMk,1251
18
- carconnectivity_connectors/skoda/ui/connector_ui.py,sha256=2Gywhyki52IxIZXV6DhWhzrBLn2293LlUMhK1Rxnw9w,1376
19
- carconnectivity_connector_skoda-0.5a1.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
20
- carconnectivity_connector_skoda-0.5a1.dist-info/METADATA,sha256=dB0LvcHwohnohuDrxnEyb1UcYqNfd9RubqrCyLGbJFw,5360
21
- carconnectivity_connector_skoda-0.5a1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
22
- carconnectivity_connector_skoda-0.5a1.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
23
- carconnectivity_connector_skoda-0.5a1.dist-info/RECORD,,
19
+ carconnectivity_connectors/skoda/ui/connector_ui.py,sha256=lLjwoakRaU0S80hAVwVi4JA1wtHycGHcoM2-7S9qsqI,1386
20
+ carconnectivity_connector_skoda-0.6.dist-info/METADATA,sha256=gBl4hXksq1yvNoa71CaDj2pu2VAujatHB5nxUM5kTnU,5378
21
+ carconnectivity_connector_skoda-0.6.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
22
+ carconnectivity_connector_skoda-0.6.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
23
+ carconnectivity_connector_skoda-0.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.0.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.5a1'
21
- __version_tuple__ = version_tuple = (0, 5)
20
+ __version__ = version = '0.6'
21
+ __version_tuple__ = version_tuple = (0, 6)
@@ -26,11 +26,11 @@ class SkodaCharging(Charging): # pylint: disable=too-many-instance-attributes
26
26
  """
27
27
  def __init__(self, vehicle: ElectricVehicle | None = None, origin: Optional[Charging] = None) -> None:
28
28
  if origin is not None:
29
- super().__init__(origin=origin)
30
- self.settings: Charging.Settings = SkodaCharging.Settings(origin=origin.settings)
29
+ super().__init__(vehicle=vehicle, origin=origin)
30
+ self.settings: Charging.Settings = SkodaCharging.Settings(parent=self, origin=origin.settings)
31
31
  else:
32
32
  super().__init__(vehicle=vehicle)
33
- self.settings: Charging.Settings = SkodaCharging.Settings(origin=self.settings)
33
+ self.settings: Charging.Settings = SkodaCharging.Settings(parent=self, origin=self.settings)
34
34
  self.errors: Dict[str, Error] = {}
35
35
  self.is_in_saved_location: BooleanAttribute = BooleanAttribute("is_in_saved_location", parent=self, tags={'connector_custom'})
36
36
 
@@ -40,7 +40,7 @@ class SkodaCharging(Charging): # pylint: disable=too-many-instance-attributes
40
40
  """
41
41
  def __init__(self, parent: Optional[GenericObject] = None, origin: Optional[Charging.Settings] = None) -> None:
42
42
  if origin is not None:
43
- super().__init__(origin=origin)
43
+ super().__init__(parent=parent, origin=origin)
44
44
  else:
45
45
  super().__init__(parent=parent)
46
46
  self.preferred_charge_mode: EnumAttribute = EnumAttribute("preferred_charge_mode", parent=self, tags={'connector_custom'})
@@ -33,7 +33,11 @@ class SpinCommand(GenericCommand):
33
33
  def value(self, new_value: Optional[Union[str, Dict]]) -> None:
34
34
  # Execute early hooks before parsing the value
35
35
  new_value = self._execute_on_set_hook(new_value, early_hook=True)
36
- if isinstance(new_value, str):
36
+ if isinstance(new_value, SpinCommand.Command):
37
+ newvalue_dict = {}
38
+ newvalue_dict['command'] = new_value
39
+ new_value = newvalue_dict
40
+ elif isinstance(new_value, str):
37
41
  parser = ThrowingArgumentParser(prog='', add_help=False, exit_on_error=False)
38
42
  parser.add_argument('command', help='Command to execute', type=SpinCommand.Command,
39
43
  choices=list(SpinCommand.Command))
@@ -23,7 +23,8 @@ from carconnectivity.doors import Doors
23
23
  from carconnectivity.windows import Windows
24
24
  from carconnectivity.lights import Lights
25
25
  from carconnectivity.drive import GenericDrive, ElectricDrive, CombustionDrive
26
- from carconnectivity.attributes import GenericAttribute, BooleanAttribute, DurationAttribute, TemperatureAttribute, EnumAttribute
26
+ from carconnectivity.attributes import BooleanAttribute, DurationAttribute, TemperatureAttribute, EnumAttribute, LevelAttribute, \
27
+ CurrentAttribute
27
28
  from carconnectivity.charging import Charging
28
29
  from carconnectivity.position import Position
29
30
  from carconnectivity.climatization import Climatization
@@ -327,6 +328,9 @@ class Connector(BaseConnector):
327
328
  if 'vehicles' in data and data['vehicles'] is not None:
328
329
  for vehicle_dict in data['vehicles']:
329
330
  if 'vin' in vehicle_dict and vehicle_dict['vin'] is not None:
331
+ if vehicle_dict['vin'] in self.active_config['hide_vins']:
332
+ LOG.info('Vehicle %s filtered out due to configuration', vehicle_dict['vin'])
333
+ continue
330
334
  seen_vehicle_vins.add(vehicle_dict['vin'])
331
335
  vehicle: Optional[SkodaVehicle] = garage.get_vehicle(vehicle_dict['vin']) # pyright: ignore[reportAssignmentType]
332
336
  if not vehicle:
@@ -373,8 +377,9 @@ class Connector(BaseConnector):
373
377
  vehicle_to_update: Optional[GenericVehicle] = garage.get_vehicle(vin)
374
378
  if vehicle_to_update is not None and isinstance(vehicle_to_update, SkodaVehicle) and vehicle_to_update.is_managed_by_connector(self):
375
379
  vehicle_to_update = self.fetch_vehicle_status(vehicle_to_update)
376
- vehicle_to_update = self.fetch_driving_range(vehicle_to_update)
377
380
  if vehicle_to_update.capabilities is not None and vehicle_to_update.capabilities.enabled:
381
+ if vehicle_to_update.capabilities.has_capability('MEASUREMENTS', check_status_ok=True):
382
+ vehicle_to_update = self.fetch_driving_range(vehicle_to_update)
378
383
  if vehicle_to_update.capabilities.has_capability('READINESS', check_status_ok=True):
379
384
  vehicle_to_update = self.fetch_connection_status(vehicle_to_update)
380
385
  if vehicle_to_update.capabilities.has_capability('PARKING_POSITION', check_status_ok=True):
@@ -509,14 +514,24 @@ class Connector(BaseConnector):
509
514
  if 'settings' in data and data['settings'] is not None:
510
515
  if 'targetStateOfChargeInPercent' in data['settings'] and data['settings']['targetStateOfChargeInPercent'] is not None \
511
516
  and vehicle.charging is not None and vehicle.charging.settings is not None:
517
+ vehicle.charging.settings.target_level.minimum = 50.0
518
+ vehicle.charging.settings.target_level.maximum = 100.0
519
+ vehicle.charging.settings.target_level.precision = 10.0
520
+ vehicle.charging.settings.target_level._add_on_set_hook(self.__on_charging_target_level_change) # pylint: disable=protected-access
521
+ vehicle.charging.settings.target_level._is_changeable = True # pylint: disable=protected-access
512
522
  # pylint: disable-next=protected-access
513
523
  vehicle.charging.settings.target_level._set_value(value=data['settings']['targetStateOfChargeInPercent'], measured=captured_at)
514
524
  else:
515
525
  vehicle.charging.settings.target_level._set_value(None, measured=captured_at) # pylint: disable=protected-access
516
526
  if 'maxChargeCurrentAc' in data['settings'] and data['settings']['maxChargeCurrentAc'] is not None \
517
527
  and vehicle.charging is not None and vehicle.charging.settings is not None:
528
+ vehicle.charging.settings.maximum_current.minimum = 6.0
529
+ vehicle.charging.settings.maximum_current.maximum = 16.0
530
+ vehicle.charging.settings.maximum_current.precision = 1.0
531
+ vehicle.charging.settings.maximum_current._add_on_set_hook(self.__on_charging_maximum_current_change) # pylint: disable=protected-access
532
+ vehicle.charging.settings.maximum_current._is_changeable = True # pylint: disable=protected-access
518
533
  if data['settings']['maxChargeCurrentAc'] == 'MAXIMUM':
519
- vehicle.charging.settings.maximum_current._set_value(value=11, measured=captured_at) # pylint: disable=protected-access
534
+ vehicle.charging.settings.maximum_current._set_value(value=16, measured=captured_at) # pylint: disable=protected-access
520
535
  elif data['settings']['maxChargeCurrentAc'] == 'REDUCED':
521
536
  vehicle.charging.settings.maximum_current._set_value(value=6, measured=captured_at) # pylint: disable=protected-access
522
537
  else:
@@ -525,6 +540,8 @@ class Connector(BaseConnector):
525
540
  else:
526
541
  vehicle.charging.settings.maximum_current._set_value(None, measured=captured_at) # pylint: disable=protected-access
527
542
  if 'autoUnlockPlugWhenCharged' in data['settings'] and data['settings']['autoUnlockPlugWhenCharged'] is not None:
543
+ vehicle.charging.settings.auto_unlock._add_on_set_hook(self.__on_charging_auto_unlock_change) # pylint: disable=protected-access
544
+ vehicle.charging.settings.auto_unlock._is_changeable = True # pylint: disable=protected-access
528
545
  if data['settings']['autoUnlockPlugWhenCharged'] in ['ON', 'PERMANENT']:
529
546
  vehicle.charging.settings.auto_unlock._set_value(True, measured=captured_at) # pylint: disable=protected-access
530
547
  elif data['settings']['autoUnlockPlugWhenCharged'] == 'OFF':
@@ -1234,7 +1251,7 @@ class Connector(BaseConnector):
1234
1251
  car_type = GenericVehicle.Type(range_data['carType'])
1235
1252
  if car_type == GenericVehicle.Type.ELECTRIC and not isinstance(vehicle, SkodaElectricVehicle):
1236
1253
  LOG.debug('Promoting %s to SkodaElectricVehicle object for %s', vehicle.__class__.__name__, vin)
1237
- vehicle = SkodaElectricVehicle(origin=vehicle)
1254
+ vehicle = SkodaElectricVehicle(garage=self.car_connectivity.garage, origin=vehicle)
1238
1255
  self.car_connectivity.garage.replace_vehicle(vin, vehicle)
1239
1256
  elif car_type in [GenericVehicle.Type.FUEL,
1240
1257
  GenericVehicle.Type.GASOLINE,
@@ -1244,11 +1261,11 @@ class Connector(BaseConnector):
1244
1261
  GenericVehicle.Type.LPG] \
1245
1262
  and not isinstance(vehicle, SkodaCombustionVehicle):
1246
1263
  LOG.debug('Promoting %s to SkodaCombustionVehicle object for %s', vehicle.__class__.__name__, vin)
1247
- vehicle = SkodaCombustionVehicle(origin=vehicle)
1264
+ vehicle = SkodaCombustionVehicle(garage=self.car_connectivity.garage, origin=vehicle)
1248
1265
  self.car_connectivity.garage.replace_vehicle(vin, vehicle)
1249
1266
  elif car_type == GenericVehicle.Type.HYBRID and not isinstance(vehicle, SkodaHybridVehicle):
1250
1267
  LOG.debug('Promoting %s to SkodaHybridVehicle object for %s', vehicle.__class__.__name__, vin)
1251
- vehicle = SkodaHybridVehicle(origin=vehicle)
1268
+ vehicle = SkodaHybridVehicle(garage=self.car_connectivity.garage, origin=vehicle)
1252
1269
  self.car_connectivity.garage.replace_vehicle(vin, vehicle)
1253
1270
  except ValueError:
1254
1271
  LOG_API.warning('Unknown car type %s', range_data['carType'])
@@ -1889,5 +1906,122 @@ class Connector(BaseConnector):
1889
1906
  raise CommandError(f'Retrying failed: {retry_error}') from retry_error
1890
1907
  return command_arguments
1891
1908
 
1909
+ def __on_charging_target_level_change(self, level_attribute: LevelAttribute, target_level: float) -> float:
1910
+ """
1911
+ Callback for the charging target level change.
1912
+
1913
+ Args:
1914
+ level_attribute (LevelAttribute): The level attribute that changed.
1915
+ target_level (float): The new target level.
1916
+ """
1917
+ if level_attribute.parent is None or level_attribute.parent.parent is None \
1918
+ or level_attribute.parent.parent.parent is None or not isinstance(level_attribute.parent.parent.parent, SkodaVehicle):
1919
+ raise SetterError('Object hierarchy is not as expected')
1920
+ vehicle: SkodaVehicle = level_attribute.parent.parent.parent
1921
+ vin: Optional[str] = vehicle.vin.value
1922
+ if vin is None:
1923
+ raise SetterError('VIN in object hierarchy missing')
1924
+ precision: float = level_attribute.precision if level_attribute.precision is not None else 10.0
1925
+ target_level = round(target_level / precision) * precision
1926
+ setting_dict = {}
1927
+ setting_dict['targetSOCInPercent'] = target_level
1928
+
1929
+ url = f'https://mysmob.api.connect.skoda-auto.cz/api/v1/charging/{vin}/set-charge-limit'
1930
+ try:
1931
+ settings_response: requests.Response = self.session.put(url, data=json.dumps(setting_dict), allow_redirects=True)
1932
+ if settings_response.status_code != requests.codes['accepted']:
1933
+ LOG.error('Could not set target level (%s)', settings_response.status_code)
1934
+ raise SetterError(f'Could not set value ({settings_response.status_code})')
1935
+ except requests.exceptions.ConnectionError as connection_error:
1936
+ raise SetterError(f'Connection error: {connection_error}.'
1937
+ ' If this happens frequently, please check if other applications communicate with the Skoda server.') from connection_error
1938
+ except requests.exceptions.ChunkedEncodingError as chunked_encoding_error:
1939
+ raise SetterError(f'Error: {chunked_encoding_error}') from chunked_encoding_error
1940
+ except requests.exceptions.ReadTimeout as timeout_error:
1941
+ raise SetterError(f'Timeout during read: {timeout_error}') from timeout_error
1942
+ except requests.exceptions.RetryError as retry_error:
1943
+ raise SetterError(f'Retrying failed: {retry_error}') from retry_error
1944
+ return target_level
1945
+
1946
+ def __on_charging_maximum_current_change(self, current_attribute: CurrentAttribute, maximum_current: float) -> float:
1947
+ """
1948
+ Callback for the charging target level change.
1949
+
1950
+ Args:
1951
+ current_attribute (CurrentAttribute): The current attribute that changed.
1952
+ maximum_current (float): The new maximum current.
1953
+ """
1954
+ if current_attribute.parent is None or current_attribute.parent.parent is None \
1955
+ or current_attribute.parent.parent.parent is None or not isinstance(current_attribute.parent.parent.parent, SkodaVehicle):
1956
+ raise SetterError('Object hierarchy is not as expected')
1957
+ vehicle: SkodaVehicle = current_attribute.parent.parent.parent
1958
+ vin: Optional[str] = vehicle.vin.value
1959
+ if vin is None:
1960
+ raise SetterError('VIN in object hierarchy missing')
1961
+ setting_dict = {}
1962
+ precision: float = current_attribute.precision if current_attribute.precision is not None else 1.0
1963
+ maximum_current = round(maximum_current / precision) * precision
1964
+ if maximum_current < 16:
1965
+ setting_dict['chargingCurrent'] = "REDUCED"
1966
+ maximum_current = 6.0
1967
+ else:
1968
+ setting_dict['chargingCurrent'] = "MAXIMUM"
1969
+ maximum_current = 16.0
1970
+
1971
+ url = f'https://mysmob.api.connect.skoda-auto.cz/api/v1/charging/{vin}/set-charging-current'
1972
+ try:
1973
+ settings_response: requests.Response = self.session.put(url, data=json.dumps(setting_dict), allow_redirects=True)
1974
+ if settings_response.status_code != requests.codes['accepted']:
1975
+ LOG.error('Could not set target charging current (%s)', settings_response.status_code)
1976
+ raise SetterError(f'Could not set value ({settings_response.status_code})')
1977
+ except requests.exceptions.ConnectionError as connection_error:
1978
+ raise SetterError(f'Connection error: {connection_error}.'
1979
+ ' If this happens frequently, please check if other applications communicate with the Skoda server.') from connection_error
1980
+ except requests.exceptions.ChunkedEncodingError as chunked_encoding_error:
1981
+ raise SetterError(f'Error: {chunked_encoding_error}') from chunked_encoding_error
1982
+ except requests.exceptions.ReadTimeout as timeout_error:
1983
+ raise SetterError(f'Timeout during read: {timeout_error}') from timeout_error
1984
+ except requests.exceptions.RetryError as retry_error:
1985
+ raise SetterError(f'Retrying failed: {retry_error}') from retry_error
1986
+ return maximum_current
1987
+
1988
+ def __on_charging_auto_unlock_change(self, boolean_attribute: BooleanAttribute, auto_unlock: bool) -> bool:
1989
+ """
1990
+ Callback for the charging target level change.
1991
+
1992
+ Args:
1993
+ boolean_attribute (BooleanAttribute): The boolean attribute that changed.
1994
+ auto_unlock (float): The new auto_unlock setting.
1995
+ """
1996
+ if boolean_attribute.parent is None or boolean_attribute.parent.parent is None \
1997
+ or boolean_attribute.parent.parent.parent is None or not isinstance(boolean_attribute.parent.parent.parent, SkodaVehicle):
1998
+ raise SetterError('Object hierarchy is not as expected')
1999
+ vehicle: SkodaVehicle = boolean_attribute.parent.parent.parent
2000
+ vin: Optional[str] = vehicle.vin.value
2001
+ if vin is None:
2002
+ raise SetterError('VIN in object hierarchy missing')
2003
+ setting_dict = {}
2004
+ if auto_unlock:
2005
+ setting_dict['autoUnlockPlug'] = "PERMANENT"
2006
+ else:
2007
+ setting_dict['autoUnlockPlug'] = "OFF"
2008
+
2009
+ url = f'https://mysmob.api.connect.skoda-auto.cz/api/v1/charging/{vin}/set-auto-unlock-plug'
2010
+ try:
2011
+ settings_response: requests.Response = self.session.put(url, data=json.dumps(setting_dict), allow_redirects=True)
2012
+ if settings_response.status_code != requests.codes['accepted']:
2013
+ LOG.error('Could not set auto unlock setting (%s)', settings_response.status_code)
2014
+ raise SetterError(f'Could not set value ({settings_response.status_code})')
2015
+ except requests.exceptions.ConnectionError as connection_error:
2016
+ raise SetterError(f'Connection error: {connection_error}.'
2017
+ ' If this happens frequently, please check if other applications communicate with the Skoda server.') from connection_error
2018
+ except requests.exceptions.ChunkedEncodingError as chunked_encoding_error:
2019
+ raise SetterError(f'Error: {chunked_encoding_error}') from chunked_encoding_error
2020
+ except requests.exceptions.ReadTimeout as timeout_error:
2021
+ raise SetterError(f'Timeout during read: {timeout_error}') from timeout_error
2022
+ except requests.exceptions.RetryError as retry_error:
2023
+ raise SetterError(f'Retrying failed: {retry_error}') from retry_error
2024
+ return auto_unlock
2025
+
1892
2026
  def get_name(self) -> str:
1893
2027
  return "Skoda Connector"
@@ -19,8 +19,8 @@ class ConnectorUI(BaseConnectorUI):
19
19
  A user interface class for the Skoda connector in the Car Connectivity application.
20
20
  """
21
21
  def __init__(self, connector: BaseConnector):
22
- blueprint: Optional[flask.Blueprint] = flask.Blueprint(name='skoda', import_name='carconnectivity-connector-skoda', url_prefix='/skoda',
23
- template_folder=os.path.dirname(__file__) + '/templates')
22
+ blueprint: Optional[flask.Blueprint] = flask.Blueprint(name=connector.id, import_name='carconnectivity-connector-skoda', url_prefix=f'/{connector.id}',
23
+ template_folder=os.path.dirname(__file__) + '/templates')
24
24
  super().__init__(connector, blueprint=blueprint)
25
25
 
26
26
  def get_nav_items(self) -> List[Dict[Literal['text', 'url', 'sublinks', 'divider'], Union[str, List]]]:
@@ -30,7 +30,7 @@ class SkodaVehicle(GenericVehicle): # pylint: disable=too-many-instance-attribu
30
30
  def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
31
31
  origin: Optional[SkodaVehicle] = None) -> None:
32
32
  if origin is not None:
33
- super().__init__(origin=origin)
33
+ super().__init__(garage=garage, origin=origin)
34
34
  self.capabilities: Capabilities = origin.capabilities
35
35
  self.capabilities.parent = self
36
36
  self.in_motion: BooleanAttribute = origin.in_motion
@@ -55,13 +55,14 @@ class SkodaElectricVehicle(ElectricVehicle, SkodaVehicle):
55
55
  def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
56
56
  origin: Optional[SkodaVehicle] = None) -> None:
57
57
  if origin is not None:
58
- super().__init__(origin=origin)
58
+ super().__init__(garage=garage, origin=origin)
59
59
  if isinstance(origin, ElectricVehicle):
60
- self.charging: Charging = SkodaCharging(origin=origin.charging)
61
- self.charging.parent = self
60
+ self.charging: Charging = SkodaCharging(vehicle=self, origin=origin.charging)
61
+ else:
62
+ self.charging: Charging = SkodaCharging(vehicle=self, origin=self.charging)
62
63
  else:
63
64
  super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
64
- self.charging: Charging = SkodaCharging(vehicle=self)
65
+ self.charging: Charging = SkodaCharging(vehicle=self, origin=self.charging)
65
66
 
66
67
 
67
68
  class SkodaCombustionVehicle(CombustionVehicle, SkodaVehicle):
@@ -71,7 +72,7 @@ class SkodaCombustionVehicle(CombustionVehicle, SkodaVehicle):
71
72
  def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
72
73
  origin: Optional[SkodaVehicle] = None) -> None:
73
74
  if origin is not None:
74
- super().__init__(origin=origin)
75
+ super().__init__(garage=garage, origin=origin)
75
76
  else:
76
77
  super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)
77
78
 
@@ -83,6 +84,6 @@ class SkodaHybridVehicle(HybridVehicle, SkodaVehicle):
83
84
  def __init__(self, vin: Optional[str] = None, garage: Optional[Garage] = None, managing_connector: Optional[BaseConnector] = None,
84
85
  origin: Optional[SkodaVehicle] = None) -> None:
85
86
  if origin is not None:
86
- super().__init__(origin=origin)
87
+ super().__init__(garage=garage, origin=origin)
87
88
  else:
88
89
  super().__init__(vin=vin, garage=garage, managing_connector=managing_connector)