hyundai-kia-connect-api 3.34.3__py2.py3-none-any.whl → 3.34.4__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.
- hyundai_kia_connect_api/ApiImplType1.py +115 -3
- hyundai_kia_connect_api/KiaUvoApiEU.py +0 -115
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/METADATA +1 -1
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/RECORD +9 -9
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/WHEEL +0 -0
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/entry_points.txt +0 -0
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/licenses/AUTHORS.rst +0 -0
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/licenses/LICENSE +0 -0
- {hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/top_level.txt +0 -0
@@ -8,9 +8,7 @@ from typing import Optional
|
|
8
8
|
from time import sleep
|
9
9
|
|
10
10
|
|
11
|
-
from .ApiImpl import
|
12
|
-
ApiImpl,
|
13
|
-
)
|
11
|
+
from .ApiImpl import ApiImpl, ScheduleChargingClimateRequestOptions
|
14
12
|
from .Token import Token
|
15
13
|
from .Vehicle import Vehicle
|
16
14
|
|
@@ -592,3 +590,117 @@ class ApiImplType1(ApiImpl):
|
|
592
590
|
# can't find the action, raise an exception
|
593
591
|
# Old code: raise APIError(f"No action found with ID {action_id}")
|
594
592
|
return ORDER_STATUS.UNKNOWN
|
593
|
+
|
594
|
+
def schedule_charging_and_climate(
|
595
|
+
self,
|
596
|
+
token: Token,
|
597
|
+
vehicle: Vehicle,
|
598
|
+
options: ScheduleChargingClimateRequestOptions,
|
599
|
+
) -> str:
|
600
|
+
url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id
|
601
|
+
url = url + "/ccs2" # does not depend on vehicle.ccu_ccs2_protocol_support
|
602
|
+
url = url + "/reservation/chargehvac"
|
603
|
+
|
604
|
+
def set_default_departure_options(
|
605
|
+
departure_options: ScheduleChargingClimateRequestOptions.DepartureOptions,
|
606
|
+
) -> None:
|
607
|
+
if departure_options.enabled is None:
|
608
|
+
departure_options.enabled = False
|
609
|
+
if departure_options.days is None:
|
610
|
+
departure_options.days = [0]
|
611
|
+
if departure_options.time is None:
|
612
|
+
departure_options.time = dt.time()
|
613
|
+
|
614
|
+
if options.first_departure is None:
|
615
|
+
options.first_departure = (
|
616
|
+
ScheduleChargingClimateRequestOptions.DepartureOptions()
|
617
|
+
)
|
618
|
+
if options.second_departure is None:
|
619
|
+
options.second_departure = (
|
620
|
+
ScheduleChargingClimateRequestOptions.DepartureOptions()
|
621
|
+
)
|
622
|
+
|
623
|
+
set_default_departure_options(options.first_departure)
|
624
|
+
set_default_departure_options(options.second_departure)
|
625
|
+
departures = [options.first_departure, options.second_departure]
|
626
|
+
|
627
|
+
if options.charging_enabled is None:
|
628
|
+
options.charging_enabled = False
|
629
|
+
if options.off_peak_start_time is None:
|
630
|
+
options.off_peak_start_time = dt.time()
|
631
|
+
if options.off_peak_end_time is None:
|
632
|
+
options.off_peak_end_time = options.off_peak_start_time
|
633
|
+
if options.off_peak_charge_only_enabled is None:
|
634
|
+
options.off_peak_charge_only_enabled = False
|
635
|
+
if options.climate_enabled is None:
|
636
|
+
options.climate_enabled = False
|
637
|
+
if options.temperature is None:
|
638
|
+
options.temperature = 21.0
|
639
|
+
if options.temperature_unit is None:
|
640
|
+
options.temperature_unit = 0
|
641
|
+
if options.defrost is None:
|
642
|
+
options.defrost = False
|
643
|
+
|
644
|
+
temperature: float = options.temperature
|
645
|
+
if options.temperature_unit == 0:
|
646
|
+
# Round to nearest 0.5
|
647
|
+
temperature = round(temperature * 2.0) / 2.0
|
648
|
+
# Cap at 27, floor at 17
|
649
|
+
if temperature > 27.0:
|
650
|
+
temperature = 27.0
|
651
|
+
elif temperature < 17.0:
|
652
|
+
temperature = 17.0
|
653
|
+
|
654
|
+
payload = {
|
655
|
+
"reservChargeInfo" + str(i + 1): {
|
656
|
+
"reservChargeSet": departures[i].enabled,
|
657
|
+
"reservInfo": {
|
658
|
+
"day": departures[i].days,
|
659
|
+
"time": {
|
660
|
+
"time": departures[i].time.strftime("%I%M"),
|
661
|
+
"timeSection": 1 if departures[i].time >= dt.time(12, 0) else 0,
|
662
|
+
},
|
663
|
+
},
|
664
|
+
"reservFatcSet": {
|
665
|
+
"airCtrl": 1 if options.climate_enabled else 0,
|
666
|
+
"airTemp": {
|
667
|
+
"value": f"{temperature:.1f}",
|
668
|
+
"hvacTempType": 1,
|
669
|
+
"unit": options.temperature_unit,
|
670
|
+
},
|
671
|
+
"heating1": 0,
|
672
|
+
"defrost": options.defrost,
|
673
|
+
},
|
674
|
+
}
|
675
|
+
for i in range(2)
|
676
|
+
}
|
677
|
+
|
678
|
+
payload = payload | {
|
679
|
+
"offPeakPowerInfo": {
|
680
|
+
"offPeakPowerTime1": {
|
681
|
+
"endtime": {
|
682
|
+
"timeSection": (
|
683
|
+
1 if options.off_peak_end_time >= dt.time(12, 0) else 0
|
684
|
+
),
|
685
|
+
"time": options.off_peak_end_time.strftime("%I%M"),
|
686
|
+
},
|
687
|
+
"starttime": {
|
688
|
+
"timeSection": (
|
689
|
+
1 if options.off_peak_start_time >= dt.time(12, 0) else 0
|
690
|
+
),
|
691
|
+
"time": options.off_peak_start_time.strftime("%I%M"),
|
692
|
+
},
|
693
|
+
},
|
694
|
+
"offPeakPowerFlag": 2 if options.off_peak_charge_only_enabled else 1,
|
695
|
+
},
|
696
|
+
"reservFlag": 1 if options.charging_enabled else 0,
|
697
|
+
}
|
698
|
+
|
699
|
+
_LOGGER.debug(f"{DOMAIN} - Schedule Charging and Climate Request: {payload}")
|
700
|
+
response = requests.post(
|
701
|
+
url, json=payload, headers=self._get_control_headers(token, vehicle)
|
702
|
+
).json()
|
703
|
+
_LOGGER.debug(f"{DOMAIN} - Schedule Charging and Climate Response: {response}")
|
704
|
+
_check_response_for_errors(response)
|
705
|
+
token.device_id = self._get_device_id(self._get_stamp())
|
706
|
+
return response["msgId"]
|
@@ -17,7 +17,6 @@ from dateutil import tz
|
|
17
17
|
|
18
18
|
from .ApiImpl import (
|
19
19
|
ClimateRequestOptions,
|
20
|
-
ScheduleChargingClimateRequestOptions,
|
21
20
|
)
|
22
21
|
from .ApiImplType1 import ApiImplType1
|
23
22
|
from .ApiImplType1 import _check_response_for_errors
|
@@ -1167,120 +1166,6 @@ class KiaUvoApiEU(ApiImplType1):
|
|
1167
1166
|
)
|
1168
1167
|
return None
|
1169
1168
|
|
1170
|
-
def schedule_charging_and_climate(
|
1171
|
-
self,
|
1172
|
-
token: Token,
|
1173
|
-
vehicle: Vehicle,
|
1174
|
-
options: ScheduleChargingClimateRequestOptions,
|
1175
|
-
) -> str:
|
1176
|
-
url = self.SPA_API_URL_V2 + "vehicles/" + vehicle.id
|
1177
|
-
url = url + "/ccs2" # does not depend on vehicle.ccu_ccs2_protocol_support
|
1178
|
-
url = url + "/reservation/chargehvac"
|
1179
|
-
|
1180
|
-
def set_default_departure_options(
|
1181
|
-
departure_options: ScheduleChargingClimateRequestOptions.DepartureOptions,
|
1182
|
-
) -> None:
|
1183
|
-
if departure_options.enabled is None:
|
1184
|
-
departure_options.enabled = False
|
1185
|
-
if departure_options.days is None:
|
1186
|
-
departure_options.days = [0]
|
1187
|
-
if departure_options.time is None:
|
1188
|
-
departure_options.time = dt.time()
|
1189
|
-
|
1190
|
-
if options.first_departure is None:
|
1191
|
-
options.first_departure = (
|
1192
|
-
ScheduleChargingClimateRequestOptions.DepartureOptions()
|
1193
|
-
)
|
1194
|
-
if options.second_departure is None:
|
1195
|
-
options.second_departure = (
|
1196
|
-
ScheduleChargingClimateRequestOptions.DepartureOptions()
|
1197
|
-
)
|
1198
|
-
|
1199
|
-
set_default_departure_options(options.first_departure)
|
1200
|
-
set_default_departure_options(options.second_departure)
|
1201
|
-
departures = [options.first_departure, options.second_departure]
|
1202
|
-
|
1203
|
-
if options.charging_enabled is None:
|
1204
|
-
options.charging_enabled = False
|
1205
|
-
if options.off_peak_start_time is None:
|
1206
|
-
options.off_peak_start_time = dt.time()
|
1207
|
-
if options.off_peak_end_time is None:
|
1208
|
-
options.off_peak_end_time = options.off_peak_start_time
|
1209
|
-
if options.off_peak_charge_only_enabled is None:
|
1210
|
-
options.off_peak_charge_only_enabled = False
|
1211
|
-
if options.climate_enabled is None:
|
1212
|
-
options.climate_enabled = False
|
1213
|
-
if options.temperature is None:
|
1214
|
-
options.temperature = 21.0
|
1215
|
-
if options.temperature_unit is None:
|
1216
|
-
options.temperature_unit = 0
|
1217
|
-
if options.defrost is None:
|
1218
|
-
options.defrost = False
|
1219
|
-
|
1220
|
-
temperature: float = options.temperature
|
1221
|
-
if options.temperature_unit == 0:
|
1222
|
-
# Round to nearest 0.5
|
1223
|
-
temperature = round(temperature * 2.0) / 2.0
|
1224
|
-
# Cap at 27, floor at 17
|
1225
|
-
if temperature > 27.0:
|
1226
|
-
temperature = 27.0
|
1227
|
-
elif temperature < 17.0:
|
1228
|
-
temperature = 17.0
|
1229
|
-
|
1230
|
-
payload = {
|
1231
|
-
"reservChargeInfo" + str(i + 1): {
|
1232
|
-
"reservChargeSet": departures[i].enabled,
|
1233
|
-
"reservInfo": {
|
1234
|
-
"day": departures[i].days,
|
1235
|
-
"time": {
|
1236
|
-
"time": departures[i].time.strftime("%I%M"),
|
1237
|
-
"timeSection": 1 if departures[i].time >= dt.time(12, 0) else 0,
|
1238
|
-
},
|
1239
|
-
},
|
1240
|
-
"reservFatcSet": {
|
1241
|
-
"airCtrl": 1 if options.climate_enabled else 0,
|
1242
|
-
"airTemp": {
|
1243
|
-
"value": f"{temperature:.1f}",
|
1244
|
-
"hvacTempType": 1,
|
1245
|
-
"unit": options.temperature_unit,
|
1246
|
-
},
|
1247
|
-
"heating1": 0,
|
1248
|
-
"defrost": options.defrost,
|
1249
|
-
},
|
1250
|
-
}
|
1251
|
-
for i in range(2)
|
1252
|
-
}
|
1253
|
-
|
1254
|
-
payload = payload | {
|
1255
|
-
"offPeakPowerInfo": {
|
1256
|
-
"offPeakPowerTime1": {
|
1257
|
-
"endtime": {
|
1258
|
-
"timeSection": (
|
1259
|
-
1 if options.off_peak_end_time >= dt.time(12, 0) else 0
|
1260
|
-
),
|
1261
|
-
"time": options.off_peak_end_time.strftime("%I%M"),
|
1262
|
-
},
|
1263
|
-
"starttime": {
|
1264
|
-
"timeSection": (
|
1265
|
-
1 if options.off_peak_start_time >= dt.time(12, 0) else 0
|
1266
|
-
),
|
1267
|
-
"time": options.off_peak_start_time.strftime("%I%M"),
|
1268
|
-
},
|
1269
|
-
},
|
1270
|
-
"offPeakPowerFlag": 2 if options.off_peak_charge_only_enabled else 1,
|
1271
|
-
},
|
1272
|
-
"reservFlag": 1 if options.charging_enabled else 0,
|
1273
|
-
}
|
1274
|
-
|
1275
|
-
_LOGGER.debug(f"{DOMAIN} - Schedule Charging and Climate Request: {payload}")
|
1276
|
-
response = requests.post(
|
1277
|
-
url, json=payload, headers=self._get_control_headers(token, vehicle)
|
1278
|
-
).json()
|
1279
|
-
_LOGGER.debug(f"{DOMAIN} - Schedule Charging and Climate Response: {response}")
|
1280
|
-
_check_response_for_errors(response)
|
1281
|
-
token.device_id = self._get_device_id(self._get_stamp())
|
1282
|
-
return response["msgId"]
|
1283
|
-
|
1284
1169
|
def valet_mode_action(
|
1285
1170
|
self, token: Token, vehicle: Vehicle, action: VALET_MODE_ACTION
|
1286
1171
|
) -> str:
|
{hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyundai_kia_connect_api
|
3
|
-
Version: 3.34.
|
3
|
+
Version: 3.34.4
|
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
|
{hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/RECORD
RENAMED
@@ -1,10 +1,10 @@
|
|
1
1
|
hyundai_kia_connect_api/ApiImpl.py,sha256=UeG2FH4KCdU5LvGp5Ks793vrWbwBx8MN_DedbVRRouM,9612
|
2
|
-
hyundai_kia_connect_api/ApiImplType1.py,sha256=
|
2
|
+
hyundai_kia_connect_api/ApiImplType1.py,sha256=kdCY5GBwRJ2dRnu2CXcEzc48XbXw2Q7UOnflyEcSR3o,26919
|
3
3
|
hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=FGYyrS3dSq8Plfu8DQMwVG1LM3nmRv8Y4vrN7wZ4oVY,36988
|
4
4
|
hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=gvywTkeZRiL0vv_mSqZefttFK44lHmY2kFDVv31gx70,41929
|
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=
|
7
|
+
hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=xOqwFwm2V0Uc0c6G6Rlps3vtfjKsLaGAsnDQW09FQWU,57568
|
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.
|
18
|
-
hyundai_kia_connect_api-3.34.
|
19
|
-
hyundai_kia_connect_api-3.34.
|
20
|
-
hyundai_kia_connect_api-3.34.
|
21
|
-
hyundai_kia_connect_api-3.34.
|
22
|
-
hyundai_kia_connect_api-3.34.
|
23
|
-
hyundai_kia_connect_api-3.34.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{hyundai_kia_connect_api-3.34.3.dist-info → hyundai_kia_connect_api-3.34.4.dist-info}/top_level.txt
RENAMED
File without changes
|