Closed MarkusKress closed 4 years ago
What if you retry with autoLogin deviceUuid (capitals)
I tried also lowercase for autoLogin/deviceUuid before (but forget to change it back in my posting), but I got exacly the same message. I found a mistake in the documentation (api-reference), where Bluelinky() is also lowercase instead of BlueLinky(), so I tried to change lower and uppercase also for autoLogin/deviceUuid.
If I set 'autoLogin: false', then I got the error on 'client.login()'
[2020-10-19 11:33:38] debug: EU Controller created
[2020-10-19 11:33:38] debug: loggin into to API
(node:9143) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Response code 400 (Bad Request)')
Look in the Bluelinky app if you dont have to change your password or pin.
On 19 Oct 2020, at 10:38, MarkusKress notifications@github.com wrote:
I tried also lowercase for autoLogin/deviceUuid before (but forget to change it back in my posting), but I got exacly the same message. I found a mistake in the documentation (api-reference), where Bluelinky() is also lowercase instead of BlueLinky(), so I tried to change lower and uppercase also for autoLogin/deviceUuid.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Hacksore/bluelinky/issues/76#issuecomment-711854348, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7MCG7UDDVFLGEWPEH4H2DSLP3HDANCNFSM4SVVL5UA.
PIN and Password are correct (I have a dot '.' in the password). I've checked this twice with logoff/login in bluelink android app. I'm sure, that user/password/pin are correct. But I'm not sure, if I have to set deviceUuid and which value I have to use for this. I've tried to add vin and vehicleId. 'vin' is clear, for vehicleId I'm using 'OS EV CZECH 20' which is used in the bluelink app.
const client = new BlueLinky({
username: 'mXXXX@XXXXX.de',
password: 'BXXXXX.',
region: 'EU',
pin: 'XXXX',
autoLogin: false,
deviceUuid: 'bluelinky',
vin: 'TXXXXXXXXXXXXX3',
vehicleId: 'OS EV CZECH 20'
});
client.login();
or
const client = new BlueLinky({
username: 'mXXXX@XXXXX.de',
password: 'BXXXXX.',
region: 'EU',
pin: 'XXXX',
autoLogin: false,
deviceUuid: 'bluelinky'
});
client.login();
I've tried also this one with the same error:
const client = new BlueLinky({
username: 'mXXXX@XXXXX.de',
password: 'BXXXXX.',
region: 'EU',
autoLogin: true,
pin: 'XXXX',
deviceUuid: 'dxxxxxx9-3xxx5-4xxx-9xxf-cxxxxxxxxxe'
});
@MarkusKress The documentation is quite outdated and some properties are not needed but here are my suggestions.
Try running with the LOG_LEVEL=debug
so that we can see all the debug logs (might need to mask sensitive data).
example LOG_LEVEL=debug node bl.js
(wont work on widows, you'll want to set the var via set
)
const client = new BlueLinky({
username: 'mXXXX@XXXXX.de',
password: 'BXXXXX.',
region: 'EU',
pin: 'XXXX',
});
Another option is to double-check that you can log in via the link and you are not getting forced to take some action like changing the password. https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=6d477c38-3ca4-4cf3-9557-2a1929a94654&redirect_uri=https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/redirect
I've already tried LOG_LEVEL=debug, but did not get more information. Here the output:
LOG_LEVEL=debug node bl.js
[2020-10-19 15:24:59] debug: EU Controller created
[2020-10-19 15:24:59] debug: Bluelinky is logging in automatically, to disable use autoLogin: false
[2020-10-19 15:24:59] debug: loggin into to API
(node:24581) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Response code 400 (Bad Request)')
at t.emit (events.js:187:17)
at t.<anonymous> (/root/node_modules/bluelinky/dist/index.js:2:41022)
at /root/node_modules/bluelinky/dist/index.js:2:1955
at Object.throw (/root/node_modules/bluelinky/dist/index.js:2:2060)
at a (/root/node_modules/bluelinky/dist/index.js:2:850)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:24581) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24581) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I tried the given URL and saw the Login Screen. I tried to login with my credentials, but then I was redirected to complete empty page. The URL was: https://prd.eu-ccapi.hyundai.com:8080/api/v1/user/oauth2/redirect?code=9XLAMNRPMSQXIBRL9AUQJA&state=test I tried your URL on Deskop and Mobile. Both the same.
So I added some debug statements and I am seeing the error too. Seems related to fetching the cookies at the initial request so something on the API side could have changed.
Thank you. But how can I test this. Will be a new version (>5.2.1) availible or can I patch a file on my PC?
hey guys, if i rent a hyundai to test this out, is it possible?
You have to connect the car (using VIN) with your hyundai account for testing.
im guessing the hyundai account w/ that vin will already be made. if not then should be ok....i want to try out this api and need a hyundai. any suggestions?
I would test it, I have a Hyundai EV car for Region EU. But I have no experience about npm packages, only a little bit js programming. So I'm more a less only a user.
Markus, first you'd have to install npm and node.js on your machine, lots of how-to's to find around. Then install bluelinky (npm install bluelinky) Then create a config file (config.json) with your client definition Then run the debug program (node debug.js)
I have npm and node.js already installed. I did also an 'npm install bluelinky'. And I have to "npm install inquirer" But I did not fully understand about config.json. I've created in /root/node_modules/bluelinky the following config.json:
{
"validation_key": "",
"username": "mxxx@exxx.de",
"password": "Bxxxx.",
"vin": "Txxxxxxxxx3",
"pin": "xxxx",
"region": "EU"
}
Then I run debug.js
root@server:~/node_modules/bluelinky# node debug.js
? What Region are you in? EU
{ region: 'EU' }
Logging in...
(node:7317) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Response code 400 (Bad Request)')
at t.emit (events.js:187:17)
at t.<anonymous> (/root/node_modules/bluelinky/dist/index.js:2:41022)
at /root/node_modules/bluelinky/dist/index.js:2:1955
at Object.throw (/root/node_modules/bluelinky/dist/index.js:2:2060)
at a (/root/node_modules/bluelinky/dist/index.js:2:850)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:7317) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7317) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@MarkusKress I will publish the latest fix and it should resolve this issue.
Thanks. I've updated to 5.2.2 and it works for lock:
client.on('ready', async () => {
const vehicle = client.getVehicle('Txxxxxxxxxxxxxx3');
const response = await vehicle.lock();
console.log(response);
});
(base) root@server:~# node bluelink.js
Lock successful
But not for status():
client.on('ready', async () => {
const vehicle = client.getVehicle('Txxxxxxxxxxxxxx3');
const response = await vehicle.status();
console.log(response);
});
(node:32309) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'parsed' of undefined
at n.<anonymous> (/root/node_modules/bluelinky/dist/index.js:2:21313)
at /root/node_modules/bluelinky/dist/index.js:2:1955
at Object.next (/root/node_modules/bluelinky/dist/index.js:2:2060)
at s (/root/node_modules/bluelinky/dist/index.js:2:799)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:32309) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:32309) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Also not for start():
(node:10516) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'defrost' of undefined
unlock(), odometer(), location(), getVehicles() works. stop() works also! update() not:
(node:12977) UnhandledPromiseRejectionWarning: TypeError: vehicle.update is not a function
@MarkusKress since this fixed the issue I'll close this.
As for the status you need to pass in an object now to status, like .status({ parsed: false })
however it should not be erroring. I'll take a look and see if this is a bug.
start() and update() also does not work. .status({ parsed: false }) works.
This is the output of .status({ parsed: false }):
{ airCtrlOn: false,
engine: false,
doorLock: false,
doorOpen: { frontLeft: 0, frontRight: 0, backLeft: 0, backRight: 0 },
trunkOpen: false,
airTemp: { value: '10H', unit: 0, hvacTempType: 1 },
defrost: false,
acc: false,
evStatus:
{ batteryCharge: true,
batteryStatus: 91,
batteryPlugin: 2,
remainTime2:
{ etc1: [Object], etc2: [Object], etc3: [Object], atc: [Object] },
drvDistance: [ [Object] ],
reservChargeInfos:
{ reservChargeInfo: [Object],
offpeakPowerInfo: [Object],
reserveChargeInfo2: [Object],
reservFlag: 1,
ect: [Object],
targetSOClist: [Array] } },
ign3: true,
hoodOpen: false,
transCond: true,
steerWheelHeat: 0,
sideBackWindowHeat: 0,
tirePressureLamp:
{ tirePressureLampAll: 0,
tirePressureLampFL: 0,
tirePressureLampFR: 0,
tirePressureLampRL: 0,
tirePressureLampRR: 0 },
battery: { batSoc: 85, batState: 0 },
time: '20201020145658' }
@MarkusKress update is not a thing anymore. As for the start command please open a new issue if you found a bug.
Sorry, didn't catch about update.
Hello, I tried to connect to the hyundai server, but got constanly an error. I'm not a good programmer. I put the code below in a bl.js file and run it with
node bl.js
This is the output:
What I'm doing wrong (I've tested also 'autoLogin' and 'deviceUuid' instead of autologin'/deviceuuid') ? What is the deviceuuid/deviceUuid for?