bassmaster187 / TeslaLogger

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
https://www.teslalogger.de
GNU General Public License v3.0
518 stars 171 forks source link

Token not refreshed when calling webserver endpoints #1330

Open mss1010 opened 4 months ago

mss1010 commented 4 months ago

Append Logfile

08.07.2024 08:00:01 : #2[Thread Pool Worker:1093]: PostCommand: command/set_sentry_mode - {"on":false} 08.07.2024 08:00:01 : #2[Thread Pool Worker:1093]: Use ProxyServer 08.07.2024 08:00:02 : #2[Thread Pool Worker:1094]: Response: {"error":"token expired (401)"}

Describe the bug I try to call the command endpoint on the internal webserver according to https://github.com/bassmaster187/TeslaLogger/blob/master/TeslaLogger/WebServer.md

I have the Fleet API active. When I do this shortly after doing other requests, or when the car was online shortly before, it works. But After some hours the token expires and you get the above error. It seems, that for calling the webserver, a refresh token process is not applied.

To Reproduce Steps to reproduce the behavior:

Leave the car offline for some hours (3-6 ? I dont know how long the Token is valid)

Expected behavior A clear and concise description of what you expected to happen.

Teslalogger should refresh the token, if it‘s expired, and then ideally automatically send the last command again (I would see the second part as nice to have. This would enable super simple cronjobs that just call endpoints without handling the response)

Screenshots If applicable, add screenshots to help explain your problem.

Teslalogger Type Raspberry PI 3 / Raspberry Pi4 / Docker / Selfmade Did you update the Image with apt-get update & upgrade?

raspi 4 with Docker. Yes the system is up to date.

Do you use Tasker or iBeacon

Additional context Add any other context about the problem here.