Soc Modul Kia E-Niro 2020
Re: Soc Modul Kia E-Niro 2020
Hi
Hab die Datei bluelinksoc.py mal abgeändert in:
in main.sh . /var/www/html/openWB/openwb.conf hinzugefügt.
Fehlermeldung ist:
Wo liegt der Fehler?
Hab die Datei bluelinksoc.py mal abgeändert in:
Code: Alles auswählen
import sys
import requests
import uuid
import json
import urllib.parse as urlparse
from urllib.parse import parse_qs
email = str(sys.argv[1])
password = str(sys.argv[2])
pin = str(sys.argv[3])
#vin = str(sys.argv[4])
def main():
#diviceID
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/notifications/register'
headers = {
'ccsp-service-id': 'fdc85c00-0a2f-4c64-bcb4-2cfb1500730a',
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '80',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"pushRegId":"1","pushType":"GCM","uuid": str(uuid.uuid1())}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
deviceId = response['resMsg']['deviceId']
#print(deviceId)
else:
print('NOK diviceID')
return
#cookie für login
session = requests.Session()
response = session.get('https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=fdc85c00-0a2f-4c64-bcb4-2cfb1500730a&redirect_uri=https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect')
if response.status_code == 200:
cookies = session.cookies.get_dict()
#print(cookies)
else:
print('NOK cookie für login')
return
#login
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin'
headers = {'Content-type': 'application/json'}
data = {"email": email,"password": password}
response = requests.post(url, json = data, headers = headers, cookies = cookies)
if response.status_code == 200:
response = json.loads(response.text)
response = response['redirectUrl']
parsed = urlparse.urlparse(response)
authCode = ''.join(parse_qs(parsed.query)['code'])
#print(authCode)
else:
print('NOK login')
return
#token
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/token'
headers = {
'Authorization': 'Basic ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==',
'Content-type': 'application/x-www-form-urlencoded',
'Content-Length': '154',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = 'grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprd.eu-ccapi.kia.com%3A8080%2Fapi%2Fv1%2Fuser%2Foauth2%2Fredirect&code=' + authCode
response = requests.post(url, data = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
access_token = response['token_type'] + ' ' + response['access_token']
#print(access_token)
else:
print('NOK token')
return
#vehicles
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
vehicleId = response['resMsg']['vehicles'][0]['vehicleId']
#print(vehicleId)
else:
print('NOK vehicles')
return
#vehicles/profile
#prewakeup
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles/' + vehicleId + '/control/engine'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Content-Type': 'application/json;charset=UTF-8',
'Content-Length': '72',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"action":"prewakeup","deviceId": deviceId}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
#print(response.text)
response = ''
else:
print('NOK prewakeup')
return
#pin
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin'
headers = {
'Authorization': access_token,
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '64',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"deviceId": deviceId,"pin": pin}
response = requests.put(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
controlToken = 'Bearer ' + response['controlToken']
#print(controlToken)
else:
print('NOK pin')
return
#status
url = 'https://prd.eu-ccapi.kia.com:8080/api/v2/spa/vehicles/' + vehicleId + '/status'
headers = {
'Authorization': controlToken,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Host': 'prd.eu-ccapi.kia.com::8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
#print(response.text)
response = json.loads(response.text)
soc = response['resMsg']['evStatus']['batteryStatus']
#print(soc)
f = open('/var/www/html/openWB/ramdisk/soc', 'w')
f.write(str(soc))
f.close()
else:
print('NOK status')
return
if __name__ == '__main__':
main()
Fehlermeldung ist:
Code: Alles auswählen
main.sh: 12: main.sh: cannot open tmpintervall: No such file
main.sh: 12: main.sh: soctimer: not found
root@raspberrypi:/var/www/html/openWB/modules/soc_bluelink# Traceback (most recent call last):
File "/var/www/html/openWB/modules/soc_bluelink/bluelinksoc.py", line 168, in <module>
main()
File "/var/www/html/openWB/modules/soc_bluelink/bluelinksoc.py", line 157, in main
response = json.loads(response.text)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Wo liegt der Fehler?
- mattle1957
- Beiträge: 47
- Registriert: Sa Jun 27, 2020 8:45 am
- Wohnort: Uhingen
- Kontaktdaten:
Re: Soc Modul Kia E-Niro 2020
Hallo,
könnte es daran liegen, dass es bei Kia nicht "Bluelink", sondern "UVO" heisst?
Grüße
Martin
könnte es daran liegen, dass es bei Kia nicht "Bluelink", sondern "UVO" heisst?
Grüße
Martin
PV-Axitec: 9,92 kWp
Alpha ESS Smile 5 (Inverter) + SMA Sunnyboy (WR) in Hybridschaltung
Alpha ESS Speicher: 10,7 kWh (nutzbar)
WB: openWB Standalone mit go e Charger
Fiat 500e Cabrio LaPrima
Cupra Born
Re: Soc Modul Kia E-Niro 2020
Das Modul ist das selbe es müssen nur andere ids und Adressen eingetragen werden.
-
- Site Admin
- Beiträge: 8494
- Registriert: So Okt 07, 2018 1:50 pm
- Has thanked: 1 time
- Been thanked: 27 times
Re: Soc Modul Kia E-Niro 2020
Weißt du / kannst du alles nötige abändern?
Supportanfragen bitte NICHT per PN stellen.
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de
Re: Soc Modul Kia E-Niro 2020
Hi
Bin ein gutes stück weiter.Anmelden geht. Leider funktioniert das Auslesen nicht.
Fehlermeldung:
Hat noch einer eine Idee?
Bin ein gutes stück weiter.Anmelden geht. Leider funktioniert das Auslesen nicht.
Code: Alles auswählen
def main():
#diviceID
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/notifications/register'
headers = {
'ccsp-service-id': 'fdc85c00-0a2f-4c64-bcb4-2cfb1500730a',
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '80',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"pushRegId":"1","pushType":"GCM","uuid": str(uuid.uuid1())}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
deviceId = response['resMsg']['deviceId']
print(deviceId)
else:
print('NOK diviceID')
return
#cookie für login
session = requests.Session()
response = session.get('https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=fdc85c00-0a2f-4c64-bcb4-2cfb1500730a&redirect_uri=https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect')
if response.status_code == 200:
cookies = session.cookies.get_dict()
#print(cookies)
else:
print('NOK cookie für login')
return
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/language'
headers = {'Content-type': 'application/json'}
data = {"lang": "en"}
response = requests.post(url, json = data, headers = headers, cookies = cookies)
#login
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin'
headers = {'Content-type': 'application/json'}
data = {"email": email,"password": password}
response = requests.post(url, json = data, headers = headers, cookies = cookies)
if response.status_code == 200:
response = json.loads(response.text)
response = response['redirectUrl']
parsed = urlparse.urlparse(response)
authCode = ''.join(parse_qs(parsed.query)['code'])
#print(authCode)
else:
print('NOK login')
return
#token
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/token'
headers = {
'Authorization': 'Basic ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==',
'Content-type': 'application/x-www-form-urlencoded',
'Content-Length': '150',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = 'grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprd.eu-ccapi.kia.com%3A8080%2Fapi%2Fv1%2Fuser%2Foauth2%2Fredirect&code=' + authCode
response = requests.post(url, data = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
access_token = response['token_type'] + ' ' + response['access_token']
#print(access_token)
else:
print('NOK token')
return
#vehicles
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
vehicleId = response['resMsg']['vehicles'][0]['vehicleId']
#print(vehicleId)
else:
print('NOK vehicles')
return
#vehicles/profile
#prewakeup
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles/' + vehicleId + '/control/engine'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Content-Type': 'application/json;charset=UTF-8',
'Content-Length': '72',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"action":"prewakeup","deviceId": deviceId}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
#print(response.text)
response = ''
else:
print('NOK prewakeup')
return
#pin
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin'
headers = {
'Authorization': access_token,
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '64',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"deviceId": deviceId,"pin": pin}
response = requests.put(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
controlToken = 'Bearer ' + response['controlToken']
#print(controlToken)
else:
print('NOK pin')
return
#status
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles/' + vehicleId + '/status'
headers = {
'Authorization': controlToken,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Host': 'prd.eu-ccapi.kia.com::8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
print(response.text)
response = json.loads(response.text)
soc = response['resMsg']['evStatus']['batteryStatus']
print(soc)
f = open('/var/www/html/openWB/ramdisk/soc', 'w')
f.write(str(soc))
f.close()
else:
print('NOK status')
return
if __name__ == '__main__':
main()
Fehlermeldung:
Code: Alles auswählen
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Blocking Page</title>
</head>
<body>
<div align="center">
<br />
<br />
<form action="login.php" method="post">
<fieldset>
<br> <span style="color:#FF0000"> <접근 제한>
<br>
<br> <span style="color:#000000"> 보안 운영팀에 문의 바랍니다
<br>
<br> 당신의 차단 ID 는 15663020050990421609 입니다.
<a href='javascript:history.back();'>
<br>
<p class="submit"><input type="submit" value="Go Back" name="Go Back"></p>
</fieldset>
</form>
<br />
<br />
<div>
</body>
</html>
Traceback (most recent call last):
File "/var/www/html/openWB/modules/soc_bluelink/bluelinksoc.py", line 174, in <module>
main()
File "/var/www/html/openWB/modules/soc_bluelink/bluelinksoc.py", line 163, in main
response = json.loads(response.text)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
-
- Site Admin
- Beiträge: 8494
- Registriert: So Okt 07, 2018 1:50 pm
- Has thanked: 1 time
- Been thanked: 27 times
Re: Soc Modul Kia E-Niro 2020
Erwartet wird eine JSON Antwort die aber nicht kommt und der Decoder daher einen Error wirft.
Supportanfragen bitte NICHT per PN stellen.
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de
Re: Soc Modul Kia E-Niro 2020
Fertig es funktioniert.
Mein Dank geht an Plips-nl
Angabe der Vin ist erforderlich.
Ausgabe SoC und Ladestatus.
soc: 96
charging: False
Mein Dank geht an Plips-nl
Angabe der Vin ist erforderlich.
Ausgabe SoC und Ladestatus.
soc: 96
charging: False
Code: Alles auswählen
import sys
import requests
import uuid
import json
import urllib.parse as urlparse
from urllib.parse import parse_qs
email = str(sys.argv[1])
password = str(sys.argv[2])
pin = str(sys.argv[3])
vin = str(sys.argv[4])
def main():
#diviceID
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/notifications/register'
headers = {
'ccsp-service-id': 'fdc85c00-0a2f-4c64-bcb4-2cfb1500730a',
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '80',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"pushRegId":"1","pushType":"GCM","uuid": str(uuid.uuid1())}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
deviceId = response['resMsg']['deviceId']
print(deviceId)
else:
print('NOK diviceID')
return
#cookie für login
session = requests.Session()
response = session.get('https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=fdc85c00-0a2f-4c64-bcb4-2cfb1500730a&redirect_uri=https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect')
if response.status_code == 200:
cookies = session.cookies.get_dict()
#print(cookies)
else:
print('NOK cookie für login')
return
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/language'
headers = {'Content-type': 'application/json'}
data = {"lang": "en"}
response = requests.post(url, json = data, headers = headers, cookies = cookies)
#login
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin'
headers = {'Content-type': 'application/json'}
data = {"email": email,"password": password}
response = requests.post(url, json = data, headers = headers, cookies = cookies)
if response.status_code == 200:
response = json.loads(response.text)
response = response['redirectUrl']
parsed = urlparse.urlparse(response)
authCode = ''.join(parse_qs(parsed.query)['code'])
#print(authCode)
else:
print('NOK login')
return
#token
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/token'
headers = {
'Authorization': 'Basic ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==',
'Content-type': 'application/x-www-form-urlencoded',
'Content-Length': '150',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = 'grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprd.eu-ccapi.kia.com%3A8080%2Fapi%2Fv1%2Fuser%2Foauth2%2Fredirect&code=' + authCode
response = requests.post(url, data = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
access_token = response['token_type'] + ' ' + response['access_token']
#print(access_token)
else:
print('NOK token')
return
#vehicles
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
vehicleId = response['resMsg']['vehicles'][0]['vehicleId']
#print(vehicleId)
else:
print('NOK vehicles')
return
#vehicles/profile
#prewakeup
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles/' + vehicleId + '/control/engine'
headers = {
'Authorization': access_token,
'ccsp-device-id': deviceId,
'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417',
'offset': '1',
'Content-Type': 'application/json;charset=UTF-8',
'Content-Length': '72',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"action":"prewakeup","deviceId": deviceId}
response = requests.post(url, json = data, headers = headers)
if response.status_code == 200:
#print(response.text)
response = ''
else:
print('NOK prewakeup')
return
#pin
url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin'
headers = {
'Authorization': access_token,
'Content-type': 'application/json;charset=UTF-8',
'Content-Length': '64',
'Host': 'prd.eu-ccapi.kia.com:8080',
'Connection': 'close',
'Accept-Encoding': 'gzip, deflate',
'User-Agent': 'okhttp/3.10.0'}
data = {"deviceId": deviceId,"pin": pin}
response = requests.put(url, json = data, headers = headers)
if response.status_code == 200:
response = json.loads(response.text)
controlToken = 'Bearer ' + response['controlToken']
#print(controlToken)
else:
print('NOK pin')
return
#status
url = 'https://prd.eu-ccapi.kia.com:8080/api/v2/spa/vehicles/' + vehicleId + '/status'
headers = {
'Authorization': controlToken,
'ccsp-device-id': deviceId,
'Content-Type': 'application/json'}
response = requests.get(url, headers = headers)
if response.status_code == 200:
statusresponse = json.loads(response.text)
#log (statusresponse)
soc = statusresponse['resMsg']['evStatus']['batteryStatus']
print('soc: ',soc)
charging = statusresponse['resMsg']['evStatus']['batteryCharge']
print('charging: ', charging)
f = open('/var/www/html/openWB/ramdisk/soc', 'w')
f.write(str(soc))
f.close()
else:
print('NOK status')
return
if __name__ == '__main__':
main()
- mattle1957
- Beiträge: 47
- Registriert: Sa Jun 27, 2020 8:45 am
- Wohnort: Uhingen
- Kontaktdaten:
Re: Soc Modul Kia E-Niro 2020
Bitte um Info, wenn das Modul implementiert ist und wie die Einstellung aussehen sollte.
Fahre einen e Soul und würde dies auch gerne nutzen.
Danke!
Gruß
Martin
Fahre einen e Soul und würde dies auch gerne nutzen.
Danke!
Gruß
Martin
PV-Axitec: 9,92 kWp
Alpha ESS Smile 5 (Inverter) + SMA Sunnyboy (WR) in Hybridschaltung
Alpha ESS Speicher: 10,7 kWh (nutzbar)
WB: openWB Standalone mit go e Charger
Fiat 500e Cabrio LaPrima
Cupra Born
-
- Site Admin
- Beiträge: 8494
- Registriert: So Okt 07, 2018 1:50 pm
- Has thanked: 1 time
- Been thanked: 27 times
Re: Soc Modul Kia E-Niro 2020
Habe es mal in die Nightly übernommen - bitte testen.Cobra hat geschrieben: ↑Do Jul 16, 2020 10:48 am Fertig es funktioniert.
Mein Dank geht an Plips-nl
Angabe der Vin ist erforderlich.
Ausgabe SoC und Ladestatus.
soc: 96
charging: False
Code: Alles auswählen
import sys import requests import uuid import json import urllib.parse as urlparse from urllib.parse import parse_qs email = str(sys.argv[1]) password = str(sys.argv[2]) pin = str(sys.argv[3]) vin = str(sys.argv[4]) def main(): #diviceID url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/notifications/register' headers = { 'ccsp-service-id': 'fdc85c00-0a2f-4c64-bcb4-2cfb1500730a', 'Content-type': 'application/json;charset=UTF-8', 'Content-Length': '80', 'Host': 'prd.eu-ccapi.kia.com:8080', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'okhttp/3.10.0'} data = {"pushRegId":"1","pushType":"GCM","uuid": str(uuid.uuid1())} response = requests.post(url, json = data, headers = headers) if response.status_code == 200: response = json.loads(response.text) deviceId = response['resMsg']['deviceId'] print(deviceId) else: print('NOK diviceID') return #cookie für login session = requests.Session() response = session.get('https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=fdc85c00-0a2f-4c64-bcb4-2cfb1500730a&redirect_uri=https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/redirect') if response.status_code == 200: cookies = session.cookies.get_dict() #print(cookies) else: print('NOK cookie für login') return url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/language' headers = {'Content-type': 'application/json'} data = {"lang": "en"} response = requests.post(url, json = data, headers = headers, cookies = cookies) #login url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/signin' headers = {'Content-type': 'application/json'} data = {"email": email,"password": password} response = requests.post(url, json = data, headers = headers, cookies = cookies) if response.status_code == 200: response = json.loads(response.text) response = response['redirectUrl'] parsed = urlparse.urlparse(response) authCode = ''.join(parse_qs(parsed.query)['code']) #print(authCode) else: print('NOK login') return #token url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/oauth2/token' headers = { 'Authorization': 'Basic ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==', 'Content-type': 'application/x-www-form-urlencoded', 'Content-Length': '150', 'Host': 'prd.eu-ccapi.kia.com:8080', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'okhttp/3.10.0'} data = 'grant_type=authorization_code&redirect_uri=https%3A%2F%2Fprd.eu-ccapi.kia.com%3A8080%2Fapi%2Fv1%2Fuser%2Foauth2%2Fredirect&code=' + authCode response = requests.post(url, data = data, headers = headers) if response.status_code == 200: response = json.loads(response.text) access_token = response['token_type'] + ' ' + response['access_token'] #print(access_token) else: print('NOK token') return #vehicles url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles' headers = { 'Authorization': access_token, 'ccsp-device-id': deviceId, 'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417', 'offset': '1', 'Host': 'prd.eu-ccapi.kia.com:8080', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'okhttp/3.10.0'} response = requests.get(url, headers = headers) if response.status_code == 200: response = json.loads(response.text) vehicleId = response['resMsg']['vehicles'][0]['vehicleId'] #print(vehicleId) else: print('NOK vehicles') return #vehicles/profile #prewakeup url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/spa/vehicles/' + vehicleId + '/control/engine' headers = { 'Authorization': access_token, 'ccsp-device-id': deviceId, 'ccsp-application-id': '693a33fa-c117-43f2-ae3b-61a02d24f417', 'offset': '1', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '72', 'Host': 'prd.eu-ccapi.kia.com:8080', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'okhttp/3.10.0'} data = {"action":"prewakeup","deviceId": deviceId} response = requests.post(url, json = data, headers = headers) if response.status_code == 200: #print(response.text) response = '' else: print('NOK prewakeup') return #pin url = 'https://prd.eu-ccapi.kia.com:8080/api/v1/user/pin' headers = { 'Authorization': access_token, 'Content-type': 'application/json;charset=UTF-8', 'Content-Length': '64', 'Host': 'prd.eu-ccapi.kia.com:8080', 'Connection': 'close', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'okhttp/3.10.0'} data = {"deviceId": deviceId,"pin": pin} response = requests.put(url, json = data, headers = headers) if response.status_code == 200: response = json.loads(response.text) controlToken = 'Bearer ' + response['controlToken'] #print(controlToken) else: print('NOK pin') return #status url = 'https://prd.eu-ccapi.kia.com:8080/api/v2/spa/vehicles/' + vehicleId + '/status' headers = { 'Authorization': controlToken, 'ccsp-device-id': deviceId, 'Content-Type': 'application/json'} response = requests.get(url, headers = headers) if response.status_code == 200: statusresponse = json.loads(response.text) #log (statusresponse) soc = statusresponse['resMsg']['evStatus']['batteryStatus'] print('soc: ',soc) charging = statusresponse['resMsg']['evStatus']['batteryCharge'] print('charging: ', charging) f = open('/var/www/html/openWB/ramdisk/soc', 'w') f.write(str(soc)) f.close() else: print('NOK status') return if __name__ == '__main__': main()
Supportanfragen bitte NICHT per PN stellen.
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de
Hardwareprobleme bitte über die Funktion Debug Daten senden mitteilen oder per Mail an support@openwb.de