hyundai-kia-connect-api 3.22.8__tar.gz → 3.22.9__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.22.8 → hyundai_kia_connect_api-3.22.9}/PKG-INFO +5 -5
  2. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/README.rst +4 -4
  3. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/ApiImpl.py +5 -5
  4. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/ApiImplType1.py +4 -0
  5. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py +1 -1
  6. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/KiaUvoApiAU.py +4 -4
  7. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/KiaUvoApiCN.py +7 -4
  8. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/KiaUvoApiEU.py +17 -29
  9. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/Vehicle.py +55 -5
  10. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/VehicleManager.py +2 -2
  11. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/utils.py +1 -1
  12. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/PKG-INFO +5 -5
  13. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/setup.py +1 -1
  14. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/AUTHORS.rst +0 -0
  15. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/CONTRIBUTING.rst +0 -0
  16. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/HISTORY.rst +0 -0
  17. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/LICENSE +0 -0
  18. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/MANIFEST.in +0 -0
  19. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/Makefile +0 -0
  20. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/authors.rst +0 -0
  21. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/conf.py +0 -0
  22. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/contributing.rst +0 -0
  23. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/history.rst +0 -0
  24. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/index.rst +0 -0
  25. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/installation.rst +0 -0
  26. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/make.bat +0 -0
  27. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/readme.rst +0 -0
  28. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/docs/usage.rst +0 -0
  29. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/KiaUvoAPIUSA.py +0 -0
  30. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/KiaUvoApiCA.py +0 -0
  31. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/Token.py +0 -0
  32. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/__init__.py +0 -0
  33. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/const.py +0 -0
  34. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api/exceptions.py +0 -0
  35. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/SOURCES.txt +0 -0
  36. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/dependency_links.txt +0 -0
  37. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/not-zip-safe +0 -0
  38. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/requires.txt +0 -0
  39. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/hyundai_kia_connect_api.egg-info/top_level.txt +0 -0
  40. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/requirements.txt +0 -0
  41. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/setup.cfg +0 -0
  42. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/tests/__init__.py +0 -0
  43. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/tests/au_login_test.py +0 -0
  44. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/tests/ca_login_test.py +0 -0
  45. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/tests/eu_check_response_for_errors_test.py +0 -0
  46. {hyundai_kia_connect_api-3.22.8 → hyundai_kia_connect_api-3.22.9}/tests/eu_login_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.22.8
3
+ Version: 3.22.9
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
@@ -112,16 +112,16 @@ For a list of language codes, see here: https://www.science.co.il/language/Codes
112
112
  - "pt" Portuguese
113
113
 
114
114
 
115
- In Europe also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
116
- - First call vm.update_month_trip_info(vehicle.id, yyymm) before getting vehicle.month_trip_info for that month
115
+ In Europe and some other regions also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
116
+ - First call vm.update_month_trip_info(vehicle.id, yyyymm) before getting vehicle.month_trip_info for that month
117
117
  - First call vm.update_day_trip_info(vehicle.id, day.yyyymmdd) before getting vehicle.day_trip_info for that day
118
118
 
119
119
  Example of getting trip info of the current month and day (vm is VehicleManager instance)::
120
120
 
121
121
  now = datetime.now()
122
- yyymm = now.strftime("%Y%m")
122
+ yyyymm = now.strftime("%Y%m")
123
123
  yyyymmdd = now.strftime("%Y%m%d")
124
- vm.update_month_trip_info(vehicle.id, yyymm)
124
+ vm.update_month_trip_info(vehicle.id, yyyymm)
125
125
  if vehicle.month_trip_info is not None:
126
126
  for day in vehicle.month_trip_info.day_list: # ordered on day
127
127
  if yyyymmdd == day.yyyymmdd: # in example only interested in current day
@@ -89,16 +89,16 @@ For a list of language codes, see here: https://www.science.co.il/language/Codes
89
89
  - "pt" Portuguese
90
90
 
91
91
 
92
- In Europe also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
93
- - First call vm.update_month_trip_info(vehicle.id, yyymm) before getting vehicle.month_trip_info for that month
92
+ In Europe and some other regions also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
93
+ - First call vm.update_month_trip_info(vehicle.id, yyyymm) before getting vehicle.month_trip_info for that month
94
94
  - First call vm.update_day_trip_info(vehicle.id, day.yyyymmdd) before getting vehicle.day_trip_info for that day
95
95
 
96
96
  Example of getting trip info of the current month and day (vm is VehicleManager instance)::
97
97
 
98
98
  now = datetime.now()
99
- yyymm = now.strftime("%Y%m")
99
+ yyyymm = now.strftime("%Y%m")
100
100
  yyyymmdd = now.strftime("%Y%m%d")
101
- vm.update_month_trip_info(vehicle.id, yyymm)
101
+ vm.update_month_trip_info(vehicle.id, yyyymm)
102
102
  if vehicle.month_trip_info is not None:
103
103
  for day in vehicle.month_trip_info.day_list: # ordered on day
104
104
  if yyyymmdd == day.yyyymmdd: # in example only interested in current day
@@ -1,6 +1,6 @@
1
1
  """ApiImpl.py"""
2
2
 
3
- # pylint:disable=unnecessary-pass,missing-class-docstring,invalid-name,missing-function-docstring,wildcard-import,unused-wildcard-import,unused-argument,missing-timeout
3
+ # pylint:disable=unnecessary-pass,missing-class-docstring,invalid-name,missing-function-docstring,wildcard-import,unused-wildcard-import,unused-argument,missing-timeout,logging-fstring-interpolation
4
4
 
5
5
  import datetime as dt
6
6
  import logging
@@ -158,7 +158,7 @@ class ApiImpl:
158
158
 
159
159
  def set_charging_current(self, token: Token, vehicle: Vehicle, level: int) -> str:
160
160
  """
161
- Europe feature only.
161
+ feature only available for some regions.
162
162
  Sets charge current level (1=100%, 2=90%, 3=60%). Returns the tracking ID
163
163
  """
164
164
  pass
@@ -179,7 +179,7 @@ class ApiImpl:
179
179
  self, token: Token, vehicle: Vehicle, yyyymm_string: str
180
180
  ) -> None:
181
181
  """
182
- Europe feature only.
182
+ feature only available for some regions.
183
183
  Updates the vehicle.month_trip_info for the specified month.
184
184
 
185
185
  Default this information is None:
@@ -192,7 +192,7 @@ class ApiImpl:
192
192
  self, token: Token, vehicle: Vehicle, yyyymmdd_string: str
193
193
  ) -> None:
194
194
  """
195
- Europe feature only.
195
+ feature only available for some regions.
196
196
  Updates the vehicle.day_trip_info information for the specified day.
197
197
 
198
198
  Default this information is None:
@@ -208,7 +208,7 @@ class ApiImpl:
208
208
  options: ScheduleChargingClimateRequestOptions,
209
209
  ) -> str:
210
210
  """
211
- Europe feature only.
211
+ feature only available for some regions.
212
212
  Schedule charging and climate control. Returns the tracking ID
213
213
  """
214
214
  pass
@@ -1,3 +1,5 @@
1
+ """ "ApiImplType1.py"""
2
+
1
3
  import datetime as dt
2
4
  from typing import Optional
3
5
 
@@ -23,6 +25,8 @@ USER_AGENT_OK_HTTP: str = "okhttp/3.12.0"
23
25
 
24
26
 
25
27
  class ApiImplType1(ApiImpl):
28
+ """ApiImplType1"""
29
+
26
30
  def __init__(self) -> None:
27
31
  """Initialize."""
28
32
 
@@ -710,6 +710,6 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
710
710
 
711
711
  response = self.sessions.post(url, json=data, headers=headers)
712
712
  _LOGGER.debug(
713
- f"{DOMAIN} - Setting charge limits response status code: {response.status_code}"
713
+ f"{DOMAIN} - Setting charge limits response status code: {response.status_code}" # noqa
714
714
  )
715
715
  _LOGGER.debug(f"{DOMAIN} - Setting charge limits: {response.text}")
@@ -113,12 +113,12 @@ class KiaUvoApiAU(ApiImplType1):
113
113
  self.BASE_URL: str = "au-apigw.ccs.kia.com.au:8082"
114
114
  self.CCSP_SERVICE_ID: str = "8acb778a-b918-4a8d-8624-73a0beb64289"
115
115
  self.APP_ID: str = "4ad4dcde-be23-48a8-bc1c-91b94f5c06f8" # Android app ID
116
- self.BASIC_AUTHORIZATION: str = "Basic OGFjYjc3OGEtYjkxOC00YThkLTg2MjQtNzNhMGJlYjY0Mjg5OjdTY01NbTZmRVlYZGlFUEN4YVBhUW1nZVlkbFVyZndvaDRBZlhHT3pZSVMyQ3U5VA=="
116
+ self.BASIC_AUTHORIZATION: str = "Basic OGFjYjc3OGEtYjkxOC00YThkLTg2MjQtNzNhMGJlYjY0Mjg5OjdTY01NbTZmRVlYZGlFUEN4YVBhUW1nZVlkbFVyZndvaDRBZlhHT3pZSVMyQ3U5VA==" # noqa
117
117
  elif BRANDS[brand] == BRAND_HYUNDAI:
118
118
  self.BASE_URL: str = "au-apigw.ccs.hyundai.com.au:8080"
119
119
  self.CCSP_SERVICE_ID: str = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
120
120
  self.APP_ID: str = "f9ccfdac-a48d-4c57-bd32-9116963c24ed" # Android app ID
121
- self.BASIC_AUTHORIZATION: str = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw=="
121
+ self.BASIC_AUTHORIZATION: str = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw==" # noqa
122
122
 
123
123
  self.USER_API_URL: str = "https://" + self.BASE_URL + "/api/v1/user/"
124
124
  self.SPA_API_URL: str = "https://" + self.BASE_URL + "/api/v1/spa/"
@@ -847,7 +847,7 @@ class KiaUvoApiAU(ApiImplType1):
847
847
  yyyymm_string,
848
848
  ) -> None:
849
849
  """
850
- Europe feature only.
850
+ feature only available for some regions.
851
851
  Updates the vehicle.month_trip_info for the specified month.
852
852
 
853
853
  Default this information is None:
@@ -891,7 +891,7 @@ class KiaUvoApiAU(ApiImplType1):
891
891
  yyyymmdd_string,
892
892
  ) -> None:
893
893
  """
894
- Europe feature only.
894
+ feature only available for some regions.
895
895
  Updates the vehicle.day_trip_info information for the specified day.
896
896
 
897
897
  Default this information is None:
@@ -6,6 +6,7 @@ import datetime as dt
6
6
  import math
7
7
  import logging
8
8
  import uuid
9
+ from typing import Optional
9
10
  from time import sleep
10
11
  from urllib.parse import parse_qs, urlparse
11
12
 
@@ -112,7 +113,7 @@ class KiaUvoApiCN(ApiImplType1):
112
113
  self.BASE_DOMAIN: str = "prd.cn-ccapi.kia.com"
113
114
  self.CCSP_SERVICE_ID: str = "9d5df92a-06ae-435f-b459-8304f2efcc67"
114
115
  self.APP_ID: str = "eea8762c-adfc-4ee4-8d7a-6e2452ddf342"
115
- self.BASIC_AUTHORIZATION: str = "Basic OWQ1ZGY5MmEtMDZhZS00MzVmLWI0NTktODMwNGYyZWZjYzY3OnRzWGRrVWcwOEF2MlpaelhPZ1d6Snl4VVQ2eWVTbk5OUWtYWFBSZEtXRUFOd2wxcA=="
116
+ self.BASIC_AUTHORIZATION: str = "Basic OWQ1ZGY5MmEtMDZhZS00MzVmLWI0NTktODMwNGYyZWZjYzY3OnRzWGRrVWcwOEF2MlpaelhPZ1d6Snl4VVQ2eWVTbk5OUWtYWFBSZEtXRUFOd2wxcA==" # noqa
116
117
  elif BRANDS[brand] == BRAND_HYUNDAI:
117
118
  self.BASE_DOMAIN: str = "prd.cn-ccapi.hyundai.com"
118
119
  self.CCSP_SERVICE_ID: str = "72b3d019-5bc7-443d-a437-08f307cf06e2"
@@ -128,7 +129,9 @@ class KiaUvoApiCN(ApiImplType1):
128
129
  self.CLIENT_ID: str = self.CCSP_SERVICE_ID
129
130
  self.GCM_SENDER_ID = 199360397125
130
131
 
131
- def _get_authenticated_headers(self, token: Token) -> dict:
132
+ def _get_authenticated_headers(
133
+ self, token: Token, ccs2_support: Optional[int] = None
134
+ ) -> dict:
132
135
  return {
133
136
  "Authorization": token.access_token,
134
137
  "ccsp-service-id": self.CCSP_SERVICE_ID,
@@ -826,7 +829,7 @@ class KiaUvoApiCN(ApiImplType1):
826
829
  yyyymm_string,
827
830
  ) -> None:
828
831
  """
829
- Europe feature only.
832
+ feature only available for some regions.
830
833
  Updates the vehicle.month_trip_info for the specified month.
831
834
 
832
835
  Default this information is None:
@@ -870,7 +873,7 @@ class KiaUvoApiCN(ApiImplType1):
870
873
  yyyymmdd_string,
871
874
  ) -> None:
872
875
  """
873
- Europe feature only.
876
+ feature only available for some regions.
874
877
  Updates the vehicle.day_trip_info information for the specified day.
875
878
 
876
879
  Default this information is None:
@@ -706,13 +706,13 @@ class KiaUvoApiEU(ApiImplType1):
706
706
 
707
707
  if get_child_value(
708
708
  state,
709
- "vehicleStatus.evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservFatcSet.airTemp.value",
710
- ): # noqa
709
+ "vehicleStatus.evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservFatcSet.airTemp.value", # noqa
710
+ ):
711
711
  temp_index = get_hex_temp_into_index(
712
712
  get_child_value(
713
713
  state,
714
- "vehicleStatus.evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservFatcSet.airTemp.value",
715
- ) # noqa
714
+ "vehicleStatus.evStatus.reservChargeInfos.reservChargeInfo.reservChargeInfoDetail.reservFatcSet.airTemp.value", # noqa
715
+ )
716
716
  )
717
717
 
718
718
  vehicle.ev_first_departure_climate_temperature = (
@@ -727,13 +727,13 @@ class KiaUvoApiEU(ApiImplType1):
727
727
 
728
728
  if get_child_value(
729
729
  state,
730
- "vehicleStatus.evStatus.reservChargeInfos.reserveChargeInfo2.reservChargeInfoDetail.reservFatcSet.airTemp.value",
731
- ): # noqa
730
+ "vehicleStatus.evStatus.reservChargeInfos.reserveChargeInfo2.reservChargeInfoDetail.reservFatcSet.airTemp.value", # noqa
731
+ ):
732
732
  temp_index = get_hex_temp_into_index(
733
733
  get_child_value(
734
734
  state,
735
- "vehicleStatus.evStatus.reservChargeInfos.reserveChargeInfo2.reservChargeInfoDetail.reservFatcSet.airTemp.value",
736
- ) # noqa
735
+ "vehicleStatus.evStatus.reservChargeInfos.reserveChargeInfo2.reservChargeInfoDetail.reservFatcSet.airTemp.value", # noqa
736
+ )
737
737
  )
738
738
 
739
739
  vehicle.ev_second_departure_climate_temperature = (
@@ -1088,7 +1088,7 @@ class KiaUvoApiEU(ApiImplType1):
1088
1088
  yyyymm_string,
1089
1089
  ) -> None:
1090
1090
  """
1091
- Europe feature only.
1091
+ feature only available for some regions.
1092
1092
  Updates the vehicle.month_trip_info for the specified month.
1093
1093
 
1094
1094
  Default this information is None:
@@ -1123,9 +1123,6 @@ class KiaUvoApiEU(ApiImplType1):
1123
1123
  )
1124
1124
  result.day_list.append(processed_day)
1125
1125
 
1126
- if len(result.day_list) > 0: # sort on increasing yyyymmdd
1127
- result.day_list.sort(key=lambda k: k.yyyymmdd)
1128
-
1129
1126
  vehicle.month_trip_info = result
1130
1127
 
1131
1128
  def update_day_trip_info(
@@ -1135,7 +1132,7 @@ class KiaUvoApiEU(ApiImplType1):
1135
1132
  yyyymmdd_string,
1136
1133
  ) -> None:
1137
1134
  """
1138
- Europe feature only.
1135
+ feature only available for some regions.
1139
1136
  Updates the vehicle.day_trip_info information for the specified day.
1140
1137
 
1141
1138
  Default this information is None:
@@ -1174,9 +1171,6 @@ class KiaUvoApiEU(ApiImplType1):
1174
1171
  )
1175
1172
  result.trip_list.append(processed_trip)
1176
1173
 
1177
- if len(result.trip_list) > 0: # sort on descending hhmmss
1178
- result.trip_list.sort(reverse=True, key=lambda k: k.hhmmss)
1179
-
1180
1174
  vehicle.day_trip_info = result
1181
1175
 
1182
1176
  def _get_driving_info(self, token: Token, vehicle: Vehicle) -> dict:
@@ -1244,12 +1238,6 @@ class KiaUvoApiEU(ApiImplType1):
1244
1238
  )
1245
1239
  break
1246
1240
 
1247
- daily_stats = drivingInfo["dailyStats"]
1248
- _LOGGER.debug(f"KiaUvoApiEU: before daily_stats: {daily_stats}") # noqa
1249
- if len(daily_stats) > 0: # sort on decreasing date
1250
- daily_stats.sort(reverse=True, key=lambda k: k.date)
1251
- drivingInfo["dailyStats"] = daily_stats
1252
- _LOGGER.debug(f"KiaUvoApiEU: after daily_stats: {daily_stats}") # noqa
1253
1241
  return drivingInfo
1254
1242
  else:
1255
1243
  _LOGGER.debug(
@@ -1375,7 +1363,7 @@ class KiaUvoApiEU(ApiImplType1):
1375
1363
  "reservFatcSet": {
1376
1364
  "airCtrl": 1 if options.climate_enabled else 0,
1377
1365
  "airTemp": {
1378
- "value": "{:.1f}".format(temperature),
1366
+ "value": f"{temperature:.1f}",
1379
1367
  "hvacTempType": 1,
1380
1368
  "unit": options.temperature_unit,
1381
1369
  },
@@ -1390,15 +1378,15 @@ class KiaUvoApiEU(ApiImplType1):
1390
1378
  "offPeakPowerInfo": {
1391
1379
  "offPeakPowerTime1": {
1392
1380
  "endtime": {
1393
- "timeSection": 1
1394
- if options.off_peak_end_time >= dt.time(12, 0)
1395
- else 0,
1381
+ "timeSection": (
1382
+ 1 if options.off_peak_end_time >= dt.time(12, 0) else 0
1383
+ ),
1396
1384
  "time": options.off_peak_end_time.strftime("%I%M"),
1397
1385
  },
1398
1386
  "starttime": {
1399
- "timeSection": 1
1400
- if options.off_peak_start_time >= dt.time(12, 0)
1401
- else 0,
1387
+ "timeSection": (
1388
+ 1 if options.off_peak_start_time >= dt.time(12, 0) else 0
1389
+ ),
1402
1390
  "time": options.off_peak_start_time.strftime("%I%M"),
1403
1391
  },
1404
1392
  },
@@ -1,4 +1,4 @@
1
- # pylint:disable=missing-class-docstring,missing-function-docstring,wildcard-import,unused-wildcard-import,invalid-name
1
+ # pylint:disable=missing-class-docstring,missing-function-docstring,wildcard-import,unused-wildcard-import,invalid-name,logging-fstring-interpolation
2
2
  """Vehicle class"""
3
3
 
4
4
  import logging
@@ -173,11 +173,61 @@ class Vehicle:
173
173
  # expressed in watt-hours (Wh)
174
174
  power_consumption_30d: float = None # Europe feature only
175
175
 
176
- # Europe feature only
177
- daily_stats: list[DailyDrivingStats] = field(default_factory=list)
176
+ # feature only available for some regions (getter/setter for sorting)
177
+ _daily_stats: list[DailyDrivingStats] = field(default_factory=list)
178
178
 
179
- month_trip_info: MonthTripInfo = None # Europe feature only
180
- day_trip_info: DayTripInfo = None # Europe feature only
179
+ @property
180
+ def daily_stats(self):
181
+ return self._daily_stats
182
+
183
+ @daily_stats.setter
184
+ def daily_stats(self, value):
185
+ result = value
186
+ if result is not None and len(result) > 0: # sort on decreasing date
187
+ _LOGGER.debug(f"before daily_stats: {result}")
188
+ result.sort(reverse=True, key=lambda k: k.date)
189
+ _LOGGER.debug(f"after daily_stats: {result}")
190
+ self._daily_stats = result
191
+
192
+ # feature only available for some regions (getter/setter for sorting)
193
+ _month_trip_info: MonthTripInfo = None
194
+
195
+ @property
196
+ def month_trip_info(self):
197
+ return self._month_trip_info
198
+
199
+ @month_trip_info.setter
200
+ def month_trip_info(self, value):
201
+ result = value
202
+ if (
203
+ result is not None
204
+ and hasattr(result, "day_list")
205
+ and len(result.day_list) > 0
206
+ ): # sort on increasing yyyymmdd
207
+ _LOGGER.debug(f"before month_trip_info: {result}")
208
+ result.day_list.sort(key=lambda k: k.yyyymmdd)
209
+ _LOGGER.debug(f"after month_trip_info: {result}")
210
+ self._month_trip_info = result
211
+
212
+ # feature only available for some regions (getter/setter for sorting)
213
+ _day_trip_info: DayTripInfo = None
214
+
215
+ @property
216
+ def day_trip_info(self):
217
+ return self._day_trip_info
218
+
219
+ @day_trip_info.setter
220
+ def day_trip_info(self, value):
221
+ result = value
222
+ if (
223
+ result is not None
224
+ and hasattr(result, "trip_list")
225
+ and len(result.trip_list) > 0
226
+ ): # sort on descending hhmmss
227
+ _LOGGER.debug(f"before day_trip_info: {result}")
228
+ result.trip_list.sort(reverse=True, key=lambda k: k.hhmmss)
229
+ _LOGGER.debug(f"after day_trip_info: {result}")
230
+ self._day_trip_info = result
181
231
 
182
232
  ev_battery_percentage: int = None
183
233
  ev_battery_soh_percentage: int = None
@@ -219,7 +219,7 @@ class VehicleManager:
219
219
 
220
220
  def update_month_trip_info(self, vehicle_id: str, yyyymm_string: str) -> None:
221
221
  """
222
- Europe feature only.
222
+ feature only available for some regions.
223
223
  Updates the vehicle.month_trip_info for the specified month.
224
224
 
225
225
  Default this information is None:
@@ -231,7 +231,7 @@ class VehicleManager:
231
231
 
232
232
  def update_day_trip_info(self, vehicle_id: str, yyyymmdd_string: str) -> None:
233
233
  """
234
- Europe feature only.
234
+ feature only available for some regions.
235
235
  Updates the vehicle.day_trip_info information for the specified day.
236
236
 
237
237
  Default this information is None:
@@ -1,4 +1,4 @@
1
- # pylint:disable=bare-except,missing-function-docstring,invalid-name
1
+ # pylint:disable=bare-except,missing-function-docstring,invalid-name,broad-exception-caught
2
2
  """utils.py"""
3
3
 
4
4
  import datetime
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.22.8
3
+ Version: 3.22.9
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
@@ -112,16 +112,16 @@ For a list of language codes, see here: https://www.science.co.il/language/Codes
112
112
  - "pt" Portuguese
113
113
 
114
114
 
115
- In Europe also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
116
- - First call vm.update_month_trip_info(vehicle.id, yyymm) before getting vehicle.month_trip_info for that month
115
+ In Europe and some other regions also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
116
+ - First call vm.update_month_trip_info(vehicle.id, yyyymm) before getting vehicle.month_trip_info for that month
117
117
  - First call vm.update_day_trip_info(vehicle.id, day.yyyymmdd) before getting vehicle.day_trip_info for that day
118
118
 
119
119
  Example of getting trip info of the current month and day (vm is VehicleManager instance)::
120
120
 
121
121
  now = datetime.now()
122
- yyymm = now.strftime("%Y%m")
122
+ yyyymm = now.strftime("%Y%m")
123
123
  yyyymmdd = now.strftime("%Y%m%d")
124
- vm.update_month_trip_info(vehicle.id, yyymm)
124
+ vm.update_month_trip_info(vehicle.id, yyyymm)
125
125
  if vehicle.month_trip_info is not None:
126
126
  for day in vehicle.month_trip_info.day_list: # ordered on day
127
127
  if yyyymmdd == day.yyyymmdd: # in example only interested in current day
@@ -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.22.8",
47
+ version="3.22.9",
48
48
  zip_safe=False,
49
49
  )