NEWS
Adapter Hyundai (Bluelink) oder KIA (UVO)
-
Hallo,
bei mir läuft der Bluelink Adapter und ich kann meinen EV9 auf- und abschliessen. Auch der Km Stand wird laufend aktualisiert.
Was aber leider nicht funktioniert ist die Abfrage der Batterieladung (12V als auch Hochvoltbatterie). Beide Werte sind eingefroren und ändern sich nicht.

Hat jmd einen Tipp?
Danke
such mal in den Ordner vehicleStatusRaw
bei mir
Hochvoltbatterie
vehicleStatusRaw.Green.BatteryManagement.BatteryRemain.Ratio12-Volt Batterie
vehicleStatusRaw.Electronics.Battery.Level -
ich hab mir mal die Daten angeschaut @fichte_112 (danke für Login) ist so wie ich es vermutet habe. die fummeln an den api rum.. bei manchen wird der vehicleStatus nicht mehr geliefert in einzelnen Strang (wie früher) ... das kommt alles unter vehicleStatusRaw
aber das gute ist
man findet ALLES unter vehicleStatusRaw ich würde euch empfehlen auf den Ordner (dp) zu gehen und die Sachen da rauszuholen.
-
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
-
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
@fichte_112 besser geht es nicht, super Anleitung dafür.
-
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wiki -
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
@fichte_112 said in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Vielen Dank für die super-Anleitung!Hatte vor einigen Wochen schon mal einen refresh Token erstellt und eingetragen, damals lief alles. Zumindest so lange, bis mein Raspberry Pi wegen dem automatischen Backup-Lauf die iobroker-Instanz für einige Stunden gestoppt hat, danach ging es wieder nicht mehr.
Dann war es mir ein paar Tage egal und nun versuche ich es seit zwei Tagen wieder eine Verbindung hinzubekommen. Der Adapter geht auch auf grün, aber im Log erscheint bei jedem Datenabruf der folgende Fehler:bluelink.0 2025-10-22 16:24:54.358 error @EuropeController.pin: [400] Bad Request on [PUT] https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin - {"errId":"76563607-152a-479a-8b8a-5cc0420be32b","errCode":"4003","errMsg":"Invalid values","errBody":{"remainCount":0,"remainTime":157}} bluelink.0 2025-10-22 16:24:54.357 error Error on API-Request Status, ErrorCount:1Habe es jetzt einige male versucht, jedes mal ein neues Token bekommen, mal mit und ohne Pin (Fin) versucht usw., aber es will einfach nicht.
Jemand eine Idee?
-
@fichte_112 said in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Vielen Dank für die super-Anleitung!Hatte vor einigen Wochen schon mal einen refresh Token erstellt und eingetragen, damals lief alles. Zumindest so lange, bis mein Raspberry Pi wegen dem automatischen Backup-Lauf die iobroker-Instanz für einige Stunden gestoppt hat, danach ging es wieder nicht mehr.
Dann war es mir ein paar Tage egal und nun versuche ich es seit zwei Tagen wieder eine Verbindung hinzubekommen. Der Adapter geht auch auf grün, aber im Log erscheint bei jedem Datenabruf der folgende Fehler:bluelink.0 2025-10-22 16:24:54.358 error @EuropeController.pin: [400] Bad Request on [PUT] https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin - {"errId":"76563607-152a-479a-8b8a-5cc0420be32b","errCode":"4003","errMsg":"Invalid values","errBody":{"remainCount":0,"remainTime":157}} bluelink.0 2025-10-22 16:24:54.357 error Error on API-Request Status, ErrorCount:1Habe es jetzt einige male versucht, jedes mal ein neues Token bekommen, mal mit und ohne Pin (Fin) versucht usw., aber es will einfach nicht.
Jemand eine Idee?
@sansibar die Pin ist nicht die Fin sondern eine Pin, welche in der App von KIA oder Hyundai erstellt werden muss
-
@sansibar die Pin ist nicht die Fin sondern eine Pin, welche in der App von KIA oder Hyundai erstellt werden muss
@fichte_112 said in Adapter Hyundai (Bluelink) oder KIA (UVO):
@sansibar die Pin ist nicht die Fin sondern eine Pin, welche in der App von KIA oder Hyundai erstellt werden muss
DANKE!
Was für ein Facepalm-Moment! :face_with_rolling_eyes:
Jetzt läuft's! -
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wiki@meute sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wikiEs ist aber nicht meine github Seite.
-
@meute sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wikiEs ist aber nicht meine github Seite.
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@meute sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wikiEs ist aber nicht meine github Seite.
Schon klar, dass das nicht Deine Seite ist.
Hier wird aber der Adapter entwickelt.Vll. kann das @arteck hinzufügen.
Oder noch besser, die Seite wird als Markdown erstellt, z.B. in Notepad++ mit MD-Viewer und muss dann nur noch von @arteck ins Wiki kopiert werden. -
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
@fichte_112 Wow, das hat jetzt sofort geklappt. Vielen, vielen Dank!
Ich hatte Powershell installiert und das so abgearbeitet.
Alle Daten waren sofort wieder da! Ich hoffe das es so bleibt.Vielen Dank auch an @pedder007 , der das System beschrieben hat, dass man es auch verstanden hat.
-
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@meute sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Anleitung zur Erstellung eines Tokens für Hyundai mit Windows
:+1:
Es wäre gut, wenn so eine Top-Anleitung nicht hier im Thread-Nirvana vergammelt, sondern ins Wiki kommt.
Da gehört sowas hin.Ist das hier das richtige Wiki?
https://github.com/Newan/ioBroker.bluelink/wikiEs ist aber nicht meine github Seite.
Schon klar, dass das nicht Deine Seite ist.
Hier wird aber der Adapter entwickelt.Vll. kann das @arteck hinzufügen.
Oder noch besser, die Seite wird als Markdown erstellt, z.B. in Notepad++ mit MD-Viewer und muss dann nur noch von @arteck ins Wiki kopiert werden.@meute sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Oder noch besser, die Seite wird als Markdown erstellt, z.B. in Notepad++ mit MD-Viewer und muss dann nur noch von @arteck ins Wiki kopiert werden.
Ich habe hier auf die Schnelle für's Wiki die Anleitung von @fichte_112 als MD erstellt.
Die beiden Screenshots fehlen aber noch. -
Anleitung zur Erstellung eines Tokens für Hyundai oder KIA mit Windows
Python Releases for Windows installieren.
Google Chrome installierenIn der Konsole folgenden Befehl ausführen. (oder den Adapter Bluelink löschen)
rm -r /opt/iobroker/node_modules/bluelinky/Im Iobroker den Reiter Adapter anklicken. Dan den Expertenmodus aktivieren und die Katze anklicken.


Den Reiter Benutzerdefiniert auswählen und folgendes eintragen und installieren.
https://github.com/Newan/ioBroker.bluelink.gitJetzt Windows PowerShell mit administrativen Rechten starten.
Jetzt folgende Befehle nacheinander ausführen.
Set-ExecutionPolicy UnrestrictedA eingeben und mit Enter bestätigen.
mkdir $env:TEMP\token 2>$null; cd $env:TEMP\token$code = @" # Original authors: # Kia: fuatakgun (https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9#gistfile1.txt) # Hyundai: Maaxion (https://gist.github.com/Maaxion/22a38ba8fb06937da18482ddf35171ac#file-gistfile1-txt) # import argparse import re from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException import requests import time def main(): """ Determine brand to get the refresh token for """ parser = argparse.ArgumentParser() parser.add_argument("--brand", help="Brand of vehicle (Hyundai/Kia)", type=str.lower, required=True, choices=['hyundai','kia']) args = parser.parse_args() """ Populate global variables """ BASE_URL = f"https://idpconnect-eu.{args.brand}.com/auth/api/v2/user/oauth2/" TOKEN_URL = f"{BASE_URL}token" if args.brand == 'kia': # Kia specific variables here CLIENT_ID = "fdc85c00-0a2f-4c64-bcb4-2cfb1500730a" CLIENT_SECRET = "secret" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect" SUCCESS_ELEMENT_SELECTOR = "a[class='logout user']" LOGIN_URL = f"{BASE_URL}authorize?ui_locales=de&scope=openid%20profile%20email%20phone&response_type=code&client_id=peukiaidm-online-sales&redirect_uri=https://www.kia.com/api/bin/oneid/login&state=aHR0cHM6Ly93d3cua2lhLmNvbTo0NDMvZGUvP21zb2NraWQ9MjM1NDU0ODBmNmUyNjg5NDIwMmU0MDBjZjc2OTY5NWQmX3RtPTE3NTYzMTg3MjY1OTImX3RtPTE3NTYzMjQyMTcxMjY=_default" elif args.brand == 'hyundai': # Hyundai specific variables CLIENT_ID = "6d477c38-3ca4-4cf3-9557-2a1929a94654" CLIENT_SECRET = "KUy49XxPzLpLuoK0xhBC77W6VXhmtQR9iQhmIFjjoY4IpxsV" REDIRECT_URL_FINAL = "https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/token" SUCCESS_ELEMENT_SELECTOR = "button.mail_check" LOGIN_URL = f"{BASE_URL}authorize?client_id=peuhyundaiidm-ctb&redirect_uri=https%3A%2F%2Fctbapi.hyundai-europe.com%2Fapi%2Fauth&nonce=&state=NL_&scope=openid+profile+email+phone&response_type=code&connector_client_id=peuhyundaiidm-ctb&connector_scope=&connector_session_key=&country=&captcha=1&ui_locales=en-US" REDIRECT_URL = f"{BASE_URL}authorize?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URL_FINAL}&lang=de&state=ccsp" """ Main function to run the Selenium automation. """ # Initialize the Chrome WebDriver # Make sure you have chromedriver installed and in your PATH, # or specify the path to it. options = webdriver.ChromeOptions() options.add_argument("user-agent=Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19_CCS_APP_AOS") options.add_argument("--auto-open-devtools-for-tabs") driver = webdriver.Chrome(options=options) driver.maximize_window() # 1. Open the login page print(f"Opening login page: {LOGIN_URL}") driver.get(LOGIN_URL) print("\n" + "="*50) print("Please log in manually in the browser window.") print("The script will wait for you to complete the login...") print("="*50 + "\n") try: wait = WebDriverWait(driver, 300) # 300-second timeout if args.brand == "kia": wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR))) else: wait.until(EC.any_of( EC.presence_of_element_located((By.CSS_SELECTOR, SUCCESS_ELEMENT_SELECTOR)), EC.presence_of_element_located((By.CSS_SELECTOR, "button.ctb_button")) ) ) print("✅ Login successful! Element found.") print(f"Redirecting to: {REDIRECT_URL}") driver.get(REDIRECT_URL) wait = WebDriverWait(driver, 15) # 15-second timeout current_url = "" tries_left = 10 redir_found = False while (tries_left > 0): current_url = driver.current_url print(f" - [{11 - tries_left}] Waiting for redirect URLwith code") if args.brand == "kia": if re.match(r'^https://.*:8080/api/v1/user/oauth2/redirect', current_url): redir_found = True break elif args.brand == "hyundai": if re.match(r'^https://.*:8080/api/v1/user/oauth2/token', current_url): redir_found = True break tries_left -= 1 time.sleep(1) if redir_found == False: print(f"\n❌ Failed to get redirected to correct URL, got {current_url} instead") code = re.search( r'code=([0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36}\.[0-9a-fA-F-]{36})', current_url ).group(1) data = { "grant_type": "authorization_code", "code": code, "redirect_uri": REDIRECT_URL_FINAL, "client_id": CLIENT_ID, "client_secret": CLIENT_SECRET, } session = requests.Session() response = session.post(TOKEN_URL, data=data) if response.status_code == 200: tokens = response.json() if tokens is not None: refresh_token = tokens["refresh_token"] access_token = tokens["access_token"] print(f"\n✅ Your tokens are:\n\n- Refresh Token: {refresh_token}\n- Access Token: {access_token}") else: print(f"\n❌ Error getting tokens from der API!\n{response.text}") except TimeoutException: print("❌ Timed out after 5 minutes. Login was not completed or the success element was not found.") except Exception as e: print(f"An unexpected error occurred: {e}") time.sleep(3600) finally: print("Cleaning up and closing the browser.") driver.quit() if __name__ == "__main__": main() $code | Out-File -FilePath "$env:TEMP\token\ApiToken.py" -Encoding UTF8py -m venv .venv.\.venv\Scripts\Activate.ps1pip install --upgrade pippip install selenium requests webdriver-managerpy -m pip install --upgrade pip selenium requestsAchtung jetzt nur den Befehl für Hyundai oder KIA verwenden!!!
für Hyundai
clspy .\ApiToken.py --brand hyundaifür KIA
clspy .\ApiToken.py --brand kiaHier geht es für beide weiter.
Jetzt sollte sich Chrome öffnen. Dort mit den Benutzerdaten einloggen.
Nun sollte im Fenster von PowerShell ein Refresh Token und ein Access Token erscheinen.
Diese mit der Maus markieren und mit Strg-C kopieren und in eine leere Textdatei mit Strg-V einfügen.
Der Refresh Token ist das Passwort für den Bluelink AdapterAls letztes kann nun noch die Ausführungsrichtlinien (Unrestricted) für PowerShell-Scripts entfernt und der temporäre Ordner gelöscht werden. Dazu in der Powershell die folgenden Befehle eingeben.
Set-ExecutionPolicy UndefinedA eingeben und mit Enter bestätigen.
cd..Remove-item $env:TEMP\tokenA eingeben und mit Enter bestätigen.
Viel Spass
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
iwr -UseBasicParsing -OutFile ApiToken.py `https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9/raw/fe95ed7c02913f6277878a100458be78b794603d/gistfile1.txt
ich würde ungerne auf fremde scripte verweisen.. du hast nie dei kontrolle und wenn da einer mist einträngt....
änderer den mal bite auf unseres internes fileKiaFetchApiToken_2.py
ich habs mal in readme verlinkt

-
@fichte_112 sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
iwr -UseBasicParsing -OutFile ApiToken.py `https://gist.githubusercontent.com/fuatakgun/fa4ef1e1d48b8dca2d22133d4d028dc9/raw/fe95ed7c02913f6277878a100458be78b794603d/gistfile1.txt
ich würde ungerne auf fremde scripte verweisen.. du hast nie dei kontrolle und wenn da einer mist einträngt....
änderer den mal bite auf unseres internes fileKiaFetchApiToken_2.py
ich habs mal in readme verlinkt

@arteck ich habe es angepasst.
-
@arteck ich habe es angepasst.
Funktioniert denn bei euch der Login aktuell noch?
Ich hatte ja die neue Variante bereits in Funktion gebracht. Seit zwei Tagen wird aber der Login verweigert.
Das könnte natürlich auch mal wieder an den Servern von Kia liegen. Deswegen bräuchte ich mal euer Feedback, ob die Server erreichbar sind und ich ggf. nochmal das neue Prozedere durchführe.
bluelink.0 2025-10-23 17:26:16.103 error next auto login attempt in 1 hour or restart adapter manual bluelink.0 2025-10-23 17:26:16.103 error Server is not available or login credentials are wrong bluelink.0 2025-10-23 17:26:16.102 error ManagedBluelinkyError: @EuropeController.login: [401] Unauthorized on [POST] https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin - {"errId":"b8d86602-,"errCode":"4010","errMsg":"Require authentication"} -
Funktioniert denn bei euch der Login aktuell noch?
Ich hatte ja die neue Variante bereits in Funktion gebracht. Seit zwei Tagen wird aber der Login verweigert.
Das könnte natürlich auch mal wieder an den Servern von Kia liegen. Deswegen bräuchte ich mal euer Feedback, ob die Server erreichbar sind und ich ggf. nochmal das neue Prozedere durchführe.
bluelink.0 2025-10-23 17:26:16.103 error next auto login attempt in 1 hour or restart adapter manual bluelink.0 2025-10-23 17:26:16.103 error Server is not available or login credentials are wrong bluelink.0 2025-10-23 17:26:16.102 error ManagedBluelinkyError: @EuropeController.login: [401] Unauthorized on [POST] https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin - {"errId":"b8d86602-,"errCode":"4010","errMsg":"Require authentication"}@meister-mopper bei mir funktioniert es
-
such mal in den Ordner vehicleStatusRaw
bei mir
Hochvoltbatterie
vehicleStatusRaw.Green.BatteryManagement.BatteryRemain.Ratio12-Volt Batterie
vehicleStatusRaw.Electronics.Battery.Level@fichte_112 perfekt danke. hat funktioniert
-
Funktioniert denn bei euch der Login aktuell noch?
Ich hatte ja die neue Variante bereits in Funktion gebracht. Seit zwei Tagen wird aber der Login verweigert.
Das könnte natürlich auch mal wieder an den Servern von Kia liegen. Deswegen bräuchte ich mal euer Feedback, ob die Server erreichbar sind und ich ggf. nochmal das neue Prozedere durchführe.
bluelink.0 2025-10-23 17:26:16.103 error next auto login attempt in 1 hour or restart adapter manual bluelink.0 2025-10-23 17:26:16.103 error Server is not available or login credentials are wrong bluelink.0 2025-10-23 17:26:16.102 error ManagedBluelinkyError: @EuropeController.login: [401] Unauthorized on [POST] https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin - {"errId":"b8d86602-,"errCode":"4010","errMsg":"Require authentication"}Kia, richtig?
Der Fehlermeldung nach ist der Token abgelaufen, mach dir n neuen.. mit dem Script.. -
@ilovegym sagte in Adapter Hyundai (Bluelink) oder KIA (UVO):
Kia, richtig?
Der Fehlermeldung nach ist der Token abgelaufen, mach dir n neuen.. mit dem Script..Ich habe einen neuen Refresh Token erstellt (zweimal) und als Passwort eingetragen.
Leider wird der Adapter nicht mehr grün.
-
Funktioniert denn bei euch der Login aktuell noch?
Ich hatte ja die neue Variante bereits in Funktion gebracht. Seit zwei Tagen wird aber der Login verweigert.
Das könnte natürlich auch mal wieder an den Servern von Kia liegen. Deswegen bräuchte ich mal euer Feedback, ob die Server erreichbar sind und ich ggf. nochmal das neue Prozedere durchführe.
bluelink.0 2025-10-23 17:26:16.103 error next auto login attempt in 1 hour or restart adapter manual bluelink.0 2025-10-23 17:26:16.103 error Server is not available or login credentials are wrong bluelink.0 2025-10-23 17:26:16.102 error ManagedBluelinkyError: @EuropeController.login: [401] Unauthorized on [POST] https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin - {"errId":"b8d86602-,"errCode":"4010","errMsg":"Require authentication"}@meister-mopper ja da gabs mal wieder ein Problem..stand aber auch in der App drin.. deshalb am beten immer gegenchecken wenn der Login in Adapter nicht geht, wobei hier auch aufpassen.. wenn der Adapter auf einen anderen Server umgeroutet wird als die App dann passt es dann auch nicht..aber als grobe Richtung..