hyundai-kia-connect-api 3.12.0__tar.gz → 3.13.0__tar.gz

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.
Files changed (45) hide show
  1. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/PKG-INFO +1 -1
  2. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/KiaUvoAPIUSA.py +1 -1
  3. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/KiaUvoApiEU.py +250 -5
  4. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/Vehicle.py +1 -0
  5. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/PKG-INFO +1 -1
  6. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/setup.py +1 -1
  7. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/AUTHORS.rst +0 -0
  8. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/CONTRIBUTING.rst +0 -0
  9. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/HISTORY.rst +0 -0
  10. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/LICENSE +0 -0
  11. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/MANIFEST.in +0 -0
  12. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/README.rst +0 -0
  13. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/Makefile +0 -0
  14. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/authors.rst +0 -0
  15. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/conf.py +0 -0
  16. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/contributing.rst +0 -0
  17. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/history.rst +0 -0
  18. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/index.rst +0 -0
  19. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/installation.rst +0 -0
  20. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/make.bat +0 -0
  21. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/readme.rst +0 -0
  22. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/docs/usage.rst +0 -0
  23. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/ApiImpl.py +0 -0
  24. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py +0 -0
  25. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/KiaUvoApiAU.py +0 -0
  26. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/KiaUvoApiCA.py +0 -0
  27. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/KiaUvoApiCN.py +0 -0
  28. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/Token.py +0 -0
  29. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/VehicleManager.py +0 -0
  30. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/__init__.py +0 -0
  31. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/const.py +0 -0
  32. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/exceptions.py +0 -0
  33. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api/utils.py +0 -0
  34. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/SOURCES.txt +0 -0
  35. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/dependency_links.txt +0 -0
  36. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/not-zip-safe +0 -0
  37. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/requires.txt +0 -0
  38. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/hyundai_kia_connect_api.egg-info/top_level.txt +0 -0
  39. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/requirements.txt +0 -0
  40. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/setup.cfg +0 -0
  41. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/tests/__init__.py +0 -0
  42. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/tests/au_login_test.py +0 -0
  43. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/tests/ca_login_test.py +0 -0
  44. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/tests/eu_check_response_for_errors_test.py +0 -0
  45. {hyundai_kia_connect_api-3.12.0 → hyundai_kia_connect_api-3.13.0}/tests/eu_login_test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.12.0
3
+ Version: 3.13.0
4
4
  Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
5
5
  Home-page: https://github.com/fuatakgun/hyundai_kia_connect_api
6
6
  Author: Fuat Akgun
@@ -94,7 +94,7 @@ class KiaUvoAPIUSA(ApiImpl):
94
94
 
95
95
  def __init__(self, region: int, brand: int, language) -> None:
96
96
  self.LANGUAGE: str = language
97
- self.temperature_range = range(62, 82)
97
+ self.temperature_range = range(62, 83)
98
98
 
99
99
  # Randomly generate a plausible device id on startup
100
100
  self.device_id = (
@@ -122,6 +122,7 @@ class KiaUvoApiEU(ApiImpl):
122
122
  temperature_range = [x * 0.5 for x in range(28, 60)]
123
123
 
124
124
  def __init__(self, region: int, brand: int, language: str) -> None:
125
+ self.ccu_ccs2_protocol_support = None
125
126
  # Users were complaining about the warning message. Stating it is already english. The below handles this but still throws warnings for non english items.
126
127
  if language[0] == "e" and language[1] == "n" and len(language) > 2:
127
128
  language == "en"
@@ -225,6 +226,7 @@ class KiaUvoApiEU(ApiImpl):
225
226
  "Host": self.BASE_URL,
226
227
  "Connection": "Keep-Alive",
227
228
  "Accept-Encoding": "gzip",
229
+ "Ccuccs2protocolsupport": self.ccu_ccs2_protocol_support,
228
230
  "User-Agent": USER_AGENT_OK_HTTP,
229
231
  }
230
232
 
@@ -288,6 +290,7 @@ class KiaUvoApiEU(ApiImpl):
288
290
  VIN=entry["vin"],
289
291
  timezone=self.data_timezone,
290
292
  engine_type=entry_engine_type,
293
+ ccu_ccs2_protocol_support=entry["ccuCCS2ProtocolSupport"],
291
294
  )
292
295
  result.append(vehicle)
293
296
  return result
@@ -327,7 +330,12 @@ class KiaUvoApiEU(ApiImpl):
327
330
 
328
331
  def update_vehicle_with_cached_state(self, token: Token, vehicle: Vehicle) -> None:
329
332
  state = self._get_cached_vehicle_state(token, vehicle)
330
- self._update_vehicle_properties(vehicle, state)
333
+ self.ccu_ccs2_protocol_support = str(vehicle.ccu_ccs2_protocol_support)
334
+
335
+ if vehicle.ccu_ccs2_protocol_support == 0:
336
+ self._update_vehicle_properties(vehicle, state)
337
+ else:
338
+ self._update_vehicle_properties_ccs2(vehicle, state)
331
339
 
332
340
  if vehicle.engine_type == ENGINE_TYPES.EV:
333
341
  try:
@@ -370,6 +378,238 @@ class KiaUvoApiEU(ApiImpl):
370
378
  else:
371
379
  self._update_vehicle_drive_info(vehicle, state)
372
380
 
381
+ def _update_vehicle_properties_ccs2(self, vehicle: Vehicle, state: dict) -> None:
382
+ if get_child_value(state, "Date"):
383
+ vehicle.last_updated_at = self.get_last_updated_at(
384
+ get_child_value(state, "Date")
385
+ )
386
+ else:
387
+ vehicle.last_updated_at = dt.datetime.now(self.data_timezone)
388
+
389
+ vehicle.odometer = (
390
+ get_child_value(state, "Drivetrain.Odometer"),
391
+ DISTANCE_UNITS[1],
392
+ )
393
+ vehicle.car_battery_percentage = get_child_value(
394
+ state, "Electronics.Battery.Level"
395
+ )
396
+
397
+ vehicle.engine_is_running = get_child_value(state, "DrivingReady")
398
+
399
+ # TODO: vehicle.air_temperature = get_child_value(state, "Cabin.HVAC.Driver.Temperature.Value")
400
+
401
+ defrost_is_on = get_child_value(
402
+ state, "Cabin.Body.Windshield.Front.Defog.State"
403
+ )
404
+ if defrost_is_on in [0, 2]:
405
+ vehicle.defrost_is_on = False
406
+ elif defrost_is_on == 1:
407
+ vehicle.defrost_is_on = True
408
+
409
+ steer_wheel_heat = get_child_value(state, "Cabin.SteeringWheel.Heat.State")
410
+ if steer_wheel_heat in [0, 2]:
411
+ vehicle.steering_wheel_heater_is_on = False
412
+ elif steer_wheel_heat == 1:
413
+ vehicle.steering_wheel_heater_is_on = True
414
+
415
+ # TODO: status.sideBackWindowHeat
416
+ # TODO: status.sideMirrorHeat
417
+ # TODO: status.seatHeaterVentState.flSeatHeatState
418
+ # TODO: status.seatHeaterVentState.frSeatHeatState
419
+ # TODO: status.seatHeaterVentState.rlSeatHeatState
420
+ # TODO: status.seatHeaterVentState.rrSeatHeatState
421
+ # TODO: status.doorLock
422
+
423
+ vehicle.front_left_door_is_open = get_child_value(
424
+ state, "Cabin.Door.Row1.Driver.Open"
425
+ )
426
+ vehicle.front_right_door_is_open = get_child_value(
427
+ state, "Cabin.Door.Row1.Passenger.Open"
428
+ )
429
+ vehicle.back_left_door_is_open = get_child_value(
430
+ state, "Cabin.Door.Row2.Left.Open"
431
+ )
432
+ vehicle.back_right_door_is_open = get_child_value(
433
+ state, "Cabin.Door.Row2.Right.Open"
434
+ )
435
+
436
+ # TODO: should the windows and trunc also be checked?
437
+ if (
438
+ vehicle.front_left_door_is_open == False
439
+ and vehicle.front_right_door_is_open == False
440
+ and vehicle.back_left_door_is_open == False
441
+ and vehicle.back_right_door_is_open == False
442
+ ):
443
+ vehicle.is_locked = True
444
+ else:
445
+ vehicle.is_locked = False
446
+
447
+ vehicle.hood_is_open = get_child_value(state, "Body.Hood.Open")
448
+ vehicle.front_left_window_is_open = get_child_value(
449
+ state, "Cabin.Window.Row1.Open.Driver.Open"
450
+ )
451
+ vehicle.front_right_window_is_open = get_child_value(
452
+ state, "Cabin.Window.Row1.Open.Passenger.Open"
453
+ )
454
+ vehicle.back_left_window_is_open = get_child_value(
455
+ state, "Cabin.Window.Row2.Left.Open"
456
+ )
457
+ vehicle.back_right_window_is_open = get_child_value(
458
+ state, "Cabin.Window.Row2.Right.Open"
459
+ )
460
+ vehicle.tire_pressure_rear_left_warning_is_on = bool(
461
+ get_child_value(state, "Chassis.Axle.Row2.Left.Tire.PressureLow")
462
+ )
463
+ vehicle.tire_pressure_front_left_warning_is_on = bool(
464
+ get_child_value(state, "Chassis.Axle.Row1.Left.Tire.PressureLow")
465
+ )
466
+ vehicle.tire_pressure_front_right_warning_is_on = bool(
467
+ get_child_value(state, "Chassis.Axle.Row1.Right.Tire.PressureLow")
468
+ )
469
+ vehicle.tire_pressure_rear_right_warning_is_on = bool(
470
+ get_child_value(state, "Chassis.Axle.Row2.Right.Tire.PressureLow")
471
+ )
472
+ vehicle.tire_pressure_all_warning_is_on = bool(
473
+ get_child_value(state, "Chassis.Axle.Tire.PressureLow")
474
+ )
475
+ vehicle.trunk_is_open = get_child_value(state, "Body.Trunk.Open")
476
+
477
+ vehicle.ev_battery_percentage = get_child_value(
478
+ state, "Green.BatteryManagement.BatteryRemain.Ratio"
479
+ )
480
+ vehicle.ev_battery_is_plugged_in = get_child_value(
481
+ state, "Green.ChargingInformation.ElectricCurrentLevel.State"
482
+ )
483
+ vehicle.ev_battery_is_plugged_in = get_child_value(
484
+ state, "Green.ChargingInformation.ConnectorFastening.State"
485
+ )
486
+ charging_door_state = get_child_value(state, "Green.ChargingDoor.State")
487
+ if charging_door_state in [0, 2]:
488
+ vehicle.ev_charge_port_door_is_open = False
489
+ elif charging_door_state == 1:
490
+ vehicle.ev_charge_port_door_is_open = True
491
+
492
+ # TODO: vehicle.ev_driving_range
493
+
494
+ vehicle.total_driving_range = (
495
+ float(
496
+ get_child_value(
497
+ state,
498
+ "Drivetrain.FuelSystem.DTE.Total", # noqa
499
+ )
500
+ ),
501
+ DISTANCE_UNITS[
502
+ get_child_value(
503
+ state,
504
+ "Drivetrain.FuelSystem.DTE.Unit", # noqa
505
+ )
506
+ ],
507
+ )
508
+
509
+ vehicle.washer_fluid_warning_is_on = get_child_value(
510
+ state, "Body.Windshield.Front.WasherFluid.LevelLow"
511
+ )
512
+
513
+ vehicle.ev_estimated_current_charge_duration = (
514
+ get_child_value(state, "Green.ChargingInformation.Charging.RemainTime"),
515
+ "m",
516
+ )
517
+ vehicle.ev_estimated_fast_charge_duration = (
518
+ get_child_value(state, "Green.ChargingInformation.EstimatedTime.Standard"),
519
+ "m",
520
+ )
521
+ vehicle.ev_estimated_portable_charge_duration = (
522
+ get_child_value(state, "Green.ChargingInformation.EstimatedTime.ICCB"),
523
+ "m",
524
+ )
525
+ vehicle.ev_estimated_station_charge_duration = (
526
+ get_child_value(state, "Green.ChargingInformation.EstimatedTime.Quick"),
527
+ "m",
528
+ )
529
+ vehicle.ev_charge_limits_ac = (
530
+ get_child_value(
531
+ state,
532
+ "Green.ChargingInformation.ElectricCurrentLevel.TargetSoC.Standard",
533
+ ),
534
+ )
535
+ vehicle.ev_charge_limits_dc = (
536
+ get_child_value(
537
+ state, "Green.ChargingInformation.ElectricCurrentLevel.TargetSoC.Quick"
538
+ ),
539
+ )
540
+ vehicle.ev_target_range_charge_AC = (
541
+ get_child_value(
542
+ state,
543
+ "Green.ChargingInformation.DTE.TargetSoC.Standard", # noqa
544
+ ),
545
+ DISTANCE_UNITS[
546
+ get_child_value(
547
+ state,
548
+ "Drivetrain.FuelSystem.DTE.Unit", # noqa
549
+ )
550
+ ],
551
+ )
552
+ vehicle.ev_target_range_charge_DC = (
553
+ get_child_value(
554
+ state,
555
+ "Green.ChargingInformation.DTE.TargetSoC.Quick", # noqa
556
+ ),
557
+ DISTANCE_UNITS[
558
+ get_child_value(
559
+ state,
560
+ "Drivetrain.FuelSystem.DTE.Unit", # noqa
561
+ )
562
+ ],
563
+ )
564
+ ev_first_departure_enabled = get_child_value(
565
+ state, "Green.Reservation.Departure.Schedule1.Enable"
566
+ )
567
+ if ev_first_departure_enabled == 0:
568
+ vehicle.ev_first_departure_enabled = False
569
+ elif ev_first_departure_enabled == 1:
570
+ vehicle.ev_first_departure_enabled = True
571
+
572
+ ev_second_departure_enabled = get_child_value(
573
+ state, "Green.Reservation.Departure.Schedule2.Enable"
574
+ )
575
+ if ev_second_departure_enabled == 0:
576
+ vehicle.ev_second_departure_enabled = False
577
+ elif ev_second_departure_enabled == 1:
578
+ vehicle.ev_second_departure_enabled = True
579
+
580
+ # TODO: vehicle.ev_first_departure_days --> Green.Reservation.Departure.Schedule1.(Mon,Tue,Wed,Thu,Fri,Sat,Sun)
581
+ # TODO: vehicle.ev_second_departure_days --> Green.Reservation.Departure.Schedule2.(Mon,Tue,Wed,Thu,Fri,Sat,Sun)
582
+ # TODO: vehicle.ev_first_departure_time --> Green.Reservation.Departure.Schedule1.(Min,Hour)
583
+ # TODO: vehicle.ev_second_departure_time --> Green.Reservation.Departure.Schedule2.(Min,Hour)
584
+ # TODO: vehicle.ev_off_peak_charge_only_enabled --> unknown settings are in --> Green.Reservation.OffPeakTime and OffPeakTime2
585
+
586
+ vehicle.washer_fluid_warning_is_on = get_child_value(
587
+ state, "Body.Windshield.Front.WasherFluid.LevelLow"
588
+ )
589
+ vehicle.brake_fluid_warning_is_on = get_child_value(
590
+ state, "Chassis.Brake.Fluid.Warning"
591
+ )
592
+
593
+ vehicle.fuel_level = get_child_value(state, "Drivetrain.FuelSystem.FuelLevel")
594
+ vehicle.fuel_level_is_low = get_child_value(
595
+ state, "Drivetrain.FuelSystem.LowFuelWarning"
596
+ )
597
+ vehicle.air_control_is_on = get_child_value(
598
+ state, "Cabin.HVAC.Row1.Driver.Blower.SpeedLevel"
599
+ )
600
+ # TODO: vehicle.smart_key_battery_warning_is_on = get_child_value(
601
+ # TODO: state, "status.smartKeyBatteryWarning"
602
+ # TODO: )
603
+
604
+ if get_child_value(state, "Location.GeoCoord.Latitude"):
605
+ vehicle.location = (
606
+ get_child_value(state, "Location.GeoCoord.Latitude"),
607
+ get_child_value(state, "Location.GeoCoord.Longitude"),
608
+ get_child_value(state, "Location.TimeStamp"),
609
+ )
610
+
611
+ vehicle.data = state
612
+
373
613
  def _update_vehicle_properties(self, vehicle: Vehicle, state: dict) -> None:
374
614
  if get_child_value(state, "vehicleStatus.time"):
375
615
  vehicle.last_updated_at = self.get_last_updated_at(
@@ -738,15 +978,20 @@ class KiaUvoApiEU(ApiImpl):
738
978
  vehicle.daily_stats = get_child_value(state, "dailyStats")
739
979
 
740
980
  def _get_cached_vehicle_state(self, token: Token, vehicle: Vehicle) -> dict:
741
- url = self.SPA_API_URL + "vehicles/" + vehicle.id + "/status/latest"
742
-
981
+ url = self.SPA_API_URL + "vehicles/" + vehicle.id
982
+ if vehicle.ccu_ccs2_protocol_support == 0:
983
+ url = url + "/status/latest"
984
+ else:
985
+ url = url + "/ccs2/carstatus/latest"
743
986
  response = requests.get(
744
987
  url, headers=self._get_authenticated_headers(token)
745
988
  ).json()
746
989
  _LOGGER.debug(f"{DOMAIN} - get_cached_vehicle_status response: {response}")
747
990
  _check_response_for_errors(response)
748
- response = response["resMsg"]["vehicleStatusInfo"]
749
-
991
+ if vehicle.ccu_ccs2_protocol_support == 0:
992
+ response = response["resMsg"]["vehicleStatusInfo"]
993
+ else:
994
+ response = response["resMsg"]["state"]["Vehicle"]
750
995
  return response
751
996
 
752
997
  def _get_location(self, token: Token, vehicle: Vehicle) -> dict:
@@ -74,6 +74,7 @@ class Vehicle:
74
74
  year: int = None
75
75
  VIN: str = None
76
76
  key: str = None
77
+ ccu_ccs2_protocol_support: int = None
77
78
  # Not part of the API, enabled in our library for scanning.
78
79
  enabled: bool = True
79
80
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.12.0
3
+ Version: 3.13.0
4
4
  Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
5
5
  Home-page: https://github.com/fuatakgun/hyundai_kia_connect_api
6
6
  Author: Fuat Akgun
@@ -44,6 +44,6 @@ setup(
44
44
  test_suite="tests",
45
45
  tests_require=test_requirements,
46
46
  url="https://github.com/fuatakgun/hyundai_kia_connect_api",
47
- version="3.12.0",
47
+ version="3.13.0",
48
48
  zip_safe=False,
49
49
  )