hyundai-kia-connect-api 3.38.0__py2.py3-none-any.whl → 3.39.0__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.
@@ -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())
@@ -14,7 +14,9 @@ from typing import Optional
14
14
  import pytz
15
15
  import requests
16
16
  from dateutil import tz
17
-
17
+ from .ApiImpl import (
18
+ ClimateRequestOptions,
19
+ )
18
20
 
19
21
  from .ApiImplType1 import ApiImplType1
20
22
  from .ApiImplType1 import _check_response_for_errors
@@ -46,6 +48,7 @@ from .exceptions import (
46
48
  )
47
49
  from .utils import (
48
50
  get_child_value,
51
+ get_index_into_hex_temp,
49
52
  get_hex_temp_into_index,
50
53
  )
51
54
 
@@ -440,6 +443,59 @@ class KiaUvoApiIN(ApiImplType1):
440
443
  token.device_id = self._get_device_id(self._get_stamp())
441
444
  return response["msgId"]
442
445
 
446
+ def start_climate(
447
+ self, token: Token, vehicle: Vehicle, options: ClimateRequestOptions
448
+ ) -> str:
449
+ url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/control/engine"
450
+
451
+ # Defaults are located here to be region specific
452
+
453
+ if options.set_temp is None:
454
+ options.set_temp = 21
455
+ if options.duration is None:
456
+ options.duration = 5
457
+ if options.defrost is None:
458
+ options.defrost = False
459
+ if options.climate is None:
460
+ options.climate = True
461
+ if options.heating is None:
462
+ options.heating = 0
463
+
464
+ hex_set_temp = get_index_into_hex_temp(
465
+ self.temperature_range.index(options.set_temp)
466
+ )
467
+
468
+ payload = {
469
+ "action": "start",
470
+ "hvacType": 1,
471
+ "options": {
472
+ "defrost": options.defrost,
473
+ "heating1": int(options.heating),
474
+ },
475
+ "tempCode": hex_set_temp,
476
+ "unit": "C",
477
+ }
478
+ _LOGGER.debug(f"{DOMAIN} - Start Climate Action Request: {payload}")
479
+ response = requests.post(
480
+ url, json=payload, headers=self._get_authenticated_headers(token)
481
+ ).json()
482
+ _LOGGER.debug(f"{DOMAIN} - Start Climate Action Response: {response}")
483
+ _check_response_for_errors(response)
484
+ return response["msgId"]
485
+
486
+ def stop_climate(self, token: Token, vehicle: Vehicle) -> str:
487
+ url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/engine"
488
+ payload = {
489
+ "action": "stop",
490
+ }
491
+ _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Request: {payload}")
492
+ response = requests.post(
493
+ url, json=payload, headers=self._get_control_headers(token, vehicle)
494
+ ).json()
495
+ _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Response: {response}")
496
+ _check_response_for_errors(response)
497
+ return response["msgId"]
498
+
443
499
  def start_hazard_lights(self, token: Token, vehicle: Vehicle) -> str:
444
500
  url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/ccs2/control/light"
445
501
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.38.0
3
+ Version: 3.39.0
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
@@ -4,8 +4,8 @@ hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=TNuFJIZ6Kpd5vbV5rVJjcqp7
4
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
8
- hyundai_kia_connect_api/KiaUvoApiIN.py,sha256=UQuoL2wAyX4JzHEd03XQYFUDdNe-OMr6-CD9H6WIwJc,34293
7
+ hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=UqgzyeG9tpArc_WK4h6NA_eeWEiMCyI1SO2CCzDk0ZY,50801
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
11
11
  hyundai_kia_connect_api/Vehicle.py,sha256=DPMwJ2fXpV3VxdTdX6JGXfIVX5etyH4r6cnk_Q0AlE8,19039
@@ -15,10 +15,10 @@ hyundai_kia_connect_api/bluelink.py,sha256=JiNIHl-Qi8zwqyN6ywKg5CdXOLT74WkvpjVcn
15
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.38.0.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
- hyundai_kia_connect_api-3.38.0.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
- hyundai_kia_connect_api-3.38.0.dist-info/METADATA,sha256=xtGzWqUN6AyL3We2NBqoE41vaQAOabSUytUGavECX7Q,7156
21
- hyundai_kia_connect_api-3.38.0.dist-info/WHEEL,sha256=7wAbZI8A1UjN-j4-aYf66qBxOZ0Ioy0QNykkY5NcGJo,109
22
- hyundai_kia_connect_api-3.38.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
- hyundai_kia_connect_api-3.38.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
- hyundai_kia_connect_api-3.38.0.dist-info/RECORD,,
18
+ hyundai_kia_connect_api-3.39.0.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
19
+ hyundai_kia_connect_api-3.39.0.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
20
+ hyundai_kia_connect_api-3.39.0.dist-info/METADATA,sha256=5j29ngxTlKQpE7qMnl1RKc4R6tbktVaKZ7FVI-l-SXY,7156
21
+ hyundai_kia_connect_api-3.39.0.dist-info/WHEEL,sha256=Td9E1opt19FSuwsk_gcDwtsGPmyXw7uz9xQf-y2gvl8,109
22
+ hyundai_kia_connect_api-3.39.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
23
+ hyundai_kia_connect_api-3.39.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
24
+ hyundai_kia_connect_api-3.39.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.1)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any