hyundai-kia-connect-api 3.17.6__tar.gz → 3.32.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.
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/CONTRIBUTING.rst +7 -8
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/LICENSE +0 -1
- {hyundai_kia_connect_api-3.17.6/hyundai_kia_connect_api.egg-info → hyundai_kia_connect_api-3.32.0}/PKG-INFO +50 -15
- hyundai_kia_connect_api-3.17.6/PKG-INFO → hyundai_kia_connect_api-3.32.0/README.rst +33 -31
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/installation.rst +4 -4
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/ApiImpl.py +102 -29
- hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api/ApiImplType1.py +321 -0
- hyundai_kia_connect_api-3.17.6/hyundai_kia_connect_api/HyundaiBlueLinkAPIUSA.py → hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api/HyundaiBlueLinkApiUSA.py +295 -35
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/KiaUvoApiAU.py +77 -88
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/KiaUvoApiCA.py +70 -41
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/KiaUvoApiCN.py +30 -42
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/KiaUvoApiEU.py +466 -376
- hyundai_kia_connect_api-3.17.6/hyundai_kia_connect_api/KiaUvoAPIUSA.py → hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api/KiaUvoApiUSA.py +98 -102
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/Vehicle.py +142 -19
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/VehicleManager.py +60 -19
- hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api/__init__.py +14 -0
- hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api/bluelink.py +457 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/const.py +12 -1
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/utils.py +30 -3
- hyundai_kia_connect_api-3.17.6/README.rst → hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api.egg-info/PKG-INFO +67 -10
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api.egg-info/SOURCES.txt +5 -2
- hyundai_kia_connect_api-3.32.0/hyundai_kia_connect_api.egg-info/entry_points.txt +2 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api.egg-info/requires.txt +1 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/requirements.txt +1 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/setup.py +7 -4
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/tests/eu_check_response_for_errors_test.py +5 -1
- hyundai_kia_connect_api-3.17.6/hyundai_kia_connect_api/__init__.py +0 -15
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/AUTHORS.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/HISTORY.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/MANIFEST.in +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/Makefile +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/authors.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/conf.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/contributing.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/history.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/index.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/make.bat +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/readme.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/docs/usage.rst +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/Token.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/exceptions.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api.egg-info/dependency_links.txt +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api.egg-info/not-zip-safe +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api.egg-info/top_level.txt +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/setup.cfg +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/tests/__init__.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/tests/au_login_test.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/tests/ca_login_test.py +0 -0
- {hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/tests/eu_login_test.py +0 -0
@@ -15,7 +15,7 @@ Types of Contributions
|
|
15
15
|
Report Bugs
|
16
16
|
~~~~~~~~~~~
|
17
17
|
|
18
|
-
Report bugs at https://github.com/
|
18
|
+
Report bugs at https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/issues.
|
19
19
|
|
20
20
|
If you are reporting a bug, please include:
|
21
21
|
|
@@ -45,7 +45,7 @@ articles, and such.
|
|
45
45
|
Submit Feedback
|
46
46
|
~~~~~~~~~~~~~~~
|
47
47
|
|
48
|
-
The best way to send feedback is to file an issue at https://github.com/
|
48
|
+
The best way to send feedback is to file an issue at https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/issues.
|
49
49
|
|
50
50
|
If you are proposing a feature:
|
51
51
|
|
@@ -76,14 +76,14 @@ Ready to contribute? Here's how to set up `hyundai_kia_connect_api` for local de
|
|
76
76
|
|
77
77
|
Now you can make your changes locally.
|
78
78
|
|
79
|
-
5. When you're done making changes, check that your changes pass flake8
|
80
|
-
tests
|
79
|
+
5. When you're done making changes, check that your changes pass flake8. Most
|
80
|
+
tests require environment variables to supply the username and password and
|
81
|
+
they will run as part of the PR pre-requisites:
|
81
82
|
|
82
83
|
$ flake8 hyundai_kia_connect_api tests
|
83
84
|
$ python setup.py test or pytest
|
84
|
-
$ tox
|
85
85
|
|
86
|
-
To get flake8
|
86
|
+
To get flake8, pip install them into your virtualenv.
|
87
87
|
|
88
88
|
6. Commit your changes and push your branch to GitHub::
|
89
89
|
|
@@ -102,8 +102,7 @@ Before you submit a pull request, check that it meets these guidelines:
|
|
102
102
|
2. If the pull request adds functionality, the docs should be updated. Put
|
103
103
|
your new functionality into a function with a docstring, and add the
|
104
104
|
feature to the list in README.rst.
|
105
|
-
3. The pull request should work for Python
|
106
|
-
https://travis-ci.com/fuatakgun/hyundai_kia_connect_api/pull_requests
|
105
|
+
3. The pull request should work for recent Python. Check GitHub Actions checks
|
107
106
|
and make sure that the tests pass for all supported Python versions.
|
108
107
|
|
109
108
|
Tips
|
@@ -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
18
|
Requires-Dist: beautifulsoup4>=4.10.0
|
19
19
|
Requires-Dist: curlify>=2.2.1
|
20
20
|
Requires-Dist: python-dateutil
|
21
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.
|
@@ -1,37 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Home-page: https://github.com/fuatakgun/hyundai_kia_connect_api
|
6
|
-
Author: Fuat Akgun
|
7
|
-
Author-email: fuatakgun@gmail.com
|
8
|
-
License: MIT license
|
9
|
-
Keywords: hyundai_kia_connect_api
|
10
|
-
Classifier: Development Status :: 2 - Pre-Alpha
|
11
|
-
Classifier: Intended Audience :: Developers
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
13
|
-
Classifier: Natural Language :: English
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
15
|
-
Requires-Python: >=3.6
|
16
|
-
License-File: LICENSE
|
17
|
-
License-File: AUTHORS.rst
|
18
|
-
Requires-Dist: beautifulsoup4>=4.10.0
|
19
|
-
Requires-Dist: curlify>=2.2.1
|
20
|
-
Requires-Dist: python-dateutil
|
21
|
-
Requires-Dist: pytz>=2021.3
|
1
|
+
Code Maintainers Wanted
|
2
|
+
=======================
|
3
|
+
|
4
|
+
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
5
|
|
23
6
|
Introduction
|
24
7
|
============
|
25
8
|
|
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/
|
9
|
+
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.
|
10
|
+
|
11
|
+
Chat on discord:: |Discord|
|
27
12
|
|
13
|
+
.. |Discord| image:: https://img.shields.io/discord/652755205041029120
|
14
|
+
:target: https://discord.gg/HwnG8sY
|
15
|
+
:alt: Discord
|
28
16
|
|
29
|
-
Usage
|
30
|
-
|
17
|
+
API Usage
|
18
|
+
=========
|
31
19
|
|
32
20
|
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
21
|
|
34
|
-
Python 3.
|
22
|
+
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
23
|
|
36
24
|
region: int
|
37
25
|
brand: int,
|
@@ -39,7 +27,7 @@ Python 3.9 or newer is required to use this package. Vehicle manager is the key
|
|
39
27
|
password: str
|
40
28
|
pin: str (required for CA, and potentially USA, otherwise pass a blank string)
|
41
29
|
|
42
|
-
Key values for the int exist in the
|
30
|
+
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
31
|
|
44
32
|
REGIONS = {1: REGION_EUROPE, 2: REGION_CANADA, 3: REGION_USA, 4: REGION_CHINA, 5: REGION_AUSTRALIA}
|
45
33
|
BRANDS = {1: BRAND_KIA, 2: BRAND_HYUNDAI, 3: BRAND_GENESIS}
|
@@ -67,7 +55,6 @@ Once this is done you can now make the following calls against the vehicle manag
|
|
67
55
|
Force refreshes a single car:
|
68
56
|
force_refresh_vehicles_states(self, vehicle_id)
|
69
57
|
|
70
|
-
|
71
58
|
An example call would be::
|
72
59
|
|
73
60
|
from hyundai_kia_connect_api import *
|
@@ -107,16 +94,17 @@ For a list of language codes, see here: https://www.science.co.il/language/Codes
|
|
107
94
|
- "fi" Finnish
|
108
95
|
- "pt" Portuguese
|
109
96
|
|
110
|
-
|
111
|
-
|
97
|
+
|
98
|
+
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.::
|
99
|
+
- First call vm.update_month_trip_info(vehicle.id, yyyymm) before getting vehicle.month_trip_info for that month
|
112
100
|
- First call vm.update_day_trip_info(vehicle.id, day.yyyymmdd) before getting vehicle.day_trip_info for that day
|
113
101
|
|
114
102
|
Example of getting trip info of the current month and day (vm is VehicleManager instance)::
|
115
103
|
|
116
104
|
now = datetime.now()
|
117
|
-
|
105
|
+
yyyymm = now.strftime("%Y%m")
|
118
106
|
yyyymmdd = now.strftime("%Y%m%d")
|
119
|
-
vm.update_month_trip_info(vehicle.id,
|
107
|
+
vm.update_month_trip_info(vehicle.id, yyyymm)
|
120
108
|
if vehicle.month_trip_info is not None:
|
121
109
|
for day in vehicle.month_trip_info.day_list: # ordered on day
|
122
110
|
if yyyymmdd == day.yyyymmdd: # in example only interested in current day
|
@@ -124,3 +112,17 @@ Example of getting trip info of the current month and day (vm is VehicleManager
|
|
124
112
|
if vehicle.day_trip_info is not None:
|
125
113
|
for trip in reversed(vehicle.day_trip_info.trip_list): # show oldest first
|
126
114
|
print(f"{day.yyyymmdd},{trip.hhmmss},{trip.drive_time},{trip.idle_time},{trip.distance},{trip.avg_speed},{trip.max_speed}")
|
115
|
+
|
116
|
+
|
117
|
+
CLI Usage
|
118
|
+
=========
|
119
|
+
|
120
|
+
A tool `bluelink` is provided that enable querying the vehicles and save the
|
121
|
+
state to a JSON file. Example usage:
|
122
|
+
|
123
|
+
::
|
124
|
+
|
125
|
+
bluelink --region Canada --brand Hyundai --username FOO --password BAR --pin 1234 info --json infos.json
|
126
|
+
|
127
|
+
Environment variables BLUELINK_XXX can be used to provide a default value for
|
128
|
+
the corresponding --xxx argument.
|
@@ -32,13 +32,13 @@ You can either clone the public repository:
|
|
32
32
|
|
33
33
|
.. code-block:: console
|
34
34
|
|
35
|
-
$ git clone git://github.com/
|
35
|
+
$ git clone git://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api
|
36
36
|
|
37
37
|
Or download the `tarball`_:
|
38
38
|
|
39
39
|
.. code-block:: console
|
40
40
|
|
41
|
-
$ curl -OJL https://github.com/
|
41
|
+
$ curl -OJL https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/tarball/master
|
42
42
|
|
43
43
|
Once you have a copy of the source, you can install it with:
|
44
44
|
|
@@ -47,5 +47,5 @@ Once you have a copy of the source, you can install it with:
|
|
47
47
|
$ python setup.py install
|
48
48
|
|
49
49
|
|
50
|
-
.. _Github repo: https://github.com/
|
51
|
-
.. _tarball: https://github.com/
|
50
|
+
.. _Github repo: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api
|
51
|
+
.. _tarball: https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api/tarball/master
|
{hyundai_kia_connect_api-3.17.6 → hyundai_kia_connect_api-3.32.0}/hyundai_kia_connect_api/ApiImpl.py
RENAMED
@@ -1,16 +1,23 @@
|
|
1
1
|
"""ApiImpl.py"""
|
2
2
|
|
3
|
-
# pylint:disable=unnecessary-pass,missing-class-docstring,invalid-name,missing-function-docstring,wildcard-import,unused-wildcard-import,unused-argument,missing-timeout
|
3
|
+
# pylint:disable=unnecessary-pass,missing-class-docstring,invalid-name,missing-function-docstring,wildcard-import,unused-wildcard-import,unused-argument,missing-timeout,logging-fstring-interpolation
|
4
4
|
|
5
5
|
import datetime as dt
|
6
6
|
import logging
|
7
7
|
from dataclasses import dataclass
|
8
8
|
|
9
9
|
import requests
|
10
|
-
|
10
|
+
from requests.exceptions import JSONDecodeError
|
11
11
|
from .Token import Token
|
12
12
|
from .Vehicle import Vehicle
|
13
|
-
from .const import
|
13
|
+
from .const import (
|
14
|
+
WINDOW_STATE,
|
15
|
+
CHARGE_PORT_ACTION,
|
16
|
+
OrderStatus,
|
17
|
+
DOMAIN,
|
18
|
+
VALET_MODE_ACTION,
|
19
|
+
VEHICLE_LOCK_ACTION,
|
20
|
+
)
|
14
21
|
from .utils import get_child_value
|
15
22
|
|
16
23
|
_LOGGER = logging.getLogger(__name__)
|
@@ -27,6 +34,7 @@ class ClimateRequestOptions:
|
|
27
34
|
front_right_seat: int = None
|
28
35
|
rear_left_seat: int = None
|
29
36
|
rear_right_seat: int = None
|
37
|
+
steering_wheel: int = None
|
30
38
|
|
31
39
|
|
32
40
|
@dataclass
|
@@ -37,6 +45,26 @@ class WindowRequestOptions:
|
|
37
45
|
front_right: WINDOW_STATE = None
|
38
46
|
|
39
47
|
|
48
|
+
@dataclass
|
49
|
+
class ScheduleChargingClimateRequestOptions:
|
50
|
+
@dataclass
|
51
|
+
class DepartureOptions:
|
52
|
+
enabled: bool = None
|
53
|
+
days: list[int] = None # Sun=0, Mon=1, ..., Sat=6
|
54
|
+
time: dt.time = None
|
55
|
+
|
56
|
+
first_departure: DepartureOptions = None
|
57
|
+
second_departure: DepartureOptions = None
|
58
|
+
charging_enabled: bool = None
|
59
|
+
off_peak_start_time: dt.time = None
|
60
|
+
off_peak_end_time: dt.time = None
|
61
|
+
off_peak_charge_only_enabled: bool = None
|
62
|
+
climate_enabled: bool = None
|
63
|
+
temperature: float = None
|
64
|
+
temperature_unit: int = None
|
65
|
+
defrost: bool = None
|
66
|
+
|
67
|
+
|
40
68
|
class ApiImpl:
|
41
69
|
data_timezone = dt.timezone.utc
|
42
70
|
temperature_range = None
|
@@ -57,10 +85,6 @@ class ApiImpl:
|
|
57
85
|
Required for Kia USA as key is session specific"""
|
58
86
|
return vehicles
|
59
87
|
|
60
|
-
def get_last_updated_at(self, value) -> dt.datetime:
|
61
|
-
"""Convert last updated value of vehicle into into datetime"""
|
62
|
-
pass
|
63
|
-
|
64
88
|
def update_vehicle_with_cached_state(self, token: Token, vehicle: Vehicle) -> None:
|
65
89
|
"""Get cached vehicle data and update Vehicle instance with it"""
|
66
90
|
pass
|
@@ -82,26 +106,39 @@ class ApiImpl:
|
|
82
106
|
def update_geocoded_location(
|
83
107
|
self, token: Token, vehicle: Vehicle, use_email: bool
|
84
108
|
) -> None:
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
109
|
+
if vehicle.location_latitude and vehicle.location_longitude:
|
110
|
+
email_parameter = ""
|
111
|
+
if use_email is True:
|
112
|
+
email_parameter = "&email=" + token.username
|
113
|
+
|
114
|
+
url = (
|
115
|
+
"https://nominatim.openstreetmap.org/reverse?lat="
|
116
|
+
+ str(vehicle.location_latitude)
|
117
|
+
+ "&lon="
|
118
|
+
+ str(vehicle.location_longitude)
|
119
|
+
+ "&format=json&addressdetails=1&zoom=18"
|
120
|
+
+ email_parameter
|
121
|
+
)
|
122
|
+
_LOGGER.debug(
|
123
|
+
f"{DOMAIN} - Running update geocode location with value: {url}"
|
124
|
+
)
|
125
|
+
response = requests.get(url)
|
126
|
+
_LOGGER.debug(f"{DOMAIN} - geocode location raw response: {response}")
|
127
|
+
try:
|
128
|
+
response = response.json()
|
129
|
+
except JSONDecodeError:
|
130
|
+
_LOGGER.debug(f"{DOMAIN} - failed to decode json for geocode location")
|
131
|
+
vehicle.geocode = None
|
132
|
+
else:
|
133
|
+
_LOGGER.debug(f"{DOMAIN} - geocode location json response: {response}")
|
134
|
+
vehicle.geocode = (
|
135
|
+
get_child_value(response, "display_name"),
|
136
|
+
get_child_value(response, "address"),
|
137
|
+
)
|
138
|
+
|
139
|
+
def lock_action(
|
140
|
+
self, token: Token, vehicle: Vehicle, action: VEHICLE_LOCK_ACTION
|
141
|
+
) -> str:
|
105
142
|
"""Lock or unlocks a vehicle. Returns the tracking ID"""
|
106
143
|
pass
|
107
144
|
|
@@ -129,6 +166,13 @@ class ApiImpl:
|
|
129
166
|
"""Sets charge limits. Returns the tracking ID"""
|
130
167
|
pass
|
131
168
|
|
169
|
+
def set_charging_current(self, token: Token, vehicle: Vehicle, level: int) -> str:
|
170
|
+
"""
|
171
|
+
feature only available for some regions.
|
172
|
+
Sets charge current level (1=100%, 2=90%, 3=60%). Returns the tracking ID
|
173
|
+
"""
|
174
|
+
pass
|
175
|
+
|
132
176
|
def set_windows_state(
|
133
177
|
self, token: Token, vehicle: Vehicle, options: WindowRequestOptions
|
134
178
|
) -> str:
|
@@ -145,7 +189,7 @@ class ApiImpl:
|
|
145
189
|
self, token: Token, vehicle: Vehicle, yyyymm_string: str
|
146
190
|
) -> None:
|
147
191
|
"""
|
148
|
-
|
192
|
+
feature only available for some regions.
|
149
193
|
Updates the vehicle.month_trip_info for the specified month.
|
150
194
|
|
151
195
|
Default this information is None:
|
@@ -158,7 +202,7 @@ class ApiImpl:
|
|
158
202
|
self, token: Token, vehicle: Vehicle, yyyymmdd_string: str
|
159
203
|
) -> None:
|
160
204
|
"""
|
161
|
-
|
205
|
+
feature only available for some regions.
|
162
206
|
Updates the vehicle.day_trip_info information for the specified day.
|
163
207
|
|
164
208
|
Default this information is None:
|
@@ -166,3 +210,32 @@ class ApiImpl:
|
|
166
210
|
day_trip_info: DayTripInfo = None
|
167
211
|
"""
|
168
212
|
pass
|
213
|
+
|
214
|
+
def schedule_charging_and_climate(
|
215
|
+
self,
|
216
|
+
token: Token,
|
217
|
+
vehicle: Vehicle,
|
218
|
+
options: ScheduleChargingClimateRequestOptions,
|
219
|
+
) -> str:
|
220
|
+
"""
|
221
|
+
feature only available for some regions.
|
222
|
+
Schedule charging and climate control. Returns the tracking ID
|
223
|
+
"""
|
224
|
+
pass
|
225
|
+
|
226
|
+
def start_hazard_lights(self, token: Token, vehicle: Vehicle) -> str:
|
227
|
+
"""Turns on the hazard lights for 30 seconds"""
|
228
|
+
pass
|
229
|
+
|
230
|
+
def start_hazard_lights_and_horn(self, token: Token, vehicle: Vehicle) -> str:
|
231
|
+
"""Turns on the hazard lights and horn for 30 seconds"""
|
232
|
+
pass
|
233
|
+
|
234
|
+
def valet_mode_action(
|
235
|
+
self, token: Token, vehicle: Vehicle, action: VALET_MODE_ACTION
|
236
|
+
) -> str:
|
237
|
+
"""
|
238
|
+
feature only available for some regions.
|
239
|
+
Activate or Deactivate valet mode. Returns the tracking ID
|
240
|
+
"""
|
241
|
+
pass
|