hyundai-kia-connect-api 3.17.6__py2.py3-none-any.whl → 3.32.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.
- hyundai_kia_connect_api/ApiImpl.py +102 -29
- hyundai_kia_connect_api/ApiImplType1.py +321 -0
- hyundai_kia_connect_api/{HyundaiBlueLinkAPIUSA.py → HyundaiBlueLinkApiUSA.py} +295 -35
- hyundai_kia_connect_api/KiaUvoApiAU.py +77 -88
- hyundai_kia_connect_api/KiaUvoApiCA.py +70 -41
- hyundai_kia_connect_api/KiaUvoApiCN.py +30 -42
- hyundai_kia_connect_api/KiaUvoApiEU.py +466 -376
- hyundai_kia_connect_api/{KiaUvoAPIUSA.py → KiaUvoApiUSA.py} +98 -102
- hyundai_kia_connect_api/Vehicle.py +142 -19
- hyundai_kia_connect_api/VehicleManager.py +60 -19
- hyundai_kia_connect_api/__init__.py +5 -6
- hyundai_kia_connect_api/bluelink.py +457 -0
- hyundai_kia_connect_api/const.py +12 -1
- hyundai_kia_connect_api/utils.py +30 -3
- {hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/LICENSE +0 -1
- {hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/METADATA +53 -18
- hyundai_kia_connect_api-3.32.0.dist-info/RECORD +23 -0
- {hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/WHEEL +1 -1
- hyundai_kia_connect_api-3.32.0.dist-info/entry_points.txt +2 -0
- hyundai_kia_connect_api-3.17.6.dist-info/RECORD +0 -20
- {hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/AUTHORS.rst +0 -0
- {hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/top_level.txt +0 -0
hyundai_kia_connect_api/utils.py
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
# pylint:disable=bare-except,missing-function-docstring,invalid-name
|
1
|
+
# pylint:disable=bare-except,missing-function-docstring,invalid-name,broad-exception-caught
|
2
2
|
"""utils.py"""
|
3
3
|
|
4
|
+
import datetime
|
5
|
+
import re
|
6
|
+
|
4
7
|
|
5
8
|
def get_child_value(data, key):
|
6
9
|
value = data
|
7
10
|
for x in key.split("."):
|
8
11
|
try:
|
9
12
|
value = value[x]
|
10
|
-
except:
|
13
|
+
except Exception:
|
11
14
|
try:
|
12
15
|
value = value[int(x)]
|
13
|
-
except:
|
16
|
+
except Exception:
|
14
17
|
value = None
|
15
18
|
return value
|
16
19
|
|
@@ -47,3 +50,27 @@ def get_index_into_hex_temp(value):
|
|
47
50
|
return value
|
48
51
|
else:
|
49
52
|
return None
|
53
|
+
|
54
|
+
|
55
|
+
def parse_datetime(value, timezone) -> datetime.datetime:
|
56
|
+
if value is None:
|
57
|
+
return datetime.datetime(2000, 1, 1, tzinfo=timezone)
|
58
|
+
|
59
|
+
value = value.replace("-", "").replace("T", "").replace(":", "").replace("Z", "")
|
60
|
+
m = re.match(r"(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})", value)
|
61
|
+
return datetime.datetime(
|
62
|
+
year=int(m.group(1)),
|
63
|
+
month=int(m.group(2)),
|
64
|
+
day=int(m.group(3)),
|
65
|
+
hour=int(m.group(4)),
|
66
|
+
minute=int(m.group(5)),
|
67
|
+
second=int(m.group(6)),
|
68
|
+
tzinfo=timezone,
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
def get_safe_local_datetime(date: datetime) -> datetime:
|
73
|
+
"""get safe local datetime"""
|
74
|
+
if date is not None and hasattr(date, "tzinfo") and date.tzinfo is not None:
|
75
|
+
date = date.astimezone()
|
76
|
+
return date
|
{hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/METADATA
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: hyundai_kia_connect_api
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.32.0
|
4
4
|
Summary: Python Boilerplate contains all the boilerplate you need to create a Python package.
|
5
|
-
Home-page: https://github.com/
|
5
|
+
Home-page: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api
|
6
6
|
Author: Fuat Akgun
|
7
7
|
Author-email: fuatakgun@gmail.com
|
8
8
|
License: MIT license
|
@@ -11,27 +11,48 @@ Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
13
13
|
Classifier: Natural Language :: English
|
14
|
-
Classifier: Programming Language :: Python :: 3.
|
15
|
-
Requires-Python: >=3.
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Requires-Python: >=3.10
|
16
16
|
License-File: LICENSE
|
17
17
|
License-File: AUTHORS.rst
|
18
|
-
Requires-Dist: beautifulsoup4
|
19
|
-
Requires-Dist: curlify
|
18
|
+
Requires-Dist: beautifulsoup4>=4.10.0
|
19
|
+
Requires-Dist: curlify>=2.2.1
|
20
20
|
Requires-Dist: python-dateutil
|
21
|
-
Requires-Dist: pytz
|
21
|
+
Requires-Dist: pytz>=2021.3
|
22
|
+
Requires-Dist: certifi>=2024.6.2
|
23
|
+
Dynamic: author
|
24
|
+
Dynamic: author-email
|
25
|
+
Dynamic: classifier
|
26
|
+
Dynamic: description
|
27
|
+
Dynamic: home-page
|
28
|
+
Dynamic: keywords
|
29
|
+
Dynamic: license
|
30
|
+
Dynamic: requires-dist
|
31
|
+
Dynamic: requires-python
|
32
|
+
Dynamic: summary
|
33
|
+
|
34
|
+
Code Maintainers Wanted
|
35
|
+
=======================
|
36
|
+
|
37
|
+
I no longer have a Kia or Hyundai so don't maintain this like I used to. Others who are interested in jumping in are welcome to join the project! Even just pull requests are appreciated!
|
22
38
|
|
23
39
|
Introduction
|
24
40
|
============
|
25
41
|
|
26
|
-
This is a Kia UVO, Hyundai Bluelink, Genesis Connect(Canada Only) written in python. It is primary consumed by home assistant. If you are looking for a home assistant Kia / Hyundai implementation please look here: https://github.com/
|
42
|
+
This is a Kia UVO, Hyundai Bluelink, Genesis Connect(Canada Only) written in python. It is primary consumed by home assistant. If you are looking for a home assistant Kia / Hyundai implementation please look here: https://github.com/Hyundai-Kia-Connect/kia_uvo. Much of this base code came from reading `bluelinky <https://github.com/Hacksore/bluelinky>`_ and contributions to the kia_uvo home assistant project.
|
27
43
|
|
44
|
+
Chat on discord:: |Discord|
|
28
45
|
|
29
|
-
|
30
|
-
|
46
|
+
.. |Discord| image:: https://img.shields.io/discord/652755205041029120
|
47
|
+
:target: https://discord.gg/HwnG8sY
|
48
|
+
:alt: Discord
|
49
|
+
|
50
|
+
API Usage
|
51
|
+
=========
|
31
52
|
|
32
53
|
This package is designed to simplify the complexity of using multiple regions. It attempts to standardize the usage regardless of what brand or region the car is in. That isn't always possible though, in particular some features differ from one to the next.
|
33
54
|
|
34
|
-
Python 3.
|
55
|
+
Python 3.10 or newer is required to use this package. Vehicle manager is the key class that is called to manage the vehicle lists. One vehicle manager should be used per login. Key data points required to instantiate vehicle manager are::
|
35
56
|
|
36
57
|
region: int
|
37
58
|
brand: int,
|
@@ -39,7 +60,7 @@ Python 3.9 or newer is required to use this package. Vehicle manager is the key
|
|
39
60
|
password: str
|
40
61
|
pin: str (required for CA, and potentially USA, otherwise pass a blank string)
|
41
62
|
|
42
|
-
Key values for the int exist in the
|
63
|
+
Key values for the int exist in the `const.py <https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/blob/master/hyundai_kia_connect_api/const.py>`_ file as::
|
43
64
|
|
44
65
|
REGIONS = {1: REGION_EUROPE, 2: REGION_CANADA, 3: REGION_USA, 4: REGION_CHINA, 5: REGION_AUSTRALIA}
|
45
66
|
BRANDS = {1: BRAND_KIA, 2: BRAND_HYUNDAI, 3: BRAND_GENESIS}
|
@@ -67,7 +88,6 @@ Once this is done you can now make the following calls against the vehicle manag
|
|
67
88
|
Force refreshes a single car:
|
68
89
|
force_refresh_vehicles_states(self, vehicle_id)
|
69
90
|
|
70
|
-
|
71
91
|
An example call would be::
|
72
92
|
|
73
93
|
from hyundai_kia_connect_api import *
|
@@ -107,16 +127,17 @@ For a list of language codes, see here: https://www.science.co.il/language/Codes
|
|
107
127
|
- "fi" Finnish
|
108
128
|
- "pt" Portuguese
|
109
129
|
|
110
|
-
|
111
|
-
|
130
|
+
|
131
|
+
In Europe and some other regions also trip info can be retrieved. For a month you can ask the days with trips. And you can ask for a specific day for all the trips of that specific day.::
|
132
|
+
- First call vm.update_month_trip_info(vehicle.id, yyyymm) before getting vehicle.month_trip_info for that month
|
112
133
|
- First call vm.update_day_trip_info(vehicle.id, day.yyyymmdd) before getting vehicle.day_trip_info for that day
|
113
134
|
|
114
135
|
Example of getting trip info of the current month and day (vm is VehicleManager instance)::
|
115
136
|
|
116
137
|
now = datetime.now()
|
117
|
-
|
138
|
+
yyyymm = now.strftime("%Y%m")
|
118
139
|
yyyymmdd = now.strftime("%Y%m%d")
|
119
|
-
vm.update_month_trip_info(vehicle.id,
|
140
|
+
vm.update_month_trip_info(vehicle.id, yyyymm)
|
120
141
|
if vehicle.month_trip_info is not None:
|
121
142
|
for day in vehicle.month_trip_info.day_list: # ordered on day
|
122
143
|
if yyyymmdd == day.yyyymmdd: # in example only interested in current day
|
@@ -124,3 +145,17 @@ Example of getting trip info of the current month and day (vm is VehicleManager
|
|
124
145
|
if vehicle.day_trip_info is not None:
|
125
146
|
for trip in reversed(vehicle.day_trip_info.trip_list): # show oldest first
|
126
147
|
print(f"{day.yyyymmdd},{trip.hhmmss},{trip.drive_time},{trip.idle_time},{trip.distance},{trip.avg_speed},{trip.max_speed}")
|
148
|
+
|
149
|
+
|
150
|
+
CLI Usage
|
151
|
+
=========
|
152
|
+
|
153
|
+
A tool `bluelink` is provided that enable querying the vehicles and save the
|
154
|
+
state to a JSON file. Example usage:
|
155
|
+
|
156
|
+
::
|
157
|
+
|
158
|
+
bluelink --region Canada --brand Hyundai --username FOO --password BAR --pin 1234 info --json infos.json
|
159
|
+
|
160
|
+
Environment variables BLUELINK_XXX can be used to provide a default value for
|
161
|
+
the corresponding --xxx argument.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
hyundai_kia_connect_api/ApiImpl.py,sha256=eCEQEz6L-7EN2eKnrYiHrYC0pPV-ngGFcayF0tFdPxA,7569
|
2
|
+
hyundai_kia_connect_api/ApiImplType1.py,sha256=PnKwpbCoYGOXBWzBLIlDSrC6daIYeW9qlfW7TM4HCU0,12184
|
3
|
+
hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py,sha256=Tx-L4ZWiPhq-uHcjWSUzjLEsfunV6nzyzqQpjPTYuIo,36831
|
4
|
+
hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=tslh0gzvPBwYJmcWlf9B0l7PyYZdy2e7GqpRkl8_Svk,48471
|
5
|
+
hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=QXs7Gk3uvv1719B8E-Gqe1H0hBh_jQflBJtPZZxvz2g,31460
|
6
|
+
hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=cwIPZ0dU6HolKdooUQeQKlLAic6YU8dQmNs0VQDBgpQ,47035
|
7
|
+
hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=FiRPb_anGRDiNP41U0pFWLZ9uoLDCMAzmKWqEO_zXZU,71414
|
8
|
+
hyundai_kia_connect_api/KiaUvoApiUSA.py,sha256=G2sGtv88sBZuAz8qKYq_3_JNXIkxEjOBAzwM6R8GUi0,30548
|
9
|
+
hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
|
10
|
+
hyundai_kia_connect_api/Vehicle.py,sha256=raCMzJsLuJnVHlFJ16VKdKat55L0uivbbcZRDCGWTxI,18793
|
11
|
+
hyundai_kia_connect_api/VehicleManager.py,sha256=I0HDOsbXDen-26vyD7YR-RUgdaofOZrv_H_PPPuWjHg,11087
|
12
|
+
hyundai_kia_connect_api/__init__.py,sha256=IkyVeIMbcFJZgLaiiNnUVA1Ferxvrm1bXHKVg01cxvc,319
|
13
|
+
hyundai_kia_connect_api/bluelink.py,sha256=sBU7hlElie21GU4Ma-i4a5vdztGc2jtmlVBbbgUqmTE,19720
|
14
|
+
hyundai_kia_connect_api/const.py,sha256=HE0_1_be4ERB73vsekWxv6TDWd8cvAgY1oPZojUrcwM,2096
|
15
|
+
hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
|
16
|
+
hyundai_kia_connect_api/utils.py,sha256=J0aXUX-nKIoS3XbelatNh-DZlHRU2_DYz_Mg_ZUKQJU,1957
|
17
|
+
hyundai_kia_connect_api-3.32.0.dist-info/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
|
18
|
+
hyundai_kia_connect_api-3.32.0.dist-info/LICENSE,sha256=49hmc755oyMwKdZ-2epiorjStRB0PfcZR1w5_NXZPgs,1068
|
19
|
+
hyundai_kia_connect_api-3.32.0.dist-info/METADATA,sha256=f624MFz_orTUhgUm4jS7JLn-lL1Udvylkb68LszHt3A,6872
|
20
|
+
hyundai_kia_connect_api-3.32.0.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
|
21
|
+
hyundai_kia_connect_api-3.32.0.dist-info/entry_points.txt,sha256=XfrroRdyC_9q9VXjEZe5SdRPhkQyCCE4S7ZK6XSKelA,67
|
22
|
+
hyundai_kia_connect_api-3.32.0.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
|
23
|
+
hyundai_kia_connect_api-3.32.0.dist-info/RECORD,,
|
@@ -1,20 +0,0 @@
|
|
1
|
-
hyundai_kia_connect_api/ApiImpl.py,sha256=1j5FRTQIILrSzQU6oE5i4J_l8cVvYuMGBmQn-kL7zyg,5018
|
2
|
-
hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py,sha256=FVWDzmkO_jsc_r4WzufgxaJkeVYhf9UAw9A6r37b-Dc,26750
|
3
|
-
hyundai_kia_connect_api/KiaUvoAPIUSA.py,sha256=kQo3PA_FktsAHhdugZi0lrpMcp96WNXcvBJPbIJIcfY,31217
|
4
|
-
hyundai_kia_connect_api/KiaUvoApiAU.py,sha256=ncAUEWqepHwYTZqu7JDNAozguucqqIg-HKPvpN_54CE,48738
|
5
|
-
hyundai_kia_connect_api/KiaUvoApiCA.py,sha256=7bcDLcJ3JLLoWldPy514eKhWUAo1Gb1mu_3SaXno4v8,30358
|
6
|
-
hyundai_kia_connect_api/KiaUvoApiCN.py,sha256=MjXdDdm1wDVvFZhgg8AjAF6X2SB-AIFMTE5iRmr80QM,47384
|
7
|
-
hyundai_kia_connect_api/KiaUvoApiEU.py,sha256=jKIJ6B9BBfz6UyzlTH-RuWjuAr1ljrhOGsLwYGRXjlE,68960
|
8
|
-
hyundai_kia_connect_api/Token.py,sha256=ZsPvXh1ID7FUTGHAqhZUZyrKT7xVbOtIn6FRJn4Ygf0,370
|
9
|
-
hyundai_kia_connect_api/Vehicle.py,sha256=jx8m3z9QRg9BvLLMT8wL0yD6jCnsA_w1nYE19Pm0bUo,13644
|
10
|
-
hyundai_kia_connect_api/VehicleManager.py,sha256=JdJ8tUCVGciVC1SJubmMQqEZ7KXp6DlI_UiOQPkDeN4,9654
|
11
|
-
hyundai_kia_connect_api/__init__.py,sha256=6UwXW6Lj5VnRtWNOt_0dLFdOYlcbysHCc6ol_XAC5YM,479
|
12
|
-
hyundai_kia_connect_api/const.py,sha256=C25jgV79u7SZF5xDy96gol_CekIkyI4h3goTyDEmng0,1967
|
13
|
-
hyundai_kia_connect_api/exceptions.py,sha256=m7gyDnvA5OVAK4EXSP_ZwE0s0uV8HsGUV0tiYwqofK0,1343
|
14
|
-
hyundai_kia_connect_api/utils.py,sha256=rfhERPXkzqelsaieLtiAyN9xDDTheNyKX5aBPRLrHf4,1117
|
15
|
-
hyundai_kia_connect_api-3.17.6.dist-info/AUTHORS.rst,sha256=T77OE1hrQF6YyDE6NbdMKyL66inHt7dnjHAzblwuk2A,155
|
16
|
-
hyundai_kia_connect_api-3.17.6.dist-info/LICENSE,sha256=AsZwIRViAze7ObwO6V6IB0q4caXv6DJS2-3dsU1FWy8,1069
|
17
|
-
hyundai_kia_connect_api-3.17.6.dist-info/METADATA,sha256=ckastDAh9Lnhzjiy0Y9ypxkXay-UxVslXFlpEZ9JIMA,5770
|
18
|
-
hyundai_kia_connect_api-3.17.6.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
19
|
-
hyundai_kia_connect_api-3.17.6.dist-info/top_level.txt,sha256=otZ7J_fN-s3EW4jD-kAearIo2OIzhQLR8DNEHIaFfds,24
|
20
|
-
hyundai_kia_connect_api-3.17.6.dist-info/RECORD,,
|
{hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/AUTHORS.rst
RENAMED
File without changes
|
{hyundai_kia_connect_api-3.17.6.dist-info → hyundai_kia_connect_api-3.32.0.dist-info}/top_level.txt
RENAMED
File without changes
|