wimaha / TeslaBleHttpProxy

TeslaBleHttpProxy is a program written in Go that receives HTTP requests and forwards them via Bluetooth to a Tesla vehicle. The program can, for example, be easily used together with evcc.
Apache License 2.0
11 stars 0 forks source link

Don't retry if the command is not possible for non-communication related reasons #13

Closed gauner1986 closed 5 days ago

gauner1986 commented 6 days ago

For example if the car is not charging, charging cannot be stopped:

2024/06/27 01:00:52 INFO received command command=charge_stop VIN=xxx body=map[] 2024/06/27 01:00:53 INFO handle command command=charge_stop VIN=xxx 2024/06/27 01:00:56 WARN failed to stop charge: car could not execute command: not_charging 2024/06/27 01:00:56 INFO retrying in 3 seconds 2024/06/27 01:01:02 WARN failed to stop charge: car could not execute command: not_charging 2024/06/27 01:01:02 INFO retrying in 6 seconds 2024/06/27 01:01:11 WARN failed to stop charge: car could not execute command: not_charging 2024/06/27 01:01:11 INFO retrying in 12 seconds 2024/06/27 01:01:27 WARN failed to stop charge: car could not execute command: not_charging 2024/06/27 01:01:27 INFO retrying in 24 seconds 2024/06/27 01:01:54 WARN failed to stop charge: car could not execute command: not_charging 2024/06/27 01:01:54 INFO retrying in 48 seconds 2024/06/27 01:02:46 ERRO stop retrying after 6 attempts 2024/06/27 01:02:46 ERRO The command was canceled. command=charge_stop err="failed to stop charge: car could not execute command: not_charging"

The same goes for starting charging when the car is already charging. That fault would be is_charging.

IMHO retrying doesn't make sense in these cases. The retry then clogs the command queue while other requests that make more sense could be executed.

wimaha commented 5 days ago

Thank you! I have made an update so these command. So we don't retry if the vehicle is already charging respectively has stopped charging.