bluelinky icon indicating copy to clipboard operation
bluelinky copied to clipboard

"Invalid request body - Invalid deviceId" after a write command

Open cr0ste opened this issue 2 years ago • 4 comments

Hi,

I know that this error message was there during login and solved rather soon. Login is also working fine for me, as well as reading the vehicle status.

An extract of my code:

client = new BlueLinky({
            username: kiaConfig.username,
            password: kiaConfig.password,
            brand: niroEVConfig.brand,
            region: kiaConfig.region,
            pin: niroEVConfig.pin,
            autoLogin: false
});
await client.login();
vehicle = await client.getVehicle(niroEVConfig.vin);
await vehicle.status({ refresh: false, parsed: false });

Now If lock the car via await req.vehicle.lock(); this also works fine.

But if I now try to read status again: await vehicle.status({ refresh: false, parsed: false }); it fails with "Invalid request body - Invalid deviceId. "

Perhaps I'm doing something wrong? Do I need a fresh login after the lock command?

  • OS: Docker container based on node:current-alpine
  • Bluelinky Version: 8.2.1
  • Region: EU
  • Brand: Kia

cr0ste avatar Oct 04 '23 21:10 cr0ste

In our python version we solved this by adding a new device call within our actions to refresh the device ID. Most likely not the right way to do it but it works.

cdnninja avatar Nov 26 '23 23:11 cdnninja

I solved it by creating a new BlueLinky instance (client) after each writing request (e.g. startaircond, lock, etc.). Also not sure if this is really a solution, but works for me.

Just reading the vehicle status does not require a new instance.

cr0ste avatar Feb 09 '24 15:02 cr0ste