carconnectivity-connector-seatcupra 0.1a11__py3-none-any.whl → 0.1a12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: carconnectivity-connector-seatcupra
3
- Version: 0.1a11
3
+ Version: 0.1a12
4
4
  Summary: CarConnectivity connector for Seat and Cupra 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.9
38
38
  Description-Content-Type: text/markdown
39
39
  License-File: LICENSE
40
- Requires-Dist: carconnectivity>=0.4a4
40
+ Requires-Dist: carconnectivity>=0.4a6
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/seatcupra/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- carconnectivity_connectors/seatcupra/_version.py,sha256=8hC_LLpTTiKrt81VVDKjTD0LIQ0Qtf_-ak-wISSul2I,509
2
+ carconnectivity_connectors/seatcupra/_version.py,sha256=P5HzP2QWt9JgX2cjp9oYZxzRbLpLn0PHY12_Tr5maGE,509
3
3
  carconnectivity_connectors/seatcupra/capability.py,sha256=Oe9tC_u69bj6VmOuNJ21RKoETe2j3QyZCoz-VgcZPQ0,4523
4
4
  carconnectivity_connectors/seatcupra/charging.py,sha256=BJe_5GEB0JkP78tpU6kyKpwuwjDZHvm-kt3PTlpQHeU,3336
5
5
  carconnectivity_connectors/seatcupra/climatization.py,sha256=0xxWlxrheAPzkVT8WRQtbm6ExZmVdgW7lUdOXyS_qWY,1695
6
6
  carconnectivity_connectors/seatcupra/command_impl.py,sha256=mtw8ZwJLmf79fPDZ1N3ImLfB8Gt9JPbzjMuIo2y5v3M,2879
7
- carconnectivity_connectors/seatcupra/connector.py,sha256=fmn62rMBt7IKRv-fLU0UpjMLSADCK_DzAeRP9ry_IwY,100546
7
+ carconnectivity_connectors/seatcupra/connector.py,sha256=GZLdactSC5vOKE3OvXekcwaAmYtRfoo8G7x0iBJJB7s,101388
8
8
  carconnectivity_connectors/seatcupra/vehicle.py,sha256=kiFVbJgq5VQOzf-vSli_2NsMgY0x4pwvJsjPWLGdr1g,3404
9
9
  carconnectivity_connectors/seatcupra/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  carconnectivity_connectors/seatcupra/auth/auth_util.py,sha256=Y81h8fGOMSMgPtE4wI_TI9WgE_s43uaPjRLBBINhj4g,4433
@@ -14,8 +14,8 @@ carconnectivity_connectors/seatcupra/auth/session_manager.py,sha256=ZIDvC848T3fy
14
14
  carconnectivity_connectors/seatcupra/auth/vw_web_session.py,sha256=CcI6m68IyRs6WsMDu-IsW3Dj85vyGiMmxvFqNETMHO0,10929
15
15
  carconnectivity_connectors/seatcupra/auth/helpers/blacklist_retry.py,sha256=f3wsiY5bpHDBxp7Va1Mv9nKJ4u3qnCHZZmDu78_AhMk,1251
16
16
  carconnectivity_connectors/seatcupra/ui/connector_ui.py,sha256=SNYnlcGJpbWhuLiIHD2l6H9IfSiMz3IgmvXsdossDnE,1412
17
- carconnectivity_connector_seatcupra-0.1a11.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
18
- carconnectivity_connector_seatcupra-0.1a11.dist-info/METADATA,sha256=Kdviy1kwi2S9KrNRWfyf-GGfsPdBYcD5dBOkCQh6WRw,5641
19
- carconnectivity_connector_seatcupra-0.1a11.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
20
- carconnectivity_connector_seatcupra-0.1a11.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
21
- carconnectivity_connector_seatcupra-0.1a11.dist-info/RECORD,,
17
+ carconnectivity_connector_seatcupra-0.1a12.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
18
+ carconnectivity_connector_seatcupra-0.1a12.dist-info/METADATA,sha256=QwGVdp8CkV8qlNFb_NLHqRUdd9xdhh0kiCKxYAEQkQ8,5641
19
+ carconnectivity_connector_seatcupra-0.1a12.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
20
+ carconnectivity_connector_seatcupra-0.1a12.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
21
+ carconnectivity_connector_seatcupra-0.1a12.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.1a11'
20
+ __version__ = version = '0.1a12'
21
21
  __version_tuple__ = version_tuple = (0, 1)
@@ -77,6 +77,16 @@ class Connector(BaseConnector):
77
77
 
78
78
  self.connected: BooleanAttribute = BooleanAttribute(name="connected", parent=self, tags={'connector_custom'})
79
79
  self.interval: DurationAttribute = DurationAttribute(name="interval", parent=self, tags={'connector_custom'})
80
+
81
+ def __check_interval(attribute: GenericAttribute, value: Any) -> Any:
82
+ del attribute
83
+ if value is not None and value < timedelta(seconds=180):
84
+ raise ValueError('Intervall must be at least 180 seconds')
85
+ return value
86
+
87
+ self.interval._is_changeable = True # pylint: disable=protected-access
88
+ self.interval._add_on_set_hook(__check_interval) # pylint: disable=protected-access
89
+
80
90
  self.commands: Commands = Commands(parent=self)
81
91
 
82
92
  LOG.info("Loading seatcupra connector with config %s", config_remove_credentials(config))
@@ -159,6 +169,7 @@ class Connector(BaseConnector):
159
169
 
160
170
  def startup(self) -> None:
161
171
  self._background_thread = threading.Thread(target=self._background_loop, daemon=False)
172
+ self._background_thread.name = 'carconnectivity.connectors.seatcupra-background'
162
173
  self._background_thread.start()
163
174
 
164
175
  def _background_loop(self) -> None:
@@ -226,10 +237,10 @@ class Connector(BaseConnector):
226
237
  self.car_connectivity.garage.remove_vehicle(vehicle.id)
227
238
  vehicle.enabled = False
228
239
  self._stop_event.set()
240
+ self.session.close()
229
241
  if self._background_thread is not None:
230
242
  self._background_thread.join()
231
243
  self.persist()
232
- self.session.close()
233
244
  BaseConnector.shutdown(self)
234
245
 
235
246
  def fetch_all(self) -> None:
@@ -524,6 +535,10 @@ class Connector(BaseConnector):
524
535
  else:
525
536
  vehicle.doors.open_state._set_value(Doors.OpenState.OPEN, measured=captured_at) # pylint: disable=protected-access
526
537
  seen_window_ids: set[str] = set()
538
+ if 'sunRoof' in vehicle_status_data and vehicle_status_data['sunRoof'] is not None \
539
+ and 'windows' in vehicle_status_data and vehicle_status_data['windows'] is not None:
540
+ vehicle_status_data['windows']['sunRoof'] = vehicle_status_data['sunRoof']
541
+
527
542
  if 'windows' in vehicle_status_data and vehicle_status_data['windows'] is not None:
528
543
  all_windows_closed = True
529
544
  for window_id, window_status in vehicle_status_data['windows'].items():
@@ -550,7 +565,7 @@ class Connector(BaseConnector):
550
565
  for window_id in vehicle.windows.windows.keys() - seen_window_ids:
551
566
  vehicle.windows.windows[window_id].enabled = False
552
567
  log_extra_keys(LOG_API, f'/api/v2/vehicle-status/{vin}', vehicle_status_data, {'updatedAt', 'locked', 'lights', 'hood', 'trunk', 'doors',
553
- 'windows'})
568
+ 'windows', 'sunRoof'})
554
569
  return vehicle
555
570
 
556
571
  def fetch_vehicle_mycar_status(self, vehicle: SeatCupraVehicle, no_cache: bool = False) -> SeatCupraVehicle:
@@ -994,7 +1009,7 @@ class Connector(BaseConnector):
994
1009
  if img is None or self.active_config['max_age'] is None \
995
1010
  or (cache_date is not None and cache_date < (datetime.utcnow() - timedelta(seconds=self.active_config['max_age']))):
996
1011
  try:
997
- image_download_response = requests.get(image_url, stream=True, timeout=180)
1012
+ image_download_response = requests.get(image_url, stream=True, timeout=10)
998
1013
  if image_download_response.status_code == requests.codes['ok']:
999
1014
  img = Image.open(image_download_response.raw) # pyright: ignore[reportPossiblyUnboundVariable]
1000
1015
  if self.session.cache is not None: