hyundai-kia-connect-api 3.37.0__py2.py3-none-any.whl → 3.38.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.
@@ -28,7 +28,10 @@ from .const import (
28
28
  BRAND_HYUNDAI,
29
29
  BRAND_KIA,
30
30
  BRANDS,
31
+ REGIONS,
31
32
  DOMAIN,
33
+ REGION_AUSTRALIA,
34
+ REGION_NZ,
32
35
  DISTANCE_UNITS,
33
36
  TEMPERATURE_UNITS,
34
37
  SEAT_STATUS,
@@ -56,16 +59,30 @@ class KiaUvoApiAU(ApiImplType1):
56
59
 
57
60
  def __init__(self, region: int, brand: int, language: str) -> None:
58
61
  self.brand = brand
59
- if BRANDS[brand] == BRAND_KIA:
62
+ if BRANDS[brand] == BRAND_KIA and REGIONS[region] == REGION_AUSTRALIA:
60
63
  self.BASE_URL: str = "au-apigw.ccs.kia.com.au:8082"
61
64
  self.CCSP_SERVICE_ID: str = "8acb778a-b918-4a8d-8624-73a0beb64289"
62
65
  self.APP_ID: str = "4ad4dcde-be23-48a8-bc1c-91b94f5c06f8" # Android app ID
63
66
  self.BASIC_AUTHORIZATION: str = "Basic OGFjYjc3OGEtYjkxOC00YThkLTg2MjQtNzNhMGJlYjY0Mjg5OjdTY01NbTZmRVlYZGlFUEN4YVBhUW1nZVlkbFVyZndvaDRBZlhHT3pZSVMyQ3U5VA==" # noqa
67
+ self.cfb = base64.b64decode(
68
+ "IDbMgWBXgic4MAyMgf5PFFRAdGX5O3IyC3uvN3scCs0gDpTFDuyvBorlAH9JMM2/wMc="
69
+ )
64
70
  elif BRANDS[brand] == BRAND_HYUNDAI:
65
71
  self.BASE_URL: str = "au-apigw.ccs.hyundai.com.au:8080"
66
72
  self.CCSP_SERVICE_ID: str = "855c72df-dfd7-4230-ab03-67cbf902bb1c"
67
73
  self.APP_ID: str = "f9ccfdac-a48d-4c57-bd32-9116963c24ed" # Android app ID
68
74
  self.BASIC_AUTHORIZATION: str = "Basic ODU1YzcyZGYtZGZkNy00MjMwLWFiMDMtNjdjYmY5MDJiYjFjOmU2ZmJ3SE0zMllOYmhRbDBwdmlhUHAzcmY0dDNTNms5MWVjZUEzTUpMZGJkVGhDTw==" # noqa
75
+ self.cfb = base64.b64decode(
76
+ "V60WkEmyRQaAfrBF1623/7QL62MjLVbCHdItGzQ1g5T/hkmKmMVTaMHv4cKGzgD3gL8="
77
+ )
78
+ elif BRANDS[brand] == BRAND_KIA and REGIONS[region] == REGION_NZ:
79
+ self.BASE_URL: str = "au-apigw.ccs.kia.com.au:8082"
80
+ self.CCSP_SERVICE_ID: str = "4ab606a7-cea4-48a0-a216-ed9c14a4a38c"
81
+ self.APP_ID: str = "97745337-cac6-4a5b-afc3-e65ace81c994" # Android app ID
82
+ self.BASIC_AUTHORIZATION: str = "Basic NGFiNjA2YTctY2VhNC00OGEwLWEyMTYtZWQ5YzE0YTRhMzhjOjBoYUZxWFRrS2t0Tktmemt4aFowYWt1MzFpNzRnMHlRRm01b2QybXo0TGRJNW1MWQ==" # noqa
83
+ self.cfb = base64.b64decode(
84
+ "IDbMgWBXgic4MAyMgf5PFGsDas7YzQmN/lcPSkArm/KVUTutuiJAZ+4ZFoVxsHFNNy4="
85
+ )
69
86
 
70
87
  self.USER_API_URL: str = "https://" + self.BASE_URL + "/api/v1/user/"
71
88
  self.SPA_API_URL: str = "https://" + self.BASE_URL + "/api/v1/spa/"
@@ -777,18 +794,8 @@ class KiaUvoApiAU(ApiImplType1):
777
794
  return None
778
795
 
779
796
  def _get_stamp(self) -> str:
780
- if BRANDS[self.brand] == BRAND_KIA:
781
- cfb = base64.b64decode(
782
- "IDbMgWBXgic4MAyMgf5PFFRAdGX5O3IyC3uvN3scCs0gDpTFDuyvBorlAH9JMM2/wMc="
783
- )
784
- elif BRANDS[self.brand] == BRAND_HYUNDAI:
785
- cfb = base64.b64decode(
786
- "V60WkEmyRQaAfrBF1623/7QL62MjLVbCHdItGzQ1g5T/hkmKmMVTaMHv4cKGzgD3gL8="
787
- )
788
- else:
789
- raise ValueError("Invalid brand")
790
797
  raw_data = f"{self.APP_ID}:{int(dt.datetime.now().timestamp())}".encode()
791
- result = bytes(b1 ^ b2 for b1, b2 in zip(cfb, raw_data))
798
+ result = bytes(b1 ^ b2 for b1, b2 in zip(self.cfb, raw_data))
792
799
  return base64.b64encode(result).decode("utf-8")
793
800
 
794
801
  def _get_device_id(self, stamp):
@@ -790,13 +790,30 @@ class KiaUvoApiEU(ApiImplType1):
790
790
  def charge_port_action(
791
791
  self, token: Token, vehicle: Vehicle, action: CHARGE_PORT_ACTION
792
792
  ) -> str:
793
- url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/portdoor"
793
+ if vehicle.ccu_ccs2_protocol_support:
794
+ url = (
795
+ self.SPA_API_URL_V2
796
+ + "vehicles/"
797
+ + vehicle.id
798
+ + "/ccs2/control/portdoor"
799
+ )
794
800
 
795
- payload = {"action": action.value}
796
- _LOGGER.debug(f"{DOMAIN} - Charge Port Action Request: {payload}")
797
- response = requests.post(
798
- url, json=payload, headers=self._get_control_headers(token, vehicle)
799
- ).json()
801
+ payload = {"command": action.value}
802
+ _LOGGER.debug(f"{DOMAIN} - Charge Port Action Request: {payload}")
803
+ response = requests.post(
804
+ url, json=payload, headers=self._get_control_headers(token, vehicle)
805
+ ).json()
806
+ else:
807
+ url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/portdoor"
808
+ payload = {"action": action.value}
809
+ _LOGGER.debug(f"{DOMAIN} - Charge Port Action Request: {payload}")
810
+ response = requests.post(
811
+ url,
812
+ json=payload,
813
+ headers=self._get_authenticated_headers(
814
+ token, vehicle.ccu_ccs2_protocol_support
815
+ ),
816
+ ).json()
800
817
  _LOGGER.debug(f"{DOMAIN} - Charge Port Action Response: {response}")
801
818
  _check_response_for_errors(response)
802
819
  token.device_id = self._get_device_id(self._get_stamp())
@@ -34,6 +34,7 @@ from .const import (
34
34
  REGION_EUROPE,
35
35
  REGION_USA,
36
36
  REGION_CHINA,
37
+ REGION_NZ,
37
38
  REGION_INDIA,
38
39
  REGIONS,
39
40
  VEHICLE_LOCK_ACTION,
@@ -314,6 +315,13 @@ class VehicleManager:
314
315
  return KiaUvoApiCN(region, brand, language)
315
316
  elif REGIONS[region] == REGION_AUSTRALIA:
316
317
  return KiaUvoApiAU(region, brand, language)
318
+ elif REGIONS[region] == REGION_NZ:
319
+ if BRANDS[brand] == BRAND_KIA:
320
+ return KiaUvoApiAU(region, brand, language)
321
+ else:
322
+ raise APIError(
323
+ f"Unknown brand {BRANDS[brand]} for region {REGIONS[region]}"
324
+ )
317
325
  elif REGIONS[region] == REGION_INDIA:
318
326
  return KiaUvoApiIN(brand)
319
327
  else:
@@ -21,6 +21,8 @@ REGION_CANADA = "Canada"
21
21
  REGION_USA = "USA"
22
22
  REGION_CHINA = "China"
23
23
  REGION_AUSTRALIA = "Australia"
24
+ REGION_NZ = "New Zealand"
25
+
24
26
  REGION_INDIA = "India"
25
27
  REGIONS = {
26
28
  1: REGION_EUROPE,
@@ -29,6 +31,7 @@ REGIONS = {
29
31
  4: REGION_CHINA,
30
32
  5: REGION_AUSTRALIA,
31
33
  6: REGION_INDIA,
34
+ 7: REGION_NZ,
32
35
  }
33
36
 
34
37
  LOGIN_TOKEN_LIFETIME = datetime.timedelta(hours=23)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.37.0
3
+ Version: 3.38.1
4
4
  Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
5
5
  Home-page: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api
6
6
  Author: Fuat Akgun
@@ -70,7 +70,7 @@ Python 3.10 or newer is required to use this package. Vehicle manager is the key
70
70
 
71
71
  Key values for the int exist in the `const.py <https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/master/hyundai_kia_connect_api/const.py>`_ file as::
72
72
 
73
- REGIONS = {1: REGION_EUROPE, 2: REGION_CANADA, 3: REGION_USA, 4: REGION_CHINA, 5: REGION_AUSTRALIA}
73
+ REGIONS = {1: REGION_EUROPE, 2: REGION_CANADA, 3: REGION_USA, 4: REGION_CHINA, 5: REGION_AUSTRALIA, 6: REGION_NZ}
74
74
  BRANDS = {1: BRAND_KIA, 2: BRAND_HYUNDAI, 3: BRAND_GENESIS}
75
75
  GEO_LOCATION_PROVIDERS = {1: OPENSTREETMAP, 2: GOOGLE}
76
76
 
@@ -1,24 +1,24 @@
1
1
  hyundai_kia_connect_api/ApiImpl.py,sha256=UeG2FH4KCdU5LvGp5Ks793vrWbwBx8MN_DedbVRRouM,9612
2
2
  hyundai_kia_connect_api/ApiImplType1.py,sha256=puAO4lN7vgzNJ2ZVE-rreJQNWN0Iwt7RYE87m47TX_o,37892
3
3
  hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=TNuFJIZ6Kpd5vbV5rVJjcqp7z-Ys3blzsz6YYWZThiA,36710
4
- hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=tJ_pQqjSA6qfRRO7_LgwlC0J_3x77U9wDftpCyH_XZI,35525
4
+ hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=433Db-rp3drhyY8ZvN-GiVP85pl90Wwu4A2uAdkYH1c,36100
5
5
  hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=vP1WTSficCPSd3XrFh_FQZL2irJQbCYFVKm4OF2bWd8,32301
6
6
  hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=WP-rRI3wZmjuLYZmPXeOSk2NNNc6UhTrpOMuYMG6-iE,47043
7
- hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=vYmXY5so023HUTskBGPdOUgyyTpeTvRha0K_nwWpbKI,50171
7
+ hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=UqgzyeG9tpArc_WK4h6NA_eeWEiMCyI1SO2CCzDk0ZY,50801
8
8
  hyundai_kia_connect_api/KiaUvoApiIN.py,sha256=UQuoL2wAyX4JzHEd03XQYFUDdNe-OMr6-CD9H6WIwJc,34293
9
9
  hyundai_kia_connect_api/KiaUvoApiUSA.py,sha256=DeA-a2qq78XPYGB8U4vzy2oAcCQJ1xJRN9tlAK_I94o,30404
10
10
  hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
11
11
  hyundai_kia_connect_api/Vehicle.py,sha256=DPMwJ2fXpV3VxdTdX6JGXfIVX5etyH4r6cnk_Q0AlE8,19039
12
- hyundai_kia_connect_api/VehicleManager.py,sha256=qe2K-Eo14DImn3NyKsIvaovGXeXArkFJe-FVD3qgeCU,11872
12
+ hyundai_kia_connect_api/VehicleManager.py,sha256=BbMeM5HU38nimNTN4QsSFuEcsbeUYCcFdC7-MCU52AY,12183
13
13
  hyundai_kia_connect_api/__init__.py,sha256=IkyVeIMbcFJZgLaiiNnUVA1Ferxvrm1bXHKVg01cxvc,319
14
14
  hyundai_kia_connect_api/bluelink.py,sha256=JiNIHl-Qi8zwqyN6ywKg5CdXOLT74WkvpjVcn-rYEjI,19730
15
- hyundai_kia_connect_api/const.py,sha256=quNZV943B_xzDvAeQyyMKD5qFjC3uTRvxSJrtfoCaWo,2325
15
+ hyundai_kia_connect_api/const.py,sha256=ImISRt4QarbN8BOBlDGYRB3F69NKCcGu8ddFvNPhhXU,2370
16
16
  hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
17
17
  hyundai_kia_connect_api/utils.py,sha256=J0aXUX-nKIoS3XbelatNh-DZlHRU2_DYz_Mg_ZUKQJU,1957
18
- hyundai_kia_connect_api-3.37.0.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
- hyundai_kia_connect_api-3.37.0.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
- hyundai_kia_connect_api-3.37.0.dist-info/METADATA,sha256=olxsZ_AU8KS9wiHOtyz2ET7zecd6GqW02Nq9yvr1LFA,7142
21
- hyundai_kia_connect_api-3.37.0.dist-info/WHEEL,sha256=7wAbZI8A1UjN-j4-aYf66qBxOZ0Ioy0QNykkY5NcGJo,109
22
- hyundai_kia_connect_api-3.37.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
- hyundai_kia_connect_api-3.37.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
- hyundai_kia_connect_api-3.37.0.dist-info/RECORD,,
18
+ hyundai_kia_connect_api-3.38.1.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
+ hyundai_kia_connect_api-3.38.1.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
+ hyundai_kia_connect_api-3.38.1.dist-info/METADATA,sha256=SYPMMq4urHcAsq_clj91mPKP6zkJLallqKjBidI_xM8,7156
21
+ hyundai_kia_connect_api-3.38.1.dist-info/WHEEL,sha256=7wAbZI8A1UjN-j4-aYf66qBxOZ0Ioy0QNykkY5NcGJo,109
22
+ hyundai_kia_connect_api-3.38.1.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
+ hyundai_kia_connect_api-3.38.1.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
+ hyundai_kia_connect_api-3.38.1.dist-info/RECORD,,