hyundai-kia-connect-api 3.23.9__tar.gz → 3.24.1__tar.gz

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.
Files changed (46) hide show
  1. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/CONTRIBUTING.rst +5 -6
  2. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/PKG-INFO +3 -3
  3. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py +30 -1
  4. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/KiaUvoApiAU.py +14 -7
  5. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/Vehicle.py +2 -4
  6. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/__init__.py +0 -7
  7. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/PKG-INFO +3 -3
  8. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/setup.py +3 -3
  9. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/AUTHORS.rst +0 -0
  10. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/HISTORY.rst +0 -0
  11. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/LICENSE +0 -0
  12. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/MANIFEST.in +0 -0
  13. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/README.rst +0 -0
  14. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/Makefile +0 -0
  15. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/authors.rst +0 -0
  16. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/conf.py +0 -0
  17. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/contributing.rst +0 -0
  18. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/history.rst +0 -0
  19. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/index.rst +0 -0
  20. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/installation.rst +0 -0
  21. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/make.bat +0 -0
  22. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/readme.rst +0 -0
  23. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/docs/usage.rst +0 -0
  24. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/ApiImpl.py +0 -0
  25. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/ApiImplType1.py +0 -0
  26. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/KiaUvoAPIUSA.py +0 -0
  27. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/KiaUvoApiCA.py +0 -0
  28. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/KiaUvoApiCN.py +0 -0
  29. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/KiaUvoApiEU.py +0 -0
  30. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/Token.py +0 -0
  31. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/VehicleManager.py +0 -0
  32. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/const.py +0 -0
  33. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/exceptions.py +0 -0
  34. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api/utils.py +0 -0
  35. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/SOURCES.txt +0 -0
  36. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/dependency_links.txt +0 -0
  37. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/not-zip-safe +0 -0
  38. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/requires.txt +0 -0
  39. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/hyundai_kia_connect_api.egg-info/top_level.txt +0 -0
  40. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/requirements.txt +0 -0
  41. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/setup.cfg +0 -0
  42. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/tests/__init__.py +0 -0
  43. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/tests/au_login_test.py +0 -0
  44. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/tests/ca_login_test.py +0 -0
  45. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/tests/eu_check_response_for_errors_test.py +0 -0
  46. {hyundai_kia_connect_api-3.23.9 → hyundai_kia_connect_api-3.24.1}/tests/eu_login_test.py +0 -0
@@ -76,14 +76,14 @@ Ready to contribute? Here's how to set up `hyundai_kia_connect_api` for local de
76
76
 
77
77
  Now you can make your changes locally.
78
78
 
79
- 5. When you're done making changes, check that your changes pass flake8 and the
80
- tests, including testing other Python versions with tox::
79
+ 5. When you're done making changes, check that your changes pass flake8. Most
80
+ tests require environment variables to supply the username and password and
81
+ they will run as part of the PR pre-requisites:
81
82
 
82
83
  $ flake8 hyundai_kia_connect_api tests
83
84
  $ python setup.py test or pytest
84
- $ tox
85
85
 
86
- To get flake8 and tox, just pip install them into your virtualenv.
86
+ To get flake8, pip install them into your virtualenv.
87
87
 
88
88
  6. Commit your changes and push your branch to GitHub::
89
89
 
@@ -102,8 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
102
102
  2. If the pull request adds functionality, the docs should be updated. Put
103
103
  your new functionality into a function with a docstring, and add the
104
104
  feature to the list in README.rst.
105
- 3. The pull request should work for Python 3.5, 3.6, 3.7 and 3.8, and for PyPy. Check
106
- https://travis-ci.com/fuatakgun/hyundai_kia_connect_api/pull_requests
105
+ 3. The pull request should work for recent Python. Check GitHub Actions checks
107
106
  and make sure that the tests pass for all supported Python versions.
108
107
 
109
108
  Tips
@@ -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
@@ -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
@@ -23,13 +23,13 @@ test_requirements = [
23
23
  setup(
24
24
  author="Fuat Akgun",
25
25
  author_email="fuatakgun@gmail.com",
26
- python_requires=">=3.6",
26
+ python_requires=">=3.10",
27
27
  classifiers=[
28
28
  "Development Status :: 2 - Pre-Alpha",
29
29
  "Intended Audience :: Developers",
30
30
  "License :: OSI Approved :: MIT License",
31
31
  "Natural Language :: English",
32
- "Programming Language :: Python :: 3.9",
32
+ "Programming Language :: Python :: 3.10",
33
33
  ],
34
34
  description="Python Boilerplate contains all the boilerplate you need to create a Python package.",
35
35
  install_requires=requirements,
@@ -44,6 +44,6 @@ setup(
44
44
  test_suite="tests",
45
45
  tests_require=test_requirements,
46
46
  url="https://github.com/fuatakgun/hyundai_kia_connect_api",
47
- version="3.23.9",
47
+ version="3.24.1",
48
48
  zip_safe=False,
49
49
  )