hyundai-kia-connect-api 3.34.4__py2.py3-none-any.whl → 3.35.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.
@@ -8,14 +8,15 @@ from typing import Optional
8
8
  from time import sleep
9
9
 
10
10
 
11
- from .ApiImpl import ApiImpl, ScheduleChargingClimateRequestOptions
11
+ from .ApiImpl import (
12
+ ApiImpl,
13
+ ScheduleChargingClimateRequestOptions,
14
+ ClimateRequestOptions,
15
+ )
12
16
  from .Token import Token
13
17
  from .Vehicle import Vehicle
14
18
 
15
- from .utils import (
16
- get_child_value,
17
- parse_datetime,
18
- )
19
+ from .utils import get_child_value, parse_datetime, get_index_into_hex_temp
19
20
 
20
21
  from .const import (
21
22
  DOMAIN,
@@ -704,3 +705,120 @@ class ApiImplType1(ApiImpl):
704
705
  _check_response_for_errors(response)
705
706
  token.device_id = self._get_device_id(self._get_stamp())
706
707
  return response["msgId"]
708
+
709
+ def start_climate(
710
+ self, token: Token, vehicle: Vehicle, options: ClimateRequestOptions
711
+ ) -> str:
712
+ url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/control/temperature"
713
+
714
+ # Defaults are located here to be region specific
715
+
716
+ if options.set_temp is None:
717
+ options.set_temp = 21
718
+ if options.duration is None:
719
+ options.duration = 5
720
+ if options.defrost is None:
721
+ options.defrost = False
722
+ if options.climate is None:
723
+ options.climate = True
724
+ if options.heating is None:
725
+ options.heating = 0
726
+ if not vehicle.ccu_ccs2_protocol_support:
727
+ hex_set_temp = get_index_into_hex_temp(
728
+ self.temperature_range.index(options.set_temp)
729
+ )
730
+
731
+ payload = {
732
+ "action": "start",
733
+ "hvacType": 0,
734
+ "options": {
735
+ "defrost": options.defrost,
736
+ "heating1": int(options.heating),
737
+ },
738
+ "tempCode": hex_set_temp,
739
+ "unit": "C",
740
+ }
741
+ _LOGGER.debug(f"{DOMAIN} - Start Climate Action Request: {payload}")
742
+ response = requests.post(
743
+ url,
744
+ json=payload,
745
+ headers=self._get_authenticated_headers(
746
+ token, vehicle.ccu_ccs2_protocol_support
747
+ ),
748
+ ).json()
749
+ else:
750
+ url = (
751
+ self.SPA_API_URL_V2
752
+ + "vehicles/"
753
+ + vehicle.id
754
+ + "/ccs2/control/temperature"
755
+ )
756
+ payload = {
757
+ "command": "start",
758
+ "ignitionDuration:": options.duration,
759
+ "strgWhlHeating": options.steering_wheel,
760
+ "hvacTempType": 1,
761
+ "hvacTemp": options.set_temp,
762
+ "sideRearMirrorHeating": 1,
763
+ "drvSeatLoc": "R",
764
+ "seatClimateInfo": {
765
+ "drvSeatClimateState": options.front_left_seat,
766
+ "psgSeatClimateState": options.front_right_seat,
767
+ "rrSeatClimateState": options.rear_right_seat,
768
+ "rlSeatClimateState": options.rear_left_seat,
769
+ },
770
+ "tempUnit": "C",
771
+ "windshieldFrontDefogState": options.defrost,
772
+ }
773
+ _LOGGER.debug(f"{DOMAIN} - Start Climate Action Request: {payload}")
774
+ response = requests.post(
775
+ url,
776
+ json=payload,
777
+ headers=self._get_control_headers(token, vehicle),
778
+ ).json()
779
+ _LOGGER.debug(f"{DOMAIN} - Start Climate Action Response: {response}")
780
+ _check_response_for_errors(response)
781
+ token.device_id = self._get_device_id(self._get_stamp())
782
+ return response["msgId"]
783
+
784
+ def stop_climate(self, token: Token, vehicle: Vehicle) -> str:
785
+ if not vehicle.ccu_ccs2_protocol_support:
786
+ url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/control/temperature"
787
+ payload = {
788
+ "action": "stop",
789
+ "hvacType": 0,
790
+ "options": {
791
+ "defrost": True,
792
+ "heating1": 1,
793
+ },
794
+ "tempCode": "10H",
795
+ "unit": "C",
796
+ }
797
+ _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Request: {payload}")
798
+ response = requests.post(
799
+ url,
800
+ json=payload,
801
+ headers=self._get_authenticated_headers(
802
+ token, vehicle.ccu_ccs2_protocol_support
803
+ ),
804
+ ).json()
805
+ else:
806
+ url = (
807
+ self.SPA_API_URL_V2
808
+ + "vehicles/"
809
+ + vehicle.id
810
+ + "/ccs2/control/temperature"
811
+ )
812
+ payload = {
813
+ "command": "stop",
814
+ }
815
+ _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Request: {payload}")
816
+ response = requests.post(
817
+ url,
818
+ json=payload,
819
+ headers=self._get_control_headers(token, vehicle),
820
+ ).json()
821
+ _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Response: {response}")
822
+ _check_response_for_errors(response)
823
+ token.device_id = self._get_device_id(self._get_stamp())
824
+ return response["msgId"]
@@ -15,7 +15,6 @@ import requests
15
15
  from dateutil import tz
16
16
 
17
17
  from .ApiImpl import (
18
- ClimateRequestOptions,
19
18
  WindowRequestOptions,
20
19
  )
21
20
  from .ApiImplType1 import ApiImplType1
@@ -45,7 +44,6 @@ from .exceptions import (
45
44
  )
46
45
  from .utils import (
47
46
  get_child_value,
48
- get_index_into_hex_temp,
49
47
  get_hex_temp_into_index,
50
48
  parse_datetime,
51
49
  )
@@ -661,59 +659,6 @@ class KiaUvoApiAU(ApiImplType1):
661
659
  _check_response_for_errors(response)
662
660
  return response["msgId"]
663
661
 
664
- def start_climate(
665
- self, token: Token, vehicle: Vehicle, options: ClimateRequestOptions
666
- ) -> str:
667
- url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/engine"
668
-
669
- # Defaults are located here to be region specific
670
-
671
- if options.set_temp is None:
672
- options.set_temp = 21
673
- if options.duration is None:
674
- options.duration = 5
675
- if options.defrost is None:
676
- options.defrost = False
677
- if options.climate is None:
678
- options.climate = True
679
- if options.heating is None:
680
- options.heating = 0
681
-
682
- hex_set_temp = get_index_into_hex_temp(
683
- self.temperature_range.index(options.set_temp)
684
- )
685
-
686
- payload = {
687
- "action": "start",
688
- "hvacType": 1,
689
- "options": {
690
- "defrost": options.defrost,
691
- "heating1": int(options.heating),
692
- },
693
- "tempCode": hex_set_temp,
694
- "unit": "C",
695
- }
696
- _LOGGER.debug(f"{DOMAIN} - Start Climate Action Request: {payload}")
697
- response = requests.post(
698
- url, json=payload, headers=self._get_control_headers(token, vehicle)
699
- ).json()
700
- _LOGGER.debug(f"{DOMAIN} - Start Climate Action Response: {response}")
701
- _check_response_for_errors(response)
702
- return response["msgId"]
703
-
704
- def stop_climate(self, token: Token, vehicle: Vehicle) -> str:
705
- url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/control/engine"
706
- payload = {
707
- "action": "stop",
708
- }
709
- _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Request: {payload}")
710
- response = requests.post(
711
- url, json=payload, headers=self._get_control_headers(token, vehicle)
712
- ).json()
713
- _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Response: {response}")
714
- _check_response_for_errors(response)
715
- return response["msgId"]
716
-
717
662
  def _get_charge_limits(self, token: Token, vehicle: Vehicle) -> dict:
718
663
  # Not currently used as value is in the general get.
719
664
  # Most likely this forces the car the update it.
@@ -15,9 +15,7 @@ import requests
15
15
  from bs4 import BeautifulSoup
16
16
  from dateutil import tz
17
17
 
18
- from .ApiImpl import (
19
- ClimateRequestOptions,
20
- )
18
+
21
19
  from .ApiImplType1 import ApiImplType1
22
20
  from .ApiImplType1 import _check_response_for_errors
23
21
 
@@ -49,7 +47,6 @@ from .exceptions import (
49
47
  )
50
48
  from .utils import (
51
49
  get_child_value,
52
- get_index_into_hex_temp,
53
50
  get_hex_temp_into_index,
54
51
  parse_datetime,
55
52
  )
@@ -854,77 +851,6 @@ class KiaUvoApiEU(ApiImplType1):
854
851
  token.device_id = self._get_device_id(self._get_stamp())
855
852
  return response["msgId"]
856
853
 
857
- def start_climate(
858
- self, token: Token, vehicle: Vehicle, options: ClimateRequestOptions
859
- ) -> str:
860
- url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/control/temperature"
861
-
862
- # Defaults are located here to be region specific
863
-
864
- if options.set_temp is None:
865
- options.set_temp = 21
866
- if options.duration is None:
867
- options.duration = 5
868
- if options.defrost is None:
869
- options.defrost = False
870
- if options.climate is None:
871
- options.climate = True
872
- if options.heating is None:
873
- options.heating = 0
874
-
875
- hex_set_temp = get_index_into_hex_temp(
876
- self.temperature_range.index(options.set_temp)
877
- )
878
-
879
- payload = {
880
- "action": "start",
881
- "hvacType": 0,
882
- "options": {
883
- "defrost": options.defrost,
884
- "heating1": int(options.heating),
885
- },
886
- "tempCode": hex_set_temp,
887
- "unit": "C",
888
- }
889
- _LOGGER.debug(f"{DOMAIN} - Start Climate Action Request: {payload}")
890
- response = requests.post(
891
- url,
892
- json=payload,
893
- headers=self._get_authenticated_headers(
894
- token, vehicle.ccu_ccs2_protocol_support
895
- ),
896
- ).json()
897
- _LOGGER.debug(f"{DOMAIN} - Start Climate Action Response: {response}")
898
- _check_response_for_errors(response)
899
- token.device_id = self._get_device_id(self._get_stamp())
900
- return response["msgId"]
901
-
902
- def stop_climate(self, token: Token, vehicle: Vehicle) -> str:
903
- url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/control/temperature"
904
-
905
- payload = {
906
- "action": "stop",
907
- "hvacType": 0,
908
- "options": {
909
- "defrost": True,
910
- "heating1": 1,
911
- },
912
- "tempCode": "10H",
913
- "unit": "C",
914
- }
915
- _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Request: {payload}")
916
- response = requests.post(
917
- url,
918
- json=payload,
919
- headers=self._get_authenticated_headers(
920
- token, vehicle.ccu_ccs2_protocol_support
921
- ),
922
- ).json()
923
- _LOGGER.debug(f"{DOMAIN} - Stop Climate Action Response: {response}")
924
- _check_response_for_errors(response)
925
- token.device_id = self._get_device_id(self._get_stamp())
926
- return response["msgId"]
927
-
928
854
  def start_hazard_lights(self, token: Token, vehicle: Vehicle) -> str:
929
855
  url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id + "/ccs2/control/light"
930
856
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.34.4
3
+ Version: 3.35.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
@@ -1,10 +1,10 @@
1
1
  hyundai_kia_connect_api/ApiImpl.py,sha256=UeG2FH4KCdU5LvGp5Ks793vrWbwBx8MN_DedbVRRouM,9612
2
- hyundai_kia_connect_api/ApiImplType1.py,sha256=kdCY5GBwRJ2dRnu2CXcEzc48XbXw2Q7UOnflyEcSR3o,26919
2
+ hyundai_kia_connect_api/ApiImplType1.py,sha256=m0jTV0bumUnqfCSQln5FCquNeAzi9_81go4piKXSa3U,31410
3
3
  hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=FGYyrS3dSq8Plfu8DQMwVG1LM3nmRv8Y4vrN7wZ4oVY,36988
4
- hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=gvywTkeZRiL0vv_mSqZefttFK44lHmY2kFDVv31gx70,41929
4
+ hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=nGR7jwogKrVuM6C6xLNbSDwltuy0PFR11kpGL9YykhY,39922
5
5
  hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=Y2xWIYUuiilk3FXq1ZdHQ0DsFZA_8b6AIT32l595leg,32521
6
6
  hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=WP-rRI3wZmjuLYZmPXeOSk2NNNc6UhTrpOMuYMG6-iE,47043
7
- hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=xOqwFwm2V0Uc0c6G6Rlps3vtfjKsLaGAsnDQW09FQWU,57568
7
+ hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=E9bKbwTZ3_b6yL6ud7u_0-lQN4qRQ7nt0CyVD6KmwXM,55041
8
8
  hyundai_kia_connect_api/KiaUvoApiUSA.py,sha256=bOG3ugG_O1g5cL3E_b4F2McXeZYJVzfBpqK_kaYgM9E,30550
9
9
  hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
10
10
  hyundai_kia_connect_api/Vehicle.py,sha256=hZT0wU7-mMi85bgqNHMu6CyhQQ5h-Jfmoc1ce2uPhYM,18867
@@ -14,10 +14,10 @@ hyundai_kia_connect_api/bluelink.py,sha256=JiNIHl-Qi8zwqyN6ywKg5CdXOLT74WkvpjVcn
14
14
  hyundai_kia_connect_api/const.py,sha256=gFAhj9-YgrJNd7ZjYr4Qu1Yf4v-RhmyON1MJDN0eR90,2281
15
15
  hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
16
16
  hyundai_kia_connect_api/utils.py,sha256=J0aXUX-nKIoS3XbelatNh-DZlHRU2_DYz_Mg_ZUKQJU,1957
17
- hyundai_kia_connect_api-3.34.4.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
18
- hyundai_kia_connect_api-3.34.4.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
19
- hyundai_kia_connect_api-3.34.4.dist-info/METADATA,sha256=pb1Ky_N9KuTI69ql4vSm0-n17J2K2fcwc44PQ0b7tYI,7142
20
- hyundai_kia_connect_api-3.34.4.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
21
- hyundai_kia_connect_api-3.34.4.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
22
- hyundai_kia_connect_api-3.34.4.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
23
- hyundai_kia_connect_api-3.34.4.dist-info/RECORD,,
17
+ hyundai_kia_connect_api-3.35.0.dist-info/licenses/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
18
+ hyundai_kia_connect_api-3.35.0.dist-info/licenses/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
19
+ hyundai_kia_connect_api-3.35.0.dist-info/METADATA,sha256=3zYMgjonPboC8N7ZvQMhkbySM8pCgd9j44zDfxYti4s,7142
20
+ hyundai_kia_connect_api-3.35.0.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
21
+ hyundai_kia_connect_api-3.35.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
22
+ hyundai_kia_connect_api-3.35.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
23
+ hyundai_kia_connect_api-3.35.0.dist-info/RECORD,,