hyundai-kia-connect-api 3.22.10__tar.gz → 3.23.1__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 (46) hide show
  1. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/PKG-INFO +1 -1
  2. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py +179 -1
  3. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/KiaUvoApiCA.py +4 -1
  4. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/PKG-INFO +1 -1
  5. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/setup.py +1 -1
  6. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/AUTHORS.rst +0 -0
  7. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/CONTRIBUTING.rst +0 -0
  8. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/HISTORY.rst +0 -0
  9. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/LICENSE +0 -0
  10. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/MANIFEST.in +0 -0
  11. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/README.rst +0 -0
  12. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/Makefile +0 -0
  13. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/authors.rst +0 -0
  14. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/conf.py +0 -0
  15. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/contributing.rst +0 -0
  16. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/history.rst +0 -0
  17. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/index.rst +0 -0
  18. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/installation.rst +0 -0
  19. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/make.bat +0 -0
  20. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/readme.rst +0 -0
  21. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/docs/usage.rst +0 -0
  22. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/ApiImpl.py +0 -0
  23. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/ApiImplType1.py +0 -0
  24. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/KiaUvoAPIUSA.py +0 -0
  25. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/KiaUvoApiAU.py +0 -0
  26. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/KiaUvoApiCN.py +0 -0
  27. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/KiaUvoApiEU.py +0 -0
  28. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/Token.py +0 -0
  29. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/Vehicle.py +0 -0
  30. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/VehicleManager.py +0 -0
  31. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/__init__.py +0 -0
  32. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/const.py +0 -0
  33. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/exceptions.py +0 -0
  34. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api/utils.py +0 -0
  35. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/SOURCES.txt +0 -0
  36. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/dependency_links.txt +0 -0
  37. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/not-zip-safe +0 -0
  38. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/requires.txt +0 -0
  39. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/hyundai_kia_connect_api.egg-info/top_level.txt +0 -0
  40. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/requirements.txt +0 -0
  41. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/setup.cfg +0 -0
  42. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/tests/__init__.py +0 -0
  43. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/tests/au_login_test.py +0 -0
  44. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/tests/ca_login_test.py +0 -0
  45. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/tests/eu_check_response_for_errors_test.py +0 -0
  46. {hyundai_kia_connect_api-3.22.10 → hyundai_kia_connect_api-3.23.1}/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.22.10
3
+ Version: 3.23.1
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
@@ -23,7 +23,14 @@ from .const import (
23
23
  from .utils import get_child_value, get_float, parse_datetime
24
24
  from .ApiImpl import ApiImpl, ClimateRequestOptions
25
25
  from .Token import Token
26
- from .Vehicle import DailyDrivingStats, Vehicle
26
+ from .Vehicle import (
27
+ DailyDrivingStats,
28
+ DayTripCounts,
29
+ DayTripInfo,
30
+ MonthTripInfo,
31
+ TripInfo,
32
+ Vehicle,
33
+ )
27
34
 
28
35
 
29
36
  CIPHERS = "DEFAULT@SECLEVEL=1"
@@ -449,6 +456,7 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
449
456
  )
450
457
  vehicle.air_control_is_on = get_child_value(state, "vehicleStatus.airCtrlOn")
451
458
 
459
+ # fill vehicle.daily_stats
452
460
  tripStats = []
453
461
  tripDetails = get_child_value(state, "evTripDetails.tripdetails") or {}
454
462
  for trip in tripDetails:
@@ -467,8 +475,178 @@ class HyundaiBlueLinkAPIUSA(ApiImpl):
467
475
 
468
476
  vehicle.daily_stats = tripStats
469
477
 
478
+ # remember trips, store state
479
+ trips = []
480
+ for trip in tripDetails:
481
+ yyyymmdd_hhmmss = trip["startdate"] # remember full date
482
+ drive_time = get_child_value(trip["mileagetime"], "value")
483
+ processed_trip = TripInfo(
484
+ hhmmss=yyyymmdd_hhmmss,
485
+ drive_time=int(drive_time),
486
+ idle_time=int(get_child_value(trip["duration"], "value") - drive_time),
487
+ distance=int(trip["distance"]),
488
+ avg_speed=get_child_value(trip["avgspeed"], "value"),
489
+ max_speed=int(get_child_value(trip["maxspeed"], "value")),
490
+ )
491
+ trips.append(processed_trip)
492
+
493
+ _LOGGER.debug(f"_update_vehicle_properties filled_trips: {trips}")
494
+ if len(trips) > 0:
495
+ state["filled_trips"] = trips
496
+
470
497
  vehicle.data = state
471
498
 
499
+ def update_month_trip_info(
500
+ self,
501
+ token,
502
+ vehicle,
503
+ yyyymm_string,
504
+ ) -> None:
505
+ """
506
+ feature only available for some regions.
507
+ Updates the vehicle.month_trip_info for the specified month.
508
+
509
+ Default this information is None:
510
+
511
+ month_trip_info: MonthTripInfo = None
512
+ """
513
+ _LOGGER.debug(f"update_month_trip_info: {yyyymm_string}")
514
+ vehicle.month_trip_info = None
515
+
516
+ if vehicle.data is None or "filled_trips" not in vehicle.data:
517
+ _LOGGER.debug(f"filled_trips is empty: {vehicle.data}")
518
+ return # nothing to fill
519
+
520
+ trips = vehicle.data["filled_trips"]
521
+
522
+ month_trip_info: MonthTripInfo = None
523
+ month_trip_info_count = 0
524
+
525
+ for trip in trips:
526
+ date_str = trip.hhmmss
527
+ yyyymm = date_str[0:4] + date_str[5:7]
528
+ if yyyymm == yyyymm_string:
529
+ if month_trip_info_count == 0:
530
+ month_trip_info = MonthTripInfo(
531
+ yyyymm=yyyymm_string,
532
+ summary=TripInfo(
533
+ drive_time=trip.drive_time,
534
+ idle_time=trip.idle_time,
535
+ distance=trip.distance,
536
+ avg_speed=trip.avg_speed,
537
+ max_speed=trip.max_speed,
538
+ ),
539
+ day_list=[],
540
+ )
541
+ month_trip_info_count = 1
542
+ else:
543
+ # increment totals for month (for the few trips available)
544
+ month_trip_info_count += 1
545
+ summary = month_trip_info.summary
546
+ summary.drive_time += trip.drive_time
547
+ summary.idle_time += trip.idle_time
548
+ summary.distance += trip.distance
549
+ summary.avg_speed += trip.avg_speed
550
+ summary.max_speed = max(trip.max_speed, summary.max_speed)
551
+
552
+ month_trip_info.summary.avg_speed /= month_trip_info_count
553
+ month_trip_info.summary.avg_speed = round(
554
+ month_trip_info.summary.avg_speed, 1
555
+ )
556
+
557
+ # also fill DayTripCount
558
+ yyyymmdd = yyyymm + date_str[8:10]
559
+ day_trip_found = False
560
+ for day in month_trip_info.day_list:
561
+ if day.yyyymmdd == yyyymmdd:
562
+ day.trip_count += 1
563
+ day_trip_found = True
564
+
565
+ if not day_trip_found:
566
+ month_trip_info.day_list.append(
567
+ DayTripCounts(yyyymmdd=yyyymmdd, trip_count=1)
568
+ )
569
+
570
+ vehicle.month_trip_info = month_trip_info
571
+
572
+ def update_day_trip_info(
573
+ self,
574
+ token,
575
+ vehicle,
576
+ yyyymmdd_string,
577
+ ) -> None:
578
+ """
579
+ feature only available for some regions.
580
+ Updates the vehicle.day_trip_info information for the specified day.
581
+
582
+ Default this information is None:
583
+
584
+ day_trip_info: DayTripInfo = None
585
+ """
586
+ _LOGGER.debug(f"update_day_trip_info: {yyyymmdd_string}")
587
+ vehicle.day_trip_info = None
588
+
589
+ if vehicle.data is None or "filled_trips" not in vehicle.data:
590
+ _LOGGER.debug(f"filled_trips is empty: {vehicle.data}")
591
+ return # nothing to fill
592
+
593
+ trips = vehicle.data["filled_trips"]
594
+ _LOGGER.debug(f"filled_trips: {trips}")
595
+
596
+ day_trip_info: DayTripInfo = None
597
+ day_trip_info_count = 0
598
+
599
+ for trip in trips:
600
+ date_str = trip.hhmmss
601
+ yyyymmdd = date_str[0:4] + date_str[5:7] + date_str[8:10]
602
+ _LOGGER.debug(f"update_day_trip_info: {yyyymmdd} trip: {trip}")
603
+ if yyyymmdd == yyyymmdd_string:
604
+ if day_trip_info_count == 0:
605
+ day_trip_info = DayTripInfo(
606
+ yyyymmdd=yyyymmdd_string,
607
+ summary=TripInfo(
608
+ drive_time=trip.drive_time,
609
+ idle_time=trip.idle_time,
610
+ distance=trip.distance,
611
+ avg_speed=trip.avg_speed,
612
+ max_speed=trip.max_speed,
613
+ ),
614
+ trip_list=[],
615
+ )
616
+ day_trip_info_count = 1
617
+ else:
618
+ # increment totals for month (for the few trips available)
619
+ day_trip_info_count += 1
620
+ summary = day_trip_info.summary
621
+ summary.drive_time += trip.drive_time
622
+ summary.idle_time += trip.idle_time
623
+ summary.distance += trip.distance
624
+ summary.avg_speed += trip.avg_speed
625
+ summary.max_speed = max(trip.max_speed, summary.max_speed)
626
+
627
+ day_trip_info.summary.avg_speed /= day_trip_info_count
628
+ day_trip_info.summary.avg_speed = round(
629
+ day_trip_info.summary.avg_speed, 1
630
+ )
631
+
632
+ # also fill TripInfo
633
+ hhmmss = date_str[11:13] + date_str[14:16] + date_str[17:19]
634
+ day_trip_info.trip_list.append(
635
+ TripInfo(
636
+ hhmmss=hhmmss,
637
+ drive_time=trip.drive_time,
638
+ idle_time=trip.idle_time,
639
+ distance=trip.distance,
640
+ avg_speed=trip.avg_speed,
641
+ max_speed=trip.max_speed,
642
+ )
643
+ )
644
+ _LOGGER.debug(
645
+ f"update_day_trip_info: trip_list result: {day_trip_info.trip_list}"
646
+ )
647
+
648
+ vehicle.day_trip_info = day_trip_info
649
+
472
650
  def update_vehicle_with_cached_state(self, token: Token, vehicle: Vehicle) -> None:
473
651
  state = {}
474
652
  state["vehicleDetails"] = self._get_vehicle_details(token, vehicle)
@@ -247,7 +247,10 @@ class KiaUvoApiCA(ApiImpl):
247
247
  )
248
248
  # Converts temp to usable number. Currently only support celsius.
249
249
  # Future to do is check unit in case the care itself is set to F.
250
- if get_child_value(state, "status.airTemp.value") != "OFF":
250
+ if (
251
+ get_child_value(state, "status.airTemp.value") != "OFF"
252
+ and get_child_value(state, "status.airTemp.value")[-1] == "H"
253
+ ):
251
254
  tempIndex = get_hex_temp_into_index(
252
255
  get_child_value(state, "status.airTemp.value")
253
256
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hyundai_kia_connect_api
3
- Version: 3.22.10
3
+ Version: 3.23.1
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.22.10",
47
+ version="3.23.1",
48
48
  zip_safe=False,
49
49
  )