dbweb-ch / ioBroker.tesla-motors

ioBroker Adapter for Tesla Motors Cars
MIT License
11 stars 9 forks source link

Crash when authenticating after upgrade from 0.2.3 -> 0.3.1 #42

Closed jensb closed 3 years ago

jensb commented 3 years ago

My tesla-motors adapter started the endless restart loop again and kept the car awake, so I thought this is a good time to upgrade and try 0.3.1. Again, I removed my authentication info and car ID from iobroker-data/objects.json as required before. But since then, I cannot login at all any more. This is what I get when entering my credentials and clicking on "Get Token":

2021-02-07 21:32:11.514 - debug: tesla-motors.0 (20357) Refresh of all in Task run. Current wakeupPlan is "smart" 2021-02-07 21:32:11.518 - debug: tesla-motors.0 (20357) Get all info because last Wakeup time is only 1ago. 2021-02-07 21:32:11.519 - warn: tesla-motors.0 (20357) You tried to wake up the car, but there is currently no valid Token, please configure Adapter first! 2021-02-07 21:32:12.158 - warn: tesla-motors.0 (20357) Invalid answer from Vehicle request. Error: Unauthorized 021-02-07 21:33:11.520 - debug: tesla-motors.0 (20357) Refresh of all in Task run. Current wakeupPlan is "smart" 2021-02-07 21:33:11.527 - debug: tesla-motors.0 (20357) Get all info because last Wakeup time is only 2ago. 2021-02-07 21:33:11.529 - warn: tesla-motors.0 (20357) You tried to wake up the car, but there is currently no valid Token, please configure Adapter first! 2021-02-07 21:33:12.162 - debug: tesla-motors.0 (20357) Getting Standby Info 2021-02-07 21:33:12.845 - warn: tesla-motors.0 (20357) Invalid answer from Vehicle request. Error: Unauthorized 2021-02-07 21:34:06.646 - debug: tesla-motors.0 (20357) Got a Message: getToken 2021-02-07 21:34:06.647 - info: tesla-motors.0 (20357) Try to get a token 2021-02-07 21:34:07.099 - error: 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(). 2021-02-07 21:34:07.100 - error: tesla-motors.0 (20357) unhandled promise rejection: Cannot read property 'response' of undefined 2021-02-07 21:34:07.101 - error: tesla-motors.0 (20357) TypeError: Cannot read property 'response' of undefined at /opt/iobroker/node_modules/iobroker.tesla-motors/main.js:403:87 at /opt/iobroker/node_modules/teslajs/teslajs.js:368:9 at /opt/iobroker/node_modules/teslajs/src/auth.js:129:9 at tryCallOne (/opt/iobroker/node_modules/promise/lib/core.js:37:12) at /opt/iobroker/node_modules/promise/lib/core.js:123:15 at flush (/opt/iobroker/node_modules/asap/raw.js:50:29) at processTicksAndRejections (internal/process/task_queues.js:75:11) 2021-02-07 21:34:07.606 - info: tesla-motors.0 (20357) terminating 2021-02-07 21:34:07.607 - info: tesla-motors.0 (20357) Terminated (NO_ERROR): Without reason 2021-02-07 21:34:08.167 - info: host.raspberrypi instance system.adapter.tesla-motors.0 terminated with code 0 (NO_ERROR) 2021-02-07 21:34:08.173 - info: host.raspberrypi Restart adapter system.adapter.tesla-motors.0 because enabled

I can log in normally on the tesla.com website. Does this happen because of the API v3 upgrade, or is this a different issue?

souhl commented 3 years ago

I am getting a similiar error. But not sure if its related to 0.3.1 as it looks like it happened before, but I didn't notice.

tesla-motors.0 2021-02-08 14:36:50.396 error at processTicksAndRejections (internal/process/task_queues.js:79:11)
tesla-motors.0 2021-02-08 14:36:50.396 error at flush (/opt/iobroker/node_modules/asap/raw.js:50:29)
tesla-motors.0 2021-02-08 14:36:50.396 error at /opt/iobroker/node_modules/promise/lib/core.js:123:15
tesla-motors.0 2021-02-08 14:36:50.396 error at tryCallOne (/opt/iobroker/node_modules/promise/lib/core.js:37:12)
tesla-motors.0 2021-02-08 14:36:50.396 error at /opt/iobroker/node_modules/teslajs/src/auth.js:129:9
tesla-motors.0 2021-02-08 14:36:50.396 error at /opt/iobroker/node_modules/teslajs/teslajs.js:368:9
tesla-motors.0 2021-02-08 14:36:50.396 error at /opt/iobroker/node_modules/iobroker.tesla-motors/main.js:403:87
tesla-motors.0 2021-02-08 14:36:50.396 error (371905) TypeError: Cannot read property 'response' of undefined
tesla-motors.0 2021-02-08 14:36:50.395 error (371905) unhandled promise rejection: Cannot read property 'response' of undefined
Unhandled 2021-02-08 14:36:50.394 error 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().
dbweb-ch commented 3 years ago

It is from failed authentication, and a bug in the error reporting in that case. So main issue is with login and credentials. I am still waiting for TeslaJS to update to the new auth3 method, sorry.

dbweb-ch commented 3 years ago

Resolved that now in 0.3.2, should at least not crash anymore with this.

dbweb-ch commented 3 years ago

Could you try the latest version? There were some commits regarding the new auth and I've integrated them, but I am not 100% sure if this will fully help with auth3 already.

souhl commented 3 years ago

I cannot authenticate with the 0.3.2

dbweb-ch commented 3 years ago

Did you try with latest version from github or just 0.3.2?

souhl notifications@github.com schrieb am Mo., 8. Feb. 2021, 16:57:

I cannot authenticate with the 0.3.2

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dbweb-ch/ioBroker.tesla-motors/issues/42#issuecomment-775249072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUGWCWKUSCOPRAKNMQZAKTS6ACXBANCNFSM4XH2TJYA .

souhl commented 3 years ago

Latest from github.

jensb commented 3 years ago

0.3.2 doesn't crash any more, but still doesn't authenticate. Now I get:

tesla-motors.0 | 2021-02-08 22:25:19.432 | debug | (30674) sendTo "getToken" to system.adapter.admin.0 from system.adapter.tesla-motors.0 tesla-motors.0 | 2021-02-08 22:25:19.426 | info | (30674) Username or Password invalid. No response tesla-motors.0 | 2021-02-08 22:25:18.993 | info | (30674) Try to get a token tesla-motors.0 | 2021-02-08 22:25:18.992 | debug | (30674) Got a Message: getToken tesla-motors.0 | 2021-02-08 22:25:01.758 | warn | (30674) You tried to wake up the car, but there is currently no valid Token, please configure Adapter first! tesla-motors.0 | 2021-02-08 22:25:01.752 | debug | (30674) Get all info because last Wakeup time is only 0ago. tesla-motors.0 | 2021-02-08 22:25:01.738 | debug | (30674) Refresh of all in Task run. Current wakeupPlan is "smart" tesla-motors.0 | 2021-02-08 22:25:01.736 | warn | (30674) Invalid answer from Vehicle request. Error: Unauthorized tesla-motors.0 | 2021-02-08 22:25:00.969 | debug | (30674) Getting Standby Info tesla-motors.0 | 2021-02-08 22:25:00.913 | debug | (30674) Check for Tokens and Expires tesla-motors.0 | 2021-02-08 22:25:00.912 | debug | (30674) Checking if token is valid tesla-motors.0 | 2021-02-08 22:25:00.910 | debug | (30674) All Objects installed, setting up tasks now tesla-motors.0 | 2021-02-08 22:25:00.877 | debug | (30674) Starting Tesla Motors tesla-motors.0 | 2021-02-08 22:25:00.843 | info | (30674) starting. Version 0.3.2 in /opt/iobroker/node_modules/iobroker.tesla-motors, node: v14.15.4, js-controller: 3.1.6

lobomau76 commented 3 years ago

Yes! It seems to work again! I have just updated over Adapter in ioBroker (not github) from 0.3.1. to 0.3.2. I had to enter my login/password twice, then it worked. I have all my values back :-)

bluppdiwupp commented 3 years ago

how can i update this version via iobroker?

dbweb-ch commented 3 years ago

I've just updated stable-Repo of iobroker, you should get the update automatically as soon as they merge it.

lobomau76 commented 3 years ago

how can i update this version via iobroker?

just for your information, i was using beta-Repo. That is the reason why I received it earlier.