SondreNjaastad / node-red-contrib-bluelinky

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Canadian EV - Sometimes status return undefined

guyaumetremblay opened this issue · comments

Hi,

Sometimes, I got status: undefined from the car status node. Sometimes, calling it a second time work.
Capture d’écran, le 2021-01-17 à 16 34 19

I use the not parsed version, with do refresh = true.

I have a Canadian Kona EV.

Not sure how to provide more informations to debug this. Let me know...
Also, let me know if this should be open in https://github.com/Hacksore/bluelinky instead.

Thanks!

I feel like I've seen this before in the US region and it might have to do with refreshing the token.

Will try to pull status again after 30 minutes to see if I get undefined as well and provide an update here.

Was able to reproduce after waiting 30 minutes so something is up, will take a look and see if I can find the root cause.

image

So I had a look and this seems to be the fix for US vehicles, I'll look over the code for CA and see if I can apply the same thing. In short, this is going to require a bluelinky update to fix the issue.

Hacksore/bluelinky@8ca38af

@Hacksore yep seems to me that there is the same error in the calculation of the variable "shouldRefreshToken" @ https://github.com/Hacksore/bluelinky/blob/558af06b0fbd364201202abbfc4f47066a0ca192/lib/controllers/canadian.controller.ts#L22

European controller has the same version than the american one.

Tell me if you need someone to test the fixed version.

@guyaumetremblay just committed the working of v6.0.0-alpha1 to the bluelinky repo and there is an open PR for it to be released.

Once that is merged/published I can try updating this node-red repo and see if that fixes this issue.

@Hacksore Hi, I'm sorry but I still received undefined with the new version. Here is what I did in my flow:

  • call Door unlock - > received "Unlock sucessful"
  • wait 5sec
  • call Get status - > received "status: undefined"

Calling "Get status" only, after or before, worked! (see the debug screenshot)

Screenshot_20210124-145027_Home Assistant
Screenshot_20210124-145421_Home Assistant

@guyaumetremblay ok let me test again and see what I find :)

Ok so I don't quite think this is a token issue anymore as the tokens in CA last a whole day from what I found. @guyaumetremblay can we track this in a separate issue if you don't mind.

"expireIn": 86400