Giter Site home page Giter Site logo

hacksore / bluelinky Goto Github PK

View Code? Open in Web Editor NEW
319.0 28.0 74.0 2.22 MB

An unofficial nodejs API wrapper for Hyundai bluelink and Kia UVO

Home Page: https://bluelinky.readme.io

License: MIT License

JavaScript 0.92% TypeScript 99.08%
hyundai api-wrapper api bluelink unofficial kia nodejs uvo

bluelinky's People

Contributors

altagir avatar bchiodo avatar bitnimble avatar chubby1968 avatar djensenius avatar flock82 avatar gruijter avatar guyaumetremblay avatar hacksore avatar nename0 avatar neopix avatar pharris2411 avatar pierrelevres avatar plosfas avatar sacua avatar simieski avatar sondrenjaastad avatar toraidl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluelinky's Issues

update() will give a error: 'TypeError: vehicle.update is not a function'

bluelink.js:

client.on('ready', async () => {
const vehicle = client.getVehicle('Txxxxxxxxxxxx3');
const response = await vehicle.update();
console.log(response);
});

fails with

node bluelink.js 
(node:11992) UnhandledPromiseRejectionWarning: TypeError: vehicle.update is not a function
    at t.client.on (/root/bluelink.js:30:32)
    at t.emit (events.js:198:13)
    at t.<anonymous> (/root/node_modules/bluelinky/dist/index.js:2:40989)
    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:11992) 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:11992) [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.

Daily Remote Service Request Limit?

[Update] Bringing to the top. Spoke with Blue Link US support and...

  • 10 requests per action type a day. i.e. The lock() method will only work 10 times a "day".
  • 30 requests overall per day. i.e. If I called status() 25 times, then I could only call lock() 5 times before being blocked.

Hi!

I started developing a plugin using your wonderful library today! Thanks so much for the work creating a wrapper around this API!

However, I ran into, rather quickly an API error on the Vehicle.status method, https://github.com/Hacksore/bluelinky/blob/master/lib/vehicles/american.vehicle.ts#L167.

I was polling the endpoint once every 10 seconds, and maybe queried it 100 times maximum, if that.

{
    "errorSubCode": "HT_534",
    "systemName": "HATA",
    "functionName": "remoteVehicleStatus",
    "errorSubMessage": "HATA remoteVehicleStatus service failed while performing the operation RemoteVehicleStatus",
    "errorMessage": "You have exceeded the daily remote service request limit. Your last request was not processed.",
    "errorCode": 502,
    "serviceName": "RemoteVehicleStatus"
}

A questions? And an Idea.

  • Whats the maximum daily request limit? I can't seem to find that documented anywhere.
  • The promise doesn't throw an exception on non 200 response codes, ideally this would raise an exception instead of having to add console.log statements to the compiled JS.

Update Status for EU

I noticed that for Canada and America the 'status' can be refreshed/updated but for Europe this only gets the last known status without updating it. Is there a reason for this? It would be really useful to be able to refresh the status for Europe too.

Calling ${EU_BASE_URL}/api/v2/spa/vehicles/${this.config.id}/status seems to do it.

start/stop command doesn’t work on US electric vehicles

Using “ignitionstart” service command on an EV vehicle so far only confirm for 2019 Ioniq Electric Limited, gives the following error when run

“ {"E_IFRESULT":"E:Failure","E_IFFAILMSG":"Bad Gateway","RESPONSE_STRING":{"errorSubCode":"GEN","systemName":"BLODS","errorSubMessage":"Feature Status is OFF","errorMessage":"We're sorry, your vehicle does not support this feature.","errorCode":502}}”

Changing the service to “postRemoteFatcStart” fixes the issue

EDIT::
Same issue with stop command, ignitionstop doesn’t work but postRemoteFatcStop does work

Implementation discussion - Design Pattern & Region Inconsistencies

So currently we are implementing the library with a "constructor" pattern which allows us to create the class instance and use it.

We also are letting the developer implement the login method explicitly but really that's not something you should have to manage.

const config = require('./config.json');
const BlueLinky = require('bluelinky');

const client = new BlueLinky({
  username: config.username,
  password: config.password
});

(async () => {
  // do login explicitly
  const auth = await client.login();

  // we register and wait for a vehicle to get its features
  // this will query the api to gather the list for use on the next method(s)
  const vehicle = await client.registerVehicle(config.vin, config.pin);

  // call the status method
  const status = await vehicle.status();
  console.log(status);
})();

One solution I have to make this a bit more developer-friendly is to move to a factory pattern.

const config = require('./config.json');
const BlueLinky = require('bluelinky');

// login was now moved into here implicitly
const client = BlueLinky.createClient({
  username: config.username,
  password: config.password
});

client.on('ready', async () => {
  // we register and wait for a vehicle to get its features
  // this will query the api to gather the list for use on the next method(s)
  const vehicle = await client.registerVehicle(config.vin, config.pin);

  // call the status method
  const status = await vehicle.status();
  console.log(status);
});

Now with that all being said, it seems that Canada and US API are rather similar by nature even though the endpoints are vastly different. However, from what @SondreNjaastad it looks like they don't use the VIN number for controlling their vehicles but a vehicle identifier.

This seems problematic as in US/Canada we do:

 const vehicle = await client.registerVehicle(config.vin, config.pin);

But sounds like the EU will be doing:

const vehicle = await client.registerVehicle(<vehicleIndentifier>, config.pin);

If something here stands out to you please feel free to discuss.

Improvement for Climate Control

In the Bluelink App it is possible to use two diferent Climate Controls. Once with Schedule and the other one for directly climate.
When i use the directly Climate then is the duration time 15 minutes. When i use the Schedule then is the duration time is 30 minutes. In Bluelinky i can "only" use the 15 minutes Mode. Could it be possible to add the Schedule in Bluelinky that i can change the schedule via Smart Home for example? Or is an another possibility to use the 30 Minute Mode?

Cannot log in Response code 400 (Bad Request)

Hi,

today I tried the bluelinky lib on two systems - MacOS 10.13 and windows 10 - both got the same node.js environment. As shown in docs I changed my credentials an my VIN. When now trying to log in / creating the client as shown I always get

Logging in...
(node:68683) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Response code 400 (Bad Request)')
at t.emit (events.js:304:17)
at t. (/Users/thomas/node_modules/bluelinky/dist/index.js:2:41053)
at /Users/thomas/node_modules/bluelinky/dist/index.js:2:1955
at Object.throw (/Users/thomas/node_modules/bluelinky/dist/index.js:2:2060)
at a (/Users/thomas/node_modules/bluelinky/dist/index.js:2:850)
at processTicksAndRejections (internal/process/task_queues.js:93:5)

The region is EU - I can log in via web, I can log in via iOS App.
The console output is from debug.js.
The car it self has the new infotainment software - no three splitted screen.

I tried to downgrade from 5.2.3 to 5.2.2

Failed requests for American car

It appears that some of the methods for the AmericanVehicle class do not work properly. Upon castling start, lock and a few other methods the call results in either a 400 or 503 Bad Gateway error.
However, the odometer call works successfully for me.

I took a look at the class and it looks like the request urls are being built in different ways, also outputting the Error object shows that the urls are malformed. For instance i see that some of the urls have BASEURL prepended while some don’t.

Is this bug result of some sort of refactoring?

Feature request: add refresh flag to vehicle.location function

In EU the vehicle.location call forces a refresh of the car, while sometimes the cached location is enough to handle. This cached location can be read from vehiclestatus.location when vehiclestatus is called with (refresh=false). It might be more in line with vehiclestatus if vehicle.location can also be called with a refresh parameter (eq. defaulting to true) and for the non-refresh option vehiclestatus.location is returned.

Prepare for simpeler maintenance of Kia UVO EU Fork

If you would change the following lines in european.controller.ts and in constants/europe.ts the Kia-port would work by only changing the constants/europe.ts.
That way you don't have to maintain the Kia part, but for maintenance of the fork it is easy, since only europe.ts has to be updated.

The changes I propose underneath have been tested on KiaUVO. Works flawlessly.

In european.controller.ts
line1: import { EU_CONSTANTS, EU_BASE_URL, EU_BASE_HOST, EU_CONTENT_LENGTH, EU_CLIENT_ID } from './../constants/europe';
line 102: 'ccsp-service-id': EU_CLIENT_ID,
line 105: 'Host': EU_BASE_HOST,
line 135: 'Content-Length': EU_CONTENT_LENGTH,
line 136: 'Host': EU_BASE_HOST,

constant file europe.ts would then look like for Hyundai BlueLink
export const EU_BASE_URL = 'https://prd.eu-ccapi.hyundai.com:8080';
export const EU_BASE_HOST = 'prd.eu-ccapi.hyundai.com:8080';
export const EU_CONTENT_LENGTH = '154'
export const EU_CLIENT_ID = '6d477c38-3ca4-4cf3-9557-2a1929a94654'
export const EU_ENDPOINTS = {
session: ${EU_BASE_URL}/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=${EU_CLIENT_ID}&redirect_uri=${EU_BASE_URL}/api/v1/user/oauth2/redirect,
login: ${EU_BASE_URL}/api/v1/user/signin,
language: ${EU_BASE_URL}/api/v1/user/language,
redirectUri: ${EU_BASE_URL}/api/v1/user/oauth2/redirect,
token: ${EU_BASE_URL}/api/v1/user/oauth2/token,
};
export const EU_CONSTANTS = {
basicToken:
'Basic NmQ0NzdjMzgtM2NhNC00Y2YzLTk1NTctMmExOTI5YTk0NjU0OktVeTQ5WHhQekxwTHVvSzB4aEJDNzdXNlZYaG10UVI5aVFobUlGampvWTRJcHhzVg==',
GCMSenderID: '199360397125',
};

constant file europe.ts would then look like for KIA
export const EU_BASE_URL = 'https://prd.eu-ccapi.kia.com:8080';
export const EU_BASE_HOST = 'prd.eu-ccapi.kia.com:8080';
export const EU_CONTENT_LENGTH = '150'
export const EU_CLIENT_ID = 'fdc85c00-0a2f-4c64-bcb4-2cfb1500730a'
export const EU_ENDPOINTS = {
session: ${EU_BASE_URL}/api/v1/user/oauth2/authorize?response_type=code&state=test&client_id=${EU_CLIENT_ID}&redirect_uri=${EU_BASE_URL}/api/v1/user/oauth2/redirect,
login: ${EU_BASE_URL}/api/v1/user/signin,
language: ${EU_BASE_URL}/api/v1/user/language,
redirectUri: ${EU_BASE_URL}/api/v1/user/oauth2/redirect,
token: ${EU_BASE_URL}/api/v1/user/oauth2/token,
};
export const EU_CONSTANTS = {
basicToken:
'Basic ZmRjODVjMDAtMGEyZi00YzY0LWJjYjQtMmNmYjE1MDA3MzBhOnNlY3JldA==',
GCMSenderID: '199360397125',
};

Deprecated packages are used.

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated [email protected]: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142

npm WARN deprecated [email protected]: this library is no longer supported

For request you could e.g. move to Axios: https://www.npmjs.com/package/axios

Or other alternatives here: request/request#3143

Works initially, but after some time requests fail & return 'token is expired' message

I am running bluelinky on a raspberry pi 4, using this code to start a web daemon listening for commands. It works great when I first launch it, but after some period of time commands stop working and I get this error back instead:

/lock 192.168.1.99 token is expired, refreshing access token TypeError: Cannot read property 'RESPONSE_STRING' of null at Vehicle.<anonymous> (/home/pi/Documents/node_modules/bluelinky/dist/index.js:149:34) at Generator.next (<anonymous>) at fulfilled (/home/pi/Documents/node_modules/bluelinky/dist/index.js:52:58) at processTicksAndRejections (internal/process/task_queues.js:93:5)

I don't know what the exact timeout for this is. I'm sure it's at least an hour, because I've seen commands succeed nearly an hour after starting it.

Raw Payload

For each endpoint, do you have an example of the raw payload (with sensitive information removed) ?

Hyundai API documentation?

Congrats on a very cool project, looks amazing. I'm a new Kona Electric owner, so I'm quite interested in this and can think of a few uses. I am wondering where/how you got the details on the underlying Hyundai API? Did you just trap the network traffic to/from the app? Is there an official Hyundai source for the documentation? I would love to see all of what they expose.

Thank you very much for this. Good luck with it,
--Julian

Error in return from .status() function : UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined at e.<anonymous> (/home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:9467)

Error in return from .status() function : UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined at e. (/home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:9467)

I am trying the code shown below. All functions except .status() seem to be working. The .status() seems to return correct response from Bluelink, but something seems to be crashing in parsing the returned data. I have tried several different formats of arguments to the .status() call and all fail the same. Thanks in advance for your help! -- Dave

#!/usr/bin/env node

const BlueLinky = require('bluelinky');

const client = new BlueLinky({
  username: '[email protected]',
  password: '1234',
  region: 'US',
  pin: '1234'
});

var vehicle;
var status;

client.on('ready', async () => {

  console.log('getVehicle() ----------------------------------------------------------------------------');
  vehicle = client.getVehicle('XXXXXXXXXXXXXXXXX');
  status = await vehicle;
  console.log(status);

  console.log('location()   ----------------------------------------------------------------------------');
  status = await vehicle.location();
  console.log(status);

  console.log('status()     ----------------------------------------------------------------------------');
  status = await vehicle.status({ parsed: false, refresh: false });
  //status = await vehicle.status();
  console.log(status);


});

==================================

location() ----------------------------------------------------------------------------
[2020-08-01 14:51:06] debug: Token is all good, moving on!
[2020-08-01 14:51:44] debug: {"head":178,"coord":{"alt":41.0,"lon":-123.123456,"type":0,"lat":123.123456},"accuracy":{"pdop":13,"hdop":7},"time":"2020-08-01T21:46:10Z","speed":{"unit":1,"value":0}}
{
latitude: 123.123456,
longitude: -123.123456,
altitude: 41,
speed: { unit: 1, value: 0 },
heading: 178
}
status() ----------------------------------------------------------------------------
[2020-08-01 14:51:44] debug: Token is all good, moving on!
[2020-08-01 14:51:52] debug: {"hataTID":"0zfFAuxxxx-rJjwlyy_6Xg","vehicleStatus":{"dateTime":"2020-08-01T20:57:58Z","acc":false,"trunkOpen":false,"doorLock":false,"defrostStatus":"false","transCond":true,"doorLockStatus":"false","doorOpen":{"frontRight":0,"frontLeft":0,"backLeft":0,"backRight":0},"airCtrlOn":false,"airTemp":{"unit":0,"hvacTempType":0,"value":"01H"},"evStatus":{"valueDiff":0,"remainTime2":{"etc3":{"unit":1,"value":0},"etc2":{"unit":1,"value":0},"atc":{"unit":1,"value":0},"etc1":{"unit":1,"value":0}},"evIgnitionStatus":true,"batteryPlugin":0,"timeDiff":1,"batteryCharge":false,"batteryStatus":99,"remainTime":[],"drvDistance":[{"rangeByFuel":{"gasModeRange":{"unit":3,"value":597.0},"totalAvailableRange":{"unit":3,"value":626.0},"evModeRange":{"unit":3,"value":29.0}},"type":2}]},"battery":{"batSignalReferenceValue":{},"batSoc":67,"batState":0,"sjbDeliveryMode":0},"ign3":true,"ignitionStatus":"false","lowFuelLight":false,"sideBackWindowHeat":0,"engine":false,"defrost":false,"hoodOpen":false,"airConditionStatus":"false","steerWheelHeat":0,"tirePressureLamp":{"tirePressureWarningLampRearLeft":0,"tirePressureWarningLampFrontLeft":0,"tirePressureWarningLampFrontRight":0,"tirePressureWarningLampAll":0,"tirePressureWarningLampRearRight":0},"trunkOpenStatus":"false"}}
(node:19974) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'value' of undefined
at e. (/home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:9467)
at /home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:2098
at Object.next (/home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:2203)
at n (/home/user/bluelinky/node_modules/bluelinky/dist/index.js:1:936)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:19974) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:19974) [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.

lock/unlock not working - American Vehicles

When trying to do lock via "/ac/v2/rcs/rdo/off", get the response below in figure 1. When doing the lock command via MyHundai android app, it works without issue. Perhaps there's another api call to do unlock?

Figure 1.
{
"errorSubCode": "GEN",
"systemName": "HATA",
"functionName": "remoteDoorLock",
"errorSubMessage": "HATA remoteDoorLock service failed while performing the operation RemoteDoorLock",
"errorMessage": "We're sorry, but we could not complete your request. Please try again later.",
"errorCode": 502,
"serviceName": "RemoteDoorLock"
}

Support for bluelink in Canada

const auth = await client.login();

I always get an empty auth here. username and password are correct.
should i enable something to access API ?

Edit: turns out this is related to the same US API service not being compatible with Canada vehicles.

@EuropeControllerLogin: AuthCode was not found

Anybody else experiencing a "@EuropeControllerLogin: AuthCode was not found" error when trying to poll a EU EV on the Hyundai servers? The script was working perfectly before. Stoped working a couple of days ago. Bluelinky version 5.2.3.

Testing with the debug.js script + config.json confirms the problem:

$ node ./debug.js
? What Region are you in? EU
{ region: 'EU' }
Logging in...
(node:8797) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('@EuropeControllerLogin: AuthCode was not found')
    at t.emit (events.js:304:17)
    at t.<anonymous> (/Users/x/Code/HyundaiKona/bluelinky/dist/index.js:2:41136)
    at /Users/x/Code/HyundaiKona/bluelinky/dist/index.js:2:1955
    at Object.throw (/Users/x/Code/HyundaiKona/bluelinky/dist/index.js:2:2060)
    at a (/Users/x/Code/HyundaiKona/bluelinky/dist/index.js:2:850)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8797) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8797) [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.

No Access anymore

Since today 21-02-2021 i didn't get any access anymore. From a Hyundai guy I heard that they want to change the authentication process. I'am user of Europe maybe it is only an issue in Europe.

Sister project: Androblue

Hi :)
So... This is not a bug! I wanted to thanks the work of bluelinky. Using the API documentation of bluelinky, I created the AndroBlue project, an Android application that can be use to send command to the Ioniq EV 2020 in Canada.

@EuropeControllerLogin: AuthCode was not found'

root@aec0b057cea3:/usr/local/lib/node_modules/bluelinky# node debug.js
? What Region are you in? EU
{ region: 'EU' }
Logging in...
(node:6104) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('@EuropeControllerLogin: AuthCode was not found')
at t.emit (events.js:187:17)
at t. (/usr/local/lib/node_modules/bluelinky/dist/index.js:2:40208)
at /usr/local/lib/node_modules/bluelinky/dist/index.js:2:1955
at Object.throw (/usr/local/lib/node_modules/bluelinky/dist/index.js:2:2060)
at a (/usr/local/lib/node_modules/bluelinky/dist/index.js:2:850)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6104) 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:6104) [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.

Not working for EU Kia e-niro 2020 (UVO app)

Thx for revere engineering the API! I assume that the Hyundai bluelinky API is the same as what Kia UVO connect is using. But I'm not sure :)

When I try below code, the 'ready' event is never triggered. I only get this log [2020-07-16 17:20:17] info: { "test": 1}

const client = new BlueLinky({
		username: '[email protected]',
		password: 'mySecrtePwd',
		region: 'EU',
		pin: '1234',
	});

	client.on('ready', async () => {
		console.log('READY!!!');
		const vehicle = await client.getVehicles();
		console.log(vehicles);
	});

all branched: reverse function in util.ts and prettier temperature in output european.vehicle.ts

If setting temperature in config is done in degrees, and then converted to hex before sending it to the car, wouldn't it be prettier to get temperature from the car in hex and then display it in degrees? Therefore we need a change in european.vehicle.ts and a reverse temp/hex conversionfunction in util.ts:

european.vehicle.ts
from:

import { getTempCode } from '../util';`
to: `import { getTempFromCode, getTempCode } from '../util';

from: temperatureSetpoint: vehicleStatus.airTemp.value,
to: temperatureSetpoint: getTempFromCode(vehicleStatus.airTemp.value),

util.ts add:

export const getTempFromCode = (code: string): number => {
  switch (code) {
    case '02H':
      return 15.0;
    case '03H':
      return 15.5;
    case '04H':
      return 16.0;
    case '05H':
      return 16.5;
    case '06H':
      return 17.0;
    case '07H':
      return 17.5;
    case '08H':
      return 18.0;
    case '09H':
      return 18.5;
    case '0AH':
      return 19.0;
    case '0BH':
      return 19.5;
    case '0CH':
      return 20.0;
    case '0DH':
      return 20.5;
    case '0EH':
      return 21.0;
    case '0FH':
      return 21.5;
    case '10H':
      return 22.0;
    case '11H':
      return 22.0;
    case '12H':
      return 23.0;
    case '13H':
      return 23.5;
    case '14H':
      return 24.0;
    case '15H':
      return 24.5;
    case '16H':
      return 25.0;
    case '17H':
      return 25.5;
    case '18H':
      return 26.0;
    case '19H':
      return 26.5;
    case '1AH':
      return 27.0;
    case '1BH':
      return 27.5;
    case '1CH':
      return 28.0;
    case '1DH':
      return 28.5;
    case '1EH':
      return 29.0;
    case '1FH':
      return 29.5;
    case '20H':
      return 30.0;
    default:
      throw new Error('temperature out of bounds! min: 15.0* max: 30*, max step: 0.5');
  }

@EuropeControllerLogin: AuthCode was not found

Since some days I'm not able to get data anymore. Any changes in the service?

(node:10558) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('@EuropeControllerLogin: AuthCode was not found') at t.emit (events.js:182:17) at t.<anonymous> (/opt/fhem/node_modules/bluelinky/dist/index.js:2:41053) at /opt/fhem/node_modules/bluelinky/dist/index.js:2:1955 at Object.throw (/opt/fhem/node_modules/bluelinky/dist/index.js:2:2060) at a (/opt/fhem/node_modules/bluelinky/dist/index.js:2:850) at processTicksAndRejections (internal/process/task_queues.js:86:5) (node:10558) 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:10558) [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.

Add missing request for EU

EU added a new requirement for the language endpoint in order to log in so we need to add this to the controller.

Cannot read property 'drvDistance' of undefined for non-EV vehicles.

When requesting the vehicle.status({parsed: false}) for a non-EV vehicle, an error is thrown Cannot read property 'drvDistance' of undefined

Can you please make it that 'missing' parameters, like evStatus, do not cause a crash when requesting the non-parsed status?

Thx!

Got always 'Response code 400 (Bad Request)'

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

const BlueLinky = require('bluelinky');
const client = new BlueLinky({
 username: '[email protected]',
 password: 'xyxyxxy',
 region: 'EU',
 pin: '1234',
 autologin: true,
 deviceuuid: 'x'
});

This is the output:

(node:30736) 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:30736) 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:30736) [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.

What I'm doing wrong (I've tested also 'autoLogin' and 'deviceUuid' instead of autologin'/deviceuuid') ? What is the deviceuuid/deviceUuid for?

Enable Kia cars in Europe

This wonderful project is aimed ad Hyundai cars. Effectively Hyundai and Kia use the same apps, websites, interfaces.

For Europe, replacing Hyundai to Kia in EU_BASE_URL constant (in lib/constants.ts) would open up this project to Kia drivers too.

export const EU_BASE_URL = 'https://prd.eu-ccapi.kia.com:8080';

Might it be possible to somehow implement that? Choosing a brand in the parameters and change base_url accordingly?

develop-branch: EU vehicle.location() timeout

I updated to the bluelinky@next version and now i don't get the location of the car.

In the master-Branch the location is extracted from the status-request, in the develop-branch it is requested via the .../location-endpoint of the API.

The request to the location-endpoint ends with a timeout in my case. (car inside, no gps-available if this is important)

The status request with {refresh: true} is working, so in general there is a connection to the car possible at the moment of the request.

For now i will switch to the master branch to get the location info back.

car: 2020 Kona 64kWh, EU-Endpoint

EU vehicle should have a default start config

client.on('ready', async () => {
const vehicle = client.getVehicle('Txxxxxxxxx3');
const response = await vehicle.start({ parsed: false });
console.log(response);
});
(node:21502) UnhandledPromiseRejectionWarning: Error: temperature out of bounds! min: 14.0* max: 30*, max step: 0.5
    at R (/root/node_modules/bluelinky/dist/index.js:2:14755)
    at n.<anonymous> (/root/node_modules/bluelinky/dist/index.js:2:16676)
    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:21502) 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:21502) [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.

Support for gen 1 vehicles

{ result:
{ errorSubCode: 'GEN',
functionName: 'remoteDoorUnLock',
errorSubMessage:
'We encountered an error retrieving the vehicle details: nadid',
errorMessage:
'We encountered an error retrieving your vehicle information. Please try again later or contact the call center.',
errorCode: 502 },
status: 'E:Failure',
errorMessage: 'Bad Gateway' }

I always get this error, my BlueLink app works correclty so I am n ot sure why I am getting this, any ideas?

Hyundai Kona eletric range always zero (0)

Hi, I own a czech 2020 Kona eletric and like bluelinky so far!

In status->evStatus->driveDistance->rangeByFuel->evModeRange is always 0:

{
rangeByFuel: {
evModeRange: { value: 0, unit: 1 },
totalAvailableRange: { value: 0, unit: 1 }
},
type: 2
}

Is it possible to get the calculated remaining range from the vehicle? The bluelink app displays the value. Does it calculate it on it's own?

node version: 6.14.8
bluelinky version: 5.2.2

Thank you!

Deprecated dependencies used

Describe the bug
When installing the NPM package ([email protected]) I get warnings about the use of deprecated packages

Usefull info(please complete the following information):

  • OS: Windows
  • Bluelinky Version 6.0.0-alpha
  • Region: EU

Additional context

>npm i bluelinky
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported

> [email protected] postinstall .....\node_modules\protobufjs
> node scripts/postinstall

+ [email protected]
added 136 packages from 156 contributors and audited 138 packages in 32.806s

No vehicles detected with Hyundai Kona 2020

The brand new 2020 Hyundai Kona with BlueLink app is not working with bluelinky. The official app works perfectly. Can someone help me?

When I try to get the vehicle information with below code I only got:

[2020-07-25 21:38:50] info: {
  "test": 1
}
const client = new BlueLinky({
		username: '[email protected]',
		password: 'pwd',
		region: 'EU',
		pin: '0000',
	});

	client.on('ready', async () => {
		console.log('am I getting here?');
		const vehicle = await client.getVehicles();
		console.log(vehicles);
	});

Setting Charge Limit

Hi Folks

Does anyone know if it's possible to set the charge limit through the API? Can't see anything documented but maybe someone knows something I don't? I presume it's possible through the API as it can be done via the app, but maybe not implemented in Bluelinky yet?

Ta

engine.range undefined

Describe the bug
VehicleStatus engine.range is undefined. It always returns this value for me. None of the other values in the payload are undefined. Vehicle is a US 2021 Kona EV.

Usefull info(please complete the following information):

  • OS: Linux Debian Buster
  • Bluelinky Version 6.0.0
  • Region: US

Additional context
Snip from update payload:

engine: {
    ignition: false,
    adaptiveCruiseControl: false,
    range: undefined,
    charging: false,
    batteryCharge12v: 85,
    batteryChargeHV: 85
  }

I don't really know how to instrument this to get raw response data as I'm using bluelinky as an end-user of another project. More info in SteffeyDev/homebridge-hyundai-bluelink#7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.