teslamotors / vehicle-command

Apache License 2.0
443 stars 101 forks source link

error : You must provide a private key with -key-name or -key-file to execute this command #194

Closed kurb77 closed 8 months ago

kurb77 commented 8 months ago

hello, since few hours, i can't execute any command except wake. i have this error: You must provide a private key with -key-name or -key-file to execute this command

my command line is: ./lib/tesla_api/tesla-control/tesla-control -key-file ./lib/tesla_api/TeslaKeys/privatekey.pem -token-file .temp_token -debug -vin XP7XXXXXXNBXXX123 charging-start' before, all worked good, i could change amps, stop and start the charge

with debug arrg, i have this: no error, Server returned 200: OK: except the last line: 2024-02-23T13:12:00+01:00 [warn ] No session available for DOMAIN_INFOTAINMENT thank you for your help

jerome

sethterashima commented 8 months ago

It looks like your client was unable to complete a handshake with the vehicle, and the client (incorrectly) interprets the lack of an established session as implying that you didn't provide a private key on the command line when you did.

I think there was a bug fixed a while back that could lead to this behavior. Could you make sure you're on the latest version and try again?

If you're able to reproduce the bug in the latest version, please post the -debug output in full, but with the VIN redacted.

kurb77 commented 8 months ago

Hi, i made a new clone from GITHUB, and rebuild. i have the same error, here the answer with debug mod (i have add un line for help to debug)

2024-02-28T10:22:55+01:00 [debug] Set session cache file to '' 2024-02-28T10:22:55+01:00 [debug] Set keyring type to '' 2024-02-28T10:22:55+01:00 [debug] Set keyring Debug Logging to 'false' 2024-02-28T10:22:55+01:00 [debug] Client public key: 0453c664d7bb5ae5da33cb45def90c0d3125c94c27cdf8b58e6c4a38b5a66587bbf8072c51eac2984a99ba0a1797f803fa2bbaf06c5138d4b55d1e3c9b03602662 2024-02-28T10:22:55+01:00 [debug] Required OAuth parameters supplied by CLI and/or environment. Connecting over the Internet...

2024-02-28T11:20:14+01:00 [debug] Set session cache file to ''
2024-02-28T11:20:14+01:00 [debug] Set keyring type to ''
2024-02-28T11:20:14+01:00 [debug] Set keyring Debug Logging to 'false'
2024-02-28T11:20:14+01:00 [debug] Client public key: 0453c664d7bb5ae5da33cb45def90c0d3125c94c27cdf8b58e6c4a38b5a66587bbf8072c51eac2984a99ba0a1797f803fa2bbaf06c5138d4b55d1e3c9b03602662
2024-02-28T11:20:14+01:00 [debug] Required OAuth parameters supplied by CLI and/or environment. Connecting over the Internet...
2024-02-28T11:20:14+01:00 [info ] Connecting to car...
2024-02-28T11:20:14+01:00 [info ] Starting dispatcher service...
2024-02-28T11:20:14+01:00 [info ] Securing connction...
2024-02-28T11:20:14+01:00 [info ] Requesting session info from DOMAIN_INFOTAINMENT
2024-02-28T11:20:14+01:00 [info ] Requesting session info from DOMAIN_VEHICLE_SECURITY
2024-02-28T11:20:14+01:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/XP7YGCEL1NB009123/signed_command: {"routable_message":"MgIIAzoSEhBhso85snmWTMAU4XPHIqbdmgMQDbVWmG9Ian2G1W9fqt4Q7HJDCkEEU8Zk17ta5dozy0Xe+QwNMSXJTCfN+LWObEo4taZlh7v4ByxR6sKYSpm6CheX+AP6K7rwbFE41LVdHjybA2AmYg=="}
2024-02-28T11:20:14+01:00 [debug] Sending request to https://fleet-api.prd.eu.vn.cloud.tesla.com/api/1/vehicles/XP7YGCEL1NB009123/signed_command: {"routable_message":"MgIIAjoSEhCJN+bVmXv7V1JIgmsNbDx1mgMQ/spGzStjYLEuZgk8lxh4e3JDCkEEU8Zk17ta5dozy0Xe+QwNMSXJTCfN+LWObEo4taZlh7v4ByxR6sKYSpm6CheX+AP6K7rwbFE41LVdHjybA2AmYg=="}
2024-02-28T11:20:20+01:00 [debug] Server returned 200: OK: {"response":"MhISEGGyjzmyeZZMwBThc8cipt06AggDkgMQDbVWmG9Ian2G1W9fqt4Q7HpcCEUSQQT0JnH7iBaDprxkFpYcD+1lFzg/SQC5hHsEPRLueTYKWJHpBoMB8i0EqQOq2Y2bzmFRhgqDu+4E+hYB3aT52sFpGhCz0TmSZ8DO/P9LGaTPwTaeJeInAQBqJDIiCiAif7gxfm3hGWmMC5S87IvtJx/YA/nj7oEv/X2++5vvkA=="}
2024-02-28T11:20:21+01:00 [debug] Server returned 200: OK: {"response":"MhISEIk35tWZe/tXUkiCaw1sPHU6AggCeloSQQTCVqIJmq7Dmvqz4fTwe+iOqFtWBzoKTCphDCNr0yBq4zhzbgGwnGLLRPwI8lLtSPr1RY+pGMnL+34OCaOuyOvsGhC+4fTNBVXizn0cuiFluPCKJS4XAABqJDIiCiBq0kYbyGk92qiV8P3ibTigQpUEWLilJ9WDTfKQuQlFoZIDEP7KRs0rY2CxLmYJPJcYeHs="}
2024-02-28T11:20:21+01:00 [warn ] No session available for DOMAIN_INFOTAINMENT
You must provide a private key with -key-name or -key-file to execute this command
err: cannot send authenticated command before establishing a vehicle session (i have add this log on the code)

my vin is XP7YGCEL1NB009123

thank you for your help

sethterashima commented 8 months ago

It looks like the problem is that the client ignores handshake responses from the server if there's too much latency. This is by design. But it still behaves as though the server completed its handshake and continues, which is a bug.

You can increase these two timeout values as a work-around until the bug is fixed. They should probably be higher, anyway.

Thanks for your report!

kurb77 commented 8 months ago

Hello, i have increase these Two timeout values (5 -> 15), it's ok, i can again send orders to my car

thank you jerome