hyundai-kia-connect-api 3.23.9__py2.py3-none-any.whl → 3.24.1__py2.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 hyundai-kia-connect-api might be problematic. Click here for more details.

@@ -12,6 +12,8 @@ import certifi
12
12
  from requests.adapters import HTTPAdapter
13
13
  from urllib3.util.ssl_ import create_urllib3_context
14
14
 
15
+ from hyundai_kia_connect_api.exceptions import APIError
16
+
15
17
  from .const import (
16
18
  DOMAIN,
17
19
  VEHICLE_LOCK_ACTION,
@@ -459,6 +461,31 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
459
461
  # fill vehicle.daily_stats
460
462
  tripStats = []
461
463
  tripDetails = get_child_value(state, "evTripDetails.tripdetails") or {}
464
+
465
+ # compute more digits for distance mileage using odometer and overrule distance
466
+ previous_odometer = None
467
+ for trip in reversed(tripDetails):
468
+ odometer = get_child_value(trip, "odometer.value")
469
+ if previous_odometer and odometer:
470
+ delta_odometer = odometer - previous_odometer
471
+ if delta_odometer >= 0.0:
472
+ trip["distance"] = delta_odometer
473
+ previous_odometer = odometer
474
+
475
+ # overrule odometer with more accuracy from last trip
476
+ if (
477
+ previous_odometer
478
+ and vehicle.odometer
479
+ and previous_odometer > vehicle.odometer
480
+ ):
481
+ _LOGGER.debug(
482
+ f"Overruling odometer: {previous_odometer:.1f} old: {vehicle.odometer:.1f}" # noqa
483
+ )
484
+ vehicle.odometer = (
485
+ previous_odometer,
486
+ DISTANCE_UNITS[3],
487
+ )
488
+
462
489
  for trip in tripDetails:
463
490
  processedTrip = DailyDrivingStats(
464
491
  date=dt.datetime.strptime(trip["startdate"], "%Y-%m-%d %H:%M:%S.%f"),
@@ -485,7 +512,7 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
485
512
  hhmmss=yyyymmdd_hhmmss,
486
513
  drive_time=int(drive_time / 60), # convert seconds to minutes
487
514
  idle_time=int(idle_time / 60), # convert seconds to minutes
488
- distance=int(trip["distance"]),
515
+ distance=float(trip["distance"]),
489
516
  avg_speed=get_child_value(trip["avgspeed"], "value"),
490
517
  max_speed=int(get_child_value(trip["maxspeed"], "value")),
491
518
  )
@@ -733,6 +760,8 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
733
760
  elif action == VEHICLE_LOCK_ACTION.UNLOCK:
734
761
  url = self.API_URL + "rcs/rdo/on"
735
762
  _LOGGER.debug(f"{DOMAIN} - Calling unlock")
763
+ else:
764
+ raise APIError(f"Invalid action value: {action}")
736
765
 
737
766
  headers = self._get_vehicle_headers(token, vehicle)
738
767
  headers["APPCLOUD-VIN"] = vehicle.VIN
@@ -240,7 +240,10 @@ class KiaUvoApiAU(ApiImplType1):
240
240
  },
241
241
  )
242
242
 
243
- if vehicle.engine_type == ENGINE_TYPES.EV:
243
+ if (
244
+ vehicle.engine_type == ENGINE_TYPES.EV
245
+ or vehicle.engine_type == ENGINE_TYPES.PHEV
246
+ ):
244
247
  try:
245
248
  state = self._get_driving_info(token, vehicle)
246
249
  except Exception as e:
@@ -255,8 +258,8 @@ class KiaUvoApiAU(ApiImplType1):
255
258
  """,
256
259
  exc_info=e,
257
260
  )
258
- else:
259
- self._update_vehicle_drive_info(vehicle, state)
261
+ else:
262
+ self._update_vehicle_drive_info(vehicle, state)
260
263
 
261
264
  def force_refresh_vehicle_state(self, token: Token, vehicle: Vehicle) -> None:
262
265
  status = self._get_forced_vehicle_state(token, vehicle)
@@ -270,15 +273,19 @@ class KiaUvoApiAU(ApiImplType1):
270
273
  )
271
274
  # Only call for driving info on cars we know have a chance of supporting it.
272
275
  # Could be expanded if other types do support it.
273
- if vehicle.engine_type == ENGINE_TYPES.EV:
276
+ if (
277
+ vehicle.engine_type == ENGINE_TYPES.EV
278
+ or vehicle.engine_type == ENGINE_TYPES.PHEV
279
+ ):
274
280
  try:
275
281
  state = self._get_driving_info(token, vehicle)
276
282
  except Exception as e:
277
- # we don't know if all car types provide this information.
278
- # we also don't know what the API returns if the info is unavailable.
279
- # so, catch any exception and move on.
283
+ # we don't know if all car types (ex: ICE cars) provide this
284
+ # information. We also don't know what the API returns if
285
+ # the info is unavailable. So, catch any exception and move on.
280
286
  _LOGGER.exception(
281
287
  """Failed to parse driving info. Possible reasons:
288
+ - incompatible vehicle (ICE)
282
289
  - new API format
283
290
  - API outage
284
291
  """,
@@ -19,7 +19,7 @@ class TripInfo:
19
19
  hhmmss: str = None # will not be filled by summary
20
20
  drive_time: int = None # minutes
21
21
  idle_time: int = None # minutes
22
- distance: int = None
22
+ distance: float = None
23
23
  avg_speed: float = None
24
24
  max_speed: int = None
25
25
 
@@ -60,9 +60,7 @@ class DailyDrivingStats:
60
60
  onboard_electronics_consumption: int = None
61
61
  battery_care_consumption: int = None
62
62
  regenerated_energy: int = None
63
- # distance is expressed in (I assume) whatever unit the vehicle is
64
- # configured in. KMs (rounded) in my case
65
- distance: int = None
63
+ distance: float = None
66
64
  distance_unit: str = DISTANCE_UNITS[1] # set to kms by default
67
65
 
68
66
 
@@ -2,17 +2,10 @@
2
2
 
3
3
  # flake8: noqa
4
4
  from .ApiImpl import (
5
- ApiImpl,
6
5
  ClimateRequestOptions,
7
6
  WindowRequestOptions,
8
7
  ScheduleChargingClimateRequestOptions,
9
8
  )
10
- from .ApiImplType1 import ApiImplType1
11
- from .HyundaiBlueLinkAPIUSA import HyundaiBlueLinkAPIUSA
12
- from .KiaUvoApiCA import KiaUvoApiCA
13
- from .KiaUvoApiEU import KiaUvoApiEU
14
- from .KiaUvoAPIUSA import KiaUvoAPIUSA
15
- from .KiaUvoApiCN import KiaUvoApiCN
16
9
 
17
10
  from .Token import Token
18
11
  from .Vehicle import Vehicle
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.23.9
3
+ Version: 3.24.1
4
4
  Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
5
5
  Home-page: https://github.com/fuatakgun/hyundai_kia_connect_api
6
6
  Author: Fuat Akgun
@@ -11,8 +11,8 @@ Classifier: Development Status :: 2 - Pre-Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3.9
15
- Requires-Python: >=3.6
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Requires-Python: >=3.10
16
16
  License-File: LICENSE
17
17
  License-File: AUTHORS.rst
18
18
  Requires-Dist: beautifulsoup4 >=4.10.0
@@ -1,21 +1,21 @@
1
1
  hyundai_kia_connect_api/ApiImpl.py,sha256=7tB6PZTEVlw-GCfEjU4ekq_ZgnFseYLrEYpbUyEoL84,6866
2
2
  hyundai_kia_connect_api/ApiImplType1.py,sha256=PnKwpbCoYGOXBWzBLIlDSrC6daIYeW9qlfW7TM4HCU0,12184
3
- hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py,sha256=xHUpj-1bzHQL4w82kRAt9FMB8ze_DoqZinK6djCyeKY,35619
3
+ hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py,sha256=MK1cFcnuZebogz32-nXjHt0pAgQ1-2lrurw8SADX6ww,36690
4
4
  hyundai_kia_connect_api/KiaUvoAPIUSA.py,sha256=FmRc7bAmsOz9jBtWSAb8lD0ybRMN0OgfEPZZJbPhMUw,31292
5
- hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=Mzw0Ov5la4mQvWOXWYpvAfrM6l2BSBEusaPFsL3kn2I,48127
5
+ hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=955V2cBUdfnrzQNjF-XJw7D3jYZI6NfQl3OTLsiWwkA,48375
6
6
  hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=B3Lks_ONr3l01QLl-GQBPdktXj9PZWKuQKRLYmJ7kP4,30763
7
7
  hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=cwIPZ0dU6HolKdooUQeQKlLAic6YU8dQmNs0VQDBgpQ,47035
8
8
  hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=_wNkctkIO2hrf1K2LTZPtHWZ5ewTcXqTv0s_AXRXI2I,68254
9
9
  hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
10
- hyundai_kia_connect_api/Vehicle.py,sha256=s_AkDxiQ8vS1CCxLn1H5W15WGLnhPIWUdnkYdXuNLxw,18752
10
+ hyundai_kia_connect_api/Vehicle.py,sha256=M95Eq1vK-th5se7dZHEDcTOM1b19GIjpecyw2MKykQ8,18639
11
11
  hyundai_kia_connect_api/VehicleManager.py,sha256=REny83eNXERAcnw8qrBZ9dh6qODCvd5Z_jmSY2JtXvY,10196
12
- hyundai_kia_connect_api/__init__.py,sha256=i2kXYjBEKSvT1e8FoQ7V7oqAyL22w3XzF2rAFpyietc,578
12
+ hyundai_kia_connect_api/__init__.py,sha256=IkyVeIMbcFJZgLaiiNnUVA1Ferxvrm1bXHKVg01cxvc,319
13
13
  hyundai_kia_connect_api/const.py,sha256=ofi_ZfGxJYo0FWIcGFbIMSMRdKRtaK4GUDhFiQRvZeI,2007
14
14
  hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
15
15
  hyundai_kia_connect_api/utils.py,sha256=J0aXUX-nKIoS3XbelatNh-DZlHRU2_DYz_Mg_ZUKQJU,1957
16
- hyundai_kia_connect_api-3.23.9.dist-info/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
17
- hyundai_kia_connect_api-3.23.9.dist-info/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
18
- hyundai_kia_connect_api-3.23.9.dist-info/METADATA,sha256=dQ9GtrY9CmOw7ZWC4if9xqiC999SXSIelfkneBy7T0A,6069
19
- hyundai_kia_connect_api-3.23.9.dist-info/WHEEL,sha256=TJ49d73sNs10F0aze1W_bTW2P_X7-F4YXOlBqoqA-jY,109
20
- hyundai_kia_connect_api-3.23.9.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
21
- hyundai_kia_connect_api-3.23.9.dist-info/RECORD,,
16
+ hyundai_kia_connect_api-3.24.1.dist-info/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
17
+ hyundai_kia_connect_api-3.24.1.dist-info/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
18
+ hyundai_kia_connect_api-3.24.1.dist-info/METADATA,sha256=GLYawG9GblBIlPefUgeQ2Dg0jGeYuNVJ_7XkS65CgAU,6071
19
+ hyundai_kia_connect_api-3.24.1.dist-info/WHEEL,sha256=OpXWERl2xLPRHTvd2ZXo_iluPEQd8uSbYkJ53NAER_Y,109
20
+ hyundai_kia_connect_api-3.24.1.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
21
+ hyundai_kia_connect_api-3.24.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.2.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any