kia_uvo icon indicating copy to clipboard operation
kia_uvo copied to clipboard

EU Genesis Support

Open pdunkley opened this issue 1 year ago • 23 comments

Is your feature request related to a problem? Please describe. My wife and I have two Hyundai group cars. A Hyundai Tuscon Plug-in Hybrid (Bluelink) and a Genesis GV60 EV (GCS). I can currently use this integration with the Hyndai but not the Genesis.

Describe the solution you'd like Genesis Connected Services is effectively the same as Hyndai Bluelink and Kia Connect. It would be great if support for Genesis cars could be added to this integration.

Include the logs of the end point from Data in HA if this is a sensor

Describe alternatives you've considered

Additional context

pdunkley avatar Jul 22 '23 19:07 pdunkley

Most likely but someone needs to sniff the traffic. What country are you looking for?

cdnninja avatar Jul 22 '23 21:07 cdnninja

I am in the UK, so that would be the EU region for this app.

pdunkley avatar Jul 24 '23 10:07 pdunkley

+1 for Upgrade with Support of Genesis :)

lmuser22 avatar Aug 01 '23 16:08 lmuser22

We need someone who is a genesis owner sniff the traffic.

cdnninja avatar Aug 01 '23 16:08 cdnninja

What i have to do? I have a GV60

lmuser22 avatar Aug 01 '23 16:08 lmuser22

Does it have a website you can control the car on or only an app?

cdnninja avatar Aug 01 '23 19:08 cdnninja

Only App Control > Does it have a website you can control the car on or only an app?

lmuser22 avatar Aug 01 '23 21:08 lmuser22

If only an app it takes some work. Someone would need to either share a login, add someone as a second user or sniff the traffic themselves.

cdnninja avatar Aug 02 '23 19:08 cdnninja

if someone tells me how, i could sniff the traffic

lmuser22 avatar Aug 03 '23 05:08 lmuser22

Does it have a website you can control the car on or only an app?

There is a site - owners.genesis.com

AshishMBakshi avatar Aug 03 '23 06:08 AshishMBakshi

Only US :/ not DE / UK

lmuser22 avatar Aug 03 '23 08:08 lmuser22

https://archive.ph/k1hIG are steps to sniff traffic.

cdnninja avatar Aug 03 '23 21:08 cdnninja

Does it have a website you can control the car on or only an app?

There is a site - owners.genesis.com

Are you interested in US support?

cdnninja avatar Aug 03 '23 21:08 cdnninja

Does it have a website you can control the car on or only an app?

There is a site - owners.genesis.com

Are you interested in US support?

Yes, US support would be great. What info do you need from the browser? I noticed that at some point in the loading process, it navigated to a UVO URL, so hopefully it's not too different from the Kia system.

AshishMBakshi avatar Aug 03 '23 22:08 AshishMBakshi

https://archive.ph/k1hIG are steps to sniff traffic.

too complex for me but would share my account. Just need to figure out how to set up a second user with less rights (Unlock / Start....)

lmuser22 avatar Aug 04 '23 05:08 lmuser22

Let's hold off sharing. I got the key items from the login page. Waiting for someone on the bluelinky side to help on one item before we test.

cdnninja avatar Aug 04 '23 06:08 cdnninja

Thinking an account would help. If anyone able to share let me know.

cdnninja avatar Aug 10 '23 23:08 cdnninja

Anyone familiar enough with python to test this out for me? https://github.com/Hyundai-Kia-Connect/hyundai_kia_connect_api

Example test code:

from pathlib import Path
import logging
import sys
import os

path_root = r"C:\path to files\hyundai_kia_connect_api"
sys.path.append(str(path_root))
from hyundai_kia_connect_api import *
from hyundai_kia_connect_api.exceptions import *

logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s:%(message)s')
logger = logging.getLogger(__name__)

vm = VehicleManager(region=1, brand=3, username="username", password="pass", pin="", geocode_api_enable = True)
print(vm.check_and_refresh_token())


vm.update_all_vehicles_with_cached_state()
print(vm.vehicles)

cdnninja avatar Aug 11 '23 04:08 cdnninja

@cdnninja here's my output: (I have GV60 in the UK)

2023-09-12 21:14:18,831 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - Get Device ID request: https://prd-eu-ccapi.genesis.com:443/api/v1/spa/notifications/register {'ccsp-service-id': '3020afa2-30ff-412a-aa51-d28fbe901e10', 'ccsp-application-id': 'f11f2b86-e0e7-4851-90df-5600b01d8b70', 'Stamp': 'ImpZIJ2NNURLI0cNUotk8b8G05h70TJzbvXLirZ/QKkhptv+KoiLoNhaihlSy5I=', 'Content-Type': 'application/json;charset=UTF-8', 'Host': 'prd-eu-ccapi.genesis.com:443', 'Connection': 'Keep-Alive', 'Accept-Encoding': 'gzip', 'User-Agent': 'okhttp/3.12.0'} {'pushRegId': '2da9de0f4580579491260932903cb51f5da3eeb44fdf91226536eba227169773', 'pushType': 'GCM', 'uuid': '594c0500-3bb3-4ebf-bb09-d684d8434a29'}
2023-09-12 21:14:18,837 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): prd-eu-ccapi.genesis.com:443
2023-09-12 21:14:18,998 urllib3.connectionpool DEBUG:https://prd-eu-ccapi.genesis.com:443 "POST /api/v1/spa/notifications/register HTTP/1.1" 200 140
2023-09-12 21:14:19,000 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - Get Device ID response: {'retCode': 'S', 'resCode': '0000', 'resMsg': {'deviceId': 'f29e4c01-3420-48d6-8dfb-52e56a64c641'}, 'msgId': '10d36596-a5a5-483b-810b-52606017866f'}
2023-09-12 21:14:19,000 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - Get cookies request: https://prd-eu-ccapi.genesis.com:443/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=3020afa2-30ff-412a-aa51-d28fbe901e10&redirect_uri=https://prd-eu-ccapi.genesis.com:443/api/v1/user/oauth2/redirect&lang=en
2023-09-12 21:14:19,001 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): prd-eu-ccapi.genesis.com:443
2023-09-12 21:14:19,118 urllib3.connectionpool DEBUG:https://prd-eu-ccapi.genesis.com:443 "GET /api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=3020afa2-30ff-412a-aa51-d28fbe901e10&redirect_uri=https://prd-eu-ccapi.genesis.com:443/api/v1/user/oauth2/redirect&lang=en HTTP/1.1" 400 96
2023-09-12 21:14:19,119 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - Get cookies response: {'account': 'MmNlY2I4OGEtZmNjOS00YmNlLWE3M2ItZjg5MzA1YjJmYTlm.8b1102fdfa4a96b792e24639f1c7aad7e8c5406d', 'TS01f622c7': '01cbaa6f70a2a1b7de0658aef0f85b8e68f46857d61f2a04665d2856d66776996dd9e97e10eb35f51ea7e41042dd427ee3616ffc6d'}
2023-09-12 21:14:19,122 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): prd-eu-ccapi.genesis.com:443
2023-09-12 21:14:19,242 urllib3.connectionpool DEBUG:https://prd-eu-ccapi.genesis.com:443 "POST /api/v1/user/language HTTP/1.1" 401 100
2023-09-12 21:14:19,246 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): prd-eu-ccapi.genesis.com:443
2023-09-12 21:14:19,378 urllib3.connectionpool DEBUG:https://prd-eu-ccapi.genesis.com:443 "POST /api/v1/user/signin HTTP/1.1" 401 100
2023-09-12 21:14:19,380 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - Sign In Response: {'errId': 'a29d650f-96a1-42d0-a8fb-00a397f2b5e5', 'errCode': '4010', 'errMsg': 'Require authentication'}
2023-09-12 21:14:19,380 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - get_authorization_code_with_redirect_url failed
2023-09-12 21:14:19,382 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): prd-eu-ccapi.genesis.com:443
2023-09-12 21:14:19,505 urllib3.connectionpool DEBUG:https://prd-eu-ccapi.genesis.com:443 "GET /api/v1/user/integrationinfo HTTP/1.1" 200 46
2023-09-12 21:14:19,507 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - IntegrationInfo Response: {'userId': '', 'serviceId': '', 'serviceName': ''}
2023-09-12 21:14:19,508 urllib3.connectionpool DEBUG:Starting new HTTPS connection (1): accounts-eu.genesis.com:443
2023-09-12 21:14:19,946 urllib3.connectionpool DEBUG:https://accounts-eu.genesis.com:443 "GET /auth/realms/eugenesisidm/protocol/openid-connect/auth?client_id=3020afa2-30ff-412a-aa51-d28fbe901e10&scope=openid%20profile%20email%20phone&response_type=code&hkid_session_reset=true&redirect_uri=https://prd-eu-ccapi.genesis.com:443/api/v1/user/integration/redirect/login&ui_locales=en&state=: HTTP/1.1" 404 1265
2023-09-12 21:14:19,949 hyundai_kia_connect_api.KiaUvoApiEU DEBUG:hyundai_kia_connect_api - LoginForm https://accounts-eu.genesis.com/auth/realms/eugenesisidm/protocol/openid-connect/auth?client_id=3020afa2-30ff-412a-aa51-d28fbe901e10&scope=openid%20profile%20email%20phone&response_type=code&hkid_session_reset=true&redirect_uri=https://prd-eu-ccapi.genesis.com:443/api/v1/user/integration/redirect/login&ui_locales=en&state=: - Response:
















<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width" />
<title>GENESIS ACCOUNT</title>
<link rel="stylesheet" href="/css/style.css;jsessionid=02DB4D54715F08E4A3CC07C4E6F82465.apache21" />
<link rel="shortcut icon" href="/images/favicon.ico;jsessionid=02DB4D54715F08E4A3CC07C4E6F82465.apache21" />
</head>
<body>
    <div class="wrap">
        <!-- header -->
        <header class="only_img">
            <h1><a href="#"><img src="/images/logo.png;jsessionid=02DB4D54715F08E4A3CC07C4E6F82465.apache21" alt="GENESIS"></a></h1>
        </header>
        <!-- //header -->
        <div>
            <!-- container -->
            <div class="full_page">
                <div class="full_page_con">
                    <h1>We are sorry.</h1>
                    <h2>Page not found.</h2>
                </div>
            </div>
            <!-- //container -->
        </div>
        <footer>
            © Copyright Genesis Motor Europe. ALL RIGHTS RESERVED.
        </footer>
    </div>
</body>
</html>

Traceback (most recent call last):
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/KiaUvoApiEU.py", line 234, in login
    authorization_code = self._get_authorization_code_with_redirect_url(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/KiaUvoApiEU.py", line 1164, in _get_authorization_code_with_redirect_url
    parsed_url = urlparse(response["redirectUrl"])
                          ~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 'redirectUrl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/./test-genesis.py", line 15, in <module>
    print(vm.check_and_refresh_token())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/VehicleManager.py", line 123, in check_and_refresh_token
    self.initialize()
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/VehicleManager.py", line 67, in initialize
    self.token: Token = self.api.login(self.username, self.password)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/KiaUvoApiEU.py", line 239, in login
    authorization_code = self._get_authorization_code_with_form(
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pelant/Downloads/hyundai_kia_connect_api-master/hyundai_kia_connect_api/KiaUvoApiEU.py", line 1188, in _get_authorization_code_with_form
    login_form_action_url = soup.find("form")["action"].replace("&amp;", "&")
                            ~~~~~~~~~~~~~~~~~^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

martinpelant avatar Sep 12 '23 20:09 martinpelant

@cdnninja any ideas what the right URL might be?

martinpelant avatar Nov 02 '23 13:11 martinpelant

@martinpelant no I don't. Ideally need someone who knows python and has one of these cars willing to figure this out. I took it as far as I can. I also don't own a car that works on this integration anymore so can't say I spend much time on it.

cdnninja avatar Nov 10 '23 20:11 cdnninja

I tried using for a GV60 within Germany (DE) - without success.

What do I need to do?

bufu2012 avatar Dec 05 '23 23:12 bufu2012

Any news on this? How can we (people with Genesis but 0 knowledge in python) can help?

juodikis avatar Jul 15 '24 12:07 juodikis