teslamotors / vehicle-command

Apache License 2.0
445 stars 102 forks source link

Proxy returns HTTP 500 when sending command to sleeping vehicle #186

Open andig opened 9 months ago

andig commented 9 months ago

Note this log for retrieving data vs. sending commands (coming from https://github.com/evcc-io/evcc/issues/12294#issuecomment-1948394229):

[tesla-proxy] TRACE 2024/02/16 11:28:24 GET https://tesla.evcc.io/api/1/vehicles/xxx/vehicle_data
[tesla-proxy] TRACE 2024/02/16 11:28:24 {"response":null,"error":"vehicle unavailable: vehicle is offline or asleep","error_description":""}
[lp-1  ] ERROR 2024/02/16 11:28:24 vehicle odometer: asleep

[tesla-proxy] TRACE 2024/02/16 11:29:54 POST https://tesla.evcc.io/api/1/vehicles/xxx/command/set_charging_amps
[tesla-proxy] TRACE 2024/02/16 11:29:56 {"charging_amps": 32}
--
{"response":null,"error":"vehicle unavailable: vehicle is offline or asleep","error_description":""}
[lp-1  ] ERROR 2024/02/16 11:29:56 max charge current 32A: 500 Internal Server Error

Sending commands to proxy results in HTTP 500 (still need to verify behaviour for using fleet api directly). Imho it should return HTTP 200 and indicate the error in the body same as with executing GET requests.

rawmean commented 9 months ago

I think the problem is that the vehicle is asleep. Until a few days ago, Tesla server returned cached data when the vehicle was asleep. Somehow they stopped doing that. I'm not sure if this is a bug or if they change the behavior. I reported it here: #178

andig commented 9 months ago

Until a few days ago, Tesla server returned cached data when the vehicle was asleep.

This is NOT what this issue is about. This issue is about vehicle asleep for GET requests returning HTTP 200 and for POST requests HTTP 500. The bahaviour is inconsistent.

rawmean commented 9 months ago

This is NOT what this issue is about. This issue is about vehicle asleep for GET requests returning HTTP 200 and for POST requests HTTP 500. The bahaviour is inconsistent.

I see. But, I get HTTP 408 when I send a vehicle_data request. Don't you? I don't send the requests using the proxy. Maybe that's why?

andig commented 8 months ago

I see. But, I get HTTP 408 when I send a vehicle_data request. Don't you? I don't send the requests using the proxy. Maybe that's why?

Lets not get side-tracked. This issue is about sending commands via proxy.