hyundai-kia-connect-api 3.40.0__py2.py3-none-any.whl → 3.40.2__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.
@@ -41,6 +41,7 @@ from .exceptions import (
41
41
  InvalidAPIResponseError,
42
42
  RateLimitingError,
43
43
  DeviceIDError,
44
+ PINMissingError,
44
45
  )
45
46
 
46
47
  USER_AGENT_OK_HTTP: str = "okhttp/3.12.0"
@@ -443,6 +444,11 @@ class ApiImplType1(ApiImpl):
443
444
  get_child_value(state, "Electronics.FOB.LowBattery")
444
445
  )
445
446
 
447
+ if vehicle._ev_estimated_current_charge_duration == 0:
448
+ vehicle.ev_battery_is_charging = False
449
+ elif vehicle._ev_estimated_current_charge_duration > 0:
450
+ vehicle.ev_battery_is_charging = True
451
+
446
452
  if get_child_value(state, "Location.GeoCoord.Latitude"):
447
453
  location_last_updated_at = dt.datetime(
448
454
  2000, 1, 1, tzinfo=self.data_timezone
@@ -949,6 +955,8 @@ class ApiImplType1(ApiImpl):
949
955
  return response["msgId"]
950
956
 
951
957
  def _get_control_token(self, token: Token) -> Token:
958
+ if token.pin is None:
959
+ raise PINMissingError("PIN is not set, action will fail.")
952
960
  url = self.USER_API_URL + "pin?token="
953
961
  headers = {
954
962
  "Authorization": token.access_token,
@@ -790,30 +790,14 @@ class KiaUvoApiEU(ApiImplType1):
790
790
  def charge_port_action(
791
791
  self, token: Token, vehicle: Vehicle, action: CHARGE_PORT_ACTION
792
792
  ) -> str:
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
- )
793
+ url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/portdoor"
794
+
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()
800
800
 
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()
817
801
  _LOGGER.debug(f"{DOMAIN} - Charge Port Action Response: {response}")
818
802
  _check_response_for_errors(response)
819
803
  token.device_id = self._get_device_id(self._get_stamp())
@@ -11,6 +11,14 @@ class HyundaiKiaException(Exception):
11
11
  pass
12
12
 
13
13
 
14
+ class PINMissingError(HyundaiKiaException):
15
+ """
16
+ Raised upon receipt of an authentication error.
17
+ """
18
+
19
+ pass
20
+
21
+
14
22
  class AuthenticationError(HyundaiKiaException):
15
23
  """
16
24
  Raised upon receipt of an authentication error.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.40.0
3
+ Version: 3.40.2
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
@@ -1,10 +1,10 @@
1
1
  hyundai_kia_connect_api/ApiImpl.py,sha256=UeG2FH4KCdU5LvGp5Ks793vrWbwBx8MN_DedbVRRouM,9612
2
- hyundai_kia_connect_api/ApiImplType1.py,sha256=puAO4lN7vgzNJ2ZVE-rreJQNWN0Iwt7RYE87m47TX_o,37892
2
+ hyundai_kia_connect_api/ApiImplType1.py,sha256=6LSqH-p5balKKVkE4lvw3FqLEToKRHBhfm83656eIDM,38243
3
3
  hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=TNuFJIZ6Kpd5vbV5rVJjcqp7z-Ys3blzsz6YYWZThiA,36710
4
4
  hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=433Db-rp3drhyY8ZvN-GiVP85pl90Wwu4A2uAdkYH1c,36100
5
5
  hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=qZsHdXnxAr9N3FnF6IxpnKbSkv1fHbCDcfDLLbZLm5Q,33784
6
6
  hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=WP-rRI3wZmjuLYZmPXeOSk2NNNc6UhTrpOMuYMG6-iE,47043
7
- hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=UqgzyeG9tpArc_WK4h6NA_eeWEiMCyI1SO2CCzDk0ZY,50801
7
+ hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=ZV3yWd4W-zyN-xS6o_ItQtedLAkEvk5C_yTHGvT2qqU,50172
8
8
  hyundai_kia_connect_api/KiaUvoApiIN.py,sha256=q17gaDhp38wJwn1ceTou1QcDiuDW2wGGjOFTMDRROl8,36318
9
9
  hyundai_kia_connect_api/KiaUvoApiUSA.py,sha256=DeA-a2qq78XPYGB8U4vzy2oAcCQJ1xJRN9tlAK_I94o,30404
10
10
  hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
@@ -13,12 +13,12 @@ hyundai_kia_connect_api/VehicleManager.py,sha256=BbMeM5HU38nimNTN4QsSFuEcsbeUYCc
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
15
  hyundai_kia_connect_api/const.py,sha256=ImISRt4QarbN8BOBlDGYRB3F69NKCcGu8ddFvNPhhXU,2370
16
- hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
16
+ hyundai_kia_connect_api/exceptions.py,sha256=0dwKEPXN8KQVTeueDj2fL3E-TQMU7LjTEJbhcq8Mjx8,1467
17
17
  hyundai_kia_connect_api/utils.py,sha256=J0aXUX-nKIoS3XbelatNh-DZlHRU2_DYz_Mg_ZUKQJU,1957
18
- hyundai_kia_connect_api-3.40.0.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
- hyundai_kia_connect_api-3.40.0.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
- hyundai_kia_connect_api-3.40.0.dist-info/METADATA,sha256=65Y1bUfY6edJTu8f3T_PCM3jF6cmBHoYPHaYCvNVIZM,7156
21
- hyundai_kia_connect_api-3.40.0.dist-info/WHEEL,sha256=XAkygS4h1cf0JYWV13kJhTWht2y9NqKAsZuiTHc2920,109
22
- hyundai_kia_connect_api-3.40.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
- hyundai_kia_connect_api-3.40.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
- hyundai_kia_connect_api-3.40.0.dist-info/RECORD,,
18
+ hyundai_kia_connect_api-3.40.2.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
+ hyundai_kia_connect_api-3.40.2.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
+ hyundai_kia_connect_api-3.40.2.dist-info/METADATA,sha256=rHiMchcPK1TgX6geV_faxQH_xe8RgtpbyApOUmyOwXk,7156
21
+ hyundai_kia_connect_api-3.40.2.dist-info/WHEEL,sha256=XAkygS4h1cf0JYWV13kJhTWht2y9NqKAsZuiTHc2920,109
22
+ hyundai_kia_connect_api-3.40.2.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
+ hyundai_kia_connect_api-3.40.2.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
+ hyundai_kia_connect_api-3.40.2.dist-info/RECORD,,